From: William Tambe <tambewilliam@gmail.com>
To: Simon Marchi <simark@simark.ca>
Cc: gdb@sourceware.org
Subject: Re: Incorrect symbol name displayed in backtrace
Date: Fri, 07 Feb 2020 03:56:00 -0000 [thread overview]
Message-ID: <CAF8i9mNZfiaEfdwyZyrtEuLFYO6h+Cfje63ddn29jFR4jFCi3w@mail.gmail.com> (raw)
In-Reply-To: <6b7c07bc-c461-ee85-51bb-b47478dfde03@simark.ca>
On Thu, Feb 6, 2020 at 10:32 PM Simon Marchi <simark@simark.ca> wrote:
>
> On 2020-02-05 11:36 p.m., William Tambe wrote:
> > Below is an example of backtrace where I find that GDB printed a
> > symbol name that is not found at the address shown in the backtrace.
> > In the example below, GDB says that __kprobes_text_start() is at
> > 0x0039f000, however when I used p (void *)0x0039f000, it prints the
> > correct symbol name at 0x0039f000.
> >
> > (gdb) bt
> > #0 0x05000100 in _start ()
> > #1 0x0039f000 in __kprobes_text_start ()
> > Backtrace stopped: frame did not save the PC
> > (gdb) p (void *)0x0039f000
> > $6 = (void *) 0x39f000 <__tramp_exit>
> >
> >
> > Any idea what is the difference in the way symbol names are printed in
> > the backtrace and by the command "p" ?
>
> The only reason I could imagine is that for the backtrace, GDB looks for
> the closest code symbol, whereas with the print command, it looks for
> any kind of symbol. And perhaps that in this case, __kprobes_text_start
> is a code symbol whereas __tramp_exit is a data symbol.
>
> Note that when GDB says:
>
> #1 0x0039f000 in __kprobes_text_start ()
>
> It doesn't mean that __kprobes_text_start == 0x0039f000, it's just that for
> all it knows, the current address (0x0039f000) is in the function
> __kprobes_text_start. What does "print __kprobes_text_start" say?
(gdb) p __kprobes_text_start
$22 = 0x39eda8 <__kprobes_text_start> ""
__kprobes_text_start is not a function; it is declared as follow:
extern char __kprobes_text_start[]
>
> It's hard to tell without seeing the actual binary, so this is just a guess.
Is it possible to have pointers in the code where symbol names are
printed for the backtrace and where they are printed for the command
"p" ?
>
> Simon
next prev parent reply other threads:[~2020-02-07 3:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 4:37 William Tambe
2020-02-07 3:32 ` Simon Marchi
2020-02-07 3:56 ` William Tambe [this message]
2020-02-07 5:25 ` Simon Marchi
2020-02-07 5:27 ` Simon Marchi
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=CAF8i9mNZfiaEfdwyZyrtEuLFYO6h+Cfje63ddn29jFR4jFCi3w@mail.gmail.com \
--to=tambewilliam@gmail.com \
--cc=gdb@sourceware.org \
--cc=simark@simark.ca \
/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