public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [ARM][GDB] backtrace does not go beyond libc functions
@ 2015-06-27  1:35 Sundar Dev
  2015-06-29  9:31 ` Yao Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Sundar Dev @ 2015-06-27  1:35 UTC (permalink / raw)
  To: gdb

Hi List Members:

First things first- I am using gdbserver 7.6.2 for remote debugging.
The other main components are- GNU libc-2.19 that comes packaged in
Yocto Poky 'Daisy' release for one of my projects. This is
cross-compiled for ARMv7 and we use arm-poky-linux-gnueabi-gcc (GCC)
4.8.2 toolchain.

I use the *non-debug* version of glibc (with no .debug sections in
elf), but built with ARM unwind tables and ARM frame pointer support.
With this setup, when a user space thread is executing a blocking libc
function like poll(), read(), etc., and I attach a remote gdbserver to
the process and try to get backtrace, all I see is the following 4
backtrace frames as shown below-
(gdb) bt
#0  0x758b9190 in poll () from /lib/libc.so.6
#1  0x758b9184 in poll () from /lib/libc.so.6
#2  0x013df120 in ?? ()
#3  0x013df120 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

And address 0x013df120 is in the heap region in proc/<pid>/maps (shown
below) of my process-
root@xyz# cat /proc/621/maps
...<snip>...
01389000-0154e000 rw-p 00000000 00:00 0          [heap]
...<snip>...

I've looked at gdb source code and I know that the version of gdb that I'm using
(7.6.2) has support to backtrace using ARM unwind tables and frame
pointers (see [1] and [2]). But, even then, all I get from GDB
backtrace is the above shown output. Does anybody here have any
comments and/or suggestions?

Thanks,
Sundar Dev

[1] https://sourceware.org/ml/gdb-cvs/2011-02/msg00011.html
[2] https://sourceware.org/ml/gdb-cvs/2011-02/msg00012.html

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

* Re: [ARM][GDB] backtrace does not go beyond libc functions
  2015-06-27  1:35 [ARM][GDB] backtrace does not go beyond libc functions Sundar Dev
@ 2015-06-29  9:31 ` Yao Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Yao Qi @ 2015-06-29  9:31 UTC (permalink / raw)
  To: Sundar Dev; +Cc: gdb

Sundar Dev <sundarjdevml@gmail.com> writes:

> function like poll(), read(), etc., and I attach a remote gdbserver to
> the process and try to get backtrace, all I see is the following 4
> backtrace frames as shown below-
> (gdb) bt
> #0  0x758b9190 in poll () from /lib/libc.so.6
> #1  0x758b9184 in poll () from /lib/libc.so.6
> #2  0x013df120 in ?? ()
> #3  0x013df120 in ?? ()
> Backtrace stopped: previous frame identical to this frame (corrupt stack?)
>
> And address 0x013df120 is in the heap region in proc/<pid>/maps (shown
> below) of my process-
> root@xyz# cat /proc/621/maps
> ...<snip>...
> 01389000-0154e000 rw-p 00000000 00:00 0          [heap]
> ...<snip>...
>

The address 0x013df120 in frame #2 is got from frame #1 by unwinding.
The unwinding can be wrong, so address 0x013df120 can be wrong too.

> I've looked at gdb source code and I know that the version of gdb that I'm using
> (7.6.2) has support to backtrace using ARM unwind tables and frame
> pointers (see [1] and [2]). But, even then, all I get from GDB
> backtrace is the above shown output. Does anybody here have any
> comments and/or suggestions?

I don't have much suggestions to give, unless I can reproduce it.  GDB
tries different unwinders to unwind a certain frame, which means
exception table unwinder may be used or may not be used.  You can debug
GDB to see which unwinder is used, and identify why the bad pc
(0x013df120) is got from the unwinding.

-- 
Yao (齐尧)

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

end of thread, other threads:[~2015-06-29  9:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-27  1:35 [ARM][GDB] backtrace does not go beyond libc functions Sundar Dev
2015-06-29  9:31 ` Yao Qi

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).