This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: fix bug when debugging prelink'd library
On Mon, 12 Jul 2010 23:06:21 +0200, Tom Tromey wrote:
> >>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
>
> Tom> It does mean we need 3 new accessors, which is ugly. OTOH, I found
> Tom> that we use the objfile's name in locexpr_describe_location_piece,
> Tom> and there I think we also want the master objfile.
>
> We only need 1 new accessor -- using the master objfile is ok for the
> other uses.
Yes, I like the patch this way.
Thanks,
Jan
> --- a/gdb/dwarf2loc.h
> +++ b/gdb/dwarf2loc.h
> -/* Return the OBJFILE associated with the compilation unit CU. */
> +/* Return the OBJFILE associated with the compilation unit CU. If CU
> + came from a separate debuginfo file, then the master objfile is
> + returned. */
> struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu);
The same comment needs to be updated at the function definition in
dwarf2read.c.
> +/* Return the text offset for CU. */
> +CORE_ADDR dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *cu);
+
> +/* Return the text offset of the CU. */
Suggesting to extend the comment:
This returned offset is specific to this CU's debug info objfile and it may
be different from the SEPARATE_DEBUG_OBJFILE_BACKLINK objfile offsets.
> +CORE_ADDR
> +dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu)
> +{
> + struct objfile *objfile = per_cu->psymtab->objfile;
> +
> + return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
> +}