[PATCH 3/3] tests: Test addr2line -i with lexical blocks present

Josh Stone jistone at redhat.com
Fri Dec 12 01:23:37 UTC 2014


This test is for the fix in commit aecdf2670c02, but it was hampered by
unlucky sorting of line records.  With the new stable sort, the test now
gets the desired line numbers.

Signed-off-by: Josh Stone <jistone at redhat.com>
---
 tests/ChangeLog                   |   8 +++++
 tests/Makefile.am                 |   4 ++-
 tests/run-addr2line-i-lex-test.sh |  71 ++++++++++++++++++++++++++++++++++++++
 tests/testfile-lex-inlines.bz2    | Bin 0 -> 2599 bytes
 4 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100755 tests/run-addr2line-i-lex-test.sh
 create mode 100755 tests/testfile-lex-inlines.bz2

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 9d229c9d639c..85826f339f54 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-11  Josh Stone  <jistone at redhat.com>
+
+	* run-addr2line-i-lex-test.sh: New test.
+	* testfile-lex-inlines.bz2: New testfile.
+	* Makefile.am (EXTRA_DIST): Add run-addr2line-i-lex-test.sh and
+	testfile-lex-inlines.bz2.
+	(TESTS): Add run-addr2line-i-lex-test.sh.
+
 2014-12-10  Josh Stone  <jistone at redhat.com>
 
 	* run-addr2line-i-test.sh: Test 0x5f0 to make sure linkage_name is
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5b381130616b..bdd2997d9557 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -101,7 +101,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 	run-test-archive64.sh run-readelf-vmcoreinfo.sh \
 	run-readelf-mixed-corenote.sh run-dwfllines.sh \
 	run-dwfl-report-elf-align.sh run-addr2line-test.sh \
-	run-addr2line-i-test.sh run-varlocs.sh run-funcretval.sh \
+	run-addr2line-i-test.sh run-addr2line-i-lex-test.sh \
+	run-varlocs.sh run-funcretval.sh \
 	run-backtrace-native.sh run-backtrace-data.sh run-backtrace-dwarf.sh \
 	run-backtrace-native-biarch.sh run-backtrace-native-core.sh \
 	run-backtrace-native-core-biarch.sh run-backtrace-core-x86_64.sh \
@@ -243,6 +244,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
 	     testfilenolines.bz2 test-core-lib.so.bz2 test-core.core.bz2 \
 	     test-core.exec.bz2 run-addr2line-test.sh \
 	     run-addr2line-i-test.sh testfile-inlines.bz2 \
+	     run-addr2line-i-lex-test.sh testfile-lex-inlines.bz2 \
 	     testfileppc32.bz2 testfileppc64.bz2 \
 	     testfiles390.bz2 testfiles390x.bz2 \
 	     testfilearm.bz2 testfileaarch64.bz2 \
diff --git a/tests/run-addr2line-i-lex-test.sh b/tests/run-addr2line-i-lex-test.sh
new file mode 100755
index 000000000000..c391fd9996d9
--- /dev/null
+++ b/tests/run-addr2line-i-lex-test.sh
@@ -0,0 +1,71 @@
+#! /bin/sh
+# Copyright (C) 2014 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# // g++ x.cpp -g -fPIC -olibx.so -shared -O3 -fvisibility=hidden
+#
+# void foobar()
+# {
+#   __asm__ ( "nop" ::: );
+# }
+#
+# void foo()
+# {
+#   {
+#     void (*bar) () = foobar;
+#     bar();
+#   }
+# }
+
+testfiles testfile-lex-inlines
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000680 <<\EOF
+/tmp/x.cpp:5
+EOF
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000681 <<\EOF
+/tmp/x.cpp:5
+EOF
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000690 <<\EOF
+/tmp/x.cpp:5
+/tmp/x.cpp:12
+EOF
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000691 <<\EOF
+/tmp/x.cpp:5
+/tmp/x.cpp:12
+EOF
+
+# All together now (plus function names).
+testrun_compare ${abs_top_builddir}/src/addr2line -f -i -e testfile-lex-inlines 0x0000000000000680 0x0000000000000681 0x0000000000000690 0x0000000000000691 <<\EOF
+_Z6foobarv
+/tmp/x.cpp:5
+_Z6foobarv
+/tmp/x.cpp:5
+foobar inlined at /tmp/x.cpp:12 in _Z3foov
+/tmp/x.cpp:5
+_Z3foov
+/tmp/x.cpp:12
+foobar inlined at /tmp/x.cpp:12 in _Z3foov
+/tmp/x.cpp:5
+_Z3foov
+/tmp/x.cpp:12
+EOF
+
+exit 0
diff --git a/tests/testfile-lex-inlines.bz2 b/tests/testfile-lex-inlines.bz2
new file mode 100755
index 0000000000000000000000000000000000000000..716e792763d5b7d156aa597f8b8e7c80689e2ce8
GIT binary patch
literal 2599
zcmV+?3fT2RT4*^jL0KkKSrqP|qyPz*|NsC0|Nj5~|NsC0{`UX(|NY<p)c5 at pvvvJc
zdRSWh`)S|^-QDo_y#Uv0#^uc|-L>u*02|Gn2}B_Ro>A(0C!#dd%4s}LQ`J49o<l&4
znmtAk^)x)D(2X?0Xut-c>M((mLuzAF^q}<th+(OtP3jFzsKj9gL8 at kyYIvuzf+6Xs
z$)nP3MuQ2U7=Y2B0Mkt}8Z^^GLn8<<KmgDH0iXa44H{%I2AI at f(3+T$PgB%nKT;ZG
z4FC-Q0kr|313&=K00001pa1{>00*dK01W^D5)~1WQ^QI>N_jOsN2q#_Q`FjrskH+}
zgVX@^0D77<1Jn%$fCE9J)B`{O0MGyc&;S4c2mmw#Mu2E(qeeg(G#UY+qfCL200EF_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