]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: When highpc is in constant form also print as address.
authorMark Wielaard <mjw@redhat.com>
Mon, 25 Mar 2013 20:11:53 +0000 (21:11 +0100)
committerMark Wielaard <mjw@redhat.com>
Tue, 26 Mar 2013 08:16:23 +0000 (09:16 +0100)
When highpc is in constant form it is relative to lowpc.  In that case
also show as address.

Suggested-by: Jan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/readelf.c
tests/ChangeLog
tests/run-readelf-dwz-multi.sh

index a641d333e3b7ba957112973b85d35e0adca891e3..24bc6bfad2b2026cc036bc0b1a3b17300b9a1cbc 100644 (file)
@@ -1,3 +1,10 @@
+2013-03-25  Mark Wielaard  <mjw@redhat.com>
+
+       * readelf.c (attrcb_args): Add Dwarf_Die.
+       (attr_callback): When highpc is in constant form also print as
+       address.
+       (print_debug_units): Set args.die.
+
 2013-03-19  Mark Wielaard  <mjw@redhat.com>
 
        * readelf.c (print_gdb_index_section): Free format_dwarf_addr results.
index 1412bed32dbf9c2a891aa3782df4b4bc6432a0fa..6d9db73f39633d770a24c0a675acbf9bd99ba80d 100644 (file)
@@ -5242,6 +5242,7 @@ struct attrcb_args
 {
   Dwfl_Module *dwflmod;
   Dwarf *dbg;
+  Dwarf_Die *die;
   int level;
   bool silent;
   unsigned int version;
@@ -5437,7 +5438,19 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
       if (cbargs->silent)
        break;
 
-      if (valuestr == NULL)
+      /* When highpc is in constant form it is relative to lowpc.
+        In that case also show the address.  */
+      Dwarf_Addr highpc;
+      if (attr == DW_AT_high_pc && dwarf_highpc (cbargs->die, &highpc) == 0)
+       {
+         char *a = format_dwarf_addr (cbargs->dwflmod, cbargs->addrsize,
+                                      highpc, highpc);
+         printf ("           %*s%-20s (%s) %" PRIuMAX " (%s)\n",
+                 (int) (level * 2), "", dwarf_attr_name (attr),
+                 dwarf_form_name (form), (uintmax_t) num, a);
+         free (a);
+       }
+      else if (valuestr == NULL)
        printf ("           %*s%-20s (%s) %" PRIuMAX "\n",
                (int) (level * 2), "", dwarf_attr_name (attr),
                dwarf_form_name (form), (uintmax_t) num);
@@ -5659,6 +5672,7 @@ print_debug_units (Dwfl_Module *dwflmod,
 
       /* Print the attribute values.  */
       args.level = level;
+      args.die = &dies[level];
       (void) dwarf_getattrs (&dies[level], attr_callback, &args, 0);
 
       /* Make room for the next level's DIE.  */
index 62b589dc86241868e8df054ff13d1fad9e1aa13d..346577739a587220509f0a848191551f81b9c895 100644 (file)
@@ -1,3 +1,7 @@
+2013-03-25  Mark Wielaard  <mjw@redhat.com>
+
+       * run-readelf-dwz-multi.sh: Expect high_pc also as address.
+
 2013-03-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * Makefile.am (check_PROGRAMS): Add dwfl-report-elf-align.
index 20c00c5fba818d16cab4bcd4b823072cb07ae208..ca939f30a8c1a2a38e31ed9f813ca455108ba238 100755 (executable)
@@ -90,7 +90,7 @@ DWARF section [28] '.debug_info' at offset 0x1078:
            name                 (strp) "main.c"
            comp_dir             (GNU_strp_alt) "/home/mark/src/tests/dwz"
            low_pc               (addr) 0x00000000004006ac <main>
-           high_pc              (udata) 44
+           high_pc              (udata) 44 (0x00000000004006d8)
            stmt_list            (sec_offset) 0
  [    26]    imported_unit
              import               (GNU_ref_alt) [     b]
@@ -105,7 +105,7 @@ DWARF section [28] '.debug_info' at offset 0x1078:
              prototyped           (flag_present) 
              type                 (GNU_ref_alt) [    3e]
              low_pc               (addr) 0x00000000004006ac <main>
-             high_pc              (udata) 44
+             high_pc              (udata) 44 (0x00000000004006d8)
              frame_base           (exprloc) 
               [   0] call_frame_cfa
              GNU_all_tail_call_sites (flag_present) 
@@ -148,7 +148,7 @@ DWARF section [25] '.debug_info' at offset 0x106c:
            name                 (strp) "shared.c"
            comp_dir             (GNU_strp_alt) "/home/mark/src/tests/dwz"
            low_pc               (addr) +0x0000000000000670 <call_foo>
-           high_pc              (udata) 23
+           high_pc              (udata) 23 (+0x0000000000000687)
            stmt_list            (sec_offset) 0
  [    26]    imported_unit
              import               (GNU_ref_alt) [     b]
@@ -160,7 +160,7 @@ DWARF section [25] '.debug_info' at offset 0x106c:
              prototyped           (flag_present) 
              type                 (GNU_ref_alt) [    3e]
              low_pc               (addr) +0x0000000000000670 <call_foo>
-             high_pc              (udata) 23
+             high_pc              (udata) 23 (+0x0000000000000687)
              frame_base           (exprloc) 
               [   0] call_frame_cfa
              GNU_all_call_sites   (flag_present) 
@@ -185,7 +185,7 @@ DWARF section [28] '.debug_info' at offset 0x1088:
            name                 (GNU_strp_alt) "main.c"
            comp_dir             (GNU_strp_alt) "/home/mark/src/tests"
            low_pc               (addr) 0x00000000004004ec <main>
-           high_pc              (udata) 18
+           high_pc              (udata) 18 (0x00000000004004fe)
            stmt_list            (sec_offset) 0
  [    26]    imported_unit
              import               (GNU_ref_alt) [     b]
@@ -197,7 +197,7 @@ DWARF section [28] '.debug_info' at offset 0x1088:
              prototyped           (flag_present) 
              type                 (GNU_ref_alt) [    30]
              low_pc               (addr) 0x00000000004004ec <main>
-             high_pc              (udata) 18
+             high_pc              (udata) 18 (0x00000000004004fe)
              frame_base           (exprloc) 
               [   0] call_frame_cfa
              GNU_all_call_sites   (flag_present)