This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: gdb/257: Linux/PPC GDB 5.1 dies debugging programs linked with -lrt
- From: mendell at ca dot ibm dot com
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 11 Feb 2002 19:28:01 -0000
- Subject: Re: gdb/257: Linux/PPC GDB 5.1 dies debugging programs linked with -lrt
- Reply-to: mendell at ca dot ibm dot com
The following reply was made to PR gdb/257; it has been noted by GNATS.
From: mendell@ca.ibm.com
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-gnats@sources.redhat.com
Subject: Re: gdb/257: Linux/PPC GDB 5.1 dies debugging programs linked with -lrt
Date: Mon, 11 Feb 2002 14:20:23 -0500
Solution at end: SuSe 7.1 problem (for those who read the end of the book
first).
This is a bit confusing. The SuSe installed /usr/bin/gdb doesn't handle
it. I have a version of gdb 5.0 in /usr/local/gdb5 that works nicely. I
just rebuilt gdb 5.1, and it dies. Here is what I get:
mendell@cedar:~ > /usr/local/gdb5/bin/gdb src/gdb-5.1/gdb/gdb
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc-unknown-linux-gnu"...
(gdb) r a.out
Starting program: /home/mendell/src/gdb-5.1/gdb/gdb a.out
GNU gdb 5.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc-unknown-linux-gnu"...
(gdb) r
Starting program: /home/mendell/a.out
[New Thread 1024 (LWP 12971)]
Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) where
#0 0x0 in ?? ()
(gdb) p $lr
$1 = 0
(gdb) x/12x $sp
0x7fffeaa8: 0x00000000 0x00000000 0x00000000 0x00000000
0x7fffeab8: 0x00000000 0x00000000 0x00000000 0x00000000
0x7fffeac8: 0x00000000 0x00000000 0x00000000 0x00000000
Here is the successful one:
mendell@cedar:~ > /usr/local/gdb5/bin/gdb a.out
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "powerpc-unknown-linux-gnu"...
(gdb) r
Starting program: /home/mendell/a.out
hi
Program exited with code 03.
(gdb) q
For fun, I recompiled gdb 5.1 without -O. Same problem
Here is the end of an strace of that run:
ptrace(PTRACE_PEEKUSER, 19990, 0x1b8, [0]) = 0
ptrace(PTRACE_PEEKUSER, 19990, 0x1bc, [0]) = 0
ptrace(PTRACE_PEEKUSER, 19990, 4*PT_NIP, [0x3000f1e0]) = 0
ptrace(PTRACE_PEEKUSER, 19990, 4*PT_MSR, [0x4800d032]) = 0
ptrace(PTRACE_PEEKUSER, 19990, 4*PT_CCR, [0x22422042]) = 0
ptrace(PTRACE_PEEKUSER, 19990, 4*PT_LNK, [0x30005034]) = 0
ptrace(PTRACE_PEEKUSER, 19990, 4*PT_CTR, [0x300135fc]) = 0
ptrace(PTRACE_PEEKUSER, 19990, 4*PT_XER, [0]) = 0
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
I finally figured it out: The problem is in /usr/include/sys/ucontext.h on
the SuSe version I have:
typedef int fpreg_t; <<<<---------------------- this is not
too good!
/* Number of general registers. */
#define NFPREG 32
/* Container for all general registers. */
typedef fpreg_t fpregset_t[NFPREG];
I think this is Suse 7.1: /proc/version gives:
Linux version 2.4.2 (root@CHRP-PReP.suse.de) (gcc version 2.95.2 19991024
(release)) #1 Mon Mar 12 12:20:25 GMT 2001
This is fixed in suse 7.3.
Sorry for the defect report.
Mark
Daniel
Jacobowitz To: Mark Mendell/Toronto/IBM@IBMCA
<drow@mvista.c cc: gdb-gnats@sources.redhat.com
om> Subject: Re: gdb/257: Linux/PPC GDB 5.1
dies debugging programs linked with -lrt
02/09/2002
05:29 PM
On Thu, Dec 13, 2001 at 07:11:14PM -0000, mendell@ca.ibm.com wrote:
>
> >Number: 257
> >Category: gdb
> >Synopsis: Linux/PPC GDB 5.1 dies debugging programs linked with
-lrt
> >Confidential: no
> >Severity: serious
> >Priority: high
> >Responsible: unassigned
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Thu Dec 13 11:18:01 PST 2001
> >Closed-Date:
> >Last-Modified:
> >Originator: Mark Mendell
> >Release: gdb-5.1
> >Organization:
> >Environment:
> Linux/PPC: SuSe 7.1
> >Description:
> linking any program with -lrt will cause gdb to crash after program
execution starts
> >How-To-Repeat:
> mendell@cedar:~ > cat > t.c
> int main()
> {
> printf ("hi\n");
> }
> mendell@cedar:~ > gcc t.c -lrt
> mendell@cedar:~ > src/gdb-5.1/gdb/gdb a.out
> GNU gdb 5.1
> Copyright 2001 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you
are
> welcome to change it and/or distribute copies of it under certain
conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for
details.
> This GDB was configured as "powerpc-unknown-linux-gnu"...(no debugging
symbols found)...
> (gdb) r
> Starting program: /home/mendell/a.out
> (no debugging symbols found)...[New Thread 1024 (LWP 861)]
> Segmentation fault
> mendell@cedar:~ >
On a Debian/PowerPC system this works faultlessly. I suspect
libthread_db as the culprit. Can you provide more information? For
instance, run GDB in GDB and get a backtrace.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer