Bug 505943 - future breakpoint on pie executable crashes gdb
Summary: future breakpoint on pie executable crashes gdb
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-14 20:51 UTC by Mark Wielaard
Modified: 2009-06-18 11:51 UTC (History)
2 users (show)

Fixed In Version: 6.8.50.20090302-27.fc11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-06-18 11:43:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mark Wielaard 2009-06-14 20:51:16 UTC
Description of problem:
Putting a future breakpoint on a library in a pie executable crashes gdb when library is loaded.

Version-Release number of selected component (if applicable):
GNU gdb (GDB) Fedora (6.8.50.20090302-23.fc11)

How reproducible:
Always

Steps to Reproduce:
1. cat main.c
#include <stdio.h>

// function from our library
int func (void);

int
main (int argc, char *argv[], char *envp[])
{
  printf("main\n");
  func ();
  return 0;
}

2. cat library.c
#include <stdio.h>

static void
lib_func ()
{
  printf("lib_func\n");
}

void
func ()
{
  printf("func\n");
}

3. gcc library.c -g -O0 -fPIC -shared -o liblibrary.so

4. gcc main.c -fPIE -pie -g -O0 -L. -llibrary -Wl,-rpath,. -o main

5. gdb main
(gdb) break lib_func
Function "lib_func" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (lib_func) pending.
(gdb) run
Starting program: /home/mark/src/tests/main 
Segmentation fault

If the executable isn't compile -pie future breakpoint works as expected.

Additional info:

Running gdb under gdb shows a segfault:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004c63dd in disable_breakpoints_at_startup (silent=1)
    at ../../gdb/breakpoint.c:5026
5026		      !b->loc->duplicate)
(gdb) bt
#0  0x00000000004c63dd in disable_breakpoints_at_startup (silent=1)
    at ../../gdb/breakpoint.c:5026
#1  0x00000000005069c7 in post_create_inferior (target=0xa0e380, from_tty=0)
    at ../../gdb/infcmd.c:423
#2  0x0000000000507249 in run_command_1 (args=0x0, from_tty=1, 
    tbreak_at_main=<value optimized out>) at ../../gdb/infcmd.c:569
#3  0x0000000000451969 in execute_command (p=0xe0c103 "", from_tty=1)
    at ../../gdb/top.c:450
#4  0x000000000051c325 in command_handler (command=0xe0c100 "")
    at ../../gdb/event-top.c:519
#5  0x000000000051cfec in command_line_handler (rl=<value optimized out>)
    at ../../gdb/event-top.c:744
#6  0x000000389ce27e2c in rl_callback_read_char () at ../callback.c:205
#7  0x000000000051c469 in rl_callback_read_char_wrapper (client_data=0x0)
    at ../../gdb/event-top.c:179
#8  0x000000000051adc8 in process_event () at ../../gdb/event-loop.c:394
#9  0x000000000051bfba in gdb_do_one_event (data=<value optimized out>)
    at ../../gdb/event-loop.c:459
#10 0x00000000005160eb in catch_errors (func=<value optimized out>, 
    func_args=<value optimized out>, errstring=<value optimized out>, 
    mask=<value optimized out>) at ../../gdb/exceptions.c:516
#11 0x00000000004a6d28 in tui_command_loop (data=<value optimized out>)
    at ../../gdb/tui/tui-interp.c:156
#12 0x00000000004449c9 in captured_command_loop (data=0x0)
    at ../../gdb/main.c:183
#13 0x00000000005160eb in catch_errors (func=<value optimized out>, 
    func_args=<value optimized out>, errstring=<value optimized out>, 
    mask=<value optimized out>) at ../../gdb/exceptions.c:516
#14 0x000000000044533e in captured_main (data=<value optimized out>)
    at ../../gdb/main.c:989
#15 0x00000000005160eb in catch_errors (func=<value optimized out>, 
    func_args=<value optimized out>, errstring=<value optimized out>, 
    mask=<value optimized out>) at ../../gdb/exceptions.c:516
#16 0x00000000004449b4 in gdb_main (args=0x0) at ../../gdb/main.c:999
#17 0x0000000000444989 in main (argc=<value optimized out>, argv=0x0)
    at ../../gdb/gdb.c:47

Comment 1 Fedora Update System 2009-06-15 13:14:02 UTC
gdb-6.8.50.20090302-27.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/gdb-6.8.50.20090302-27.fc11

Comment 2 Fedora Update System 2009-06-15 13:14:50 UTC
gdb-6.8-32.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/gdb-6.8-32.fc10

Comment 3 Fedora Update System 2009-06-18 11:43:10 UTC
gdb-6.8-32.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Update System 2009-06-18 11:51:28 UTC
gdb-6.8.50.20090302-27.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.