public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Varun Kumar Erigila <varun.erigila@blackfigtech.com>,
	"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: working of backtrace command in GDB
Date: Wed, 25 Jan 2023 11:53:55 -0500	[thread overview]
Message-ID: <306793c0-a49e-b799-44b3-594d5e47a8d0@simark.ca> (raw)
In-Reply-To: <BMXPR01MB1029CA3D804A402619BEFFB68DCE9@BMXPR01MB1029.INDPRD01.PROD.OUTLOOK.COM>



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


      reply	other threads:[~2023-01-25 16:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25  4:49 Varun Kumar Erigila
2023-01-25 16:53 ` Simon Marchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=306793c0-a49e-b799-44b3-594d5e47a8d0@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb@sourceware.org \
    --cc=varun.erigila@blackfigtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).