NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/48250: gdb vs. -pie executables



>Number:         48250
>Category:       bin
>Synopsis:       gdb confused by -pie executables
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 27 18:20:00 +0000 2013
>Originator:     Martin Husemann
>Release:        NetBSD 6.99.23
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-owl.duskware.de 6.99.23 NetBSD 6.99.23 (NIGHT-OWL) #202: 
Fri Sep 20 19:59:50 CEST 2013 
martin%night-owl.duskware.de@localhost:/usr/src/sys/arch/amd64/compile/NIGHT-OWL
 amd64
Architecture: x86_64
Machine: amd64
>Description:

An executable compiled with -pic confuses the address mapping in gdb
(may be a bug in ld.elf_so, forgetting to fix up some variable looked
at by gdb?), so it does not find the correct address where .text is
mapped.

>How-To-Repeat:

[/tmp] martin@night-owl > cat test.c 
#include <stdio.h>
int main(int argc, char **argv) { printf ("hello\n"); return 0; }
[/tmp] martin@night-owl > !cc
cc -fpie -pie -g test.c
[/tmp] martin@night-owl > gdb ./a.out 
[..]
(gdb) break main
Breakpoint 1 at 0xa8f: file test.c, line 2.
(gdb) run
Starting program: /tmp/a.out 
Error in re-setting breakpoint 1: Cannot access memory at address 0xa80
Error in re-setting breakpoint 1: Cannot access memory at address 0xa80
hello
[Inferior 1 (process 1544) exited normally]

>Fix:
n/a



Home | Main Index | Thread Index | Old Index