summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-05-19 23:08:00 +0200
committerMark Wielaard <[email protected]>2015-05-27 17:17:51 +0200
commitd76d73f490b1e097e650bb77277ae9ed1efd5b1a (patch)
tree03ddb833b702c1b0f4a42ad78a08a40d51820a76 /src
parent472890f580a83f1511e1ad83c10ea2b1d364cc8d (diff)
addr2line: Always parse addresses as hex numbers.
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/addr2line.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f4ff1fb5..284b8860 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2015-05-20 Mark Wielaard <[email protected]>
+ * addr2line.c (handle_address): Call strtoumax with base 16. Make
+ sure all input has been processed.
+
+2015-05-20 Mark Wielaard <[email protected]>
+
* addr2line (argp_option): Group 'section' under "Input format
options".
diff --git a/src/addr2line.c b/src/addr2line.c
index c7ff7f71..b1ff3680 100644
--- a/src/addr2line.c
+++ b/src/addr2line.c
@@ -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;