How does GDB get the function call stack

Andrew Burgess aburgess@redhat.com
Thu Aug 18 14:05:16 GMT 2022


Luis Machado via Gdb <gdb@sourceware.org> writes:

> On 8/16/22 08:43, hilbert via Gdb wrote:
>> Hi ,
>> There are 4 ways to get the function call stack in the GDB Internals Manual.   https://sourceware.org/gdb/papers/unwind.html
>> For x86_64, does GDB get information by parsing the .eh_frame section? Or just get the call stack by Parse the function prologues.
>> 
>> 
>> 
>
> I'd say mostly 1 and 2. 1 is usually used with functions without debug
> information. 2 is used when there is debug information.

To expand on this a little, at least for version of GCC I'm using on
x86-64, the .eh_frame data replaces the .debug_frame data, so #2 and #3
are effectively merged.

The two "issues" raised against .eh_frame don't make sense to me.  As
I understand it the .eh_frame encoding is roughly the same as the
.debug_frame encoding, so I don't think there's much space saving, and
GDB reads the .eh_frame information from the ELF, so the read-only
concern seems like a non-issue.

Thanks,
Andrew



More information about the Gdb mailing list