Re: [PATCH 2/9] gdb: pass frame_info_ptr to gdbarch_value_from_register

Tom Tromey
2023-12-22T16:56:41Z

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> FWIW I tend to think new code should use 'const frame_info_ptr &' in
>> most places. It's more efficient and the design of frame_info_ptr also
>> makes it harmless, as the underlying frame_info member is mutable.

Simon> I initially thought that frame_info_ptr would be a thin enough wrapper
Simon> that it would be better to pass it by value, but I see that it's 64
Simon> bytes long, so I guess you're right. I'll change my patches, but we
Simon> should probably change the existing code too.

Yeah, and it also registers/deregisters itself on a global list...

Simon> It will also appease a frustration I had, where passing a frame_info_ptr
Simon> down to a function would call the copy constructor. So, trying to step
Simon> into that function would first step into the frame_info_ptr constructor
Simon> first.

I also find this annoying, though not yet to the point where I'm tempted
to add a gdb feature to make it nicer.

I think we have a bug open about stepping into the "last" function call
on a line, which is pretty much this idea: skip over all the copy
constructors and into the call you really care about. Dunno if this is
even implementable with current debuginfo.

Tom