[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do you set a value to a QOM register from GDB?

From: 清水寛子
Subject: How do you set a value to a QOM register from GDB?
Date: Sat, 3 Jul 2021 12:15:42 +0900

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
(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

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,
static void test_reset(DeviceState *dev)
    TestState *s = TEST(dev);
    s->src = ""              // 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;
        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 = "">    }else{
        qemu_log_mask(LOG_GUEST_ERROR,"test_write: can't change %x\n", (int)offset);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]