Hello everyone.

I made a simple QOM which returns an error message when I read/write the
QOM register value like the bottom.

Then I'm trying to read/write the QOM register from GDB.
I can read the QOM register value using the "print" command and get the
error message in qemu monitor.
This means that "print" calls the test_read function.
(gdb) p *0x40000004
      999
(qemu) access test_read 0

However, I can't write a value to the QOM register by "set" command.
Moreover, "set" command doesn't call the test_write function because I
don't get the error message defined in the test_write function.
(gdb) set *((int *)0x40000004) = 100
(gdb) p *0x40000004
      999

I really want to solve this problem.
Can you suggest any solutions how to set a value to the QOM register via
GDB ?

Best regard,
Hiroko
------------------------------------------------------------
static void test_reset(DeviceState *dev)
{
    TestState *s = TEST(dev);
    s->src = 444;               // address : 0x40000000
    s->fix_value = 999;     // address : 0x40000004
}

static uint64_t test_read(void *opaque, hwaddr offset,
                           unsigned size)
{
    error_report("access test_read %d", (int)offset);
    TestState *s = (TestState *)opaque;

    switch ((int)offset) {
    case 0:
        return s->src;
    case 4:
        return s->fix_value;
    default:
        error_report("bad offset : %d", (int)offset);
        return 0;
    }
}

static void test_write(void *opaque, hwaddr offset,
                        uint64_t value, unsigned size)
{
    error_report("access test_write %d %d", (int)offset, (int)size);
    TestState *s = (TestState *)opaque;

    if(offset == 0){
        s->src = value;
    }else{
        qemu_log_mask(LOG_GUEST_ERROR,"test_write: can't change %x\n",
(int)offset);
    }
}
----------------------------------------------------------------------------------------------------------

Reply via email to