From: Grant Edwards <grant.b.edwards@gmail.com>
To: gdb@sources.redhat.com
Subject: Troubleshooting broken gdbserver/remote-target
Date: Tue, 23 Jun 2009 03:07:00 -0000 [thread overview]
Message-ID: <h1pgtf$oc2$1@ger.gmane.org> (raw)
I've given up for now on trying to get threaded debugging
working. :(
Now I'm just trying to get normal symbolic debugging and
backtrace working. As long as execution is in user-application
code, everything is fine. I can do "next", "finish", set
breakpoints, display variables, backtraces, etc.
However, if I stop the program while it's in libc (e.g.
blocking on a read() call), gdb has absolutely no clue. Gdb is
unable to display any backtrace or figure out what the current
function is.
I've set solib-absolute-prefix to point to the directory
containing target libraries that are unstripped and contain
debug symbols. On startup, everything works (gdb knows the PC
is pointing to line 332 in ldso/ldso/arm/elfinterp.c:332.
But when the program is stopped while blocked in a call to
read() inside gets(), gdb throws up its hands:
Here's the program:
#include <stdio.h>
char buffer[1024];
int main(void)
{
while (1)
{
gets(buffer);
puts(buffer);
}
return 0;
}
And here's the debugging session:
GNU gdb 6.8
[...]
This GDB was configured as "--host=i386-pc-linux-gnu --target=arm-linux-uclibc".
[New Thread 815]
0x40001350 in _start () at ldso/ldso/arm/elfinterp.c:332
332 }
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x40031914 in ?? ()
(gdb) bt
#0 0x40031914 in ?? ()
If I look at the maps or smaps file for the process, address
0x40031914 is clearly in uclibc.so:
40025000-4008a000 r-xp 00000000 01:00 637 /lib/libuClibc-0.9.30.1.so
40031914 is offset 0x0000c914 in /lib/libuClibc-0.9.30.1.so, and
looking at the symbols in that file shows that offset 0x0000c914
is in __libc_read()
0000c5e8 T __libc_pselect
0000c6d8 T ptrace
0000c858 T quotactl
0000c8e0 T __libc_read
0000c968 T readlink
0000c9f4 T __libc_readv
0000ca78 T reboot
Why can't gdb figure out that the process is blocked in
__libc_read() and print a proper backtrace?
AFAICT from strace output gdbserver never tries to read
/proc/<pid>/[s]maps. What mechanism is supposed to be used to
determine what executable file a particular address is in?
--
Grant Edwards grante Yow! INSIDE, I have the
at same personality disorder
visi.com as LUCY RICARDO!!
next reply other threads:[~2009-06-23 3:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 3:07 Grant Edwards [this message]
2009-06-23 5:09 ` Grant Edwards
2009-06-23 17:00 ` Paul Pluzhnikov
2009-06-23 18:11 ` Grant Edwards
2009-06-23 18:25 ` Grant Edwards
2009-06-24 19:49 ` Grant Edwards
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='h1pgtf$oc2$1@ger.gmane.org' \
--to=grant.b.edwards@gmail.com \
--cc=gdb@sources.redhat.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