diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2005-10-14 15:03:21 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2005-10-14 15:03:21 +0000 |
commit | 743e33eeb33512b69912da1f5dfd2d4e136a003a (patch) | |
tree | 17d99932d329188c2ba9a8e6a070f6f3dfe06ae8 /elfutils/tests | |
parent | 10317c17ff72b7cf3bba318881d3224a7909341b (diff) | |
download | elfutils-743e33eeb33512b69912da1f5dfd2d4e136a003a.tar.gz |
0.115-alt10.115-alt1
- Updated to 0.115.
- Create libelf-devel-static and package it by default.
Diffstat (limited to 'elfutils/tests')
26 files changed, 916 insertions, 77 deletions
diff --git a/elfutils/tests/ChangeLog b/elfutils/tests/ChangeLog index 176f6b23..ec47a31d 100644 --- a/elfutils/tests/ChangeLog +++ b/elfutils/tests/ChangeLog @@ -1,3 +1,78 @@ +2005-09-02 Ulrich Drepper <drepper@redhat.com> + + * run-strings-test.sh: Remove strings.out in the end. + +2005-08-31 Ulrich Drepper <drepper@redhat.com> + + * run-addrscopes.sh: Use correct exit code if test cannot be performed. + * run-allfcts.sh: Likewise. + * run-ecp-test.sh: Likewise. + * run-ecp-test2.sh: Likewise. + * run-elflint-test.sh: Likewise. + * run-funcscopes.sh: Likewise. + * run-get-aranges.sh: Likewise. + * run-get-files.sh: Likewise. + * run-get-lines.sh: Likewise. + * run-get-pubnames.sh: Likewise. + * run-line2addr.sh: Likewise. + * run-ranlib-test2.sh: Likewise. + * run-show-abbrev.sh: Likewise. + * run-show-ciefde.sh: Likewise. + * run-show-die-info.sh: Likewise. + * run-strings-test.sh: Likewise. + * run-strip-test.sh: Likewise. + +2005-08-30 Ulrich Drepper <drepper@redhat.com> + + * coverage.sh: Handle case where there is no .gcno file at all. + +2005-08-29 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (EXTRA_DIST): Add coverage. + [GCOV]: Generate coverage summary after the tests ran + * coverage.sh: New file. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.an [BUILD_STATIC] (libdw): Add -ldl. + (CLEANFILES): Add *.gcno *.gcda *.gconv. + +2005-08-28 Ulrich Drepper <drepper@redhat.com> + + * run-strings-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2005-08-27 Roland McGrath <roland@redhat.com> + + * addrscopes.c (handle_address): Apply bias to PC addresses. + + * run-funcscopes.sh: New file. + * testfile25.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2005-08-26 Roland McGrath <roland@redhat.com> + + * addrscopes.c (dwarf_diename_integrate): Removed. + (print_vars, handle_address): Use plain dwarf_diename. + +2005-08-25 Roland McGrath <roland@redhat.com> + + * funcscopes.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (funcscopes_LDADD): New variable. + + * run-addrscopes.sh: Add another case. + * testfile24.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + + * addrscopes.c (handle_address): Take new argument IGNORE_INLINES, + pass it to dwarf_getscopes. + (main): Pass it, true when '=' follows an address. + +2005-08-24 Roland McGrath <roland@redhat.com> + + * line2addr.c (print_address): Omit () for DSOs. + 2005-08-24 Ulrich Drepper <drepper@redhat.com> * run-line2addr.sh: Remove testfile23 in the end. diff --git a/elfutils/tests/Makefile.am b/elfutils/tests/Makefile.am index b4cc1b04..119e11d7 100644 --- a/elfutils/tests/Makefile.am +++ b/elfutils/tests/Makefile.am @@ -30,7 +30,7 @@ INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ showptable update1 update2 update3 update4 test-nlist \ show-die-info get-files get-lines get-pubnames \ - get-aranges allfcts line2addr addrscopes \ + get-aranges allfcts line2addr addrscopes funcscopes \ show-abbrev hash asm-tst1 asm-tst2 asm-tst3 \ asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \ msg_tst newscn ecp dwflmodtest @@ -47,7 +47,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-strip-test6.sh run-ecp-test.sh run-ecp-test2.sh \ run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \ run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \ - run-addrscopes.sh + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh # run-show-ciefde.sh EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ @@ -63,14 +63,15 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \ run-ranlib-test3.sh run-ranlib-test4.sh \ - run-addrscopes.sh \ + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ testfile15.bz2 testfile15.debug.bz2 \ testfile16.bz2 testfile16.debug.bz2 \ testfile17.bz2 testfile17.debug.bz2 \ testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \ testfile20.bz2 testfile20.index.bz2 \ testfile21.bz2 testfile21.index.bz2 \ - testfile22.bz2 testfile23.bz2 + testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \ + coverage.sh if MUDFLAP static_build=yes @@ -78,7 +79,7 @@ libmudflap = -lmudflap endif if BUILD_STATIC -libdw = ../libdw/libdw.a $(libelf) $(libebl) +libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl libelf = ../libelf/libelf.a libasm = ../libasm/libasm.a else @@ -114,6 +115,7 @@ allfcts_LDADD = $(libdw) $(libelf) $(libmudflap) line2addr_no_Wformat = yes line2addr_LDADD = $(libdw) $(libmudflap) addrscopes_LDADD = $(libdw) $(libmudflap) +funcscopes_LDADD = $(libdw) $(libmudflap) #show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) $(libmudflap) asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl @@ -126,4 +128,11 @@ asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl -CLEANFILES = xxx +CLEANFILES = xxx *.gcno *.gcda *gconv + +if GCOV +check: check-am coverage +.PHONY: coverage +coverage: + -$(srcdir)/coverage.sh +endif diff --git a/elfutils/tests/Makefile.in b/elfutils/tests/Makefile.in index 81e864b1..0c9d1d95 100644 --- a/elfutils/tests/Makefile.in +++ b/elfutils/tests/Makefile.in @@ -43,11 +43,12 @@ noinst_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \ test-nlist$(EXEEXT) show-die-info$(EXEEXT) get-files$(EXEEXT) \ get-lines$(EXEEXT) get-pubnames$(EXEEXT) get-aranges$(EXEEXT) \ allfcts$(EXEEXT) line2addr$(EXEEXT) addrscopes$(EXEEXT) \ - show-abbrev$(EXEEXT) hash$(EXEEXT) asm-tst1$(EXEEXT) \ - asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) asm-tst4$(EXEEXT) \ - asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) asm-tst7$(EXEEXT) \ - asm-tst8$(EXEEXT) asm-tst9$(EXEEXT) msg_tst$(EXEEXT) \ - newscn$(EXEEXT) ecp$(EXEEXT) dwflmodtest$(EXEEXT) + funcscopes$(EXEEXT) show-abbrev$(EXEEXT) hash$(EXEEXT) \ + asm-tst1$(EXEEXT) asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) \ + asm-tst4$(EXEEXT) asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) \ + asm-tst7$(EXEEXT) asm-tst8$(EXEEXT) asm-tst9$(EXEEXT) \ + msg_tst$(EXEEXT) newscn$(EXEEXT) ecp$(EXEEXT) \ + dwflmodtest$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -124,6 +125,9 @@ dwflmodtest_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ ecp_SOURCES = ecp.c ecp_OBJECTS = ecp.$(OBJEXT) ecp_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_4) +funcscopes_SOURCES = funcscopes.c +funcscopes_OBJECTS = funcscopes.$(OBJEXT) +funcscopes_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) get_aranges_SOURCES = get-aranges.c get_aranges_OBJECTS = get-aranges.$(OBJEXT) get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) \ @@ -202,18 +206,19 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = addrscopes.c allfcts.c arextract.c arsymtest.c asm-tst1.c \ asm-tst2.c asm-tst3.c asm-tst4.c asm-tst5.c asm-tst6.c \ asm-tst7.c asm-tst8.c asm-tst9.c dwflmodtest.c ecp.c \ - get-aranges.c get-files.c get-lines.c get-pubnames.c hash.c \ - line2addr.c msg_tst.c newfile.c newscn.c saridx.c scnnames.c \ - sectiondump.c show-abbrev.c show-die-info.c showptable.c \ - test-nlist.c update1.c update2.c update3.c update4.c + funcscopes.c get-aranges.c get-files.c get-lines.c \ + get-pubnames.c hash.c line2addr.c msg_tst.c newfile.c newscn.c \ + saridx.c scnnames.c sectiondump.c show-abbrev.c \ + show-die-info.c showptable.c test-nlist.c update1.c update2.c \ + update3.c update4.c DIST_SOURCES = addrscopes.c allfcts.c arextract.c arsymtest.c \ asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c asm-tst5.c \ asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c dwflmodtest.c \ - ecp.c get-aranges.c get-files.c get-lines.c get-pubnames.c \ - hash.c line2addr.c msg_tst.c newfile.c newscn.c saridx.c \ - scnnames.c sectiondump.c show-abbrev.c show-die-info.c \ - showptable.c test-nlist.c update1.c update2.c update3.c \ - update4.c + ecp.c funcscopes.c get-aranges.c get-files.c get-lines.c \ + get-pubnames.c hash.c line2addr.c msg_tst.c newfile.c newscn.c \ + saridx.c scnnames.c sectiondump.c show-abbrev.c \ + show-die-info.c showptable.c test-nlist.c update1.c update2.c \ + update3.c update4.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -239,6 +244,8 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ +GCOV_FALSE = @GCOV_FALSE@ +GCOV_TRUE = @GCOV_TRUE@ GMSGFMT = @GMSGFMT@ GPROF_FALSE = @GPROF_FALSE@ GPROF_TRUE = @GPROF_TRUE@ @@ -344,7 +351,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-strip-test6.sh run-ecp-test.sh run-ecp-test2.sh \ run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \ run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \ - run-addrscopes.sh + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh # run-show-ciefde.sh EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ @@ -360,19 +367,20 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \ run-ranlib-test3.sh run-ranlib-test4.sh \ - run-addrscopes.sh \ + run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ testfile15.bz2 testfile15.debug.bz2 \ testfile16.bz2 testfile16.debug.bz2 \ testfile17.bz2 testfile17.debug.bz2 \ testfile18.bz2 testfile19.bz2 testfile19.index.bz2 \ testfile20.bz2 testfile20.index.bz2 \ testfile21.bz2 testfile21.index.bz2 \ - testfile22.bz2 testfile23.bz2 + testfile22.bz2 testfile23.bz2 testfile24.bz2 testfile25.bz2 \ + coverage.sh @MUDFLAP_TRUE@static_build = yes @MUDFLAP_TRUE@libmudflap = -lmudflap @BUILD_STATIC_FALSE@libdw = ../libdw/libdw.so -@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl) +@BUILD_STATIC_TRUE@libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl @BUILD_STATIC_FALSE@libelf = ../libelf/libelf.so @BUILD_STATIC_TRUE@libelf = ../libelf/libelf.a @BUILD_STATIC_FALSE@libasm = ../libasm/libasm.so @@ -404,6 +412,7 @@ allfcts_LDADD = $(libdw) $(libelf) $(libmudflap) line2addr_no_Wformat = yes line2addr_LDADD = $(libdw) $(libmudflap) addrscopes_LDADD = $(libdw) $(libmudflap) +funcscopes_LDADD = $(libdw) $(libmudflap) #show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) $(libmudflap) asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl @@ -415,7 +424,7 @@ asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl -CLEANFILES = xxx +CLEANFILES = xxx *.gcno *.gcda *gconv all: all-am .SUFFIXES: @@ -497,6 +506,9 @@ dwflmodtest$(EXEEXT): $(dwflmodtest_OBJECTS) $(dwflmodtest_DEPENDENCIES) ecp$(EXEEXT): $(ecp_OBJECTS) $(ecp_DEPENDENCIES) @rm -f ecp$(EXEEXT) $(LINK) $(ecp_LDFLAGS) $(ecp_OBJECTS) $(ecp_LDADD) $(LIBS) +funcscopes$(EXEEXT): $(funcscopes_OBJECTS) $(funcscopes_DEPENDENCIES) + @rm -f funcscopes$(EXEEXT) + $(LINK) $(funcscopes_LDFLAGS) $(funcscopes_OBJECTS) $(funcscopes_LDADD) $(LIBS) get-aranges$(EXEEXT): $(get_aranges_OBJECTS) $(get_aranges_DEPENDENCIES) @rm -f get-aranges$(EXEEXT) $(LINK) $(get_aranges_LDFLAGS) $(get_aranges_OBJECTS) $(get_aranges_LDADD) $(LIBS) @@ -579,6 +591,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst9.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwflmodtest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcscopes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-aranges.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-files.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-lines.Po@am__quote@ @@ -853,6 +866,11 @@ uninstall-am: uninstall-info-am mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am + +@GCOV_TRUE@check: check-am coverage +@GCOV_TRUE@.PHONY: coverage +@GCOV_TRUE@coverage: +@GCOV_TRUE@ -$(srcdir)/coverage.sh # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/elfutils/tests/addrscopes.c b/elfutils/tests/addrscopes.c index 4ef00648..1526f02a 100644 --- a/elfutils/tests/addrscopes.c +++ b/elfutils/tests/addrscopes.c @@ -45,13 +45,6 @@ paddr (const char *prefix, Dwarf_Addr addr, Dwfl_Line *line) printf ("%s%#" PRIx64, prefix, addr); } -static const char * -dwarf_diename_integrate (Dwarf_Die *die) -{ - Dwarf_Attribute attr_mem; - return dwarf_formstring (dwarf_attr_integrate (die, DW_AT_name, &attr_mem)); -} - static void print_vars (unsigned int indent, Dwarf_Die *die) { @@ -63,7 +56,7 @@ print_vars (unsigned int indent, Dwarf_Die *die) case DW_TAG_variable: case DW_TAG_formal_parameter: printf ("%*s%-30s[%6" PRIx64 "]\n", indent, "", - dwarf_diename_integrate (&child), + dwarf_diename (&child), (uint64_t) dwarf_dieoffset (&child)); break; default: @@ -83,7 +76,7 @@ print_vars (unsigned int indent, Dwarf_Die *die) case DW_TAG_variable: case DW_TAG_formal_parameter: printf ("%*s%s (abstract)\n", indent, "", - dwarf_diename_integrate (&child)); + dwarf_diename (&child)); break; default: break; @@ -118,13 +111,15 @@ handle_address (GElf_Addr pc, Dwfl *dwfl) indent += INDENT; printf ("%*s%s (%#x)", indent, "", - dwarf_diename_integrate (die) ?: "<unnamed>", + dwarf_diename (die) ?: "<unnamed>", dwarf_tag (die)); Dwarf_Addr lowpc, highpc; if (dwarf_lowpc (die, &lowpc) == 0 && dwarf_highpc (die, &highpc) == 0) { + lowpc += cubias; + highpc += cubias; Dwfl_Line *loline = dwfl_getsrc (dwfl, lowpc); Dwfl_Line *hiline = dwfl_getsrc (dwfl, highpc); paddr (": ", lowpc, loline); diff --git a/elfutils/tests/coverage.sh b/elfutils/tests/coverage.sh new file mode 100755 index 00000000..f09f644f --- /dev/null +++ b/elfutils/tests/coverage.sh @@ -0,0 +1,27 @@ +#! /bin/bash + +cd .. + +for d in lib libasm libdw libdwfl libebl libelf src; do + tmp=$d-data + cd $d + unused=0 + for f in *.gcno; do + base="$(basename $f .gcno)" + fc="$base.c" + gcda="$base.gcda" + if [ -f "$gcda" ]; then + gcov -n -a "$fc" | + gawk "/$d.$fc/ { getline; co=gensub(/.*:(.*)% .*/, \"\\\\1\", \"g\"); co=co+0.0; li=\$4+0; printf \"%-35s %6.2f %5d\n\", \"$d/$fc\", co, li } " >> $tmp + else + unused=$(($unused + 1)) + fi + done + if [ -f $tmp ]; then + gawk "{ copct=\$2; co=(\$3*copct)/100; toco+=(co+0); toli += (\$3+0); } END { printf \"%-12s %6.2f%% covered unused files: %3d\n\", \"$d\", (toco*100)/toli, \"$unused\" }" $tmp + rm -f $tmp + else + printf "%-12s 0.00%% covered unused files: %3d\n" "$d" $unused + fi + cd .. +done diff --git a/elfutils/tests/funcscopes.c b/elfutils/tests/funcscopes.c new file mode 100644 index 00000000..a74e8d87 --- /dev/null +++ b/elfutils/tests/funcscopes.c @@ -0,0 +1,192 @@ +/* Test program for dwarf_getscopes. + Copyright (C) 2005 Red Hat, Inc. + + This program is Open Source software; you can redistribute it and/or + modify it under the terms of the Open Software License version 1.0 as + published by the Open Source Initiative. + + You should have received a copy of the Open Software License along + with this program; if not, you may obtain a copy of the Open Software + License version 1.0 from http://www.opensource.org/licenses/osl.php or + by writing the Open Source Initiative c/o Lawrence Rosen, Esq., + 3001 King Ranch Road, Ukiah, CA 95482. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <libdwfl.h> +#include <dwarf.h> +#include <argp.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <stdlib.h> +#include <error.h> +#include <string.h> +#include <fnmatch.h> + + +static void +paddr (const char *prefix, Dwarf_Addr addr, Dwfl_Line *line) +{ + const char *src; + int lineno, linecol; + if (line != NULL + && (src = dwfl_lineinfo (line, &addr, &lineno, &linecol, + NULL, NULL)) != NULL) + { + if (linecol != 0) + printf ("%s%#" PRIx64 " (%s:%d:%d)", + prefix, addr, src, lineno, linecol); + else + printf ("%s%#" PRIx64 " (%s:%d)", + prefix, addr, src, lineno); + } + else + printf ("%s%#" PRIx64, prefix, addr); +} + + +static void +print_vars (unsigned int indent, Dwarf_Die *die) +{ + Dwarf_Die child; + if (dwarf_child (die, &child) == 0) + do + switch (dwarf_tag (&child)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + printf ("%*s%-30s[%6" PRIx64 "]\n", indent, "", + dwarf_diename (&child), + (uint64_t) dwarf_dieoffset (&child)); + break; + default: + break; + } + while (dwarf_siblingof (&child, &child) == 0); + + Dwarf_Attribute attr_mem; + Dwarf_Die origin; + if (dwarf_hasattr (die, DW_AT_abstract_origin) + && dwarf_formref_die (dwarf_attr (die, DW_AT_abstract_origin, &attr_mem), + &origin) != NULL + && dwarf_child (&origin, &child) == 0) + do + switch (dwarf_tag (&child)) + { + case DW_TAG_variable: + case DW_TAG_formal_parameter: + printf ("%*s%s (abstract)\n", indent, "", + dwarf_diename (&child)); + break; + default: + break; + } + while (dwarf_siblingof (&child, &child) == 0); +} + + +#define INDENT 4 + +struct args +{ + Dwfl *dwfl; + Dwarf_Die *cu; + Dwarf_Addr dwbias; + char **argv; +}; + +static int +handle_function (Dwarf_Func *func, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_func_name (func); + char **argv = a->argv; + if (argv[0] != NULL) + { + bool match; + do + match = fnmatch (*argv, name, 0) == 0; + while (!match && *++argv); + if (!match) + return 0; + } + + Dwarf_Die funcdie_mem; + Dwarf_Die *funcdie = dwarf_func_die (func, &funcdie_mem); + assert (funcdie == &funcdie_mem); + + Dwarf_Die *scopes; + int n = dwarf_getscopes_die (funcdie, &scopes); + if (n <= 0) + error (EXIT_FAILURE, 0, "dwarf_getscopes_die: %s", dwarf_errmsg (-1)); + else + { + Dwarf_Addr start, end; + const char *fname; + const char *modname = dwfl_module_info (dwfl_cumodule (a->cu), NULL, + &start, &end, + NULL, NULL, + &fname, NULL); + if (modname == NULL) + error (EXIT_FAILURE, 0, "dwfl_module_info: %s", dwarf_errmsg (-1)); + if (modname[0] == '\0') + modname = fname; + printf ("%s: %#" PRIx64 " .. %#" PRIx64 "\n", modname, start, end); + + unsigned int indent = 0; + while (n-- > 0) + { + Dwarf_Die *const die = &scopes[n]; + + indent += INDENT; + printf ("%*s%s (%#x)", indent, "", + dwarf_diename (die) ?: "<unnamed>", + dwarf_tag (die)); + + Dwarf_Addr lowpc, highpc; + if (dwarf_lowpc (die, &lowpc) == 0 + && dwarf_highpc (die, &highpc) == 0) + { + lowpc += a->dwbias; + highpc += a->dwbias; + Dwfl_Line *loline = dwfl_getsrc (a->dwfl, lowpc); + Dwfl_Line *hiline = dwfl_getsrc (a->dwfl, highpc); + paddr (": ", lowpc, loline); + if (highpc != lowpc) + paddr (" .. ", lowpc, hiline == loline ? NULL : hiline); + } + puts (""); + + print_vars (indent + INDENT, die); + } + } + + return 0; +} + + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + struct args a = { .dwfl = NULL, .cu = NULL }; + + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, + &a.dwfl); + assert (a.dwfl != NULL); + a.argv = &argv[remaining]; + + int result = 0; + + while ((a.cu = dwfl_nextcu (a.dwfl, a.cu, &a.dwbias)) != NULL) + dwarf_getfuncs (a.cu, &handle_function, &a, 0); + + return result; +} diff --git a/elfutils/tests/line2addr.c b/elfutils/tests/line2addr.c index 73c57f49..4c3b6045 100644 --- a/elfutils/tests/line2addr.c +++ b/elfutils/tests/line2addr.c @@ -28,7 +28,7 @@ print_address (Dwfl_Module *mod, Dwarf_Addr address) if (n > 1 || secname[0] != '\0') printf ("%s(%s)+%#" PRIx64, modname, secname, address); else - printf ("%s(%s)+%#" PRIx64, modname, secname, address); + printf ("%s+%#" PRIx64, modname, address); return; } } diff --git a/elfutils/tests/run-addrscopes.sh b/elfutils/tests/run-addrscopes.sh index 901d02e1..d1e89cc8 100755 --- a/elfutils/tests/run-addrscopes.sh +++ b/elfutils/tests/run-addrscopes.sh @@ -13,7 +13,7 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile22.bz2 > testfile22 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile22.bz2 > testfile22 2>/dev/null || exit 77 LD_LIBRARY_PATH=../libdw:../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ ./addrscopes -e testfile22 0x8048353 >& addrscopes-test.out || : @@ -28,4 +28,22 @@ EOF rm -f testfile22 addrscopes-test.out +# Don't fail if we cannot decompress the file. +bunzip2 -c $srcdir/testfile24.bz2 > testfile24 2>/dev/null || exit 77 + +LD_LIBRARY_PATH=../libdw:../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ + ./addrscopes -e testfile24 0x804834e >& addrscopes-test.out || : + +diff -Bbu addrscopes-test.out - <<\EOF +0x804834e: + inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x8048364 (/home/roland/build/stock-elfutils/inline-test.c:16) + add (0x1d): 0x804834e (/home/roland/build/stock-elfutils/inline-test.c:3) .. 0x8048350 (/home/roland/build/stock-elfutils/inline-test.c:9) + y [ 9d] + x [ a2] + x (abstract) + y (abstract) +EOF + +rm -f testfile24 addrscopes-test.out + exit 0 diff --git a/elfutils/tests/run-allfcts.sh b/elfutils/tests/run-allfcts.sh index 51fe75ce..3fde34b9 100755 --- a/elfutils/tests/run-allfcts.sh +++ b/elfutils/tests/run-allfcts.sh @@ -14,13 +14,13 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 77 ./allfcts testfile testfile2 testfile8 > allfcts.out diff --git a/elfutils/tests/run-ecp-test.sh b/elfutils/tests/run-ecp-test.sh index e4304965..c21bb6ca 100755 --- a/elfutils/tests/run-ecp-test.sh +++ b/elfutils/tests/run-ecp-test.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002 Red Hat, Inc. +# Copyright (C) 2002, 2005 Red Hat, Inc. # Written by Jakub Jelinek <jakub@redhat.com>, 2002. # # This program is Open Source software; you can redistribute it and/or @@ -14,7 +14,7 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile10.bz2 > testfile10 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile10.bz2 > testfile10 2>/dev/null || exit 77 ./ecp testfile10 testfile10.tmp diff --git a/elfutils/tests/run-ecp-test2.sh b/elfutils/tests/run-ecp-test2.sh index 143c70a6..8f3775be 100755 --- a/elfutils/tests/run-ecp-test2.sh +++ b/elfutils/tests/run-ecp-test2.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002 Red Hat, Inc. +# Copyright (C) 2002, 2005 Red Hat, Inc. # Written by Jakub Jelinek <jakub@redhat.com>, 2002. # # This program is Open Source software; you can redistribute it and/or @@ -14,7 +14,7 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 ./ecp testfile2 testfile2.tmp diff --git a/elfutils/tests/run-elflint-test.sh b/elfutils/tests/run-elflint-test.sh index f008ccdc..74727b66 100755 --- a/elfutils/tests/run-elflint-test.sh +++ b/elfutils/tests/run-elflint-test.sh @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile18.bz2 > testfile18 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile18.bz2 > testfile18 2>/dev/null || exit 77 LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ - ../src/elflint --gnu testfile18 >& elflint-test.out || : + ../src/elflint --gnu-ld testfile18 >& elflint-test.out || : diff -u elflint-test.out - <<"EOF" section [ 8] '.rela.dyn': relocation 1: copy relocation against symbol of type FUNC diff --git a/elfutils/tests/run-funcscopes.sh b/elfutils/tests/run-funcscopes.sh new file mode 100755 index 00000000..e0dcfae1 --- /dev/null +++ b/elfutils/tests/run-funcscopes.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# +# This program is Open Source software; you can redistribute it and/or +# modify it under the terms of the Open Software License version 1.0 as +# published by the Open Source Initiative. +# +# You should have received a copy of the Open Software License along +# with this program; if not, you may obtain a copy of the Open Software +# License version 1.0 from http://www.opensource.org/licenses/osl.php or +# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., +# 3001 King Ranch Road, Ukiah, CA 95482. +set -e + +# Don't fail if we cannot decompress the file. +bunzip2 -c $srcdir/testfile25.bz2 > testfile25 2>/dev/null || exit 77 + +LD_LIBRARY_PATH=../libdw:../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ + ./funcscopes -e testfile25 incr >& funcscopes-test.out || : + +diff -Bbu funcscopes-test.out - <<\EOF +testfile25: 0x8048000 .. 0x8049528 + inline-test.c (0x11): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9) + incr (0x2e): 0x8048348 (/home/roland/build/stock-elfutils/inline-test.c:7) .. 0x804834f (/home/roland/build/stock-elfutils/inline-test.c:9) + x [ 66] +EOF + +rm -f testfile25 funcscopes-test.out + +exit 0 diff --git a/elfutils/tests/run-get-aranges.sh b/elfutils/tests/run-get-aranges.sh index 26b29863..a816c218 100755 --- a/elfutils/tests/run-get-aranges.sh +++ b/elfutils/tests/run-get-aranges.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # # This program is Open Source software; you can redistribute it and/or @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 ./get-aranges testfile testfile2 > get-aranges.out diff --git a/elfutils/tests/run-get-files.sh b/elfutils/tests/run-get-files.sh index 7af5c139..e80cf68d 100755 --- a/elfutils/tests/run-get-files.sh +++ b/elfutils/tests/run-get-files.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2004, 2005 Red Hat, Inc. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # # This program is Open Source software; you can redistribute it and/or @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 ./get-files testfile testfile2 > get-files.out diff --git a/elfutils/tests/run-get-lines.sh b/elfutils/tests/run-get-lines.sh index 70c9cd84..2f7f8580 100755 --- a/elfutils/tests/run-get-lines.sh +++ b/elfutils/tests/run-get-lines.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2004, 2005 Red Hat, Inc. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # # This program is Open Source software; you can redistribute it and/or @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 ./get-lines testfile testfile2 > get-lines.out diff --git a/elfutils/tests/run-get-pubnames.sh b/elfutils/tests/run-get-pubnames.sh index a232bfd2..4c9d5c2a 100755 --- a/elfutils/tests/run-get-pubnames.sh +++ b/elfutils/tests/run-get-pubnames.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2005 Red Hat, Inc. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # # This program is Open Source software; you can redistribute it and/or @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 ./get-pubnames testfile testfile2 > get-pubnames.out diff --git a/elfutils/tests/run-line2addr.sh b/elfutils/tests/run-line2addr.sh index c103ae03..91047c27 100755 --- a/elfutils/tests/run-line2addr.sh +++ b/elfutils/tests/run-line2addr.sh @@ -14,19 +14,19 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile8.bz2 > testfile8 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile14.bz2 > testfile14 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile14.bz2 > testfile14 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile23.bz2 > testfile23 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile23.bz2 > testfile23 2>/dev/null || exit 77 (./line2addr -e testfile f.c:4 testfile f.c:8 ./line2addr -e testfile2 m.c:6 b.c:1 diff --git a/elfutils/tests/run-ranlib-test2.sh b/elfutils/tests/run-ranlib-test2.sh index cce9ca7c..6eb62f2e 100755 --- a/elfutils/tests/run-ranlib-test2.sh +++ b/elfutils/tests/run-ranlib-test2.sh @@ -17,10 +17,10 @@ original=${original:-testfile19} indexed=${indexed:-testfile19.index} # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 0 +bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/$indexed.bz2 > $indexed 2>/dev/null || exit 0 +bunzip2 -c $srcdir/$indexed.bz2 > $indexed 2>/dev/null || exit 77 LD_LIBRARY_PATH=../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ ../src/ranlib $original diff --git a/elfutils/tests/run-show-abbrev.sh b/elfutils/tests/run-show-abbrev.sh index 78812a5f..0d0ff60c 100755 --- a/elfutils/tests/run-show-abbrev.sh +++ b/elfutils/tests/run-show-abbrev.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # # This program is Open Source software; you can redistribute it and/or @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 ./show-abbrev testfile testfile2 > show-abbrev.out diff --git a/elfutils/tests/run-show-ciefde.sh b/elfutils/tests/run-show-ciefde.sh index b3355334..ac97bbb3 100755 --- a/elfutils/tests/run-show-ciefde.sh +++ b/elfutils/tests/run-show-ciefde.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # # This program is Open Source software; you can redistribute it and/or @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile3.bz2 > testfile3 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile3.bz2 > testfile3 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile4.bz2 > testfile4 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile4.bz2 > testfile4 2>/dev/null || exit 77 ./show-ciefde testfile3 testfile4 > show-ciefde.out diff --git a/elfutils/tests/run-show-die-info.sh b/elfutils/tests/run-show-die-info.sh index 04263268..3cdfae50 100755 --- a/elfutils/tests/run-show-die-info.sh +++ b/elfutils/tests/run-show-die-info.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2000, 2002, 2003, 2004 Red Hat, Inc. +# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc. # Written by Ulrich Drepper <drepper@redhat.com>, 1999. # # This program is Open Source software; you can redistribute it and/or @@ -14,10 +14,10 @@ set -e # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile5.bz2 > testfile5 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile5.bz2 > testfile5 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 0 +bunzip2 -c $srcdir/testfile2.bz2 > testfile2 2>/dev/null || exit 77 ./show-die-info testfile5 testfile2 > show-die-info.out diff --git a/elfutils/tests/run-strings-test.sh b/elfutils/tests/run-strings-test.sh new file mode 100755 index 00000000..66918008 --- /dev/null +++ b/elfutils/tests/run-strings-test.sh @@ -0,0 +1,475 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# This program is Open Source software; you can redistribute it and/or +# modify it under the terms of the Open Software License version 1.0 as +# published by the Open Source Initiative. +# +# You should have received a copy of the Open Software License along +# with this program; if not, you may obtain a copy of the Open Software +# License version 1.0 from http://www.opensource.org/licenses/osl.php or +# by writing the Open Source Initiative c/o Lawrence Rosen, Esq., +# 3001 King Ranch Road, Ukiah, CA 95482. +set -e + +# Don't fail if we cannot decompress the file. +bunzip2 -c $srcdir/testfile.bz2 > testfile 2>/dev/null || exit 77 + +# Don't fail if we cannot decompress the file. +for n in $(seq 2 9); do +bunzip2 -c $srcdir/testfile$n.bz2 > testfile$n 2>/dev/null || exit 77 +done + +LD_LIBRARY_PATH=../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ + ../src/strings -tx -f testfile testfile[23456789] > strings.out + +diff -u strings.out - <<"EOF" +testfile: f4 /lib/ld-linux.so.2 +testfile: 1c9 __gmon_start__ +testfile: 1d8 libc.so.6 +testfile: 1e2 __cxa_finalize +testfile: 1f1 __deregister_frame_info +testfile: 209 _IO_stdin_used +testfile: 218 __libc_start_main +testfile: 22a __register_frame_info +testfile: 240 GLIBC_2.1.3 +testfile: 24c GLIBC_2.0 +testfile: 338 PTRh +testfile: 345 QVh, +testfile2: 114 /lib/ld.so.1 +testfile2: 1f1 __gmon_start__ +testfile2: 200 __deregister_frame_info +testfile2: 218 __register_frame_info +testfile2: 22e libc.so.6 +testfile2: 238 __cxa_finalize +testfile2: 247 _IO_stdin_used +testfile2: 256 __libc_start_main +testfile2: 268 GLIBC_2.1.3 +testfile2: 274 GLIBC_2.0 +testfile2: 488 }a[xN +testfile2: 4a8 }a[xN +testfile2: 50c }a[xN +testfile2: 540 }?Kx +testfile3: f4 /lib/ld-linux.so.2 +testfile3: 1c9 __gmon_start__ +testfile3: 1d8 libc.so.6 +testfile3: 1e2 __cxa_finalize +testfile3: 1f1 __deregister_frame_info +testfile3: 209 _IO_stdin_used +testfile3: 218 __libc_start_main +testfile3: 22a __register_frame_info +testfile3: 240 GLIBC_2.1.3 +testfile3: 24c GLIBC_2.0 +testfile3: 338 PTRh +testfile3: 345 QVh, +testfile4: f4 /lib/ld-linux.so.2 +testfile4: 8e1 __gmon_start__ +testfile4: 8f0 __terminate_func +testfile4: 901 stderr +testfile4: 908 __tf9type_info +testfile4: 917 __tf16__user_type_info +testfile4: 92e __tf19__pointer_type_info +testfile4: 948 __tf16__attr_type_info +testfile4: 95f __tf16__func_type_info +testfile4: 976 __vt_9type_info +testfile4: 986 __vt_19__pointer_type_info +testfile4: 9a1 __vt_16__attr_type_info +testfile4: 9b9 __vt_16__func_type_info +testfile4: 9d1 __vt_16__ptmf_type_info +testfile4: 9e9 __vt_16__ptmd_type_info +testfile4: a01 __vt_17__array_type_info +testfile4: a1a __tiv +testfile4: a20 __vt_19__builtin_type_info +testfile4: a3b __tix +testfile4: a41 __til +testfile4: a47 __tii +testfile4: a4d __tis +testfile4: a53 __tib +testfile4: a59 __tic +testfile4: a5f __tiw +testfile4: a65 __tir +testfile4: a6b __tid +testfile4: a71 __tif +testfile4: a77 __tiUi +testfile4: a7e __tiUl +testfile4: a85 __tiUx +testfile4: a8c __tiUs +testfile4: a93 __tiUc +testfile4: a9a __tiSc +testfile4: aa1 __ti19__pointer_type_info +testfile4: abb __ti9type_info +testfile4: aca __ti16__attr_type_info +testfile4: ae1 __ti19__builtin_type_info +testfile4: afb __ti16__func_type_info +testfile4: b12 __ti16__ptmf_type_info +testfile4: b29 __ti16__ptmd_type_info +testfile4: b40 __ti17__array_type_info +testfile4: b58 __cplus_type_matcher +testfile4: b6d __vt_13bad_exception +testfile4: b82 __vt_9exception +testfile4: b92 _._13bad_exception +testfile4: ba5 __vt_8bad_cast +testfile4: bb4 _._8bad_cast +testfile4: bc1 __vt_10bad_typeid +testfile4: bd3 _._10bad_typeid +testfile4: be3 __ti9exception +testfile4: bf2 __ti13bad_exception +testfile4: c06 __vt_16__user_type_info +testfile4: c1e __vt_17__class_type_info +testfile4: c37 __vt_14__si_type_info +testfile4: c4d __ti8bad_cast +testfile4: c5b __ti10bad_typeid +testfile4: c6c __ti16__user_type_info +testfile4: c83 __ti14__si_type_info +testfile4: c98 __ti17__class_type_info +testfile4: cb0 libc.so.6 +testfile4: cba __register_frame +testfile4: ccb pthread_create +testfile4: cda pthread_getspecific +testfile4: cee pthread_key_delete +testfile4: d01 __cxa_finalize +testfile4: d10 malloc +testfile4: d17 __frame_state_for +testfile4: d29 abort +testfile4: d2f __register_frame_table +testfile4: d46 fprintf +testfile4: d4e pthread_once +testfile4: d5b __deregister_frame_info +testfile4: d73 pthread_key_create +testfile4: d86 memset +testfile4: d8d strcmp +testfile4: d94 pthread_mutex_unlock +testfile4: da9 __deregister_frame +testfile4: dbc pthread_mutex_lock +testfile4: dcf _IO_stdin_used +testfile4: dde __libc_start_main +testfile4: df0 strlen +testfile4: df7 __register_frame_info_table +testfile4: e13 __register_frame_info +testfile4: e29 pthread_setspecific +testfile4: e3d free +testfile4: e42 GLIBC_2.1.3 +testfile4: e4e GLIBC_2.0 +testfile4: 1308 PTRh< +testfile4: 194b [^_] +testfile4: 19bf [^_] +testfile4: 1dd9 wT9L> +testfile4: 1f3b [^_] +testfile4: 1fae [^_] +testfile4: 21c1 BZQRP +testfile4: 237f [^_] +testfile4: 2431 JWRV +testfile4: 2454 [^_] +testfile4: 2506 JWRV +testfile4: 2529 [^_] +testfile4: 2b6c [^_] +testfile4: 2b9d ZYPV +testfile4: 2c28 [^_] +testfile4: 2c4d ZYPV +testfile4: 2ce2 [^_] +testfile4: 2dfb X^_] +testfile4: 2fc8 [^_] +testfile4: 307d tq;F +testfile4: 315a [^_] +testfile4: 31a5 :zt 1 +testfile4: 3238 [^_] +testfile4: 32f8 AXY_VR +testfile4: 334a [^_] +testfile4: 37ab [^_] +testfile4: 38b8 sU;E +testfile4: 38f2 QRPV +testfile4: 3926 [^_] +testfile4: 3bfe QRWP +testfile4: 3e65 [^_] +testfile4: 4136 [^_] +testfile4: 472d [^_] +testfile4: 47a5 0[^_] +testfile4: 48ab [^_] +testfile4: 4ab1 _ZPV +testfile4: 4b53 _ZPV +testfile4: 4bd3 _ZPV +testfile4: 4e05 PQWj +testfile4: 4f75 [^_] +testfile4: 4f9b u$;E u +testfile4: 4feb [^_] +testfile4: 5080 [^_] +testfile4: 50a8 }$9u +testfile4: 5149 [^_] +testfile4: 51b0 [^_] +testfile4: 539b [^_] +testfile4: 53b5 E 9E +testfile4: 540d x!)E +testfile4: 5598 U$ B +testfile4: 571c [^_] +testfile4: 5819 [^_] +testfile4: 5922 [^_] +testfile4: 59c2 [^_] +testfile4: 5a62 [^_] +testfile4: 5b02 [^_] +testfile4: 5ba2 [^_] +testfile4: 5c42 [^_] +testfile4: 5ce2 [^_] +testfile4: 6112 [^_] +testfile4: 62bb [^_] +testfile4: 639b [^_] +testfile4: 6436 [^_] +testfile4: 6468 val is zero +testfile4: 6480 Internal Compiler Bug: No runtime type matcher. +testfile4: 64dc 19__pointer_type_info +testfile4: 64f2 16__attr_type_info +testfile4: 6505 19__builtin_type_info +testfile4: 651b 16__func_type_info +testfile4: 652e 16__ptmf_type_info +testfile4: 6541 16__ptmd_type_info +testfile4: 6554 17__array_type_info +testfile4: 6568 9exception +testfile4: 6573 13bad_exception +testfile4: 6583 9type_info +testfile4: 658e 8bad_cast +testfile4: 6598 10bad_typeid +testfile4: 65a5 16__user_type_info +testfile4: 65b8 14__si_type_info +testfile4: 65c9 17__class_type_info +testfile4: 6fc1 H. $ +testfile5: f4 /lib/ld-linux.so.2 +testfile5: 1c9 __gmon_start__ +testfile5: 1d8 libc.so.6 +testfile5: 1e2 __cxa_finalize +testfile5: 1f1 __deregister_frame_info +testfile5: 209 _IO_stdin_used +testfile5: 218 __libc_start_main +testfile5: 22a __register_frame_info +testfile5: 240 GLIBC_2.1.3 +testfile5: 24c GLIBC_2.0 +testfile5: 338 PTRh +testfile5: 345 QVhD +testfile6: 114 /lib/ld-linux.so.2 +testfile6: 3d9 libstdc++.so.5 +testfile6: 3e8 _ZTVSt16invalid_argument +testfile6: 401 _ZNSaIcEC1Ev +testfile6: 40e _ZTSSt16invalid_argument +testfile6: 427 _ZTVN10__cxxabiv120__si_class_type_infoE +testfile6: 450 _ZNSsD1Ev +testfile6: 45a _ZdlPv +testfile6: 461 __cxa_end_catch +testfile6: 471 __gxx_personality_v0 +testfile6: 486 _ZTISt9exception +testfile6: 497 _ZNSaIcED1Ev +testfile6: 4a4 _ZTISt11logic_error +testfile6: 4b8 _ZNSt16invalid_argumentD1Ev +testfile6: 4d4 _ZTVN10__cxxabiv117__class_type_infoE +testfile6: 4fa __cxa_throw +testfile6: 506 _ZNSt16invalid_argumentC1ERKSs +testfile6: 525 _ZNSsC1EPKcRKSaIcE +testfile6: 538 _ZNSt11logic_errorD2Ev +testfile6: 54f _ZTVN10__cxxabiv121__vmi_class_type_infoE +testfile6: 579 _ZNSt16invalid_argumentD0Ev +testfile6: 595 __cxa_begin_catch +testfile6: 5a7 __cxa_allocate_exception +testfile6: 5c0 _ZNKSt11logic_error4whatEv +testfile6: 5db _Jv_RegisterClasses +testfile6: 5ef _ZTISt16invalid_argument +testfile6: 608 __gmon_start__ +testfile6: 617 libm.so.6 +testfile6: 621 _IO_stdin_used +testfile6: 630 libgcc_s.so.1 +testfile6: 63e _Unwind_Resume +testfile6: 64d libc.so.6 +testfile6: 657 __libc_start_main +testfile6: 669 GCC_3.0 +testfile6: 671 GLIBC_2.0 +testfile6: 67b GLIBCPP_3.2 +testfile6: 687 CXXABI_1.2 +testfile6: 908 PTRh +testfile6: e48 gdb.1 +testfile6: ec8 N10__gnu_test9gnu_obj_1E +testfile6: ee1 N10__gnu_test9gnu_obj_2IiEE +testfile6: efd N10__gnu_test9gnu_obj_2IlEE +testfile6: f19 St16invalid_argument +testfile7: 114 /lib/ld-linux.so.2 +testfile7: 3d9 libstdc++.so.5 +testfile7: 3e8 _ZTVSt16invalid_argument +testfile7: 401 _ZNSaIcEC1Ev +testfile7: 40e _ZTSSt16invalid_argument +testfile7: 427 _ZTVN10__cxxabiv120__si_class_type_infoE +testfile7: 450 _ZNSsD1Ev +testfile7: 45a _ZdlPv +testfile7: 461 __cxa_end_catch +testfile7: 471 __gxx_personality_v0 +testfile7: 486 _ZTISt9exception +testfile7: 497 _ZNSaIcED1Ev +testfile7: 4a4 _ZTISt11logic_error +testfile7: 4b8 _ZNSt16invalid_argumentD1Ev +testfile7: 4d4 _ZTVN10__cxxabiv117__class_type_infoE +testfile7: 4fa __cxa_throw +testfile7: 506 _ZNSt16invalid_argumentC1ERKSs +testfile7: 525 _ZNSsC1EPKcRKSaIcE +testfile7: 538 _ZNSt11logic_errorD2Ev +testfile7: 54f _ZTVN10__cxxabiv121__vmi_class_type_infoE +testfile7: 579 _ZNSt16invalid_argumentD0Ev +testfile7: 595 __cxa_begin_catch +testfile7: 5a7 __cxa_allocate_exception +testfile7: 5c0 _ZNKSt11logic_error4whatEv +testfile7: 5db _Jv_RegisterClasses +testfile7: 5ef _ZTISt16invalid_argument +testfile7: 608 __gmon_start__ +testfile7: 617 libm.so.6 +testfile7: 621 _IO_stdin_used +testfile7: 630 libgcc_s.so.1 +testfile7: 63e _Unwind_Resume +testfile7: 64d libc.so.6 +testfile7: 657 __libc_start_main +testfile7: 669 GCC_3.0 +testfile7: 671 GLIBC_2.0 +testfile7: 67b GLIBCPP_3.2 +testfile7: 687 CXXABI_1.2 +testfile7: 908 PTRh +testfile7: e48 gdb.1 +testfile7: ec8 N10__gnu_test9gnu_obj_1E +testfile7: ee1 N10__gnu_test9gnu_obj_2IiEE +testfile7: efd N10__gnu_test9gnu_obj_2IlEE +testfile7: f19 St16invalid_argument +testfile8: 79 XZh; +testfile8: 87 YXh< +testfile8: 14f SQh[ +testfile8: 259 t5Wj +testfile8: 502 WRVQ +testfile8: 1fe7 ZYPj +testfile8: 2115 u'Pj +testfile8: 7bba FILE +testfile8: 7bbf preserve-dates +testfile8: 7bce remove-comment +testfile8: 7bdd Remove .comment section +testfile8: 7bf6 ${prefix}/share +testfile8: 7c06 elfutils +testfile8: 7c0f a.out +testfile8: 7c15 0.58 +testfile8: 7c1a strip (Red Hat %s) %s +testfile8: 7c31 2002 +testfile8: 7c36 Ulrich Drepper +testfile8: 7c45 Written by %s. +testfile8: 7c55 cannot stat input file "%s" +testfile8: 7c71 %s: INTERNAL ERROR: %s +testfile8: 7c88 while opening "%s" +testfile8: 7c9b handle_elf +testfile8: 7ca6 ../../src/strip.c +testfile8: 7cb8 shdr_info[cnt].group_idx != 0 +testfile8: 7cd6 illformed file `%s' +testfile8: 7cea elf_ndxscn (scn) == cnt +testfile8: 7d02 .shstrtab +testfile8: 7d0c while writing `%s': %s +testfile8: 7d23 ((sym->st_info) & 0xf) == 3 +testfile8: 7d3f shndxdata != ((void *)0) +testfile8: 7d58 scn != ((void *)0) +testfile8: 7d6b .gnu_debuglink +testfile8: 7d7a .comment +testfile8: 7d83 cannot open `%s' +testfile8: 7da0 Place stripped output into FILE +testfile8: 7dc0 Extract the removed sections into FILE +testfile8: 7e00 Copy modified/access timestamps to the output +testfile8: 7e40 Only one input file allowed together with '-o' and '-f' +testfile8: 7e80 Copyright (C) %s Red Hat, Inc. +testfile8: 7e9f This is free software; see the source for copying conditions. There is NO +testfile8: 7eea warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +testfile8: 7f40 Report bugs to <drepper@redhat.com>. +testfile8: 7f80 %s: File format not recognized +testfile8: 7fa0 cannot set access and modification date of "%s" +testfile8: 7fe0 cannot create new file `%s': %s +testfile8: 8000 error while finishing `%s': %s +testfile8: 8020 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0 +testfile8: 8060 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0 +testfile8: 80a0 %s: error while creating ELF header: %s +testfile8: 80e0 %s: error while reading the file: %s +testfile8: 8120 sec < 0xff00 || shndxdata != ((void *)0) +testfile8: 8160 (versiondata->d_size / sizeof (GElf_Versym)) >= shdr_info[cnt].data->d_size / elsize +testfile8: 81c0 shdr_info[cnt].shdr.sh_type == 11 +testfile8: 8200 (versiondata->d_size / sizeof (Elf32_Word)) >= shdr_info[cnt].data->d_size / elsize +testfile8: 8260 shdr_info[cnt].shdr.sh_type == 18 +testfile8: 82a0 shdr_info[cnt].data != ((void *)0) +testfile8: 82e0 elf_ndxscn (shdr_info[cnt].newscn) == idx +testfile8: 8320 while create section header section: %s +testfile8: 8360 cannot allocate section data: %s +testfile8: 83a0 elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx +testfile8: 83e0 while generating output file: %s +testfile8: 8420 while preparing output for `%s' +testfile8: 8440 shdr_info[cnt].shdr.sh_type == 2 +testfile8: 8480 shdr_info[idx].data != ((void *)0) +testfile8: 84c0 cannot determine number of sections: %s +testfile8: 8500 cannot get section header string table index +testfile8: 85c0 Discard symbols from object files. +testfile8: 85e3 [FILE...] +testfile9: 79 XZh; +testfile9: 87 YXh< +testfile9: 14f SQh[ +testfile9: 259 t5Wj +testfile9: 502 WRVQ +testfile9: 1fe7 ZYPj +testfile9: 2115 u'Pj +testfile9: 3414 FILE +testfile9: 3419 preserve-dates +testfile9: 3428 remove-comment +testfile9: 3437 Remove .comment section +testfile9: 3450 ${prefix}/share +testfile9: 3460 elfutils +testfile9: 3469 a.out +testfile9: 346f 0.58 +testfile9: 3474 strip (Red Hat %s) %s +testfile9: 348b 2002 +testfile9: 3490 Ulrich Drepper +testfile9: 349f Written by %s. +testfile9: 34af cannot stat input file "%s" +testfile9: 34cb %s: INTERNAL ERROR: %s +testfile9: 34e2 while opening "%s" +testfile9: 34f5 handle_elf +testfile9: 3500 ../../src/strip.c +testfile9: 3512 shdr_info[cnt].group_idx != 0 +testfile9: 3530 illformed file `%s' +testfile9: 3544 elf_ndxscn (scn) == cnt +testfile9: 355c .shstrtab +testfile9: 3566 while writing `%s': %s +testfile9: 357d ((sym->st_info) & 0xf) == 3 +testfile9: 3599 shndxdata != ((void *)0) +testfile9: 35b2 scn != ((void *)0) +testfile9: 35c5 .gnu_debuglink +testfile9: 35d4 .comment +testfile9: 35dd cannot open `%s' +testfile9: 3600 Place stripped output into FILE +testfile9: 3620 Extract the removed sections into FILE +testfile9: 3660 Copy modified/access timestamps to the output +testfile9: 36a0 Only one input file allowed together with '-o' and '-f' +testfile9: 36e0 Copyright (C) %s Red Hat, Inc. +testfile9: 36ff This is free software; see the source for copying conditions. There is NO +testfile9: 374a warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +testfile9: 37a0 Report bugs to <drepper@redhat.com>. +testfile9: 37e0 %s: File format not recognized +testfile9: 3800 cannot set access and modification date of "%s" +testfile9: 3840 cannot create new file `%s': %s +testfile9: 3860 error while finishing `%s': %s +testfile9: 3880 shdr_info[shdr_info[cnt].shdr.sh_link].version_idx == 0 +testfile9: 38c0 shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx == 0 +testfile9: 3900 %s: error while creating ELF header: %s +testfile9: 3940 %s: error while reading the file: %s +testfile9: 3980 sec < 0xff00 || shndxdata != ((void *)0) +testfile9: 39c0 (versiondata->d_size / sizeof (GElf_Versym)) >= shdr_info[cnt].data->d_size / elsize +testfile9: 3a20 shdr_info[cnt].shdr.sh_type == 11 +testfile9: 3a60 (versiondata->d_size / sizeof (Elf32_Word)) >= shdr_info[cnt].data->d_size / elsize +testfile9: 3ac0 shdr_info[cnt].shdr.sh_type == 18 +testfile9: 3b00 shdr_info[cnt].data != ((void *)0) +testfile9: 3b40 elf_ndxscn (shdr_info[cnt].newscn) == idx +testfile9: 3b80 while create section header section: %s +testfile9: 3bc0 cannot allocate section data: %s +testfile9: 3c00 elf_ndxscn (shdr_info[cnt].newscn) == shdr_info[cnt].idx +testfile9: 3c40 while generating output file: %s +testfile9: 3c80 while preparing output for `%s' +testfile9: 3ca0 shdr_info[cnt].shdr.sh_type == 2 +testfile9: 3ce0 shdr_info[idx].data != ((void *)0) +testfile9: 3d20 cannot determine number of sections: %s +testfile9: 3d60 cannot get section header string table index +testfile9: 3e20 Discard symbols from object files. +testfile9: 3e43 [FILE...] +EOF + +rm -f testfile testfile[23456789] strings.out + +exit 0 diff --git a/elfutils/tests/run-strip-test.sh b/elfutils/tests/run-strip-test.sh index 526eb091..169e8929 100755 --- a/elfutils/tests/run-strip-test.sh +++ b/elfutils/tests/run-strip-test.sh @@ -18,14 +18,14 @@ stripped=${stripped:-testfile7} debugout=${debugfile:+-f testfile.debug.temp -F $debugfile} # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 0 +bunzip2 -c $srcdir/$original.bz2 > $original 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. -bunzip2 -c $srcdir/$stripped.bz2 > $stripped 2>/dev/null || exit 0 +bunzip2 -c $srcdir/$stripped.bz2 > $stripped 2>/dev/null || exit 77 # Don't fail if we cannot decompress the file. test -z "$debugfile" || -bunzip2 -c $srcdir/$debugfile.bz2 > $debugfile 2>/dev/null || exit 0 +bunzip2 -c $srcdir/$debugfile.bz2 > $debugfile 2>/dev/null || exit 77 LD_LIBRARY_PATH=../libebl:../libelf${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH \ ../src/strip -o testfile.temp $debugout $original diff --git a/elfutils/tests/testfile24.bz2 b/elfutils/tests/testfile24.bz2 Binary files differnew file mode 100644 index 00000000..2320acb3 --- /dev/null +++ b/elfutils/tests/testfile24.bz2 diff --git a/elfutils/tests/testfile25.bz2 b/elfutils/tests/testfile25.bz2 Binary files differnew file mode 100644 index 00000000..51e04213 --- /dev/null +++ b/elfutils/tests/testfile25.bz2 |