This is the mail archive of the gdb-patches@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: [RFC] PR/9723: gdb breakpoints silently fail on PIE binaries


>>>>> "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


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