[Top][All Lists]

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

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

From: Peter Maydell
Subject: Re: How do you set a value to a QOM register from GDB?
Date: Sat, 3 Jul 2021 18:51:09 +0100

On Sat, 3 Jul 2021 at 04:57, 清水寛子 <hiroko07168@gmail.com> wrote:
> 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.

I've just realized why this happens. The gdbstub cannot write
to devices, only to guest RAM/ROM. (It can read either RAM/ROM or
devices.) If you try to write to a device then the write will be
silently discarded. (The technical detail is that gdbstub.c calls
cpu_memory_rw_debug() which calls address_space_write_rom(), which
ignores writes to emulated devices.)

> Can you suggest any solutions how to set a value to the QOM register via GDB ?

You can't do this via GDB, I'm afraid. Only actual guest code can do that.

-- PMM

reply via email to

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