This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH] Read pseudo registers from frame instead of regcache


On 2018-05-26 23:42, Tom Tromey wrote:
"Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> The problem: Reading pseudo registers from an upper stack frame does not Simon> work. The raw registers needed to compose the pseudo registers are Simon> always read from the current thread's regcache, which is effectively
Simon> frame #0's registers.
[...]
Simon> The gdbarch hooks

Simon>   - pseudo_register_read
Simon>   - pseudo_register_read_value
Simon>   - pseudo_register_write

Simon> receive a regcache as a parameter, as a way to get the values of the raw Simon> registers required to compute the pseudo register value. However, the Simon> regcache object always contains the current register values, not the
Simon> values unwound to the frame we're interested in.

I don't know this area very well, so apologies if this is really off
target; but I am wondering why not just make a regcache for the desired
frame and pass that to the gdbarch hooks?

That sounds like a good idea, at least to avoid changing the gdbarch interface. The current regcache always fetches raw registers using target_fetch_registers (which gets the current values of the thread's registers), but we could have another kind of regcache that instead gets raw register values by unwinding from the previous frame.

Another thing I am curious about is how far back this bug goes.  Like,
if it were introduced in one of the last few releases, then it might be
worth bisecting to find out what happened.

The oldest version of GDB with which I could print $ebx is 7.2 (did pseudo registers not exist before?), and it exhibits the same problem. So I would think that the problem exists since "forever".

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]