summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/dwflsyms.c9
-rwxr-xr-xtests/run-addrname-test.sh39
-rwxr-xr-xtests/run-dwflsyms.sh100
-rwxr-xr-xtests/testfile66.bz2bin0 -> 741 bytes
-rw-r--r--tests/testfile66.core.bz2bin0 -> 56448 bytes
6 files changed, 147 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a74830ba..f57333c8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -245,7 +245,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-backtrace-native-core.sh run-backtrace-native-core-biarch.sh \
run-backtrace-core-x86_64.sh run-backtrace-core-i386.sh \
backtrace-subr.sh backtrace.i386.core.bz2 backtrace.i386.exec.bz2 \
- backtrace.x86_64.core.bz2 backtrace.x86_64.exec.bz2
+ backtrace.x86_64.core.bz2 backtrace.x86_64.exec.bz2 \
+ testfile66.bz2 testfile66.core.bz2
if USE_VALGRIND
valgrind_cmd='valgrind -q --trace-children=yes --error-exitcode=1 --run-libc-freeres=no'
diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c
index 10c01f1f..19f1dbeb 100644
--- a/tests/dwflsyms.c
+++ b/tests/dwflsyms.c
@@ -106,13 +106,16 @@ addr_in_section (Elf *elf, GElf_Word shndx, GElf_Addr addr)
static int
list_syms (struct Dwfl_Module *mod,
- void **user __attribute__ ((unused)),
- const char *mod_name __attribute__ ((unused)),
+ void **user __attribute__ ((unused)), const char *mod_name,
Dwarf_Addr low_addr __attribute__ ((unused)),
void *arg __attribute__ ((unused)))
{
int syms = dwfl_module_getsymtab (mod);
- assert (syms >= 0);
+ if (syms < 0)
+ {
+ printf ("%s: %s\n", mod_name, dwfl_errmsg (-1));
+ return DWARF_CB_OK;
+ }
for (int ndx = 0; ndx < syms; ndx++)
{
diff --git a/tests/run-addrname-test.sh b/tests/run-addrname-test.sh
index 8624074f..bdf8ea6a 100755
--- a/tests/run-addrname-test.sh
+++ b/tests/run-addrname-test.sh
@@ -298,6 +298,45 @@ __vdso_time
??:0
EOF
+# .section ".text"
+# .globl _start
+# .section ".opd","aw"
+#_start: .quad .L._start,.TOC.@tocbase
+# .previous
+# .type _start, @function
+#.L._start:
+# .byte 0x7d, 0x82, 0x10, 0x08
+# .size _start,.-.L._start
+testfiles testfile66 testfile66.core
+testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile66 _start 0x103d0 0x103d3 0x103d4 ._start 0x2d8 0x2db 0x2dc <<\EOF
+_start
+??:0
+_start
+??:0
+_start+0x3
+??:0
+()+0x103d4
+??:0
+._start
+??:0
+._start
+??:0
+._start+0x3
+??:0
+()+0x2dc
+??:0
+EOF
+testrun_compare ${abs_top_builddir}/src/addr2line -S -e testfile66 --core=testfile66.core _start 0x461c03d0 ._start 0x461b02d8 <<\EOF
+_start
+??:0
+_start
+??:0
+._start
+??:0
+._start
+??:0
+EOF
+
testfiles testfile69.core testfile69.so
testrun_compare ${abs_top_builddir}/src/addr2line --core=./testfile69.core -S 0x7f0bc6a33535 0x7f0bc6a33546 <<\EOF
libstatic+0x9
diff --git a/tests/run-dwflsyms.sh b/tests/run-dwflsyms.sh
index 3cd7bf36..60909051 100755
--- a/tests/run-dwflsyms.sh
+++ b/tests/run-dwflsyms.sh
@@ -362,4 +362,104 @@ testrun_compare ${abs_builddir}/dwflsyms -e testfilebasmin <<\EOF
8: FUNC GLOBAL bar (44) 0x40017a, rel: 0x40017a (.text)
EOF
+testfiles testfile66
+testrun_compare ${abs_builddir}/dwflsyms -e testfile66 <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x190
+ 2: SECTION LOCAL (0) 0x1a4
+ 3: SECTION LOCAL (0) 0x1c8
+ 4: SECTION LOCAL (0) 0x1f8
+ 5: SECTION LOCAL (0) 0x288
+ 6: SECTION LOCAL (0) 0x2a8
+ 7: SECTION LOCAL (0) 0x2d8
+ 8: SECTION LOCAL (0) 0x102e0
+ 9: SECTION LOCAL (0) 0x103d0
+ 10: SECTION LOCAL (0) 0x103e8
+ 11: SECTION LOCAL (0) 0x103e8
+ 12: OBJECT LOCAL _DYNAMIC (0) 0x102e0
+ 13: FUNC GLOBAL _start (4) 0x103d0, rel: 0x103d0 (.opd)
+ 14: NOTYPE GLOBAL __bss_start (0) 0x103f0
+ 15: NOTYPE GLOBAL _edata (0) 0x103f0
+ 16: NOTYPE GLOBAL _end (0) 0x103f0
+ 17: FUNC GLOBAL ._start (4) 0x2d8, rel: 0x2d8 (.text)
+EOF
+
+testfiles testfile66.core
+testrun_compare ${abs_builddir}/dwflsyms -e testfile66 --core=testfile66.core <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0xfffb1af0410
+ 2: NOTYPE GLOBAL __kernel_datapage_offset (0) 0xfffb1af05dc
+ 3: OBJECT GLOBAL LINUX_2.6.15 (0) 0
+ 4: NOTYPE GLOBAL __kernel_clock_getres (64) 0xfffb1af052c
+ 5: NOTYPE GLOBAL __kernel_get_tbfreq (24) 0xfffb1af0620
+ 6: NOTYPE GLOBAL __kernel_gettimeofday (84) 0xfffb1af0440
+ 7: NOTYPE GLOBAL __kernel_sync_dicache (20) 0xfffb1af06c4
+ 8: NOTYPE GLOBAL __kernel_sync_dicache_p5 (20) 0xfffb1af06c4
+ 9: NOTYPE GLOBAL __kernel_sigtramp_rt64 (12) 0xfffb1af0418
+ 10: NOTYPE GLOBAL __kernel_clock_gettime (152) 0xfffb1af0494
+ 11: NOTYPE GLOBAL __kernel_get_syscall_map (44) 0xfffb1af05f4
+ld64.so.1: Callback returned failure
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x461b0190
+ 2: SECTION LOCAL (0) 0x461b01a4
+ 3: SECTION LOCAL (0) 0x461b01c8
+ 4: SECTION LOCAL (0) 0x461b01f8
+ 5: SECTION LOCAL (0) 0x461b0288
+ 6: SECTION LOCAL (0) 0x461b02a8
+ 7: SECTION LOCAL (0) 0x461b02d8
+ 8: SECTION LOCAL (0) 0x461c02e0
+ 9: SECTION LOCAL (0) 0x461c03d0
+ 10: SECTION LOCAL (0) 0x461c03e8
+ 11: SECTION LOCAL (0) 0x461c03e8
+ 12: OBJECT LOCAL _DYNAMIC (0) 0x102e0
+ 13: FUNC GLOBAL _start (4) 0x461c03d0, rel: 0x103d0 (.opd)
+ 14: NOTYPE GLOBAL __bss_start (0) 0x103f0
+ 15: NOTYPE GLOBAL _edata (0) 0x103f0
+ 16: NOTYPE GLOBAL _end (0) 0x103f0
+ 17: FUNC GLOBAL ._start (4) 0x461b02d8, rel: 0x2d8 (.text)
+EOF
+
+# Test the already present dot-prefixed names do not get duplicated.
+testfiles hello_ppc64.ko
+testrun_compare ${abs_builddir}/dwflsyms -e hello_ppc64.ko <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0
+ 2: SECTION LOCAL (0) 0x94
+ 3: SECTION LOCAL (0) 0xba
+ 4: SECTION LOCAL (0) 0xd0
+ 5: SECTION LOCAL (0) 0x13a
+ 6: SECTION LOCAL (0) 0x13a
+ 7: SECTION LOCAL (0) 0x150
+ 8: SECTION LOCAL (0) 0x170
+ 9: SECTION LOCAL (0) 0x188
+ 10: SECTION LOCAL (0) 0x410
+ 11: SECTION LOCAL (0) 0x434
+ 12: SECTION LOCAL (0) 0x438
+ 13: SECTION LOCAL (0) 0x438
+ 14: SECTION LOCAL (0) 0
+ 15: SECTION LOCAL (0) 0
+ 16: SECTION LOCAL (0) 0
+ 17: SECTION LOCAL (0) 0
+ 18: SECTION LOCAL (0) 0
+ 19: SECTION LOCAL (0) 0
+ 20: SECTION LOCAL (0) 0
+ 21: SECTION LOCAL (0) 0
+ 22: SECTION LOCAL (0) 0
+ 23: SECTION LOCAL (0) 0
+ 24: FILE LOCAL init.c (0) 0
+ 25: FILE LOCAL exit.c (0) 0
+ 26: FILE LOCAL hello.mod.c (0) 0
+ 27: OBJECT LOCAL __mod_srcversion23 (35) 0xd0
+ 28: OBJECT LOCAL __module_depends (9) 0xf8
+ 29: OBJECT LOCAL __mod_vermagic5 (50) 0x108
+ 30: OBJECT GLOBAL __this_module (648) 0x188
+ 31: FUNC GLOBAL .cleanup_module (72) 0x4c, rel: 0x4c (.text)
+ 32: FUNC GLOBAL cleanup_module (24) 0x160, rel: 0x10 (.opd)
+ 33: NOTYPE GLOBAL .printk (0) 0
+ 34: FUNC GLOBAL init_module (24) 0x150, rel: 0 (.opd)
+ 35: NOTYPE GLOBAL ._mcount (0) 0
+ 36: FUNC GLOBAL .init_module (76) 0, rel: 0 (.text)
+ 37: NOTYPE GLOBAL _mcount (0) 0
+EOF
+
exit 0
diff --git a/tests/testfile66.bz2 b/tests/testfile66.bz2
new file mode 100755
index 00000000..4797590e
--- /dev/null
+++ b/tests/testfile66.bz2
Binary files differ
diff --git a/tests/testfile66.core.bz2 b/tests/testfile66.core.bz2
new file mode 100644
index 00000000..12e2d444
--- /dev/null
+++ b/tests/testfile66.core.bz2
Binary files differ