This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Handling language trampoline
On 12/08/2017 06:39 AM, Dmitry Antipov wrote:
> On 12/07/2017 05:58 PM, Pedro Alves wrote:
>
>> I don't offhand see how can GDB know which is the right
>> language for the current PC the program just stopped at, and
>> if the program stopped inside a trampoline. That's part of
>> each language's skip_trampoline's job, so seems reasonable
>> that GDB has to try them all.
>
> I'm not an expert in this area too, but, in theory, what's the
> problem if we have (presumably valid) DWARF info? Looking through
> DWARF4 specs, each CU should have DW_AT_low_pc and DW_AT_high_pc;
> so, if CU->DW_AT_low_pc <= current PC <= CU->DW_AT_high_pc, then
> CU->DW_AT_language is the language in question, isn't it?
Some trampolines are generated by the compiler/linker, and I
assume there's no debug info for them? E.g., for C++, see
gnuv3_skip_trampoline, and virtual thunks.
I don't know whether that's the case for objc, but from:
/* Determine if we are currently in the Objective-C dispatch function.
If so, get the address of the method function that the dispatcher
would call and use that as the function to step into instead. Also
skip over the trampoline for the function (if any). This is better
for the user since they are only interested in stepping into the
method function anyway. */
static CORE_ADDR
objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc)
{
I'd assume that the "dispatch function" is a part of the objc runtime and
that this is meant to work if there's no debug info for the objc runtime
installed.
Thanks,
Pedro Alves