This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC PATCH] Fix PPC64 ELF ABI v2 symbol address retrieval
- From: Ulrich Weigand <Ulrich dot Weigand at de dot ibm dot com>
- To: Mark Wielaard <mjw at redhat dot com>
- Cc: anton at samba dot org, fche at redhat dot com, Hemant Kumar <hemant at linux dot vnet dot ibm dot com>, naveen dot n dot rao at linux dot vnet dot ibm dot com, systemtap at sourceware dot org, uweigand at gcc dot gnu dot org
- Date: Fri, 23 Jan 2015 16:17:00 +0100
- Subject: Re: [RFC PATCH] Fix PPC64 ELF ABI v2 symbol address retrieval
- Authentication-results: sourceware.org; auth=none
- References: <20150116115342 dot 1367 dot 96228 dot stgit at hemant-fedora> <1422021635 dot 4858 dot 12 dot camel at bordewijk dot wildebeest dot org>
Mark Wielaard <mjw@redhat.com> wrote on 23.01.2015 15:00:35:
> BTW. Would it make sense to let GCC encode this in the DWARF output?
> DWARF 4, 2.18 Entry Address says:
>
> Any debugging information entry describing an entity that has a
> range of code addresses, which includes compilation units,
> module initialization, subroutines, ordinary blocks, try/catch
> blocks, and the like, may have a DW_AT_entry_pc attribute to
> indicate the first executable instruction within that range of
> addresses. The value of the DW_AT_entry_pc attribute is a
> relocated address. If no DW_AT_entry_pc attribute is present,
> then the entry address is assumed to be the same as the value of
> the DW_AT_low_pc attribute, if present; otherwise, the entry
> address is unknown.
>
> Which seems to describe the situation exactly. And would make elfutils
> libdw dwarf_entrypc () do the right thing automagically (it will fall
> back to low_pc as described) without needing any extra lookups through
> symbol tables.
Well, not really. The global entry point is also a possible entry point,
and there are exectuable instructions between the global and the local
entry point as well. DW_AT_entry_pc is intended for the case where
execution *always* starts at some other place than DW_AT_low_pc. There
is no provision in DWARF right now to describe that a function has
*multiple* possible entry points.
We chose to have the DWARF address range cover the whole function
(including both entry points), and use the global entry point as
the "DWARF entry point", since that seemed to work best for most
users of that information. For example, GDB relies on that behaviour
(e.g. if you look up the current function by PC, you want to find
the function even if you stopped in between the two entry points).
Some few use cases (like yours) do require the local entry point, but
you can always find the local entry point via the symbol table if you
know the global entry point (but not necessarily vice versa).
Bye,
Ulrich