* Incorrect symbol name displayed in backtrace
@ 2020-02-06 4:37 William Tambe
2020-02-07 3:32 ` Simon Marchi
0 siblings, 1 reply; 5+ messages in thread
From: William Tambe @ 2020-02-06 4:37 UTC (permalink / raw)
To: gdb
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" ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Incorrect symbol name displayed in backtrace
2020-02-06 4:37 Incorrect symbol name displayed in backtrace William Tambe
@ 2020-02-07 3:32 ` Simon Marchi
2020-02-07 3:56 ` William Tambe
0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2020-02-07 3:32 UTC (permalink / raw)
To: William Tambe, gdb
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?
It's hard to tell without seeing the actual binary, so this is just a guess.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Incorrect symbol name displayed in backtrace
2020-02-07 3:32 ` Simon Marchi
@ 2020-02-07 3:56 ` William Tambe
2020-02-07 5:25 ` Simon Marchi
0 siblings, 1 reply; 5+ messages in thread
From: William Tambe @ 2020-02-07 3:56 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Incorrect symbol name displayed in backtrace
2020-02-07 3:56 ` William Tambe
@ 2020-02-07 5:25 ` Simon Marchi
2020-02-07 5:27 ` Simon Marchi
0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2020-02-07 5:25 UTC (permalink / raw)
To: William Tambe; +Cc: gdb
On 2020-02-06 10:55 p.m., William Tambe wrote:
> 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" ?
For the frame, I would start at print_frame_info in frame.c. For the print command,
I would break on print_value in printcmd.c.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Incorrect symbol name displayed in backtrace
2020-02-07 5:25 ` Simon Marchi
@ 2020-02-07 5:27 ` Simon Marchi
0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2020-02-07 5:27 UTC (permalink / raw)
To: William Tambe; +Cc: gdb
On 2020-02-07 12:25 a.m., Simon Marchi wrote:
> On 2020-02-06 10:55 p.m., William Tambe wrote:
>> 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" ?
>
> For the frame, I would start at print_frame_info in frame.c. For the print command,
> I would break on print_value in printcmd.c.
Sorry, print_frame_info is in stack.c.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-02-07 5:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 4:37 Incorrect symbol name displayed in backtrace William Tambe
2020-02-07 3:32 ` Simon Marchi
2020-02-07 3:56 ` William Tambe
2020-02-07 5:25 ` Simon Marchi
2020-02-07 5:27 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox