public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: "gdb@sourceware.org" <gdb@sourceware.org>, Thamil K <thamilk@gmail.com>
Subject: Re: GDB Stacktrace for optimized code!
Date: Tue, 20 Apr 2021 10:54:42 +0000 (UTC)	[thread overview]
Message-ID: <2003788873.6479831.1618916082544@mail.yahoo.com> (raw)
In-Reply-To: <CAOUPoJ1zoPjfxaCb_JYvOEz96xyFGcVRCshVQQh1e5ugY0md4w@mail.gmail.com>

 Am Dienstag, 20. April 2021, 07:55:39 MESZ hat Thamil K via Gdb <gdb@sourceware.org> Folgendes geschrieben:

> Hi Geeks,
>
> For programs compiled with -O2, where the compiler uses 'jmp' where
> possible instead of 'call' or where callee doesn't push $rbp onto the
> stack, gdb is still able to generate stack trace properly.  But by
> inspecting the $rbp and return address, I am unable to trace back the
> calls. I would like to know how gdb synthesises the stack trace ?  Any
> pointers on documentation?  Thanks in advance.

For tail call optimization ('call' optimized to 'jmp'), see [1].
For for frame pointer omission ($rbp) I couldn't find documentation in gdb, but this blog [2] has some explanations.

[1] https://sourceware.org/gdb/download/onlinedocs/gdb/Tail-Call-Frames.html
[2] https://yosefk.com/blog/getting-the-call-stack-without-a-frame-pointer.html


Hannes

      reply	other threads:[~2021-04-20 10:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  5:55 Thamil K
2021-04-20 10:54 ` Hannes Domani [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=2003788873.6479831.1618916082544@mail.yahoo.com \
    --to=ssbssa@yahoo.de \
    --cc=gdb@sourceware.org \
    --cc=thamilk@gmail.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).