Bug 7116 - gdb does not handle pic code correctly
Summary: gdb does not handle pic code correctly
Status: ASSIGNED
Alias: None
Product: gdb
Classification: Unclassified
Component: shlibs (show other bugs)
Version: 5.0
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-11-28 08:38 UTC by marc.espie
Modified: 2008-12-18 20:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
bugs.tgz (24.28 KB, application/octet-stream)
, marc.espie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marc.espie 2000-11-28 16:38:01 UTC
[Converted from Gnats 11]

Basically, i386-unknown-OpenBSD uses the same configuration
as i386-unknown-netbsd. Both are a.out platforms, with
pic code working.

gdb is utterly unable to debug pic code. Trying to advance
line by line invariably ends up in _GLOBAL_OFFSET_TABLE_
instead of the right function. 

This makes debugging pic code next to impossible. We
found out about this when we switched libgcc to -fpic.

This might be fixable at gcc's level, I don't know.

Similar problems occur with m68k and sparc. It looks like
gdb is completely lost when it comes to debugging a.out pic
code. _GLOBAL_OFFSET_TABLE_ makes it lose its way.

Release:
GDB 5.0

Environment:
i386-unknown-OpenBSD (a.out platforms in general)

How-To-Repeat:
Attached is a simple archive which holds a simple source
file, the corresponding assembly output, and a sample gdb
session... (compiled with gcc -save-temps -g -O2 -fpic).

Problem is happening with gdb 4.16.1 (bundled with OpenBSD)
and reproducible with more recent gdb releases (such as 5.0).
Comment 1 marc.espie 2000-11-28 16:38:01 UTC
Fix:
No idea. It seems that process() doesn't stop where it 
should. The determination of current pc address and 
corresponding range looks sane.