public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* working of backtrace command in GDB
@ 2023-01-25  4:49 Varun Kumar Erigila
  2023-01-25 16:53 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Varun Kumar Erigila @ 2023-01-25  4:49 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

Hello Everyone,
              I'm trying to figure out whether gdb makes use of CFI information for "backtrace command."
              In case of watchpoints, gdb tries to figure out whether the frame containing the variable on which watchpoint is set is still present by going through all the frames in stack. (it calls execute_cfa_program function to figure this out).
              But in the case of the backtrace command it does not call the execute_cfa_program to unwind all the frames.
              Is there another mechanism gdb uses to unwind the stack frames apart from CFI information.

Regards,
Varun

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: working of backtrace command in GDB
  2023-01-25  4:49 working of backtrace command in GDB Varun Kumar Erigila
@ 2023-01-25 16:53 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2023-01-25 16:53 UTC (permalink / raw)
  To: Varun Kumar Erigila, gdb



On 1/24/23 23:49, Varun Kumar Erigila wrote:
> Hello Everyone,
>               I'm trying to figure out whether gdb makes use of CFI information for "backtrace command."
>               In case of watchpoints, gdb tries to figure out whether the frame containing the variable on which watchpoint is set is still present by going through all the frames in stack. (it calls execute_cfa_program function to figure this out).
>               But in the case of the backtrace command it does not call the execute_cfa_program to unwind all the frames.
>               Is there another mechanism gdb uses to unwind the stack frames apart from CFI information.

Hi,

If a frame's PC falls within a region described by DWARF debug info
(.debug_frame), then GDB will typically use it.  But if it doesn't, for
instance if the frame is in a library for which you don't have debug
info, then GDB will revert to its architecture-specific unwinders, which
tries to unwind the frame using some knowledge of the architecture's
ABI, or by analyzing the code.

Here's the fallback unwinder for the AArch64 architecture, for instance:

  https://gitlab.com/gnutools/binutils-gdb/-/blob/d8f5b7d1d1e8e1f0352848b7066dd133edd50773/gdb/aarch64-tdep.c#L1144-1154

Simon


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-25 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25  4:49 working of backtrace command in GDB Varun Kumar Erigila
2023-01-25 16:53 ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).