This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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 PATCH] Fix PPC64 ELF ABI v2 symbol address retrieval


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


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