def set_register(self, reg, data):
        """
        Set single register from GDB hexadecimal string.
        reg parameter is the index of register in targetXML sent to GDB.
        """
        if reg < 0:
            return
        elif reg < len(self._register_list):
            regName = self._register_list[reg].name
            regBits = self._register_list[reg].bitsize
            if regBits == 64:
                value = conversion.hex16_to_u64be(data)
            else:
                value = conversion.hex8_to_u32be(data)
            logging.debug("GDB: write reg %s: 0x%X", regName, value)
            self._context.write_core_register_raw(regName, value)
Set single register from GDB hexadecimal string.
        reg parameter is the index of register in targetXML sent to GDB.