gdb causes the debugged program to segfault when stepping into shared libraries

Bug #527024 reported by Dave Martin
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gdb (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: gdb

Ubuntu lucid
gdb 7.0.1-0ubuntu1
Also observed on gdb trunk 20100223-cvs (built with the lucid tools)

When attempting to step into a shared library using gdb, gdb claims the debugged program suffered a segfault and the program cannot be debugged further.

The problem seems to occur irrespective of whether code is ARM or Thumb, or whether debug information is present or not in the shared library. If the debugged program is simply allowed to run (inside or outside gdb), it proceeds normally with no segfault.

~/bugs$ gcc -g -o hello hello.c
~/bugs$ ~/src/gdb/cvs/src/gdb/gdb ./hello
GNU gdb (GDB) 7.1.50.20100223-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-unknown-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ubuntu/bugs/hello...done.
(gdb) b main
Breakpoint 1 at 0x83b8: file hello.c, line 6.
(gdb) r
Starting program: /home/ubuntu/bugs/hello

Breakpoint 1, main () at hello.c:6
6 puts("Hello, world!");
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x4000a058 in ?? () from /lib/ld-linux.so.3
(gdb) q
A debugging session is active.

 Inferior 1 [process 17617] will be killed.

Quit anyway? (y or n) y
~/bugs$ ~/src/gdb/gcvs/src/gdb/gdb ./hello
GNU gdb (GDB) 7.1.50.20100223-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-unknown-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ubuntu/bugs/hello...done.
(gdb) b main
Breakpoint 1 at 0x83b8: file hello.c, line 6.
(gdb) r
Starting program: /home/ubuntu/bugs/hello

Breakpoint 1, main () at hello.c:6
6 puts("Hello, world!");
(gdb) n
Hello, world!
8 return EXIT_SUCCESS;
(gdb) s
9 }
(gdb) c
Continuing.

Program exited normally.
(gdb) q
~/bugs$ gcc -marm -g -o hello-arm hello.c
~/bugs$ ~/src/gdb/gcvs/src/gdb/gdb ./hello-arm
GNU gdb (GDB) 7.1.50.20100223-cvs
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-unknown-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ubuntu/bugs/hello-arm...done.
(gdb) b main
Breakpoint 1 at 0x83bc: file hello.c, line 6.
(gdb) r
Starting program: /home/ubuntu/bugs/hello-arm

Breakpoint 1, main () at hello.c:6
6 puts("Hello, world!");
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x4000a058 in ?? () from /lib/ld-linux.so.3
(gdb) c
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) q

Tags: armel
Revision history for this message
Dave Martin (dave-martin-arm) wrote :
Revision history for this message
Dave Martin (dave-martin-arm) wrote :

The patch for getting GDB to single-step correctly across state changes has been submitted here:

    http://www.sourceware.org/ml/gdb-patches/2010-03/msg00168.html

And approved here:

    http://www.sourceware.org/ml/gdb-patches/2010-03/msg00170.html

Paul Larson (pwlars)
Changed in gdb (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Steve Langasek (vorlon) wrote :

Fixed in natty.

Changed in gdb (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.