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

Tom Tromey tromey@redhat.com
Tue Jul 28 17:48:00 GMT 2009


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



More information about the Gdb-patches mailing list