]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
addr2line: Always parse addresses as hex numbers.
authorMark Wielaard <mjw@redhat.com>
Tue, 19 May 2015 21:08:00 +0000 (23:08 +0200)
committerMark Wielaard <mjw@redhat.com>
Wed, 27 May 2015 15:17:51 +0000 (17:17 +0200)
We would sometimes interpret input addresses as decimal or octal.
That could be confusing and isn't what binutils addr2line does.
Be consistent and always treat input addresses as hex.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
NEWS
src/ChangeLog
src/addr2line.c
tests/ChangeLog
tests/run-addrname-test.sh

diff --git a/NEWS b/NEWS
index 60aa995d4ce5113186861f4eb08769a14d55fefb..8cc184a2ca75085a5c13baf3cf9c7e26dfcfc0e1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ Version 0.162
 
 libdw: Install new header elfutils/known-dwarf.h.
 
+addr2line: Input addresses are now always interpreted as hexadecimal
+           numbers, never as octal or decimal numbers.
+
 Version 0.161
 
 libdw: New function dwarf_peel_type. dwarf_aggregate_size now uses
index f4ff1fb58993941959f7813d378d2111787450c5..284b8860ae9f6f38c2e75768bf983367da8873b2 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-20  Mark Wielaard  <mjw@redhat.com>
+
+       * addr2line.c (handle_address): Call strtoumax with base 16. Make
+       sure all input has been processed.
+
 2015-05-20  Mark Wielaard  <mjw@redhat.com>
 
        * addr2line (argp_option): Group 'section' under "Input format
index c7ff7f7140d781aee6ff2dd8f5b9981e8be4a77a..b1ff36804673ce698d951c7d568b1b436776471f 100644 (file)
@@ -532,8 +532,8 @@ static int
 handle_address (const char *string, Dwfl *dwfl)
 {
   char *endp;
-  uintmax_t addr = strtoumax (string, &endp, 0);
-  if (endp == string)
+  uintmax_t addr = strtoumax (string, &endp, 16);
+  if (endp == string || *endp != '\0')
     {
       bool parsed = false;
       int i, j;
index a899947eb168762ff74475221a6aa47ac9c3897a..0e310121a0a9203520f454bbb8591c51376aa9d0 100644 (file)
@@ -1,3 +1,7 @@
+2015-05-20  Mark Wielaard  <mjw@redhat.com>
+
+       * run-addrname-test.sh: Make sure all input addresses are hex.
+
 2015-05-04  Max Filippov  <jcmvbkbc@gmail.com>
 
        * backtrace-child.c (stdarg, main): Replace assert_perror with assert.
index f954ee45db2b78118b941e9c8e4c63b445e9279e..90e19df7003f663860fbcc7fc81c910fdc764f14 100755 (executable)
@@ -277,7 +277,7 @@ EOF
 #      local l0local2, 0
 #      offset 12
 testfiles testfile64
-testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile64 1 4 5 8 9 12 <<\EOF
+testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile64 1 4 5 8 9 c <<\EOF
 gglobal2
 ??:0
 g0global2