summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-05-20 14:09:46 +0200
committerMark Wielaard <mjw@redhat.com>2015-05-27 17:17:51 +0200
commitb23a5b2dda2a0beaaa12c8174808b5d0bd5996ea (patch)
tree788c6ff78cdd2901d8253946ddab3e704803cb7a /tests
parentcd2da6c37b468c7ac66d2edcd83f8bcbaeb793ec (diff)
downloadelfutils-b23a5b2dda2a0beaaa12c8174808b5d0bd5996ea.tar.gz
addr2line: Add --pretty-print option to show all information on one line.
This adds an option --pretty-print to eu-addr2line to show all information on one line and all inlines on a line of their own. This mimics the same option from binutils addr2line, but without the short option variant -p. Since we already use -p to select the process. Example output: eu-addr2line --pretty-print -s -i -f -C -p$(pidof firefox) 0x00007f368c6f8915 mozilla::ReentrantMonitor::Wait(unsigned int) at ReentrantMonitor.h:92 (inlined by) mozilla::ReentrantMonitorAutoEnter::Wait(unsigned int) at ReentrantMonitor.h:190 A couple of tests were added to check the output matches that of binutils addr2line. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog5
-rwxr-xr-xtests/run-addr2line-i-test.sh23
-rwxr-xr-xtests/run-addr2line-test.sh6
3 files changed, 34 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 30ed5f59..94ee1f7d 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,10 @@
2015-05-20 Mark Wielaard <mjw@redhat.com>
+ * run-addr2line-i-test.sh: Add pretty test.
+ * run-addr2line-test.sh: Likewise.
+
+2015-05-20 Mark Wielaard <mjw@redhat.com>
+
* run-addr2line-i-demangle-test.sh: New test.
* Makefile.am (TESTS): Add run-addr2line-i-demangle-test.sh.
(EXTRA_DIST): Likewise.
diff --git a/tests/run-addr2line-i-test.sh b/tests/run-addr2line-i-test.sh
index e62aa201..d08f3cba 100755
--- a/tests/run-addr2line-i-test.sh
+++ b/tests/run-addr2line-i-test.sh
@@ -197,4 +197,27 @@ _Z2fuv
/tmp/x.cpp:33
EOF
+# All together now (plus function names and addresses and pretty)
+testrun_compare ${abs_top_builddir}/src/addr2line --pretty-print -a -f -i -e testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f0 0x00000000000005f1 0x00000000000005f2 <<\EOF
+0x00000000000005a0: foobar at /tmp/x.cpp:5
+0x00000000000005a1: foobar at /tmp/x.cpp:6
+0x00000000000005b0: fubar at /tmp/x.cpp:10
+0x00000000000005b1: fubar at /tmp/x.cpp:11
+0x00000000000005c0: foobar at /tmp/x.cpp:5
+ (inlined by) bar at /tmp/x.cpp:15
+0x00000000000005d0: fubar at /tmp/x.cpp:10
+ (inlined by) baz at /tmp/x.cpp:20
+0x00000000000005e0: foobar at /tmp/x.cpp:5
+ (inlined by) bar at /tmp/x.cpp:15
+ (inlined by) _Z3foov at /tmp/x.cpp:25
+0x00000000000005e1: fubar at /tmp/x.cpp:10
+ (inlined by) baz at /tmp/x.cpp:20
+ (inlined by) _Z3foov at /tmp/x.cpp:26
+0x00000000000005f0: _Z2fuv at /tmp/x.cpp:31
+0x00000000000005f1: fubar at /tmp/x.cpp:10
+ (inlined by) _Z2fuv at /tmp/x.cpp:32
+0x00000000000005f2: foobar at /tmp/x.cpp:5
+ (inlined by) _Z2fuv at /tmp/x.cpp:33
+EOF
+
exit 0
diff --git a/tests/run-addr2line-test.sh b/tests/run-addr2line-test.sh
index 8d060644..1079c3e3 100755
--- a/tests/run-addr2line-test.sh
+++ b/tests/run-addr2line-test.sh
@@ -107,4 +107,10 @@ echo "# Everything from stdin (with newlines) with addresses."
cat stdin.nl | testrun ${abs_top_builddir}/src/addr2line -a -f -e testfile > stdin.nl.out || exit 1
cmp good.addr.out stdin.nl.out || exit 1
+echo "# Pretty with functions and addresses."
+testrun_compare ${abs_top_builddir}/src/addr2line --pretty -a -f -e testfile 0x08048468 0x0804845c << EOF
+0x08048468: foo at /home/drepper/gnu/new-bu/build/ttt/f.c:3
+0x0804845c: bar at /home/drepper/gnu/new-bu/build/ttt/b.c:4
+EOF
+
exit 0