From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10700 invoked by alias); 23 Jun 2009 03:07:54 -0000 Received: (qmail 10691 invoked by uid 22791); 23 Jun 2009 03:07:53 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Jun 2009 03:07:44 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MIwMG-0002KP-6f for gdb@sources.redhat.com; Tue, 23 Jun 2009 03:07:40 +0000 Received: from 67-220-17-45.usiwireless.com ([67.220.17.45]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Jun 2009 03:07:40 +0000 Received: from grant.b.edwards by 67-220-17-45.usiwireless.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Jun 2009 03:07:40 +0000 To: gdb@sources.redhat.com From: Grant Edwards Subject: Troubleshooting broken gdbserver/remote-target Date: Tue, 23 Jun 2009 03:07:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: slrn/pre0.9.9-102 (Linux) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00218.txt.bz2 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 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//[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!!