diff options
author | Yonghong Song <yhs@fb.com> | 2019-01-29 13:33:03 -0800 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2019-01-31 22:18:10 +0100 |
commit | cfaf954701fdb74f8d1da2a8f8f4ddb666e39b34 (patch) | |
tree | 7d42b2016784a4b1e7990c093e779c2dd0fea020 | |
parent | cd7ded3df43f655af945c869976401a602e46fcd (diff) |
tests: parse inode in /proc/pid/maps/correctly in run-backtrace-data.sh
The backtrace-data.c parsed the inode in /proc/pid/maps with
format "%*x".
This caused failure if inode is big. For example,
7f269223d000-7f269226b000 r-xp 00000000 00:50 10224326387095067468 /home/...
The error likes below:
-bash-4.4$ cat run-backtrace-data.sh.log
backtrace-data: /home/engshare/elfutils/0.174/src/elfutils-0.174/tests/backtrace-data.c:110:
maps_lookup: Assertion `errno == 0' failed.
/home/engshare/elfutils/0.174/src/elfutils-0.174/tests/test-subr.sh: line 84:
3123578 Aborted (core dumped)
LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" $VALGRIND_CMD "$@"
data: no main
-bash-4.4$
The reason is errno is ERANGE.
Fix the test with inode format string "%*u" as inode here is presented
as decimal numbers.
Suggested-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
-rw-r--r-- | tests/ChangeLog | 5 | ||||
-rw-r--r-- | tests/backtrace-data.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 9b589967..c91764fb 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2019-01-29 Yonghong Song <yhs@fb.com> + + * backtrace-data.c (maps_lookup): Use %*u, not %*x, to parse + inode number. + 2019-01-18 Ulf Hermann <ulf.hermann@qt.io> * run-annobingroup.sh: Use different files for strip output. diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c index 3a91c664..b389d6af 100644 --- a/tests/backtrace-data.c +++ b/tests/backtrace-data.c @@ -106,7 +106,7 @@ maps_lookup (pid_t pid, Dwarf_Addr addr, GElf_Addr *basep) { // 37e3c22000-37e3c23000 rw-p 00022000 00:11 49532 /lib64/ld-2.14.90.so */ unsigned long start, end, offset; - i = fscanf (f, "%lx-%lx %*s %lx %*x:%*x %*x", &start, &end, &offset); + i = fscanf (f, "%lx-%lx %*s %lx %*x:%*x %*u", &start, &end, &offset); assert (errno == 0); if (i != 3) break; |