This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [7.0] PR/9723: gdb breakpoints silently fail on PIE binaries


Em Segunda-feira 20 Julho 2009 01:13:00 Paul Pluzhnikov escreveu:
> On Sun, Jul 19, 2009 at 6:57 PM, Thiago Jung
>
> Bauermann<thiago.bauermann@gmail.com> wrote:
> > All this to say: can somebody save me some research time and tell in high
> > level how can I recognize from looking at an ELF file that I'm dealing
> > with a PIE binary (NOT a PIC library, of course)? Something like "see if
> > the frob bit in the bozo section is set") is enough, I can go from there.
>
> Elf*_Ehdr.e_type == ET_DYN for the main executable?
>
> Elf*_Phdr.p_vaddr == 0 for the first PT_LOAD segment?
> [This one is only true for non-prelinked -pie executable.]

Great, thanks for the tip. Since nobody jumped into discussion, I assume any 
of those ways will work and have no known side-effect or false 
positive/negative. We'll see. :-)

Now I have this issue, I'd like to ask people's opinion about it: by design 
(or defect?) the BFD library is a PITA to access the program header. I feel 
very tempted to use elf32.h and elf64.h directly in order to check that field. 
My only worry is that a cross-debugging session with a win32 gdb and a linux 
remote target would not be possible, unless windows includes such sysv elf 
headers too (perhaps it does?).

Do you have an opinion?
-- 
[]'s
Thiago Jung Bauermann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]