This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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: Some elfutils/libdw/cfi comments


On Mon, 2010-05-31 at 16:39 +0200, Mark Wielaard wrote:
> - readelf cannot show eh_frame[_hdr] for binaries with separate
>   debuginfo files. This is somewhat inconvenient. binutils readelf
>   can show --debug-dump=frames in that case, but the elfutils readelf
>   output is nicer.

The easiest is to actually look for the separate debuginfo in case we
are dumping the frames:

diff --git a/src/readelf.c b/src/readelf.c
index dc368c2..a22e762 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -558,11 +558,15 @@ process_file (int fd, const char *fname, bool
only_one)
 
   /* Use libdwfl in a trivial way to open the libdw handle for us.
      This takes care of applying relocations to DWARF data in ET_REL
files.  */
-  static const Dwfl_Callbacks callbacks =
+  static Dwfl_Callbacks callbacks =
     {
-      .section_address = dwfl_offline_section_address,
-      .find_debuginfo = find_no_debuginfo
+      .section_address = dwfl_offline_section_address
     };
+  if ((print_debug_sections | implicit_debug_sections)
+      & (section_frame | section_exception))
+    callbacks.find_debuginfo = dwfl_standard_find_debuginfo;
+  else
+    callbacks.find_debuginfo = find_no_debuginfo;
   Dwfl *dwfl = dwfl_begin (&callbacks);
   if (likely (dwfl != NULL))
     /* Let 0 be the logical address of the file (or first in archive).
*/

That way, when you have install the debuginfo package things just work.

Although a fuller solution would be to make the read_ functions for the
eh_Frame section & friends not use the Dwarf dbg argument.

Cheers,

Mark


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