From: Yonghong Song <yhs@fb.com>
To: <mark@klomp.org>, <ast@fb.com>, <elfutils-devel@sourceware.org>
Cc: <yhs@fb.com>
Subject: [PATCH elfutils] [tests] parse inode in /proc/pid/maps/correctly in run-backtrace-data.sh
Date: Tue, 29 Jan 2019 21:33:00 -0000 [thread overview]
Message-ID: <20190129213303.3364858-1-yhs@fb.com> (raw)
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>
---
tests/backtrace-data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.17.1
next reply other threads:[~2019-01-29 21:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 21:33 Yonghong Song [this message]
2019-01-31 21:21 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190129213303.3364858-1-yhs@fb.com \
--to=yhs@fb.com \
--cc=ast@fb.com \
--cc=elfutils-devel@sourceware.org \
--cc=mark@klomp.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).