summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdw/ChangeLog5
-rw-r--r--libdw/dwarf_formstring.c4
-rw-r--r--tests/ChangeLog8
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/run-readelf-dwz-multi.sh73
-rwxr-xr-xtests/testfile-dwzstr.bz2bin0 -> 2768 bytes
-rw-r--r--tests/testfile-dwzstr.multi.bz2bin0 -> 518 bytes
7 files changed, 88 insertions, 3 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 3cf30324..2900ef6c 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-15 Mark Wielaard <[email protected]>
+
+ * dwarf_formstring.c (dwarf_formstring): Check dbg_ret->sectiondata,
+ not dbg->sectiondata.
+
2013-01-07 Roland McGrath <[email protected]>
* memory-access.h
diff --git a/libdw/dwarf_formstring.c b/libdw/dwarf_formstring.c
index c66454e1..02b56d4a 100644
--- a/libdw/dwarf_formstring.c
+++ b/libdw/dwarf_formstring.c
@@ -1,5 +1,5 @@
/* Return string associated with given attribute.
- Copyright (C) 2003-2010 Red Hat, Inc.
+ Copyright (C) 2003-2010, 2013 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <[email protected]>, 2003.
@@ -60,7 +60,7 @@ dwarf_formstring (attrp)
if (unlikely (attrp->form != DW_FORM_strp
&& attrp->form != DW_FORM_GNU_strp_alt)
- || dbg->sectiondata[IDX_debug_str] == NULL)
+ || dbg_ret->sectiondata[IDX_debug_str] == NULL)
{
__libdw_seterrno (DWARF_E_NO_STRING);
return NULL;
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 0a26e7ed..c1e0ef96 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2013-02-15 Mark Wielaard <[email protected]>
+
+ * testfile-dwzstr.bz2: New testfile.
+ * testfile-dwzstr.multi.bz2: Likewise.
+ * run-readelf-dwz-multi.sh: Add readelf testfile-dwzstr test.
+ * Makefile.am (EXTRA_DIST): Add testfile-dwzstr.bz2 and
+ testfile-dwzstr.multi.bz2.
+
2013-01-30 Mark Wielaard <[email protected]>
* testfileloc.bz2: New testfile.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a26e5c26..44b4e61b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -154,6 +154,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
run-readelf-loc.sh testfileloc.bz2 \
run-readelf-dwz-multi.sh libtestfile_multi_shared.so.bz2 \
testfile_multi.dwz.bz2 testfile_multi_main.bz2 \
+ testfile-dwzstr.bz2 testfile-dwzstr.multi.bz2 \
run-prelink-addr-test.sh \
testfile52-32.so.bz2 testfile52-32.so.debug.bz2 \
testfile52-32.prelink.so.bz2 testfile52-32.noshdrs.so.bz2 \
diff --git a/tests/run-readelf-dwz-multi.sh b/tests/run-readelf-dwz-multi.sh
index aadbbbe1..20c00c5f 100755
--- a/tests/run-readelf-dwz-multi.sh
+++ b/tests/run-readelf-dwz-multi.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2012 Red Hat, Inc.
+# Copyright (C) 2012, 2013 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -56,7 +56,27 @@
# gcc -g -o testfile_multi_main -L. -ltestfile_multi_shared main.c -Wl,-rpath,.
# dwz -m testfile_multi.dwz testfile_multi_main libtestfile_multi_shared.so
+# main.c
+#
+# struct foobarbaz
+# {
+# int counter;
+# char *bookstore;
+# };
+#
+# int
+# main (int argc, char **argv)
+# {
+# struct foobarbaz fbb;
+# return 0;
+# }
+
+# gcc -g -o testfile-dwzstr main.c
+# cp testfile-dwzstr testfile-dwzstr.alt
+# dwz -m testfile-dwzstr.multi testfile-dwzstr testfile-dwzstr.alt
+
testfiles libtestfile_multi_shared.so testfile_multi_main testfile_multi.dwz
+testfiles testfile-dwzstr testfile-dwzstr.multi
testrun_compare ../src/readelf --debug-dump=info testfile_multi_main <<\EOF
@@ -153,4 +173,55 @@ DWARF section [25] '.debug_info' at offset 0x106c:
[ 0] fbreg -24
EOF
+testrun_compare ../src/readelf --debug-dump=info testfile-dwzstr <<\EOF
+
+DWARF section [28] '.debug_info' at offset 0x1088:
+ [Offset]
+ Compilation unit at offset 0:
+ Version: 4, Abbreviation section offset: 0, Address size: 8, Offset size: 4
+ [ b] compile_unit
+ producer (GNU_strp_alt) "GNU C 4.7.2 20121109 (Red Hat 4.7.2-8) -mtune=generic -march=x86-64 -g"
+ language (data1) C89 (1)
+ name (GNU_strp_alt) "main.c"
+ comp_dir (GNU_strp_alt) "/home/mark/src/tests"
+ low_pc (addr) 0x00000000004004ec <main>
+ high_pc (udata) 18
+ stmt_list (sec_offset) 0
+ [ 26] imported_unit
+ import (GNU_ref_alt) [ b]
+ [ 2b] subprogram
+ external (flag_present)
+ name (GNU_strp_alt) "main"
+ decl_file (data1) 1
+ decl_line (data1) 8
+ prototyped (flag_present)
+ type (GNU_ref_alt) [ 30]
+ low_pc (addr) 0x00000000004004ec <main>
+ high_pc (udata) 18
+ frame_base (exprloc)
+ [ 0] call_frame_cfa
+ GNU_all_call_sites (flag_present)
+ [ 41] formal_parameter
+ name (GNU_strp_alt) "argc"
+ decl_file (data1) 1
+ decl_line (data1) 8
+ type (GNU_ref_alt) [ 30]
+ location (exprloc)
+ [ 0] fbreg -36
+ [ 4f] formal_parameter
+ name (GNU_strp_alt) "argv"
+ decl_file (data1) 1
+ decl_line (data1) 8
+ type (GNU_ref_alt) [ 41]
+ location (exprloc)
+ [ 0] fbreg -48
+ [ 5d] variable
+ name (string) "fbb"
+ decl_file (data1) 1
+ decl_line (data1) 10
+ type (GNU_ref_alt) [ 14]
+ location (exprloc)
+ [ 0] fbreg -32
+EOF
+
exit 0
diff --git a/tests/testfile-dwzstr.bz2 b/tests/testfile-dwzstr.bz2
new file mode 100755
index 00000000..8d2d326e
--- /dev/null
+++ b/tests/testfile-dwzstr.bz2
Binary files differ
diff --git a/tests/testfile-dwzstr.multi.bz2 b/tests/testfile-dwzstr.multi.bz2
new file mode 100644
index 00000000..5e84991d
--- /dev/null
+++ b/tests/testfile-dwzstr.multi.bz2
Binary files differ