This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] PR/9723: gdb breakpoints silently fail on PIE binaries
- From: Tom Tromey <tromey at redhat dot com>
- To: Thiago Jung Bauermann <thiago dot bauermann at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 28 Jul 2009 11:00:35 -0600
- Subject: Re: [RFC] PR/9723: gdb breakpoints silently fail on PIE binaries
- References: <200907272021.30201.thiago.bauermann@gmail.com>
- Reply-to: tromey at redhat dot com
>>>>> "Thiago" == Thiago Jung Bauermann <thiago.bauermann@gmail.com> writes:
Thiago> + filename = bfd_get_filename (exec_bfd);
Thiago> + fp = fopen (filename, "r");
[...]
Thiago> + is_pie = (*((uint16_t *) elfhdr32.e_type) == ET_DYN)? 1 : 0;
It seems to me that you don't have to reopen the underlying file.
This code from solib-svr4.c shows how:
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
Elf_Internal_Ehdr *ehdr = elf_tdata (abfd)->elf_header;
GDB appears to do this sort of thing in many places, so I think it would
be ok here as well.
Tom