diff options
Diffstat (limited to 'tests')
200 files changed, 18010 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog new file mode 100644 index 0000000..bc78843 --- /dev/null +++ b/tests/ChangeLog @@ -0,0 +1,1034 @@ +2011-02-02 Josh Stone <jistone@redhat.com> + + * run-prelink-addr-test.sh: Add testfile55, 32 and 64-bit. + * testfile55-64.bz2, testfile55-64.debug.bz2, + testfile55-64.prelink.bz2, testfile55-32.bz2, + testfile55-32.debug.bz2, testfile55-32.prelink.bz2: New. + * Makefile.am (EXTRA_DIST): Add and update all. + +2011-01-12 Roland McGrath <roland@redhat.com> + + * run-prelink-addr-test.sh: Make symlinks to find .debug files + corresponding to .noshdrs files. + +2011-01-11 Josh Stone <jistone@redhat.com> + + * run-prelink-addr-test.sh: Add testfile54, 32 and 64-bit. + * testfile54-32.so.bz2, testfile54-32.so.debug.bz2, + testfile54-32.prelink.so.bz2, testfile54-32.noshdrs.so.bz2, + testfile54-64.so.bz2, testfile54-64.so.debug.bz2, + testfile54-64.prelink.so.bz2, testfile54-64.noshdrs.so.bz2: New. + * Makefile.am (EXTRA_DIST): Add and update all. + + * run-prelink-addr-test.sh: Run 32 and 64-bit testfile53 tests. + * testfile53.bz2, testfile53.debug.bz2, + testfile53.prelink.bz2: Deleted, so... + * testfile53-64.bz2, testfile53-64.debug.bz2, + testfile53-64.prelink.bz2: Recreated with 64-bit names. + * testfile53-32.bz2, testfile53-32.debug.bz2, + testfile53-32.prelink.bz2: New in 32-bit. + * Makefile.am (EXTRA_DIST): Add and update all. + + * run-prelink-addr-test.sh: Run 32 and 64-bit testfile52 tests. + * testfile52.so.bz2, testfile52.so.debug.bz2, + testfile52.prelink.so.bz2: Deleted, so... + * testfile52-32.so.bz2, testfile52-32.so.debug.bz2, + testfile52-32.prelink.so.bz2: Recreated with 32-bit names. + * testfile52-32.noshdrs.so.bz2: New data file, stripped of headers. + * testfile52-64.so.bz2, testfile52-64.so.debug.bz2, + testfile52-64.prelink.so.bz2, testfile52-64.noshdrs.so.bz2: New files. + * Makefile.am (EXTRA_DIST): Add and update all. + +2011-01-10 Josh Stone <jistone@redhat.com> + + * run-prelink-addr-test.sh: New test for prelinked addrs. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + * testfile52.so.bz2, testfile52.so.debug.bz2: New data files. + * testfile52.prelink.so.bz2: New data file, shows REL->RELA. + * testfile53.bz2, testfile53.debug.bz2: New data files. + * testfile53.prelink.bz2: New data file, shows ET_EXEC remap. + * Makefile.am (EXTRA_DIST): Add them. + +2010-06-04 Roland McGrath <roland@redhat.com> + + * run-unstrip-test.sh: Also test modifying the file in place. + +2010-04-22 Roland McGrath <roland@redhat.com> + + * addrcfi.c (handle_cfi): Fix function name in error message. + Use dwarf_errmsg, not dwfl_errmsg, after dwarf_cfi_addrframe. + +2010-04-14 Roland McGrath <roland@redhat.com> + + * Makefile.am (EXTRA_DIST): Add run-test-flag-nobits.sh here too. + +2010-04-10 Ulrich Drepper <drepper@redhat.com> + + * msg_tst.c: Adjust expected error message. + +2010-04-01 Petr Machata <pmachata@redhat.com> + + * test-flag-nobits.c: New test. + * run-test-flag-nobits.sh: And its wrapper. + * Makefile.am (noinst_PROGRAMS, TESTS): Add them. + (test_flag_nobits_LDADD): New variable. + +2010-02-15 Roland McGrath <roland@redhat.com> + + * Makefile.am: Use config/eu.am for common stuff. + + * asm-tst9.c (main): Rename local to avoid shadowing another local. + +2009-07-22 Roland McGrath <roland@redhat.com> + + * addrcfi.c: Update dwarf_frame_{cfa,register} calling convention. + +2009-07-08 Roland McGrath <roland@redhat.com> + + * addrcfi.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (addrcfi_LDADD): New variable. + +2009-05-07 Petr Machata <pmachata@redhat.com> + + * testfile51.bz2: New data file. + * dwarf-getmacros.c: New test core. + * run-dwarf-getmacros.sh: New test wrapper. + * Makefile.am (TESTS, EXTRA_DIST, noinst_PROGRAMS): Add them. + (dwarf_getmacros_LDADD): New variable. + +2009-04-23 Ulrich Drepper <drepper@redhat.com> + + * Makefile [BUILD_STATIC] (libdw): Add $(zip_LIBS). + (rdwrmmap_LDADD): Add $(libmudflap). + +2009-04-21 Roland McGrath <roland@redhat.com> + + * testfile50.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-dwfl-addr-sect.sh: Add a case using it. + +2008-12-31 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: Add tests for dppd, dpps, insertps, movntdqa, + mpsadbw, packusdw, pblendvb, pblendw, pcmpeqq, pcmpestri, pcmpestrm, + pcmpistri, pcmpistrm, pcmpgtq, phminposuw, pinsrb, pinsrd, pmaxsb, + pmaxsd, pmaxud, pmaxuw, pminsb, pminsd, pminud, pminuw, pmovsxbw, + pmovsxbd, pmovsxbq, pmovsxwd, pmovsxwq, pmovsxdq, pmovsxbw, pmovsxbd, + pmovsxbq, pmovsxwd, pmovsxwq, pmovsxdq, pmuldq, pmulld, popcnt, ptest, + roundss, roundps, roundpd, and roundsd. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + + * testfile44.S.bz2: Add tests for blendvpd and blendvps. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-12-30 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: Add tests for blendpd and blendps. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-12-19 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: Add tests for AMD 3DNOW. + * testfile45.S.bz2: Likewise. + * testfile44.expect.bz2: Adjust accordingly. + * testfile45.expect.bz2: Likewise. + +2008-11-26 Roland McGrath <roland@redhat.com> + + * dwfl-bug-getmodules.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwfl_bug_getmodules_LDADD): New variable. + +2008-09-10 Roland McGrath <roland@redhat.com> + + * test-subr.sh (LC_ALL): Export it set to "C". + * run-dwfl-addr-sect.sh: Don't do it here. + * run-strings-test.sh: Likewise. + +2008-08-21 Denys Vlasenko <dvlasenk@redhat.com> + + * run-addrname-test.sh: Add a new case. + * testfile49.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2008-04-10 Roland McGrath <roland@redhat.com> + + * testfile48.bz2, testfile48.bz2.debug: New data files. + * Makefile.am (EXTRA_DIST): Add them. + * run-strip-test8.sh: Use them. + + * testfile16.bz2, testfile16.debug.bz2: Replace data files. + + * run-strip-test.sh: Fail if stripped output has ".debug_*" sections. + * run-strip-test8.sh: New file. + * testfile47.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2008-03-31 Roland McGrath <roland@redhat.com> + + * run-early-offscn.sh: New file. + * early-offscn.c: New file. + * Makefile.am (noinst_PROGRAMS, TESTS, EXTRA_DIST): Add them. + (early_offscn_LDADD): New variable. + +2008-03-19 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: Add a new case. + +2008-02-22 Roland McGrath <roland@redhat.com> + + * run-elflint-test.sh: Typo fix. + +2008-02-21 Roland McGrath <roland@redhat.com> + + * run-disasm-x86.sh: Use uname instead of arch, keep tools required + for the build down to minimum. + * run-disasm-x86-64.sh: Likewise. + +2008-02-20 Roland McGrath <roland@redhat.com> + + * testfile46.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: Test on it. + +2008-02-01 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Hook up sha1-tst.c. + * sha1-tst.c: New file. + +2008-01-21 Roland McGrath <roland@redhat.com> + + * testfile45.S.bz2: Add tests for cltq, cqto. + * testfile45.expect.bz2: Adjust. + +2008-01-14 Ulrich Drepper <drepper@redhat.com> + + * testfile45.S.bz2: Add more tests. + * testfile45.expect.bz2: Adjust. + +2008-01-11 Ulrich Drepper <drepper@redhat.com> + + * testfile45.expect.bz2: Adjust for adding of address for %rip based + address mode. + +2008-01-10 Ulrich Drepper <drepper@redhat.com> + + * testfile45.S.bz2: Add more tests. + * testfile45.expect.bz2: Adjust. + +2008-01-08 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (TESTS): Add run-disasm-x86-64.sh. + (EXTRA): Add testfile45.S.bz2, testfile45.expect.bz2, + run-disasm-x86-64.sh. + * run-disasm-x86-64.sh: New file. + * testfile45.S.bz2: New file. + * testfile45.expect.bz2: New file. + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2008-01-04 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2008-01-04 Roland McGrath <roland@redhat.com> + + * dwfl-bug-fd-leak.c (main): Add a cast. + +2008-01-03 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2008-01-01 Ulrich Drepper <drepper@redhat.com> + + * line2addr.c: Use %m modifier instead of %a to appease gcc. + +2008-01-01 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-31 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-30 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-29 Ulrich Drepper <drepper@redhat.com> + + * testfile44.s.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-28 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-27 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust. + +2007-12-26 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: New tests. + * testfile44.expect.bz2: Adjust + +2007-12-21 Ulrich Drepper <drepper@redhat.com> + + * testfile44.S.bz2: More tests. + * testfile44.expect.bz2: Adjust appropriately. + +2007-12-19 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (TESTS): Add run-disasm.sh. + (EXTRA_DIST): Add run-disasm.sh, testfile44.S.bz2, and + testfile44.expect.bz2. + * run-disasm.sh: New file. + * testfile44.S.bz2: New file. + * testfile44.expect.bz2: New file. + +2007-12-15 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Change expected output for powerpc spefscr. + +2007-10-20 Roland McGrath <roland@redhat.com> + + * run-dwfl-addr-sect.sh: Change expected output, no errors. + +2007-10-19 Roland McGrath <roland@redhat.com> + + * dwfl-addr-sect.c (handle_address): Return int. + Don't exit on error, just return nonzero. + (main): Collect results. + * run-dwfl-addr-sect.sh: New file. + * testfile43.bz2: New data file. + * Makefile.am (EXTRA_DIST, TESTS): Add them. + +2007-10-18 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected ppc output for vrsave/vscr. + +2007-10-16 Roland McGrath <roland@redhat.com> + + * test-subr.sh (remove_files): Don't pass -Bb to diff. + +2007-10-09 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c (print_module): Don't use %p in output. + * run-dwfl-bug-offline-rel.sh: Updated expected output. + +2007-10-08 Roland McGrath <roland@redhat.com> + + * testfile42.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: New test on that file. + +2007-10-04 Roland McGrath <roland@redhat.com> + + * run-readelf-test4.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2007-10-03 Roland McGrath <roland@redhat.com> + + * run-readelf-test3.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2007-10-01 Roland McGrath <roland@redhat.com> + + * run-readelf-test2.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2007-09-11 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: Add a new case. + * testfile41.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2007-08-23 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected x86-64 output for %rflags. + +2007-08-12 Roland McGrath <roland@redhat.com> + + * run-strip-test7.sh: New file. + * testfile39.bz2: New data file. + * testfile40.bz2: New data file. + * testfile40.debug.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2007-08-09 Roland McGrath <roland@redhat.com> + + * dwfl-bug-report.c: Fix header inclusion. + +2007-08-08 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: Add a new case using addr2line -S. + * testfile38.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2007-07-16 Roland McGrath <roland@redhat.com> + + * dwfl-bug-report.c: New file. + * Makefile.am (noinst_PROGRAMS, TESTS): Add it. + (dwfl_bug_report_LDADD): New variable. + +2007-06-06 Roland McGrath <roland@redhat.com> + + * run-unstrip-test.sh: Declare testfile.unstrip for removal. + +2007-06-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (EXTRA_DIST): Add missing line continuation and + testfile37.bz and testfile37.debug.bz2. + +2007-05-23 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected Alpha results. + +2007-05-18 Roland McGrath <roland@redhat.com> + + * run-strip-test4.sh (stripped, debugfile): Use new reference files. + * testfile37.bz2: New data file. + * testfile37.debug.bz2: New data file. + * run-unstrip-test2.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2007-05-10 Roland McGrath <roland@redhat.com> + + * run-dwfl-bug-offline-rel.sh: New file. + * testfile36.bz2: New data file. + * testfile36.debug.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2007-04-28 Roland McGrath <roland@redhat.com> + + * run-strip-test6.sh (stripped, debugfile): Use new reference files. + * testfile35.bz2: New data file. + * testfile35.debug.bz2: New data file. + * run-unstrip-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + + * run-strip-test.sh: Do all elflint and cmp runs even when some fail. + +2007-04-26 Roland McGrath <roland@redhat.com> + + * run-elflint-self.sh: Run all tests even if one fails. + + * run-allregs.sh: Add expected output for alpha. + +2007-04-24 Roland McGrath <roland@redhat.com> + + * run-strip-test.sh: When we saved the debug info, test unstrip too. + +2007-04-22 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Update expected register info. + +2007-04-16 Roland McGrath <roland@redhat.com> + + * dwfl-addr-sect.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwfl_addr_sect_LDADD): New variable. + +2007-04-05 Roland McGrath <roland@redhat.com> + + * get-files.c: Test dwarf_getsrcdirs. + * run-get-files.sh: Update expected output. + +2007-04-01 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Updated expected output for x86_64. + +2007-03-04 Roland McGrath <roland@redhat.com> + + * dwfl-bug-fd-leak.c: New file. + * Makefile.am (noinst_PROGRAMS, TESTS): Add it. + (dwfl_bug_fd_leak_LDADD): New variable. + + * dwflmodtest.c: Test dwfl_getmodules before and after getdwarf, + show what files have been located. + +2007-02-02 Roland McGrath <roland@redhat.com> + + * run-addrname-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + * testfile34.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2007-01-20 Roland McGrath <roland@redhat.com> + + * testfile33.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: Test on it too. + +2007-01-18 Roland McGrath <roland@redhat.com> + + * Makefile.am (CFLAGS): Don't molest it. + +2007-01-11 Roland McGrath <roland@redhat.com> + + * testfile32.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + * run-elflint-test.sh: Test on it too. + +2007-02-04 Ulrich Drepper <drepper@redhat.com> + + * arls.c: New file. + * Makefile (noinst_PROGRAMS): Add arls. + + * run-ranlib-test2.sh: Fix type in comment. + +2007-01-10 Ulrich Drepper <drepper@redhat.com> + + * run-elflint-self.sh (runtest): Show which file has the problem. + +2007-01-10 Roland McGrath <roland@redhat.com> + + * dwfl-bug-addr-overflow.c: New file. + * Makefile.am (TESTS): Add it. + (dwfl_bug_addr_overflow_LDADD): New variable. + +2006-12-17 Roland McGrath <roland@redhat.com> + + * msg_tst.c (libelf_msgs): Fix ELF_E_INVALID_PHDR msg. + +2006-09-05 Roland McGrath <roland@redhat.com> + + * run-strings-test.sh: Export LC_ALL=C for the test. + +2006-08-29 Roland McGrath <roland@redhat.com> + + * run-arextract.sh: Use testrun, tempfiles functions from test-subr.sh. + * run-arsymtest.sh: Likewise. + + * run-native-test.sh (native.c compilation): Add some braces. + +2006-08-22 Roland McGrath <roland@redhat.com> + + * allregs.c (dwarf_encoding_string): New function, swiped from readelf. + (struct reginfo): New members bits, type. + (one_register, match_register): Update to take new args, + record and display new info. + (main): Display new info. + * run-allregs.sh: Update expected results. + +2006-08-03 Roland McGrath <roland@redhat.com> + + * run-allregs.sh: Add sparc cases. + * testfile30.bz2: New data file. + * testfile31.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add them. + +2006-07-21 Roland McGrath <roland@redhat.com> + + * allregs.c (struct reginfo): Increase size of name. + (one_register): Assert that it's big enough. + +2006-04-04 Roland McGrath <roland@redhat.com> + + * run-bug1-test.sh: Test a second case, to cover both byte orders. + * testfile29.bz2: New file. + * testfile29.rdwr.bz2: New file. + * Makefile.am (EXTRA_DIST): Add them. + +2006-04-04 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add rules to run run-bug1-test.sh. + * rdwrmmap.c: New file. + * run-bug1-test.sh: New file. + * testfile28.bz2: New file. + * testfile28.rdwr.bz2: New file. + +2006-03-09 Roland McGrath <roland@redhat.com> + + * Makefile.am (AM_LDFLAGS): Define to pass -rpath-link. + +2006-03-01 Roland McGrath <roland@redhat.com> + + * show-die-info.c (tagnames, attrs): Update name tables for dwarf.h + changes matching 3.0 spec. + +2006-01-13 Roland McGrath <roland@redhat.com> + + * run-native-test.sh: Do kill -9 and reap explicitly at end, since + bash 3.1 whines when it's done in the trap 0 handler. + +2006-01-11 Roland McGrath <roland@redhat.com> + + * testfile26.bz2: New data file. + * testfile27.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add them. + * run-allregs.sh: Test s390 data. + +2005-12-14 Roland McGrath <roland@redhat.com> + + * run-native-test.sh: Redirect output from native test process. + +2005-12-13 Roland McGrath <roland@redhat.com> + + * allregs.c (main): Fail if we find no registers. + + * run-native-test.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + +2005-12-10 Ulrich Drepper <drepper@redhat.com + + * run-readelf-test1.sh: New file. + * Makefile.am (TESTS): Add run-readelf-test1.sh. + (EXTRA_DIST): Likewise. + +2005-12-07 Roland McGrath <roland@redhat.com> + + * ecp.c (main): Use elf_end to clean up. + +2005-11-25 Roland McGrath <roland@redhat.com> + + * coverage.sh: Given -v argument, print names of unused files. + + * addrscopes.c (main): Use dwfl_end before return. + * allregs.c (main): Likewise. + * find-prologues.c (main): Likewise. + * funcretval.c (main): Likewise. + * funcscopes.c (main): Likewise. + * line2addr.c (main): Likewise. + + * run-allregs.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + + * allregs.c: Use libdwfl wrapper instead of direct libebl calls. + * Makefile.am (allregs_LDADD): Updated. + + * allregs.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (allregs_LDADD): New variable. + +2005-11-18 Roland McGrath <roland@redhat.com> + + * test-subr.sh (installed_testrun): Treat /usr/lib64 like /usr/lib. + * test-wrapper.sh: Likewise. + +2005-11-17 Roland McGrath <roland@redhat.com> + + * Makefile.am (installed_TESTS_ENVIRONMENT): Set libdir, bindir in + environment for test-wrapper.sh. + * test-wrapper.sh: Set LD_LIBRARY_PATH from ${libdir} if not /usr/lib. + * test-subr.sh (installed_testrun): Likewise. + Use explicit path in ${bindir}. + + * Makefile.am (installcheck-local): Fix typo in last change. + +2005-11-16 Roland McGrath <roland@redhat.com> + + * configure.ac: New file, for standalone build/dist of test suite. + * Makefile.am [!STANDALONE] (INCLUDES): Don't define it. + (asm_TESTS): New variable, broken out of ... + (TESTS): ... here. Also remove msg_tst. + [!STANDALONE] (TESTS, noinst_PROGRAMS): Add in $(asm_TESTS), msg_tst. + (installed_TESTS_ENVIRONMENT): New variable. + [STANDALONE] (TESTS_ENVIRONMENT): Use that. + [!STANDALONE] (installcheck-local): Likewise. + [STANDALONE] (libdw, libelf, libasm, libebl): Define using -lfoo. + * addrscopes.c: Include <config.h>. + Use ELFUTILS_HEADER macro in #include of installed elfutils/ headers. + * allfcts.c: Likewise. + * asm-tst1.c: Likewise. + * asm-tst2.c: Likewise. + * asm-tst3.c: Likewise. + * asm-tst4.c: Likewise. + * asm-tst5.c: Likewise. + * asm-tst6.c: Likewise. + * asm-tst7.c: Likewise. + * asm-tst8.c: Likewise. + * asm-tst9.c: Likewise. + * dwflmodtest.c: Likewise. + * find-prologues.c: Likewise. + * funcscopes.c: Likewise. + * get-aranges.c: Likewise. + * get-files.c: Likewise. + * get-lines.c: Likewise. + * get-pubnames.c: Likewise. + * line2addr.c: Likewise. + * newscn.c: Likewise. + * show-abbrev.c: Likewise. + * show-die-info.c: Likewise. + * update3.c: Likewise. + * update4.c: Likewise. + * funcretval.c: Likewise. + + * dwflmodtest.c (print_instance): Don't use INTUSE. + (options): Don't use N_ macro. + +2005-11-15 Roland McGrath <roland@redhat.com> + + * coverage.sh: Look in backends. + * Makefile.am (BUILD_RPATH): Search ../backends, not ../libebl. + (TESTS_ENVIRONMENT): Likewise. + + * funcretval.c (handle_function): Don't take DW_AT_type of FUNCDIE, + pass FUNCDIE direclty to dwfl_module_return_value_location. + + * Makefile.am (BUILD_RPATH): New variable. + [TESTS_RPATH] (AM_LDFLAGS): Pass -rpath option using that value. + (tests_rpath): New variable. + (installcheck-local): Pass it to test-wrapper.sh. + * test-wrapper.sh: In "installed" format, take yes/no value + for elfutils_tests_rpath, which export. When running a test + binary for installcheck, exit 77. + * test-subr.sh (installed_testrun): When running a test binary + for installcheck, exit 77 if $elfutils_tests_rpath = yes. + +2005-11-14 Roland McGrath <roland@redhat.com> + + * test-subr.sh: New file. + * test-wrapper.sh: New file. + * Makefile.am (EXTRA_DIST): Add them. + (AM_LDFLAGS): Variable removed. + (TESTS_ENVIRONMENT): New variable. + (installcheck-local): New target. + * run-addrscopes.sh: Use test-subr.sh. + * run-allfcts.sh: Likewise. + * run-ecp-test.sh: Likewise. + * run-ecp-test2.sh: Likewise. + * run-elflint-self.sh: Likewise. + * run-elflint-test.sh: Likewise. + * run-find-prologues.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-test.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-11-13 Roland McGrath <roland@redhat.com> + + * funcretval.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (funcretval_LDADD): New variable. + +2005-11-09 Ulrich Drepper <drepper@redhat.com> + + * line2addr.c (handle_module): Add missing parameter to printf. + +2005-10-27 Roland McGrath <roland@redhat.com> + + * allfcts.c (cb): Update for dwarf_func_* -> dwarf_decl_* changes. + * funcscopes.c (handle_function): Likewise. + * dwflmodtest.c (print_inline, print_func): Likewise. + * find-prologues.c (handle_function): Likewise. + +2005-10-27 Roland McGrath <roland@redhat.com> + + * run-find-prologues.sh: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add it. + + * find-prologues.c (handle_function): Skip inlines. + +2005-10-25 Roland McGrath <roland@redhat.com> + + * find-prologues.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (find_prologues_LDADD): New variable. + +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. + + * Makefile.am [BUILD_STATIC] (libdw): Add $(libelf) and $(libebl). + [MUDFLAP] (AM_LDFLAGS): Define to find libebl modules. + +2005-08-22 Roland McGrath <roland@redhat.com> + + * run-line2addr.sh: Add a case. + * testfile23.bz2: New data file. + * Makefile.am (EXTRA_DIST): Add it. + +2005-08-18 Roland McGrath <roland@redhat.com> + + * run-addrscopes.sh: New file. + * testfile22.bz2: New data file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + + * addrscopes.c: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (addrscopes_LDADD): New variable. + +2005-08-15 Ulrich Drepper <drepper@redhat.com> + + * run-elflint-self.sh: Don't run test if the file doesn't exist. + +2005-08-15 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c (print_instance, print_inline): New functions. + (print_func): Call print_inline. + (options, parse_opt): Grok -i/--inlines. + +2005-08-07 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c: Print function details only if -f flag is given. + +2005-08-06 Ulrich Drepper <drepper@redhat.com> + + * run-elflint-self.sh: New file. + * Makefile.am (TESTS): Add run-elflint-self.sh. + (EXTRA_DIST): Likewise. + + * Makefile.am: Link with statis libs if BUILD_STATIC. + (dwflmodtest_LDADD): Also link with -ldl. + +2005-08-02 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add -ldl to asm_tst[1-9]_LDASS. + * asm-tst1.c: Adjust for new asm_begin interface. Open backend + library first. + * asm-tst2.c: Likewise. + * asm-tst3.c: Likewise. + * asm-tst4.c: Likewise. + * asm-tst5.c: Likewise. + * asm-tst6.c: Likewise. + * asm-tst7.c: Likewise. + * asm-tst8.c: Likewise. + * asm-tst9.c: Likewise. + + * msg_tst.c: Add new error message. + +2005-07-28 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am (dwflmodtest_LDADD): Add $(libebl). + +2005-06-01 Roland McGrath <roland@redhat.com> + + * line2addr.c: Rewritten using libdwfl. + * run-line2addr.sh: Update test for changed arguments. + * Makefile.am (INCLUDES): Add libdwfl source directory to path. + (libdwfl): New variable. + (line2addr_LDADD): Use it. + +2005-07-28 Roland McGrath <roland@redhat.com> + + * dwflmodtest.c: New file, moved from ../libdwfl/ptest.c to here. + * Makefile.am (noinst_PROGRAMS): Add dwflmodtest. + (dwflmodtest_LDADD): New variable. + (INCLUDES): Add -I$(top_srcdir)/libdwfl here. + +2005-07-21 Ulrich Drepper <drepper@redhat.com> + + * testfile18.bz2: New file. + * run-elflint-test.sh: New file. + * Makefile.am (TESTS): Add run-elflint-test.sh. + (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2. + +2005-05-24 Ulrich Drepper <drepper@redhat.com> + + * get-files.c (main): Use correct format specifier. + +2005-05-21 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Add -Wextra to CFLAGS. + * get-files.c: Remove warning this produced. + * get-pubnames.c: Likewise. + * newfile.c: Likewise. + * newscn.c: Likewise. + * scnnames.c: Likewise. + * showptable.c: Likewise. + * test-nlist.c: Likewise. + * update1.c: Likewise. + * update2.c: Likewise. + * update3.c: Likewise. + * update4.c: Likewise. + +2005-05-08 Ulrich Drepper <drepper@redhat.com> + + * run-line2addr.sh: Remove testfile14 at the end. + + * run-strip-test.sh: Remove debuginfo test input file as well. + + * Makefile.am (EXTRA_DIST): Newly added files incorrectly used + .bz, not .bz2. + +2005-05-03 Roland McGrath <roland@redhat.com> + + * run-strip-test.sh: Use variables for test file names. + Optionally produce separate debug file and check it. + * run-strip-test2.sh: Use run-strip-test.sh via ., no duplication. + * run-strip-test3.sh: Likewise. + * run-strip-test4.sh: New file. + * run-strip-test5.sh: New file. + * run-strip-test6.sh: New file. + * testfile15.bz: New file. + * testfile15.debug.bz: New file. + * testfile16.bz: New file. + * testfile16.debug.bz: New file. + * testfile17.bz: New file. + * testfile17.debug.bz: New file. + * Makefile.am (TESTS, EXTRA_DIST): Add them. + +2005-04-25 Ulrich Drepper <drepper@redhat.com> + + * run-line2addr.sh: Also use testfile14. Adjust for correct + return of multiple matches. + * testfile14.bz2: New file. + * Makefile.am (EXTRA_DIST): Add testfile14.bz2. + + * show-abbrev.c (main): Adjust for dwarf_getabbrev interface change. + +2005-04-04 Roland McGrath <roland@redhat.com> + + * line2addr.c (main): Initialize LINES and NLINES before calling + dwarf_getsrc_file, and free LINES afterwards. + + * allfcts.c (main): Use size_t for CUHL. + +2005-04-04 Ulrich Drepper <drepper@redhat.com> + + * line2addr.c: New file. + * run-line2addr.sh: New file. + * Makefile.am: Add rules to build, run, and distribute new code. + +2005-04-02 Ulrich Drepper <drepper@redhat.com> + + * allfcts.c: New file. + * run-allfcts.sh: New file. + * Makefile.am: Add rules to build, run, and distribute new code. + +2005-02-05 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -fmudflap. Link all test + programs with -lmudflap. + +2004-09-25 Ulrich Drepper <drepper@redhat.com> + + * asm-tst4.c (main): Add LD_LIBRARY_PATH to elflint invocation. + * asm-tst5.c (main): Likewise. + * asm-tst6.c (main): Likewise. + +2004-01-17 Ulrich Drepper <drepper@redhat.com> + + * Makefile.am: Support building with mudflap. + +2004-01-12 Ulrich Drepper <drepper@redhat.com> + + * get-aranges.c: Rewrite to use libdw. + * Makefile.am: Reenable get-aranges test. + +2004-01-11 Ulrich Drepper <drepper@redhat.com> + + * get-lines.c: New file. + * get-files.c: Adjust for libdw. + * run-get-files.sh: Adjust expected result. + * run-get-lines.sh: Likewise. + * Makefile.am: Run get-lines test. Don't run get-aranges and + get-ciefde test for now. + + * show-abbrev.c: Adjust call to dwarf_getabbrevattr after interface + change. Print attribute offset information. + * run-show-abbrev.sh: Adjust expected output. + +2004-01-09 Ulrich Drepper <drepper@redhat.com> + + * show-abbrev.c: Adjust call to dwarf_nextcu after interface change. + * show-die-info.c: Likewise. + * run-show-die-info.sh: Adjust expected output. + +2003-08-13 Ulrich Drepper <drepper@redhat.com> + + * Makefile.in: Depend on libebl.a, not libebl.so. + +2003-08-11 Ulrich Drepper <drepper@redhat.com> + + * Moved to CVS archive. diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..b317553 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,257 @@ +## Process this file with automake to create Makefile.in +## +## Copyright (C) 1996-2010 Red Hat, Inc. +## This file is part of Red Hat elfutils. +## +## Red Hat elfutils 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; version 2 of the License. +## +## Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +## +## Red Hat elfutils is an included package of the Open Invention Network. +## An included package of the Open Invention Network is a package for which +## Open Invention Network licensees cross-license their patents. No patent +## license is granted, either expressly or impliedly, by designation as an +## included package. Should you wish to participate in the Open Invention +## Network licensing program, please visit www.openinventionnetwork.com +## <http://www.openinventionnetwork.com>. +## +include $(top_srcdir)/config/eu.am +if MUDFLAP +BUILD_RPATH = \$$ORIGIN/../backends +else +BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf +endif + +AM_LDFLAGS = + +if !STANDALONE +INCLUDES += -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/libdwfl \ + -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \ + -I$(top_srcdir)/lib -I.. +AM_LDFLAGS += -Wl,-rpath-link,../libasm:../libdw:../libelf +endif + +if TESTS_RPATH +AM_LDFLAGS += -Wl,-rpath,$(BUILT_RPATH) +tests_rpath = yes +else +tests_rpath = no +endif + +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 funcscopes \ + show-abbrev hash newscn ecp dwflmodtest \ + find-prologues funcretval allregs rdwrmmap \ + dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \ + dwfl-addr-sect dwfl-bug-report early-offscn \ + dwfl-bug-getmodules dwarf-getmacros addrcfi \ + test-flag-nobits +asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ + asm-tst6 asm-tst7 asm-tst8 asm-tst9 + +TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ + update1 update2 update3 update4 \ + run-show-die-info.sh run-get-files.sh run-get-lines.sh \ + run-get-pubnames.sh run-get-aranges.sh run-allfcts.sh \ + run-show-abbrev.sh run-line2addr.sh hash \ + newscn run-strip-test.sh run-strip-test2.sh \ + run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \ + run-strip-test6.sh run-strip-test7.sh run-strip-test8.sh \ + run-unstrip-test.sh run-unstrip-test2.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-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh \ + run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ + run-readelf-test4.sh \ + run-native-test.sh run-bug1-test.sh \ + dwfl-bug-addr-overflow run-addrname-test.sh \ + dwfl-bug-fd-leak dwfl-bug-report \ + run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \ + run-disasm-x86.sh run-disasm-x86-64.sh \ + run-early-offscn.sh run-dwarf-getmacros.sh \ + run-test-flag-nobits.sh run-prelink-addr-test.sh +# run-show-ciefde.sh + +if !STANDALONE +noinst_PROGRAMS += msg_tst sha1-tst +TESTS += msg_tst sha1-tst +endif + +if HAVE_LIBASM +noinst_PROGRAMS += $(asm_TESTS) +TESTS += $(asm_TESTS) +endif + + +EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ + run-show-die-info.sh run-get-files.sh run-get-lines.sh \ + run-get-pubnames.sh run-get-aranges.sh \ + run-show-ciefde.sh run-show-abbrev.sh run-strip-test.sh \ + run-strip-test2.sh run-ecp-test.sh run-ecp-test2.sh \ + testfile.bz2 testfile2.bz2 testfile3.bz2 testfile4.bz2 \ + testfile5.bz2 testfile6.bz2 testfile7.bz2 testfile8.bz2 \ + testfile9.bz2 testfile10.bz2 testfile11.bz2 testfile12.bz2 \ + testfile13.bz2 run-strip-test3.sh run-allfcts.sh \ + run-line2addr.sh run-elflint-test.sh testfile14.bz2 \ + run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ + run-strip-test7.sh run-strip-test8.sh \ + run-unstrip-test.sh run-unstrip-test2.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-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh run-native-test.sh \ + run-addrname-test.sh run-dwfl-bug-offline-rel.sh \ + run-dwfl-addr-sect.sh run-early-offscn.sh \ + run-dwarf-getmacros.sh run-test-flag-nobits.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 testfile24.bz2 testfile25.bz2 \ + testfile26.bz2 testfile27.bz2 \ + coverage.sh test-subr.sh test-wrapper.sh \ + run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ + run-readelf-test4.sh \ + run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 \ + testfile29.bz2 testfile29.rdwr.bz2 \ + testfile30.bz2 testfile31.bz2 testfile32.bz2 testfile33.bz2 \ + testfile34.bz2 testfile35.bz2 testfile35.debug.bz2 \ + testfile36.bz2 testfile36.debug.bz2 \ + testfile37.bz2 testfile37.debug.bz2 \ + testfile38.bz2 testfile39.bz2 testfile40.bz2 testfile40.debug.bz2 \ + testfile41.bz2 testfile42.bz2 testfile43.bz2 \ + testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \ + testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \ + testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ + testfile49.bz2 testfile50.bz2 testfile51.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 \ + testfile52-64.so.bz2 testfile52-64.so.debug.bz2 \ + testfile52-64.prelink.so.bz2 testfile52-64.noshdrs.so.bz2 \ + testfile53-32.bz2 testfile53-32.debug.bz2 \ + testfile53-32.prelink.bz2 testfile53-64.bz2 \ + testfile53-64.debug.bz2 testfile53-64.prelink.bz2 \ + testfile54-32.so.bz2 testfile54-32.so.debug.bz2 \ + testfile54-32.prelink.so.bz2 testfile54-32.noshdrs.so.bz2 \ + testfile54-64.so.bz2 testfile54-64.so.debug.bz2 \ + testfile54-64.prelink.so.bz2 testfile54-64.noshdrs.so.bz2 \ + testfile55-32.bz2 testfile55-32.debug.bz2 \ + testfile55-32.prelink.bz2 testfile55-64.bz2 \ + testfile55-64.debug.bz2 testfile55-64.prelink.bz2 + +installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ + bindir=$(DESTDIR)$(bindir) \ + $(srcdir)/test-wrapper.sh \ + installed $(tests_rpath) \ + $(program_transform_name) +if STANDALONE +TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT) +else !STANDALONE +TESTS_ENVIRONMENT = $(srcdir)/test-wrapper.sh \ + ../libdw:../backends:../libelf:../libasm + +installcheck-local: + $(MAKE) $(AM_MAKEFLAGS) \ + TESTS_ENVIRONMENT='$(installed_TESTS_ENVIRONMENT)' check-TESTS +endif !STANDALONE + +if MUDFLAP +static_build = yes +endif + +if STANDALONE +libdw = -ldw +libelf = -lelf +libasm = -lasm +libebl = -lebl +else !STANDALONE +if BUILD_STATIC +libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl +libelf = ../libelf/libelf.a +libasm = ../libasm/libasm.a +else +libdw = ../libdw/libdw.so +libelf = ../libelf/libelf.so +libasm = ../libasm/libasm.so +endif +libebl = ../libebl/libebl.a +libeu = ../lib/libeu.a +endif !STANDALONE + +arextract_LDADD = $(libelf) $(libmudflap) +arsymtest_LDADD = $(libelf) $(libmudflap) +newfile_LDADD = $(libelf) $(libmudflap) +saridx_LDADD = $(libelf) $(libmudflap) +scnnames_LDADD = $(libelf) $(libmudflap) +sectiondump_LDADD = $(libelf) $(libmudflap) +showptable_LDADD = $(libelf) $(libmudflap) +hash_LDADD = $(libelf) $(libmudflap) +test_nlist_LDADD = $(libelf) $(libmudflap) +msg_tst_LDADD = $(libelf) $(libmudflap) +newscn_LDADD = $(libelf) $(libmudflap) +early_offscn_LDADD = $(libelf) $(libmudflap) +ecp_LDADD = $(libelf) $(libmudflap) +update1_LDADD = $(libelf) $(libmudflap) +update2_LDADD = $(libelf) $(libmudflap) +update3_LDADD = $(libebl) $(libelf) $(libmudflap) +update4_LDADD = $(libebl) $(libelf) $(libmudflap) +show_die_info_LDADD = $(libdw) $(libelf) $(libmudflap) +get_pubnames_LDADD = $(libdw) $(libelf) $(libmudflap) +show_abbrev_LDADD = $(libdw) $(libelf) $(libmudflap) +get_lines_LDADD = $(libdw) $(libelf) $(libmudflap) +get_files_LDADD = $(libdw) $(libelf) $(libmudflap) +get_aranges_LDADD = $(libdw) $(libelf) $(libmudflap) +allfcts_LDADD = $(libdw) $(libelf) $(libmudflap) +line2addr_no_Wformat = yes +line2addr_LDADD = $(libdw) $(libmudflap) +addrscopes_LDADD = $(libdw) $(libmudflap) +funcscopes_LDADD = $(libdw) $(libmudflap) +funcretval_LDADD = $(libdw) $(libmudflap) +allregs_LDADD = $(libdw) $(libmudflap) +find_prologues_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 +asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +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 +rdwrmmap_LDADD = $(libelf) $(libmudflap) +dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +arls_LDADD = $(libelf) $(libmudflap) +dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +sha1_tst_LDADD = $(libeu) $(libmudflap) +dwarf_getmacros_LDADD = $(libdw) $(libmudflap) +addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +test_flag_nobits_LDADD = $(libelf) $(libmudflap) + +if GCOV +check: check-am coverage +.PHONY: coverage +coverage: + -$(srcdir)/coverage.sh +endif diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..f9d93ed --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,1192 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/config/eu.am ChangeLog +@MUDFLAP_TRUE@am__append_1 = -fmudflap +@STANDALONE_FALSE@am__append_2 = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \ +@STANDALONE_FALSE@ -I$(top_srcdir)/libdwfl \ +@STANDALONE_FALSE@ -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \ +@STANDALONE_FALSE@ -I$(top_srcdir)/lib -I.. + +@STANDALONE_FALSE@am__append_3 = -Wl,-rpath-link,../libasm:../libdw:../libelf +@TESTS_RPATH_TRUE@am__append_4 = -Wl,-rpath,$(BUILT_RPATH) +noinst_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \ + newfile$(EXEEXT) saridx$(EXEEXT) scnnames$(EXEEXT) \ + sectiondump$(EXEEXT) showptable$(EXEEXT) update1$(EXEEXT) \ + update2$(EXEEXT) update3$(EXEEXT) update4$(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) \ + funcscopes$(EXEEXT) show-abbrev$(EXEEXT) hash$(EXEEXT) \ + newscn$(EXEEXT) ecp$(EXEEXT) dwflmodtest$(EXEEXT) \ + find-prologues$(EXEEXT) funcretval$(EXEEXT) allregs$(EXEEXT) \ + rdwrmmap$(EXEEXT) dwfl-bug-addr-overflow$(EXEEXT) \ + arls$(EXEEXT) dwfl-bug-fd-leak$(EXEEXT) \ + dwfl-addr-sect$(EXEEXT) dwfl-bug-report$(EXEEXT) \ + early-offscn$(EXEEXT) dwfl-bug-getmodules$(EXEEXT) \ + dwarf-getmacros$(EXEEXT) addrcfi$(EXEEXT) \ + test-flag-nobits$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_3) +TESTS = run-arextract.sh run-arsymtest.sh newfile$(EXEEXT) \ + test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \ + update3$(EXEEXT) update4$(EXEEXT) run-show-die-info.sh \ + run-get-files.sh run-get-lines.sh run-get-pubnames.sh \ + run-get-aranges.sh run-allfcts.sh run-show-abbrev.sh \ + run-line2addr.sh hash$(EXEEXT) newscn$(EXEEXT) \ + run-strip-test.sh run-strip-test2.sh run-strip-test3.sh \ + run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ + run-strip-test7.sh run-strip-test8.sh run-unstrip-test.sh \ + run-unstrip-test2.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-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh run-readelf-test1.sh \ + run-readelf-test2.sh run-readelf-test3.sh run-readelf-test4.sh \ + run-native-test.sh run-bug1-test.sh \ + dwfl-bug-addr-overflow$(EXEEXT) run-addrname-test.sh \ + dwfl-bug-fd-leak$(EXEEXT) dwfl-bug-report$(EXEEXT) \ + run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \ + run-disasm-x86.sh run-disasm-x86-64.sh run-early-offscn.sh \ + run-dwarf-getmacros.sh run-test-flag-nobits.sh \ + run-prelink-addr-test.sh $(am__EXEEXT_1) $(am__EXEEXT_3) +# run-show-ciefde.sh +@STANDALONE_FALSE@am__append_5 = msg_tst sha1-tst +@STANDALONE_FALSE@am__append_6 = msg_tst sha1-tst +@HAVE_LIBASM_TRUE@am__append_7 = $(asm_TESTS) +@HAVE_LIBASM_TRUE@am__append_8 = $(asm_TESTS) +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/zip.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@STANDALONE_FALSE@am__EXEEXT_1 = msg_tst$(EXEEXT) sha1-tst$(EXEEXT) +am__EXEEXT_2 = 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) +@HAVE_LIBASM_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) +PROGRAMS = $(noinst_PROGRAMS) +addrcfi_SOURCES = addrcfi.c +addrcfi_OBJECTS = addrcfi.$(OBJEXT) +am__DEPENDENCIES_1 = +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_2 = \ +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libelf/libelf.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_2 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libelf/libelf.a +@STANDALONE_FALSE@am__DEPENDENCIES_3 = ../libebl/libebl.a +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_4 = \ +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libdw/libdw.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_4 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libdw/libdw.a \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_1) \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_2) \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ $(am__DEPENDENCIES_3) +addrcfi_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +addrscopes_SOURCES = addrscopes.c +addrscopes_OBJECTS = addrscopes.$(OBJEXT) +addrscopes_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +allfcts_SOURCES = allfcts.c +allfcts_OBJECTS = allfcts.$(OBJEXT) +allfcts_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +allregs_SOURCES = allregs.c +allregs_OBJECTS = allregs.$(OBJEXT) +allregs_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +arextract_SOURCES = arextract.c +arextract_OBJECTS = arextract.$(OBJEXT) +arextract_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +arls_SOURCES = arls.c +arls_OBJECTS = arls.$(OBJEXT) +arls_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +arsymtest_SOURCES = arsymtest.c +arsymtest_OBJECTS = arsymtest.$(OBJEXT) +arsymtest_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst1_SOURCES = asm-tst1.c +asm_tst1_OBJECTS = asm-tst1.$(OBJEXT) +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@am__DEPENDENCIES_5 = \ +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@ ../libasm/libasm.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@am__DEPENDENCIES_5 = \ +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@ ../libasm/libasm.a +asm_tst1_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst2_SOURCES = asm-tst2.c +asm_tst2_OBJECTS = asm-tst2.$(OBJEXT) +asm_tst2_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst3_SOURCES = asm-tst3.c +asm_tst3_OBJECTS = asm-tst3.$(OBJEXT) +asm_tst3_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst4_SOURCES = asm-tst4.c +asm_tst4_OBJECTS = asm-tst4.$(OBJEXT) +asm_tst4_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst5_SOURCES = asm-tst5.c +asm_tst5_OBJECTS = asm-tst5.$(OBJEXT) +asm_tst5_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst6_SOURCES = asm-tst6.c +asm_tst6_OBJECTS = asm-tst6.$(OBJEXT) +asm_tst6_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst7_SOURCES = asm-tst7.c +asm_tst7_OBJECTS = asm-tst7.$(OBJEXT) +asm_tst7_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst8_SOURCES = asm-tst8.c +asm_tst8_OBJECTS = asm-tst8.$(OBJEXT) +asm_tst8_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +asm_tst9_SOURCES = asm-tst9.c +asm_tst9_OBJECTS = asm-tst9.$(OBJEXT) +asm_tst9_DEPENDENCIES = $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +dwarf_getmacros_SOURCES = dwarf-getmacros.c +dwarf_getmacros_OBJECTS = dwarf-getmacros.$(OBJEXT) +dwarf_getmacros_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_1) +dwfl_addr_sect_SOURCES = dwfl-addr-sect.c +dwfl_addr_sect_OBJECTS = dwfl-addr-sect.$(OBJEXT) +dwfl_addr_sect_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +dwfl_bug_addr_overflow_SOURCES = dwfl-bug-addr-overflow.c +dwfl_bug_addr_overflow_OBJECTS = dwfl-bug-addr-overflow.$(OBJEXT) +dwfl_bug_addr_overflow_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +dwfl_bug_fd_leak_SOURCES = dwfl-bug-fd-leak.c +dwfl_bug_fd_leak_OBJECTS = dwfl-bug-fd-leak.$(OBJEXT) +dwfl_bug_fd_leak_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +dwfl_bug_getmodules_SOURCES = dwfl-bug-getmodules.c +dwfl_bug_getmodules_OBJECTS = dwfl-bug-getmodules.$(OBJEXT) +dwfl_bug_getmodules_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +dwfl_bug_report_SOURCES = dwfl-bug-report.c +dwfl_bug_report_OBJECTS = dwfl-bug-report.$(OBJEXT) +dwfl_bug_report_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +dwflmodtest_SOURCES = dwflmodtest.c +dwflmodtest_OBJECTS = dwflmodtest.$(OBJEXT) +dwflmodtest_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +early_offscn_SOURCES = early-offscn.c +early_offscn_OBJECTS = early-offscn.$(OBJEXT) +early_offscn_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +ecp_SOURCES = ecp.c +ecp_OBJECTS = ecp.$(OBJEXT) +ecp_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +find_prologues_SOURCES = find-prologues.c +find_prologues_OBJECTS = find-prologues.$(OBJEXT) +find_prologues_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_1) +funcretval_SOURCES = funcretval.c +funcretval_OBJECTS = funcretval.$(OBJEXT) +funcretval_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +funcscopes_SOURCES = funcscopes.c +funcscopes_OBJECTS = funcscopes.$(OBJEXT) +funcscopes_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +get_aranges_SOURCES = get-aranges.c +get_aranges_OBJECTS = get-aranges.$(OBJEXT) +get_aranges_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +get_files_SOURCES = get-files.c +get_files_OBJECTS = get-files.$(OBJEXT) +get_files_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +get_lines_SOURCES = get-lines.c +get_lines_OBJECTS = get-lines.$(OBJEXT) +get_lines_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +get_pubnames_SOURCES = get-pubnames.c +get_pubnames_OBJECTS = get-pubnames.$(OBJEXT) +get_pubnames_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +hash_SOURCES = hash.c +hash_OBJECTS = hash.$(OBJEXT) +hash_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +line2addr_SOURCES = line2addr.c +line2addr_OBJECTS = line2addr.$(OBJEXT) +line2addr_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) +msg_tst_SOURCES = msg_tst.c +msg_tst_OBJECTS = msg_tst.$(OBJEXT) +msg_tst_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +newfile_SOURCES = newfile.c +newfile_OBJECTS = newfile.$(OBJEXT) +newfile_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +newscn_SOURCES = newscn.c +newscn_OBJECTS = newscn.$(OBJEXT) +newscn_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +rdwrmmap_SOURCES = rdwrmmap.c +rdwrmmap_OBJECTS = rdwrmmap.$(OBJEXT) +rdwrmmap_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +saridx_SOURCES = saridx.c +saridx_OBJECTS = saridx.$(OBJEXT) +saridx_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +scnnames_SOURCES = scnnames.c +scnnames_OBJECTS = scnnames.$(OBJEXT) +scnnames_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +sectiondump_SOURCES = sectiondump.c +sectiondump_OBJECTS = sectiondump.$(OBJEXT) +sectiondump_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +sha1_tst_SOURCES = sha1-tst.c +sha1_tst_OBJECTS = sha1-tst.$(OBJEXT) +sha1_tst_DEPENDENCIES = $(libeu) $(am__DEPENDENCIES_1) +show_abbrev_SOURCES = show-abbrev.c +show_abbrev_OBJECTS = show-abbrev.$(OBJEXT) +show_abbrev_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +show_die_info_SOURCES = show-die-info.c +show_die_info_OBJECTS = show-die-info.$(OBJEXT) +show_die_info_DEPENDENCIES = $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +showptable_SOURCES = showptable.c +showptable_OBJECTS = showptable.$(OBJEXT) +showptable_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +test_flag_nobits_SOURCES = test-flag-nobits.c +test_flag_nobits_OBJECTS = test-flag-nobits.$(OBJEXT) +test_flag_nobits_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +test_nlist_SOURCES = test-nlist.c +test_nlist_OBJECTS = test-nlist.$(OBJEXT) +test_nlist_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +update1_SOURCES = update1.c +update1_OBJECTS = update1.$(OBJEXT) +update1_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +update2_SOURCES = update2.c +update2_OBJECTS = update2.$(OBJEXT) +update2_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) +update3_SOURCES = update3.c +update3_OBJECTS = update3.$(OBJEXT) +update3_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +update4_SOURCES = update4.c +update4_OBJECTS = update4.$(OBJEXT) +update4_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = addrcfi.c addrscopes.c allfcts.c allregs.c arextract.c \ + arls.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 \ + dwarf-getmacros.c dwfl-addr-sect.c dwfl-bug-addr-overflow.c \ + dwfl-bug-fd-leak.c dwfl-bug-getmodules.c dwfl-bug-report.c \ + dwflmodtest.c early-offscn.c ecp.c find-prologues.c \ + funcretval.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 rdwrmmap.c saridx.c scnnames.c \ + sectiondump.c sha1-tst.c show-abbrev.c show-die-info.c \ + showptable.c test-flag-nobits.c test-nlist.c update1.c \ + update2.c update3.c update4.c +DIST_SOURCES = addrcfi.c addrscopes.c allfcts.c allregs.c arextract.c \ + arls.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 \ + dwarf-getmacros.c dwfl-addr-sect.c dwfl-bug-addr-overflow.c \ + dwfl-bug-fd-leak.c dwfl-bug-getmodules.c dwfl-bug-report.c \ + dwflmodtest.c early-offscn.c ecp.c find-prologues.c \ + funcretval.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 rdwrmmap.c saridx.c scnnames.c \ + sectiondump.c sha1-tst.c show-abbrev.c show-die-info.c \ + showptable.c test-flag-nobits.c test-nlist.c update1.c \ + update2.c update3.c update4.c +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUGPRED = @DEBUGPRED@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODVERSION = @MODVERSION@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +base_cpu = @base_cpu@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +eu_version = @eu_version@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +zip_LIBS = @zip_LIBS@ +INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_2) +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ + $($(*F)_no_Werror),,-Werror) $(if \ + $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ + $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ + $(am__append_1) +@MUDFLAP_FALSE@libmudflap = +@MUDFLAP_TRUE@libmudflap = -lmudflap +COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\ + $(COMPILE)) + +CLEANFILES = *.gcno *.gcda +textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi +@MUDFLAP_TRUE@BUILD_RPATH = \$$ORIGIN/../backends +@MUDFLAP_FALSE@BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf +AM_LDFLAGS = $(am__append_3) $(am__append_4) +@TESTS_RPATH_FALSE@tests_rpath = no +@TESTS_RPATH_TRUE@tests_rpath = yes +asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ + asm-tst6 asm-tst7 asm-tst8 asm-tst9 + +EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ + run-show-die-info.sh run-get-files.sh run-get-lines.sh \ + run-get-pubnames.sh run-get-aranges.sh \ + run-show-ciefde.sh run-show-abbrev.sh run-strip-test.sh \ + run-strip-test2.sh run-ecp-test.sh run-ecp-test2.sh \ + testfile.bz2 testfile2.bz2 testfile3.bz2 testfile4.bz2 \ + testfile5.bz2 testfile6.bz2 testfile7.bz2 testfile8.bz2 \ + testfile9.bz2 testfile10.bz2 testfile11.bz2 testfile12.bz2 \ + testfile13.bz2 run-strip-test3.sh run-allfcts.sh \ + run-line2addr.sh run-elflint-test.sh testfile14.bz2 \ + run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ + run-strip-test7.sh run-strip-test8.sh \ + run-unstrip-test.sh run-unstrip-test2.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-strings-test.sh run-funcscopes.sh \ + run-find-prologues.sh run-allregs.sh run-native-test.sh \ + run-addrname-test.sh run-dwfl-bug-offline-rel.sh \ + run-dwfl-addr-sect.sh run-early-offscn.sh \ + run-dwarf-getmacros.sh run-test-flag-nobits.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 testfile24.bz2 testfile25.bz2 \ + testfile26.bz2 testfile27.bz2 \ + coverage.sh test-subr.sh test-wrapper.sh \ + run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ + run-readelf-test4.sh \ + run-bug1-test.sh testfile28.bz2 testfile28.rdwr.bz2 \ + testfile29.bz2 testfile29.rdwr.bz2 \ + testfile30.bz2 testfile31.bz2 testfile32.bz2 testfile33.bz2 \ + testfile34.bz2 testfile35.bz2 testfile35.debug.bz2 \ + testfile36.bz2 testfile36.debug.bz2 \ + testfile37.bz2 testfile37.debug.bz2 \ + testfile38.bz2 testfile39.bz2 testfile40.bz2 testfile40.debug.bz2 \ + testfile41.bz2 testfile42.bz2 testfile43.bz2 \ + testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \ + testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \ + testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \ + testfile49.bz2 testfile50.bz2 testfile51.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 \ + testfile52-64.so.bz2 testfile52-64.so.debug.bz2 \ + testfile52-64.prelink.so.bz2 testfile52-64.noshdrs.so.bz2 \ + testfile53-32.bz2 testfile53-32.debug.bz2 \ + testfile53-32.prelink.bz2 testfile53-64.bz2 \ + testfile53-64.debug.bz2 testfile53-64.prelink.bz2 \ + testfile54-32.so.bz2 testfile54-32.so.debug.bz2 \ + testfile54-32.prelink.so.bz2 testfile54-32.noshdrs.so.bz2 \ + testfile54-64.so.bz2 testfile54-64.so.debug.bz2 \ + testfile54-64.prelink.so.bz2 testfile54-64.noshdrs.so.bz2 \ + testfile55-32.bz2 testfile55-32.debug.bz2 \ + testfile55-32.prelink.bz2 testfile55-64.bz2 \ + testfile55-64.debug.bz2 testfile55-64.prelink.bz2 + +installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \ + bindir=$(DESTDIR)$(bindir) \ + $(srcdir)/test-wrapper.sh \ + installed $(tests_rpath) \ + $(program_transform_name) + +@STANDALONE_FALSE@TESTS_ENVIRONMENT = $(srcdir)/test-wrapper.sh \ +@STANDALONE_FALSE@ ../libdw:../backends:../libelf:../libasm + +@STANDALONE_TRUE@TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT) +@MUDFLAP_TRUE@static_build = yes +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@libdw = ../libdw/libdw.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl +@STANDALONE_TRUE@libdw = -ldw +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@libelf = ../libelf/libelf.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libelf = ../libelf/libelf.a +@STANDALONE_TRUE@libelf = -lelf +@BUILD_STATIC_FALSE@@STANDALONE_FALSE@libasm = ../libasm/libasm.so +@BUILD_STATIC_TRUE@@STANDALONE_FALSE@libasm = ../libasm/libasm.a +@STANDALONE_TRUE@libasm = -lasm +@STANDALONE_FALSE@libebl = ../libebl/libebl.a +@STANDALONE_TRUE@libebl = -lebl +@STANDALONE_FALSE@libeu = ../lib/libeu.a +arextract_LDADD = $(libelf) $(libmudflap) +arsymtest_LDADD = $(libelf) $(libmudflap) +newfile_LDADD = $(libelf) $(libmudflap) +saridx_LDADD = $(libelf) $(libmudflap) +scnnames_LDADD = $(libelf) $(libmudflap) +sectiondump_LDADD = $(libelf) $(libmudflap) +showptable_LDADD = $(libelf) $(libmudflap) +hash_LDADD = $(libelf) $(libmudflap) +test_nlist_LDADD = $(libelf) $(libmudflap) +msg_tst_LDADD = $(libelf) $(libmudflap) +newscn_LDADD = $(libelf) $(libmudflap) +early_offscn_LDADD = $(libelf) $(libmudflap) +ecp_LDADD = $(libelf) $(libmudflap) +update1_LDADD = $(libelf) $(libmudflap) +update2_LDADD = $(libelf) $(libmudflap) +update3_LDADD = $(libebl) $(libelf) $(libmudflap) +update4_LDADD = $(libebl) $(libelf) $(libmudflap) +show_die_info_LDADD = $(libdw) $(libelf) $(libmudflap) +get_pubnames_LDADD = $(libdw) $(libelf) $(libmudflap) +show_abbrev_LDADD = $(libdw) $(libelf) $(libmudflap) +get_lines_LDADD = $(libdw) $(libelf) $(libmudflap) +get_files_LDADD = $(libdw) $(libelf) $(libmudflap) +get_aranges_LDADD = $(libdw) $(libelf) $(libmudflap) +allfcts_LDADD = $(libdw) $(libelf) $(libmudflap) +line2addr_no_Wformat = yes +line2addr_LDADD = $(libdw) $(libmudflap) +addrscopes_LDADD = $(libdw) $(libmudflap) +funcscopes_LDADD = $(libdw) $(libmudflap) +funcretval_LDADD = $(libdw) $(libmudflap) +allregs_LDADD = $(libdw) $(libmudflap) +find_prologues_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 +asm_tst3_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst4_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst5_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) $(libmudflap) -ldl +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 +rdwrmmap_LDADD = $(libelf) $(libmudflap) +dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +arls_LDADD = $(libelf) $(libmudflap) +dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +sha1_tst_LDADD = $(libeu) $(libmudflap) +dwarf_getmacros_LDADD = $(libdw) $(libmudflap) +addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl +test_flag_nobits_LDADD = $(libelf) $(libmudflap) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/eu.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnits tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +addrcfi$(EXEEXT): $(addrcfi_OBJECTS) $(addrcfi_DEPENDENCIES) + @rm -f addrcfi$(EXEEXT) + $(LINK) $(addrcfi_OBJECTS) $(addrcfi_LDADD) $(LIBS) +addrscopes$(EXEEXT): $(addrscopes_OBJECTS) $(addrscopes_DEPENDENCIES) + @rm -f addrscopes$(EXEEXT) + $(LINK) $(addrscopes_OBJECTS) $(addrscopes_LDADD) $(LIBS) +allfcts$(EXEEXT): $(allfcts_OBJECTS) $(allfcts_DEPENDENCIES) + @rm -f allfcts$(EXEEXT) + $(LINK) $(allfcts_OBJECTS) $(allfcts_LDADD) $(LIBS) +allregs$(EXEEXT): $(allregs_OBJECTS) $(allregs_DEPENDENCIES) + @rm -f allregs$(EXEEXT) + $(LINK) $(allregs_OBJECTS) $(allregs_LDADD) $(LIBS) +arextract$(EXEEXT): $(arextract_OBJECTS) $(arextract_DEPENDENCIES) + @rm -f arextract$(EXEEXT) + $(LINK) $(arextract_OBJECTS) $(arextract_LDADD) $(LIBS) +arls$(EXEEXT): $(arls_OBJECTS) $(arls_DEPENDENCIES) + @rm -f arls$(EXEEXT) + $(LINK) $(arls_OBJECTS) $(arls_LDADD) $(LIBS) +arsymtest$(EXEEXT): $(arsymtest_OBJECTS) $(arsymtest_DEPENDENCIES) + @rm -f arsymtest$(EXEEXT) + $(LINK) $(arsymtest_OBJECTS) $(arsymtest_LDADD) $(LIBS) +asm-tst1$(EXEEXT): $(asm_tst1_OBJECTS) $(asm_tst1_DEPENDENCIES) + @rm -f asm-tst1$(EXEEXT) + $(LINK) $(asm_tst1_OBJECTS) $(asm_tst1_LDADD) $(LIBS) +asm-tst2$(EXEEXT): $(asm_tst2_OBJECTS) $(asm_tst2_DEPENDENCIES) + @rm -f asm-tst2$(EXEEXT) + $(LINK) $(asm_tst2_OBJECTS) $(asm_tst2_LDADD) $(LIBS) +asm-tst3$(EXEEXT): $(asm_tst3_OBJECTS) $(asm_tst3_DEPENDENCIES) + @rm -f asm-tst3$(EXEEXT) + $(LINK) $(asm_tst3_OBJECTS) $(asm_tst3_LDADD) $(LIBS) +asm-tst4$(EXEEXT): $(asm_tst4_OBJECTS) $(asm_tst4_DEPENDENCIES) + @rm -f asm-tst4$(EXEEXT) + $(LINK) $(asm_tst4_OBJECTS) $(asm_tst4_LDADD) $(LIBS) +asm-tst5$(EXEEXT): $(asm_tst5_OBJECTS) $(asm_tst5_DEPENDENCIES) + @rm -f asm-tst5$(EXEEXT) + $(LINK) $(asm_tst5_OBJECTS) $(asm_tst5_LDADD) $(LIBS) +asm-tst6$(EXEEXT): $(asm_tst6_OBJECTS) $(asm_tst6_DEPENDENCIES) + @rm -f asm-tst6$(EXEEXT) + $(LINK) $(asm_tst6_OBJECTS) $(asm_tst6_LDADD) $(LIBS) +asm-tst7$(EXEEXT): $(asm_tst7_OBJECTS) $(asm_tst7_DEPENDENCIES) + @rm -f asm-tst7$(EXEEXT) + $(LINK) $(asm_tst7_OBJECTS) $(asm_tst7_LDADD) $(LIBS) +asm-tst8$(EXEEXT): $(asm_tst8_OBJECTS) $(asm_tst8_DEPENDENCIES) + @rm -f asm-tst8$(EXEEXT) + $(LINK) $(asm_tst8_OBJECTS) $(asm_tst8_LDADD) $(LIBS) +asm-tst9$(EXEEXT): $(asm_tst9_OBJECTS) $(asm_tst9_DEPENDENCIES) + @rm -f asm-tst9$(EXEEXT) + $(LINK) $(asm_tst9_OBJECTS) $(asm_tst9_LDADD) $(LIBS) +dwarf-getmacros$(EXEEXT): $(dwarf_getmacros_OBJECTS) $(dwarf_getmacros_DEPENDENCIES) + @rm -f dwarf-getmacros$(EXEEXT) + $(LINK) $(dwarf_getmacros_OBJECTS) $(dwarf_getmacros_LDADD) $(LIBS) +dwfl-addr-sect$(EXEEXT): $(dwfl_addr_sect_OBJECTS) $(dwfl_addr_sect_DEPENDENCIES) + @rm -f dwfl-addr-sect$(EXEEXT) + $(LINK) $(dwfl_addr_sect_OBJECTS) $(dwfl_addr_sect_LDADD) $(LIBS) +dwfl-bug-addr-overflow$(EXEEXT): $(dwfl_bug_addr_overflow_OBJECTS) $(dwfl_bug_addr_overflow_DEPENDENCIES) + @rm -f dwfl-bug-addr-overflow$(EXEEXT) + $(LINK) $(dwfl_bug_addr_overflow_OBJECTS) $(dwfl_bug_addr_overflow_LDADD) $(LIBS) +dwfl-bug-fd-leak$(EXEEXT): $(dwfl_bug_fd_leak_OBJECTS) $(dwfl_bug_fd_leak_DEPENDENCIES) + @rm -f dwfl-bug-fd-leak$(EXEEXT) + $(LINK) $(dwfl_bug_fd_leak_OBJECTS) $(dwfl_bug_fd_leak_LDADD) $(LIBS) +dwfl-bug-getmodules$(EXEEXT): $(dwfl_bug_getmodules_OBJECTS) $(dwfl_bug_getmodules_DEPENDENCIES) + @rm -f dwfl-bug-getmodules$(EXEEXT) + $(LINK) $(dwfl_bug_getmodules_OBJECTS) $(dwfl_bug_getmodules_LDADD) $(LIBS) +dwfl-bug-report$(EXEEXT): $(dwfl_bug_report_OBJECTS) $(dwfl_bug_report_DEPENDENCIES) + @rm -f dwfl-bug-report$(EXEEXT) + $(LINK) $(dwfl_bug_report_OBJECTS) $(dwfl_bug_report_LDADD) $(LIBS) +dwflmodtest$(EXEEXT): $(dwflmodtest_OBJECTS) $(dwflmodtest_DEPENDENCIES) + @rm -f dwflmodtest$(EXEEXT) + $(LINK) $(dwflmodtest_OBJECTS) $(dwflmodtest_LDADD) $(LIBS) +early-offscn$(EXEEXT): $(early_offscn_OBJECTS) $(early_offscn_DEPENDENCIES) + @rm -f early-offscn$(EXEEXT) + $(LINK) $(early_offscn_OBJECTS) $(early_offscn_LDADD) $(LIBS) +ecp$(EXEEXT): $(ecp_OBJECTS) $(ecp_DEPENDENCIES) + @rm -f ecp$(EXEEXT) + $(LINK) $(ecp_OBJECTS) $(ecp_LDADD) $(LIBS) +find-prologues$(EXEEXT): $(find_prologues_OBJECTS) $(find_prologues_DEPENDENCIES) + @rm -f find-prologues$(EXEEXT) + $(LINK) $(find_prologues_OBJECTS) $(find_prologues_LDADD) $(LIBS) +funcretval$(EXEEXT): $(funcretval_OBJECTS) $(funcretval_DEPENDENCIES) + @rm -f funcretval$(EXEEXT) + $(LINK) $(funcretval_OBJECTS) $(funcretval_LDADD) $(LIBS) +funcscopes$(EXEEXT): $(funcscopes_OBJECTS) $(funcscopes_DEPENDENCIES) + @rm -f funcscopes$(EXEEXT) + $(LINK) $(funcscopes_OBJECTS) $(funcscopes_LDADD) $(LIBS) +get-aranges$(EXEEXT): $(get_aranges_OBJECTS) $(get_aranges_DEPENDENCIES) + @rm -f get-aranges$(EXEEXT) + $(LINK) $(get_aranges_OBJECTS) $(get_aranges_LDADD) $(LIBS) +get-files$(EXEEXT): $(get_files_OBJECTS) $(get_files_DEPENDENCIES) + @rm -f get-files$(EXEEXT) + $(LINK) $(get_files_OBJECTS) $(get_files_LDADD) $(LIBS) +get-lines$(EXEEXT): $(get_lines_OBJECTS) $(get_lines_DEPENDENCIES) + @rm -f get-lines$(EXEEXT) + $(LINK) $(get_lines_OBJECTS) $(get_lines_LDADD) $(LIBS) +get-pubnames$(EXEEXT): $(get_pubnames_OBJECTS) $(get_pubnames_DEPENDENCIES) + @rm -f get-pubnames$(EXEEXT) + $(LINK) $(get_pubnames_OBJECTS) $(get_pubnames_LDADD) $(LIBS) +hash$(EXEEXT): $(hash_OBJECTS) $(hash_DEPENDENCIES) + @rm -f hash$(EXEEXT) + $(LINK) $(hash_OBJECTS) $(hash_LDADD) $(LIBS) +line2addr$(EXEEXT): $(line2addr_OBJECTS) $(line2addr_DEPENDENCIES) + @rm -f line2addr$(EXEEXT) + $(LINK) $(line2addr_OBJECTS) $(line2addr_LDADD) $(LIBS) +msg_tst$(EXEEXT): $(msg_tst_OBJECTS) $(msg_tst_DEPENDENCIES) + @rm -f msg_tst$(EXEEXT) + $(LINK) $(msg_tst_OBJECTS) $(msg_tst_LDADD) $(LIBS) +newfile$(EXEEXT): $(newfile_OBJECTS) $(newfile_DEPENDENCIES) + @rm -f newfile$(EXEEXT) + $(LINK) $(newfile_OBJECTS) $(newfile_LDADD) $(LIBS) +newscn$(EXEEXT): $(newscn_OBJECTS) $(newscn_DEPENDENCIES) + @rm -f newscn$(EXEEXT) + $(LINK) $(newscn_OBJECTS) $(newscn_LDADD) $(LIBS) +rdwrmmap$(EXEEXT): $(rdwrmmap_OBJECTS) $(rdwrmmap_DEPENDENCIES) + @rm -f rdwrmmap$(EXEEXT) + $(LINK) $(rdwrmmap_OBJECTS) $(rdwrmmap_LDADD) $(LIBS) +saridx$(EXEEXT): $(saridx_OBJECTS) $(saridx_DEPENDENCIES) + @rm -f saridx$(EXEEXT) + $(LINK) $(saridx_OBJECTS) $(saridx_LDADD) $(LIBS) +scnnames$(EXEEXT): $(scnnames_OBJECTS) $(scnnames_DEPENDENCIES) + @rm -f scnnames$(EXEEXT) + $(LINK) $(scnnames_OBJECTS) $(scnnames_LDADD) $(LIBS) +sectiondump$(EXEEXT): $(sectiondump_OBJECTS) $(sectiondump_DEPENDENCIES) + @rm -f sectiondump$(EXEEXT) + $(LINK) $(sectiondump_OBJECTS) $(sectiondump_LDADD) $(LIBS) +sha1-tst$(EXEEXT): $(sha1_tst_OBJECTS) $(sha1_tst_DEPENDENCIES) + @rm -f sha1-tst$(EXEEXT) + $(LINK) $(sha1_tst_OBJECTS) $(sha1_tst_LDADD) $(LIBS) +show-abbrev$(EXEEXT): $(show_abbrev_OBJECTS) $(show_abbrev_DEPENDENCIES) + @rm -f show-abbrev$(EXEEXT) + $(LINK) $(show_abbrev_OBJECTS) $(show_abbrev_LDADD) $(LIBS) +show-die-info$(EXEEXT): $(show_die_info_OBJECTS) $(show_die_info_DEPENDENCIES) + @rm -f show-die-info$(EXEEXT) + $(LINK) $(show_die_info_OBJECTS) $(show_die_info_LDADD) $(LIBS) +showptable$(EXEEXT): $(showptable_OBJECTS) $(showptable_DEPENDENCIES) + @rm -f showptable$(EXEEXT) + $(LINK) $(showptable_OBJECTS) $(showptable_LDADD) $(LIBS) +test-flag-nobits$(EXEEXT): $(test_flag_nobits_OBJECTS) $(test_flag_nobits_DEPENDENCIES) + @rm -f test-flag-nobits$(EXEEXT) + $(LINK) $(test_flag_nobits_OBJECTS) $(test_flag_nobits_LDADD) $(LIBS) +test-nlist$(EXEEXT): $(test_nlist_OBJECTS) $(test_nlist_DEPENDENCIES) + @rm -f test-nlist$(EXEEXT) + $(LINK) $(test_nlist_OBJECTS) $(test_nlist_LDADD) $(LIBS) +update1$(EXEEXT): $(update1_OBJECTS) $(update1_DEPENDENCIES) + @rm -f update1$(EXEEXT) + $(LINK) $(update1_OBJECTS) $(update1_LDADD) $(LIBS) +update2$(EXEEXT): $(update2_OBJECTS) $(update2_DEPENDENCIES) + @rm -f update2$(EXEEXT) + $(LINK) $(update2_OBJECTS) $(update2_LDADD) $(LIBS) +update3$(EXEEXT): $(update3_OBJECTS) $(update3_DEPENDENCIES) + @rm -f update3$(EXEEXT) + $(LINK) $(update3_OBJECTS) $(update3_LDADD) $(LIBS) +update4$(EXEEXT): $(update4_OBJECTS) $(update4_DEPENDENCIES) + @rm -f update4$(EXEEXT) + $(LINK) $(update4_OBJECTS) $(update4_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addrcfi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addrscopes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allfcts.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allregs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arextract.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arls.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arsymtest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst4.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst6.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst7.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst8.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asm-tst9.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf-getmacros.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-addr-sect.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-addr-overflow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-fd-leak.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-getmodules.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-report.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwflmodtest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/early-offscn.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find-prologues.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcretval.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@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-pubnames.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line2addr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_tst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newscn.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdwrmmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saridx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scnnames.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sectiondump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1-tst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show-abbrev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show-die-info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/showptable.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-flag-nobits.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-nlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/update1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/update2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/update3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/update4.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@STANDALONE_TRUE@installcheck-local: +clean: clean-am + +clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: installcheck-local + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installcheck-local installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +%.os: %.c %.o +@AMDEP_TRUE@ if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ +@AMDEP_TRUE@ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ +@AMDEP_TRUE@ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ +@AMDEP_TRUE@ rm -f "$(DEPDIR)/$*.Tpo"; \ +@AMDEP_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@AMDEP_TRUE@ fi +@AMDEP_FALSE@ $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $< + +@STANDALONE_FALSE@installcheck-local: +@STANDALONE_FALSE@ $(MAKE) $(AM_MAKEFLAGS) \ +@STANDALONE_FALSE@ TESTS_ENVIRONMENT='$(installed_TESTS_ENVIRONMENT)' check-TESTS + +@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/tests/addrcfi.c b/tests/addrcfi.c new file mode 100644 index 0000000..4e04241 --- /dev/null +++ b/tests/addrcfi.c @@ -0,0 +1,207 @@ +/* Test program for CFI handling. + Copyright (C) 2009-2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#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> + + +static void +print_detail (int result, const Dwarf_Op *ops, size_t nops, Dwarf_Addr bias) +{ + if (result < 0) + printf ("indeterminate (%s)\n", dwarf_errmsg (-1)); + else if (nops == 0) + printf ("%s\n", result == 0 ? "same_value" : "undefined"); + else + { + printf ("%s expression:", result == 0 ? "location" : "value"); + for (size_t i = 0; i < nops; ++i) + { + printf (" %#x", ops[i].atom); + if (ops[i].number2 == 0) + { + if (ops[i].atom == DW_OP_addr) + printf ("(%#" PRIx64 ")", ops[i].number + bias); + else if (ops[i].number != 0) + printf ("(%" PRId64 ")", ops[i].number); + } + else + printf ("(%" PRId64 ",%" PRId64 ")", + ops[i].number, ops[i].number2); + } + puts (""); + } +} + +struct stuff +{ + Dwarf_Frame *frame; + Dwarf_Addr bias; +}; + +static int +print_register (void *arg, + int regno, + const char *setname, + const char *prefix, + const char *regname, + int bits __attribute__ ((unused)), + int type __attribute__ ((unused))) +{ + struct stuff *stuff = arg; + + printf ("\t%s reg%u (%s%s): ", setname, regno, prefix, regname); + + Dwarf_Op ops_mem[2]; + Dwarf_Op *ops; + size_t nops; + int result = dwarf_frame_register (stuff->frame, regno, ops_mem, &ops, &nops); + print_detail (result, ops, nops, stuff->bias); + + return DWARF_CB_OK; +} + +static int +handle_cfi (Dwfl *dwfl, const char *which, Dwarf_CFI *cfi, + GElf_Addr pc, struct stuff *stuff) +{ + int result = dwarf_cfi_addrframe (cfi, pc - stuff->bias, &stuff->frame); + if (result != 0) + { + error (0, 0, "dwarf_cfi_addrframe (%s): %s", which, dwarf_errmsg (-1)); + return 1; + } + + Dwarf_Addr start = pc; + Dwarf_Addr end = pc; + bool signalp; + int ra_regno = dwarf_frame_info (stuff->frame, &start, &end, &signalp); + if (ra_regno >= 0) + { + start += stuff->bias; + end += stuff->bias; + } + + printf ("%s has %#" PRIx64 " => [%#" PRIx64 ", %#" PRIx64 "):\n", + which, pc, start, end); + + if (ra_regno < 0) + printf ("\treturn address register unavailable (%s)\n", + dwarf_errmsg (0)); + else + printf ("\treturn address in reg%u%s\n", + ra_regno, signalp ? " (signal frame)" : ""); + + Dwarf_Op *cfa_ops; + size_t cfa_nops; + result = dwarf_frame_cfa (stuff->frame, &cfa_ops, &cfa_nops); + + printf ("\tCFA "); + print_detail (result, cfa_ops, cfa_nops, stuff->bias); + + (void) dwfl_module_register_names (dwfl_addrmodule (dwfl, pc), + &print_register, stuff); + + return 0; +} + +static int +handle_address (GElf_Addr pc, Dwfl *dwfl) +{ + Dwfl_Module *mod = dwfl_addrmodule (dwfl, pc); + + struct stuff stuff; + return (handle_cfi (dwfl, ".eh_frame", + dwfl_module_eh_cfi (mod, &stuff.bias), pc, &stuff) + & handle_cfi (dwfl, ".debug_frame", + dwfl_module_dwarf_cfi (mod, &stuff.bias), pc, &stuff)); +} + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + int result = 0; + + /* Now handle the addresses. In case none are given on the command + line, read from stdin. */ + if (remaining == argc) + { + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); + + char *buf = NULL; + size_t len = 0; + while (!feof_unlocked (stdin)) + { + if (getline (&buf, &len, stdin) < 0) + break; + + char *endp; + uintmax_t addr = strtoumax (buf, &endp, 0); + if (endp != buf) + result |= handle_address (addr, dwfl); + else + result = 1; + } + + free (buf); + } + else + { + do + { + char *endp; + uintmax_t addr = strtoumax (argv[remaining], &endp, 0); + if (endp != argv[remaining]) + result |= handle_address (addr, dwfl); + else + result = 1; + } + while (++remaining < argc); + } + + dwfl_end (dwfl); + + return result; +} diff --git a/tests/addrscopes.c b/tests/addrscopes.c new file mode 100644 index 0000000..3394cd2 --- /dev/null +++ b/tests/addrscopes.c @@ -0,0 +1,203 @@ +/* Test program for dwarf_getscopes. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#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> + + +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 + +static void +handle_address (GElf_Addr pc, Dwfl *dwfl) +{ + Dwarf_Addr cubias; + Dwarf_Die *cudie = dwfl_addrdie (dwfl, pc, &cubias); + if (cudie == NULL) + error (EXIT_FAILURE, 0, "dwfl_addrdie: %s", dwfl_errmsg (-1)); + + Dwarf_Die *scopes; + int n = dwarf_getscopes (cudie, pc - cubias, &scopes); + if (n < 0) + error (EXIT_FAILURE, 0, "dwarf_getscopes: %s", dwarf_errmsg (-1)); + else if (n == 0) + printf ("%#" PRIx64 ": not in any scope\n", pc); + else + { + printf ("%#" PRIx64 ":\n", pc); + 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 += cubias; + highpc += cubias; + Dwfl_Line *loline = dwfl_getsrc (dwfl, lowpc); + Dwfl_Line *hiline = dwfl_getsrc (dwfl, highpc); + paddr (": ", lowpc, loline); + if (highpc != lowpc) + paddr (" .. ", lowpc, hiline == loline ? NULL : hiline); + } + puts (""); + + print_vars (indent + INDENT, die); + } + } +} + +int +main (int argc, char *argv[]) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + int result = 0; + + /* Now handle the addresses. In case none are given on the command + line, read from stdin. */ + if (remaining == argc) + { + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdin, FSETLOCKING_BYCALLER); + + char *buf = NULL; + size_t len = 0; + while (!feof_unlocked (stdin)) + { + if (getline (&buf, &len, stdin) < 0) + break; + + char *endp; + uintmax_t addr = strtoumax (buf, &endp, 0); + if (endp != buf) + handle_address (addr, dwfl); + else + result = 1; + } + + free (buf); + } + else + { + do + { + char *endp; + uintmax_t addr = strtoumax (argv[remaining], &endp, 0); + if (endp != argv[remaining]) + handle_address (addr, dwfl); + else + result = 1; + } + while (++remaining < argc); + } + + dwfl_end (dwfl); + + return result; +} diff --git a/tests/allfcts.c b/tests/allfcts.c new file mode 100644 index 0000000..5fed814 --- /dev/null +++ b/tests/allfcts.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +static int +cb (Dwarf_Die *func, void *arg __attribute__ ((unused))) +{ + const char *file = dwarf_decl_file (func); + int line = -1; + dwarf_decl_line (func, &line); + const char *fct = dwarf_diename (func); + + printf ("%s:%d:%s\n", file, line, fct); + + return DWARF_CB_OK; +} + + +int +main (int argc, char *argv[]) +{ + for (int i = 1; i < argc; ++i) + { + int fd = open (argv[i], O_RDONLY); + + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg != NULL) + { + Dwarf_Off off = 0; + size_t cuhl; + Dwarf_Off noff; + + while (dwarf_nextcu (dbg, off, &noff, &cuhl, NULL, NULL, NULL) == 0) + { + Dwarf_Die die_mem; + Dwarf_Die *die = dwarf_offdie (dbg, off + cuhl, &die_mem); + + (void) dwarf_getfuncs (die, cb, NULL, 0); + + off = noff; + } + + dwarf_end (dbg); + } + + close (fd); + } +} diff --git a/tests/allregs.c b/tests/allregs.c new file mode 100644 index 0000000..f1856df --- /dev/null +++ b/tests/allregs.c @@ -0,0 +1,229 @@ +/* Copyright (C) 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> +#include <locale.h> +#include <argp.h> +#include <assert.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> + + +static const char * +dwarf_encoding_string (unsigned int code) +{ + static const char *known[] = + { + [DW_ATE_void] = "void", + [DW_ATE_address] = "address", + [DW_ATE_boolean] = "boolean", + [DW_ATE_complex_float] = "complex_float", + [DW_ATE_float] = "float", + [DW_ATE_signed] = "signed", + [DW_ATE_signed_char] = "signed_char", + [DW_ATE_unsigned] = "unsigned", + [DW_ATE_unsigned_char] = "unsigned_char", + [DW_ATE_imaginary_float] = "imaginary_float", + [DW_ATE_packed_decimal] = "packed_decimal", + [DW_ATE_numeric_string] = "numeric_string", + [DW_ATE_edited] = "edited", + [DW_ATE_signed_fixed] = "signed_fixed", + [DW_ATE_unsigned_fixed] = "unsigned_fixed", + [DW_ATE_decimal_float] = "decimal_float", + }; + + if (code < sizeof (known) / sizeof (known[0])) + return known[code]; + + if (code >= DW_ATE_lo_user && code <= DW_ATE_hi_user) + { + static char buf[30]; + snprintf (buf, sizeof (buf), "lo_user+%u", code - DW_ATE_lo_user); + return buf; + } + + return "???"; +} + +static int +first_module (Dwfl_Module *mod, + void **userdatap __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr low_addr __attribute__ ((unused)), + void *arg) +{ + Dwarf_Addr bias; + if (dwfl_module_getelf (mod, &bias) == NULL) /* Not really a module. */ + return DWARF_CB_OK; + + *(Dwfl_Module **) arg = mod; + return DWARF_CB_ABORT; +} + + +struct state +{ + struct reginfo *info; + int nregs; +}; + +struct reginfo +{ + const char *set, *pfx; + int regno; + int bits; + int type; + char name[32]; +}; + +static int +compare (const void *r1, const void *r2) +{ + const struct reginfo *a = r1, *b = r2; + if (a->set == b->set) + return a->regno - b->regno; + if (a->set == NULL) + return 1; + if (b->set == NULL) + return -1; + if (!strcmp (a->set, "integer")) + return -1; + if (!strcmp (b->set, "integer")) + return 1; + return strcmp (a->set, b->set); +} + +static int +one_register (void *arg, + int regno, + const char *setname, + const char *prefix, + const char *regname, + int bits, int type) +{ + struct state *state = arg; + + if (regno >= state->nregs) + { + state->info = realloc (state->info, (regno + 1) * sizeof state->info[0]); + memset (&state->info[state->nregs], 0, + ((void *) &state->info[regno + 1] + - (void *) &state->info[state->nregs])); + state->nregs = regno + 1; + } + + state->info[regno].regno = regno; + state->info[regno].set = setname; + state->info[regno].pfx = prefix; + state->info[regno].bits = bits; + state->info[regno].type = type; + assert (strlen (regname) < sizeof state->info[regno].name); + strcpy (state->info[regno].name, regname); + + return DWARF_CB_OK; +} + + +static int +match_register (void *arg, + int regno, + const char *setname, + const char *prefix, + const char *regname, + int bits, int type) +{ + if (regno == *(int *) arg) + printf ("%5d => %s register %s%s %s %d bits\n", + regno, setname, prefix, regname, + dwarf_encoding_string (type), bits); + + return DWARF_CB_ABORT; +} + + +int +main (int argc, char **argv) +{ + int remaining; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + Dwfl_Module *mod = NULL; + if (dwfl_getmodules (dwfl, &first_module, &mod, 0) < 0) + error (EXIT_FAILURE, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + if (remaining == argc) + { + struct state state = { NULL, 0 }; + int result = dwfl_module_register_names (mod, &one_register, &state); + if (result != 0 || state.nregs == 0) + error (EXIT_FAILURE, 0, "dwfl_module_register_names: %s", + result ? dwfl_errmsg (-1) : "no backend registers known"); + + qsort (state.info, state.nregs, sizeof state.info[0], &compare); + + const char *set = NULL; + for (int i = 0; i < state.nregs; ++i) + if (state.info[i].set != NULL) + { + if (set != state.info[i].set) + printf ("%s registers:\n", state.info[i].set); + set = state.info[i].set; + + printf ("\t%3d: %s%s (%s), %s %d bits\n", + state.info[i].regno, + state.info[i].pfx ?: "", state.info[i].name, + state.info[i].name, + dwarf_encoding_string (state.info[i].type), + state.info[i].bits); + } + } + else + do + { + const char *arg = argv[remaining++]; + int regno = atoi (arg); + int result = dwfl_module_register_names (mod, &match_register, ®no); + if (result != DWARF_CB_ABORT) + error (EXIT_FAILURE, 0, "dwfl_module_register_names: %s", + result ? dwfl_errmsg (-1) : "no backend registers known"); + } + while (remaining < argc); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/arextract.c b/tests/arextract.c new file mode 100644 index 0000000..5bc4f27 --- /dev/null +++ b/tests/arextract.c @@ -0,0 +1,167 @@ +/* Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1999. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <gelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/param.h> + + +int +main (int argc, char *argv[]) +{ + int fd; + Elf *elf; + Elf *subelf; + Elf_Cmd cmd; + off_t offset; + size_t todo; + + if (argc < 4) + exit (1); + + /* Open the archive. */ + fd = open (argv[1], O_RDONLY); + if (fd == -1) + { + printf ("Cannot open input file: %m"); + exit (1); + } + + /* Set the ELF version. */ + elf_version (EV_CURRENT); + + /* Create an ELF descriptor. */ + cmd = ELF_C_READ; + elf = elf_begin (fd, cmd, NULL); + if (elf == NULL) + { + printf ("Cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* If it is no archive punt. */ + if (elf_kind (elf) != ELF_K_AR) + { + printf ("`%s' is no archive\n", argv[1]); + exit (1); + } + + /* Get the elements of the archive one after the other. */ + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + /* The the header for this element. */ + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + + if (arhdr == NULL) + { + printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); + exit (1); + } + + if (strcmp (arhdr->ar_name, argv[2]) == 0) + { + int outfd; + + /* Get the offset of the file in the archive. */ + offset = elf_getbase (subelf); + if (offset == -1) + { + printf ("\ +Failed to get base address for the archive element: %s\n", + elf_errmsg (-1)); + exit (1); + } + + /* Open the output file. */ + outfd = open (argv[3], O_CREAT | O_TRUNC | O_RDWR, 0666); + if (outfd == -1) + { + printf ("cannot open output file: %m"); + exit (1); + } + + /* Now write out the data. */ + todo = arhdr->ar_size; + while (todo > 0) + { + char buf[1024]; + ssize_t n = pread (fd, buf, MIN (sizeof buf, todo), offset); + if (n == 0) + break; + + if (write (outfd, buf, n) != n) + { + puts ("Writing output failed"); + exit (1); + } + + offset += n; + todo -= n; + } + + /* Check whether all the date was read and written out. */ + if (todo != 0) + { + puts ("Reading archive member failed."); + exit (1); + } + + /* Close the descriptors. */ + if (elf_end (subelf) != 0 || elf_end (elf) != 0) + { + printf ("Freeing ELF descriptors failed: %s", elf_errmsg (-1)); + exit (1); + } + + close (outfd); + close (fd); + + /* All went well. */ + exit (0); + } + + /* Get next archive element. */ + cmd = elf_next (subelf); + if (elf_end (subelf) != 0) + { + printf ("error while freeing sub-ELF descriptor: %s\n", + elf_errmsg (-1)); + exit (1); + } + } + + /* When we reach this point we haven't found the given file in the + archive. */ + printf ("File `%s' not found in archive\n", argv[2]); + exit (1); +} diff --git a/tests/arls.c b/tests/arls.c new file mode 100644 index 0000000..79b867d --- /dev/null +++ b/tests/arls.c @@ -0,0 +1,91 @@ +#include <ar.h> +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <unistd.h> + + +static int handle (const char *fname); + + +int +main (int argc, char *argv[]) +{ + elf_version (EV_CURRENT); + + int result = 0; + if (argc == 1) + result = handle ("a.out"); + else + for (int i = 1; i < argc; ++i) + result |= handle (argv[1]); + + return result; +} + + +static int +handle (const char *fname) +{ + int fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open '%s': %m\n", fname); + return 1; + } + + Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); + if (elf == NULL) + { + printf ("cannot get ELF handling for '%s': %s\n", + fname, elf_errmsg (-1)); + close (fd); + return 1; + } + + if (elf_kind (elf) != ELF_K_AR) + { + printf ("'%s' is no archive\n", fname); + elf_end (elf); + close (fd); + return 1; + } + + printf ("%s:\n", fname); + Elf *subelf = NULL; + Elf_Cmd cmd = ELF_C_READ_MMAP; + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + if (arhdr == NULL) + { + printf ("cannot get archive header in '%s': %s\n", + fname, elf_errmsg (-1)); + elf_end (subelf); + elf_end (elf); + close (fd); + return 1; + } + + off_t off = elf_getaroff (subelf); + + printf ("\nOffset %llu\n" + " Name %s\n" + " Date %ld\n" + " UID %d\n" + " GID %d\n" + " Mode %o\n" + " Size %lld\n", + (unsigned long long int) off, + arhdr->ar_name, (long int) arhdr->ar_date, (int) arhdr->ar_uid, + (int) arhdr->ar_gid, + (int) arhdr->ar_mode, (long long int) arhdr->ar_size); + + cmd = elf_next (subelf); + elf_end (subelf); + } + + close (fd); + + return 0; +} diff --git a/tests/arsymtest.c b/tests/arsymtest.c new file mode 100644 index 0000000..86d82cf --- /dev/null +++ b/tests/arsymtest.c @@ -0,0 +1,144 @@ +/* Copyright (C) 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1999. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +int +main (int argc, char *argv[]) +{ + int fd; + FILE *fp; + Elf *elf; + Elf_Arsym *arsym; + size_t narsym; + + if (argc < 3) + exit (1); + + /* Open the archive. */ + fd = open (argv[1], O_RDONLY); + if (fd == -1) + { + printf ("Cannot open input file: %m"); + exit (1); + } + + /* Open the output file. */ + fp = fopen (argv[2], "w"); + if (fp == NULL) + { + printf ("Cannot open output file: %m"); + exit (1); + } + + /* Set the ELF version. */ + elf_version (EV_CURRENT); + + /* Create an ELF descriptor. */ + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("Cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* If it is no archive punt. */ + if (elf_kind (elf) != ELF_K_AR) + { + printf ("`%s' is no archive\n", argv[1]); + exit (1); + } + + /* Now get the index of the archive. */ + arsym = elf_getarsym (elf, &narsym); + if (arsym == NULL) + { + printf ("Cannot get archive index: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* If there is no element in the index do nothing. There always is + an empty entry at the end which is included in the count and + which we want to skip. */ + if (narsym-- > 1) + while (narsym-- > 0) + { + Elf *subelf; + Elf_Arhdr *arhdr; + + if (elf_rand (elf, arsym[narsym].as_off) != arsym[narsym].as_off) + { + printf ("random access for symbol `%s' fails: %s\n", + arsym[narsym].as_name, elf_errmsg (-1)); + exit (1); + } + + subelf = elf_begin (fd, ELF_C_READ, elf); + if (subelf == NULL) + { + printf ("Cannot create ELF descriptor for archive member: %s\n", + elf_errmsg (-1)); + exit (1); + } + + arhdr = elf_getarhdr (subelf); + if (arhdr == NULL) + { + printf ("Cannot get archive header for element `%s': %s\n", + arsym[narsym].as_name, elf_errmsg (-1)); + exit (1); + } + + /* Now print what we actually want. */ + fprintf (fp, "%s in %s\n", arsym[narsym].as_name, arhdr->ar_name); + + /* Free the ELF descriptor. */ + if (elf_end (subelf) != 0) + { + printf ("Error while freeing subELF descriptor: %s\n", + elf_errmsg (-1)); + exit (1); + } + } + + /* Free the ELF descriptor. */ + if (elf_end (elf) != 0) + { + printf ("Error while freeing ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + close (fd); + fclose (fp); + + return 0; +} diff --git a/tests/asm-tst1.c b/tests/asm-tst1.c new file mode 100644 index 0000000..123346a --- /dev/null +++ b/tests/asm-tst1.c @@ -0,0 +1,264 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + + +static const char fname[] = "asm-tst1-out.o"; + + +static const GElf_Ehdr expected_ehdr = + { + .e_ident = { [EI_MAG0] = ELFMAG0, + [EI_MAG1] = ELFMAG1, + [EI_MAG2] = ELFMAG2, + [EI_MAG3] = ELFMAG3, + [EI_CLASS] = ELFCLASS32, + [EI_DATA] = ELFDATA2LSB, + [EI_VERSION] = EV_CURRENT }, + .e_type = ET_REL, + .e_machine = EM_386, + .e_version = EV_CURRENT, + .e_shoff = 88, + .e_ehsize = sizeof (Elf32_Ehdr), + .e_shentsize = sizeof (Elf32_Shdr), + .e_shnum = 4, + .e_shstrndx = 3 + }; + + +static const char *scnnames[4] = + { + [0] = "", + [1] = ".text", + [2] = ".data", + [3] = ".shstrtab" + }; + + +int +main (void) +{ + AsmCtx_t *ctx; + AsmScn_t *scn1; + AsmScn_t *scn2; + int fd; + Elf *elf; + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr; + int result = 0; + size_t cnt; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + /* Create two sections. */ + scn1 = asm_newscn (ctx, ".text", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR); + scn2 = asm_newscn (ctx, ".data", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE); + if (scn1 == NULL || scn2 == NULL) + { + printf ("cannot create section in output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Special alignment for the .text section. */ + if (asm_align (scn1, 32) != 0) + { + printf ("cannot align .text section: %s\n", asm_errmsg (-1)); + result = 1; + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Check the file. */ + fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open generated file: %m\n"); + result = 1; + goto out; + } + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close; + } + if (elf_kind (elf) != ELF_K_ELF) + { + puts ("not a valid ELF file"); + result = 1; + goto out_close2; + } + + ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + { + printf ("cannot get ELF header: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close2; + } + + if (memcmp (ehdr, &expected_ehdr, sizeof (GElf_Ehdr)) != 0) + { + puts ("ELF header does not match"); + result = 1; + goto out_close2; + } + + for (cnt = 1; cnt < 4; ++cnt) + { + Elf_Scn *scn; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr; + + scn = elf_getscn (elf, cnt); + if (scn == NULL) + { + printf ("cannot get section %Zd: %s\n", cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + { + printf ("cannot get section header for section %Zd: %s\n", + cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + if (strcmp (elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]) != 0) + { + printf ("section %Zd's name differs: %s vs %s\n", cnt, + elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]); + result = 1; + } + + if (shdr->sh_type != (cnt == 3 ? SHT_STRTAB : SHT_PROGBITS)) + { + printf ("section %Zd's type differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_flags != (SHF_ALLOC | SHF_EXECINSTR)) + || (cnt == 2 && shdr->sh_flags != (SHF_ALLOC | SHF_WRITE)) + || (cnt == 3 && shdr->sh_flags != 0)) + { + printf ("section %Zd's flags differs\n", cnt); + result = 1; + } + + if (shdr->sh_addr != 0) + { + printf ("section %Zd's address differs\n", cnt); + result = 1; + } + + if (shdr->sh_offset != ((sizeof (Elf32_Ehdr) + 31) & ~31)) + { + printf ("section %Zd's offset differs\n", cnt); + result = 1; + } + + if ((cnt != 3 && shdr->sh_size != 0) + || (cnt == 3 && shdr->sh_size != 23)) + { + printf ("section %Zd's size differs\n", cnt); + result = 1; + } + + if (shdr->sh_link != 0) + { + printf ("section %Zd's link differs\n", cnt); + result = 1; + } + + if (shdr->sh_info != 0) + { + printf ("section %Zd's info differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_addralign != 32) + || (cnt != 1 && shdr->sh_addralign != 1)) + { + printf ("section %Zd's addralign differs\n", cnt); + result = 1; + } + + if (shdr->sh_entsize != 0) + { + printf ("section %Zd's entsize differs\n", cnt); + result = 1; + } + } + + out_close2: + elf_end (elf); + out_close: + close (fd); + out: + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst2.c b/tests/asm-tst2.c new file mode 100644 index 0000000..7caaf36 --- /dev/null +++ b/tests/asm-tst2.c @@ -0,0 +1,286 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + + +static const char fname[] = "asm-tst2-out.o"; + + +static const GElf_Ehdr expected_ehdr = + { + .e_ident = { [EI_MAG0] = ELFMAG0, + [EI_MAG1] = ELFMAG1, + [EI_MAG2] = ELFMAG2, + [EI_MAG3] = ELFMAG3, + [EI_CLASS] = ELFCLASS32, + [EI_DATA] = ELFDATA2LSB, + [EI_VERSION] = EV_CURRENT }, + .e_type = ET_REL, + .e_machine = EM_386, + .e_version = EV_CURRENT, + .e_shoff = 96, + .e_ehsize = sizeof (Elf32_Ehdr), + .e_shentsize = sizeof (Elf32_Shdr), + .e_shnum = 3, + .e_shstrndx = 2 + }; + + +static const char *scnnames[3] = + { + [0] = "", + [1] = ".data", + [2] = ".shstrtab" + }; + + +int +main (void) +{ + AsmCtx_t *ctx; + AsmScn_t *scn1; + AsmScn_t *scn2; + int result = 0; + int fd; + Elf *elf; + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr; + size_t cnt; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + /* Create two sections. */ + scn1 = asm_newscn (ctx, ".data", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE); + scn2 = asm_newsubscn (scn1, 1); + if (scn1 == NULL || scn2 == NULL) + { + printf ("cannot create section in output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Special alignment for the .text section. */ + if (asm_align (scn1, 16) != 0) + { + printf ("cannot align .text section: %s\n", asm_errmsg (-1)); + result = 1; + } + + /* Add a few strings. */ + if (asm_addstrz (scn1, "one", 4) != 0) + { + printf ("cannot insert first string: %s\n", asm_errmsg (-1)); + result = 1; + } + if (asm_addstrz (scn2, "three", 0) != 0) + { + printf ("cannot insert second string: %s\n", asm_errmsg (-1)); + result = 1; + } + if (asm_addstrz (scn1, "two", 4) != 0) + { + printf ("cannot insert third string: %s\n", asm_errmsg (-1)); + result = 1; + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Check the file. */ + fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open generated file: %m\n"); + result = 1; + goto out; + } + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close; + } + if (elf_kind (elf) != ELF_K_ELF) + { + puts ("not a valid ELF file"); + result = 1; + goto out_close2; + } + + ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + { + printf ("cannot get ELF header: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close2; + } + + if (memcmp (ehdr, &expected_ehdr, sizeof (GElf_Ehdr)) != 0) + { + puts ("ELF header does not match"); + result = 1; + goto out_close2; + } + + for (cnt = 1; cnt < 3; ++cnt) + { + Elf_Scn *scn; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr; + + scn = elf_getscn (elf, cnt); + if (scn == NULL) + { + printf ("cannot get section %Zd: %s\n", cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + { + printf ("cannot get section header for section %Zd: %s\n", + cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + if (strcmp (elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]) != 0) + { + printf ("section %Zd's name differs: %s vs %s\n", cnt, + elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]); + result = 1; + } + + if (shdr->sh_type != (cnt == 2 ? SHT_STRTAB : SHT_PROGBITS)) + { + printf ("section %Zd's type differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_flags != (SHF_ALLOC | SHF_WRITE)) + || (cnt == 2 && shdr->sh_flags != 0)) + { + printf ("section %Zd's flags differs\n", cnt); + result = 1; + } + + if (shdr->sh_addr != 0) + { + printf ("section %Zd's address differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_offset != ((sizeof (Elf32_Ehdr) + 15) & ~15)) + || (cnt == 2 + && shdr->sh_offset != (((sizeof (Elf32_Ehdr) + 15) & ~15) + + strlen ("one") + 1 + + strlen ("two") + 1 + + strlen ("three") + 1))) + { + printf ("section %Zd's offset differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_size != (strlen ("one") + 1 + + strlen ("two") + 1 + + strlen ("three") + 1)) + || (cnt == 2 && shdr->sh_size != 17)) + { + printf ("section %Zd's size differs\n", cnt); + result = 1; + } + + if (shdr->sh_link != 0) + { + printf ("section %Zd's link differs\n", cnt); + result = 1; + } + + if (shdr->sh_info != 0) + { + printf ("section %Zd's info differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_addralign != 16) + || (cnt != 1 && shdr->sh_addralign != 1)) + { + printf ("section %Zd's addralign differs\n", cnt); + result = 1; + } + + if (shdr->sh_entsize != 0) + { + printf ("section %Zd's entsize differs\n", cnt); + result = 1; + } + } + + out_close2: + elf_end (elf); + out_close: + close (fd); + out: + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst3.c b/tests/asm-tst3.c new file mode 100644 index 0000000..f38feeb --- /dev/null +++ b/tests/asm-tst3.c @@ -0,0 +1,347 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + + +static const char fname[] = "asm-tst3-out.o"; + + +static const char *scnnames[5] = + { + [0] = "", + [1] = ".data", + [2] = ".strtab", + [3] = ".symtab", + [4] = ".shstrtab" + }; + + +static unsigned int scntypes[5] = + { + [0] = SHT_NULL, + [1] = SHT_PROGBITS, + [2] = SHT_STRTAB, + [3] = SHT_SYMTAB, + [4] = SHT_STRTAB + }; + + +int +main (void) +{ + AsmCtx_t *ctx; + AsmScn_t *scn1; + AsmScn_t *scn2; + int result = 0; + int fd; + Elf *elf; + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr; + size_t cnt; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + /* Create two sections. */ + scn1 = asm_newscn (ctx, ".data", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE); + scn2 = asm_newsubscn (scn1, 1); + if (scn1 == NULL || scn2 == NULL) + { + printf ("cannot create section in output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Special alignment for the .text section. */ + if (asm_align (scn1, 16) != 0) + { + printf ("cannot align .text section: %s\n", asm_errmsg (-1)); + result = 1; + } + + /* Add a few strings with names. */ + if (asm_newsym (scn1, "one", 4, STT_OBJECT, STB_GLOBAL) == NULL) + { + printf ("cannot create first name: %s\n", asm_errmsg (-1)); + result = 1; + } + if (asm_addstrz (scn1, "one", 4) != 0) + { + printf ("cannot insert first string: %s\n", asm_errmsg (-1)); + result = 1; + } + if (asm_newsym (scn2, "three", 6, STT_OBJECT, STB_WEAK) == NULL) + { + printf ("cannot create second name: %s\n", asm_errmsg (-1)); + result = 1; + } + if (asm_addstrz (scn2, "three", 0) != 0) + { + printf ("cannot insert second string: %s\n", asm_errmsg (-1)); + result = 1; + } + if (asm_newsym (scn1, "two", 4, STT_OBJECT, STB_LOCAL) == NULL) + { + printf ("cannot create third name: %s\n", asm_errmsg (-1)); + result = 1; + } + if (asm_addstrz (scn1, "two", 4) != 0) + { + printf ("cannot insert third string: %s\n", asm_errmsg (-1)); + result = 1; + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Check the file. */ + fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open generated file: %m\n"); + result = 1; + goto out; + } + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close; + } + if (elf_kind (elf) != ELF_K_ELF) + { + puts ("not a valid ELF file"); + result = 1; + goto out_close2; + } + + ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + { + printf ("cannot get ELF header: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close2; + } + + for (cnt = 1; cnt < 5; ++cnt) + { + Elf_Scn *scn; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr; + + scn = elf_getscn (elf, cnt); + if (scn == NULL) + { + printf ("cannot get section %Zd: %s\n", cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + { + printf ("cannot get section header for section %Zd: %s\n", + cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + if (strcmp (elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]) != 0) + { + printf ("section %Zd's name differs: %s vs %s\n", cnt, + elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]); + result = 1; + } + + if (shdr->sh_type != scntypes[cnt]) + { + printf ("section %Zd's type differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_flags != (SHF_ALLOC | SHF_WRITE)) + || (cnt != 1 && shdr->sh_flags != 0)) + { + printf ("section %Zd's flags differs\n", cnt); + result = 1; + } + + if (shdr->sh_addr != 0) + { + printf ("section %Zd's address differs\n", cnt); + result = 1; + } + + if (cnt == 3) + { + Elf_Data *data; + + if (shdr->sh_link != 2) + { + puts ("symbol table has incorrect link"); + result = 1; + } + + data = elf_getdata (scn, NULL); + if (data == NULL) + { + puts ("cannot get data of symbol table"); + result = 1; + } + else + { + size_t inner; + + for (inner = 1; + inner < (shdr->sh_size + / gelf_fsize (elf, ELF_T_SYM, 1, EV_CURRENT)); + ++inner) + { + GElf_Sym sym_mem; + GElf_Sym *sym; + + sym = gelf_getsym (data, inner, &sym_mem); + if (sym == NULL) + { + printf ("cannot get symbol %zu: %s\n", + inner, elf_errmsg (-1)); + result = 1; + } + else + { + /* The order of the third and fourth entry depends + on how the hash table is organized. */ + static const char *names[4] = + { + [0] = "", + [1] = "two", + [2] = "one", + [3] = "three" + }; + static const int info[4] = + { + [0] = GELF_ST_INFO (STB_LOCAL, STT_NOTYPE), + [1] = GELF_ST_INFO (STB_LOCAL, STT_OBJECT), + [2] = GELF_ST_INFO (STB_GLOBAL, STT_OBJECT), + [3] = GELF_ST_INFO (STB_WEAK, STT_OBJECT) + }; + static const unsigned value[4] = + { + [0] = 0, + [1] = 4, + [2] = 0, + [3] = 8 + }; + + if (strcmp (names[inner], + elf_strptr (elf, shdr->sh_link, + sym->st_name)) != 0) + { + printf ("symbol %zu has different name\n", inner); + result = 1; + } + + if (sym->st_value != value[inner]) + { + printf ("symbol %zu has wrong value\n", inner); + result = 1; + } + + if (sym->st_other != 0) + { + printf ("symbol %zu has wrong other info\n", inner); + result = 1; + } + + if (sym->st_shndx != 1) + { + printf ("symbol %zu has wrong section reference\n", + inner); + result = 1; + } + + if (sym->st_info != info[inner]) + { + printf ("symbol %zu has wrong type or binding\n", + inner); + result = 1; + } + + if ((inner != 3 && sym->st_size != 4) + || (inner == 3 && sym->st_size != 6)) + { + printf ("symbol %zu has wrong size\n", inner); + result = 1; + } + } + } + } + } + } + + out_close2: + elf_end (elf); + out_close: + close (fd); + out: + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c new file mode 100644 index 0000000..54d054c --- /dev/null +++ b/tests/asm-tst4.c @@ -0,0 +1,113 @@ +/* Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/wait.h> + + +static const char fname[] = "asm-tst4-out.o"; + + +int +main (void) +{ + AsmCtx_t *ctx; + int result = 0; + size_t cnt; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + /* Create 66000 sections. */ + for (cnt = 0; cnt < 66000; ++cnt) + { + char buf[20]; + AsmScn_t *scn; + + /* Create a unique name. */ + snprintf (buf, sizeof (buf), ".data.%Zu", cnt); + + /* Create the section. */ + scn = asm_newscn (ctx, buf, SHT_PROGBITS, SHF_ALLOC | SHF_WRITE); + if (scn == NULL) + { + printf ("cannot create section \"%s\" in output file: %s\n", + buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Add some content. */ + if (asm_adduint32 (scn, cnt) != 0) + { + printf ("cannot create content of section \"%s\": %s\n", + buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + if (result == 0) + result = WEXITSTATUS (system ("\ +env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst4-out.o")); + + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c new file mode 100644 index 0000000..2a8b3f0 --- /dev/null +++ b/tests/asm-tst5.c @@ -0,0 +1,125 @@ +/* Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/wait.h> + +#include "system.h" + + +static const char fname[] = "asm-tst5-out.o"; + + +int +main (void) +{ + AsmCtx_t *ctx; + int result = 0; + size_t cnt; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + /* Create 66000 sections. */ + for (cnt = 0; cnt < 66000; ++cnt) + { + char buf[20]; + AsmScn_t *scn; + + /* Create a unique name. */ + snprintf (buf, sizeof (buf), ".data.%Zu", cnt); + + /* Create the section. */ + scn = asm_newscn (ctx, buf, SHT_PROGBITS, SHF_ALLOC | SHF_WRITE); + if (scn == NULL) + { + printf ("cannot create section \"%s\" in output file: %s\n", + buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Add a name. */ + snprintf (buf, sizeof (buf), "%Zu", cnt); + if (asm_newsym (scn, buf, sizeof (uint32_t), STT_OBJECT, + STB_GLOBAL) == NULL) + { + printf ("cannot create symbol \"%s\": %s\n", buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Add some content. */ + if (asm_adduint32 (scn, cnt) != 0) + { + printf ("cannot create content of section \"%s\": %s\n", + buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + if (result == 0) + result = WEXITSTATUS (system ("\ +env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst5-out.o")); + + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c new file mode 100644 index 0000000..bd6a71d --- /dev/null +++ b/tests/asm-tst6.c @@ -0,0 +1,159 @@ +/* Copyright (C) 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + +#include <system.h> + + +static const char fname[] = "asm-tst6-out.o"; + + +int +main (void) +{ + AsmCtx_t *ctx; + int result = 0; + size_t cnt; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + for (cnt = 0; cnt < 22000; ++cnt) + { + char buf[512]; + AsmScnGrp_t *grp; + AsmScn_t *scn; + AsmSym_t *sym; + + snprintf (buf, sizeof (buf), ".grp%Zu", cnt); + grp = asm_newscngrp (ctx, buf, NULL, 0); + if (grp == NULL) + { + printf ("cannot section group %Zu: %s\n", cnt, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + scn = asm_newscn_ingrp (ctx, ".data", SHT_PROGBITS, + SHF_ALLOC | SHF_WRITE, grp); + if (scn == NULL) + { + printf ("cannot data section for group %Zu: %s\n", + cnt, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Add a name. */ + snprintf (buf, sizeof (buf), "%Zu", cnt); + sym = asm_newsym (scn, buf, sizeof (uint32_t), STT_OBJECT, + STB_GLOBAL); + if (sym == NULL) + { + printf ("cannot create symbol \"%s\": %s\n", buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Add some content. */ + if (asm_adduint32 (scn, cnt) != 0) + { + printf ("cannot create content of section \"%s\": %s\n", + buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Now we have a symbol, use it as the signature. */ + if (asm_scngrp_newsignature (grp, sym) != 0) + { + printf ("cannot set signature for section group %Zu: %s\n", + cnt, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Create a phony debug info section. */ + scn = asm_newscn_ingrp (ctx, ".stab", SHT_PROGBITS, 0, grp); + if (scn == NULL) + { + printf ("cannot stab section for group %Zu: %s\n", + cnt, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Add some content. */ + if (asm_adduint32 (scn, cnt) != 0) + { + printf ("cannot create content of section \"%s\": %s\n", + buf, asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + if (result == 0) + result = WEXITSTATUS (system ("\ +env LD_LIBRARY_PATH=../libelf ../src/elflint -q asm-tst6-out.o")); + + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst7.c b/tests/asm-tst7.c new file mode 100644 index 0000000..329f03b --- /dev/null +++ b/tests/asm-tst7.c @@ -0,0 +1,189 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <unistd.h> + + +static const char fname[] = "asm-tst7-out.o"; + + +int +main (void) +{ + int result = 0; + size_t cnt; + AsmCtx_t *ctx; + Elf *elf; + int fd; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + if (asm_newcomsym (ctx, "commsym", 4, 16) == NULL) + { + printf ("cannot create common symbol: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Check the file. */ + fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open generated file: %m\n"); + result = 1; + goto out; + } + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close; + } + if (elf_kind (elf) != ELF_K_ELF) + { + puts ("not a valid ELF file"); + result = 1; + goto out_close2; + } + + for (cnt = 1; 1; ++cnt) + { + Elf_Scn *scn; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr; + + scn = elf_getscn (elf, cnt); + if (scn == NULL) + { + printf ("cannot get section %Zd: %s\n", cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + { + printf ("cannot get section header for section %Zd: %s\n", + cnt, elf_errmsg (-1)); + result = 1; + continue; + } + /* We are looking for the symbol table. */ + if (shdr->sh_type != SHT_SYMTAB) + continue; + + for (cnt = 1; cnt< (shdr->sh_size + / gelf_fsize (elf, ELF_T_SYM, 1, EV_CURRENT)); + ++cnt) + { + GElf_Sym sym_mem; + GElf_Sym *sym; + + if (cnt > 1) + { + puts ("too many symbol"); + result = 1; + break; + } + + sym = gelf_getsym (elf_getdata (scn, NULL), cnt, &sym_mem); + if (sym == NULL) + { + printf ("cannot get symbol %zu: %s\n", cnt, elf_errmsg (-1)); + result = 1; + } + else + { + if (sym->st_shndx != SHN_COMMON) + { + printf ("expected common symbol, got section %u\n", + (unsigned int) sym->st_shndx); + result = 1; + } + + if (sym->st_value != 16) + { + printf ("requested alignment 16, is %" PRIuMAX "\n", + (uintmax_t) sym->st_value); + result = 1; + } + + if (sym->st_size != 4) + { + printf ("requested size 4, is %" PRIuMAX "\n", + (uintmax_t) sym->st_value); + result = 1; + } + } + } + + break; + } + + out_close2: + elf_end (elf); + out_close: + close (fd); + out: + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst8.c b/tests/asm-tst8.c new file mode 100644 index 0000000..19c7aa9 --- /dev/null +++ b/tests/asm-tst8.c @@ -0,0 +1,197 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <unistd.h> + + +static const char fname[] = "asm-tst8-out.o"; + + +int +main (void) +{ + int result = 0; + size_t cnt; + AsmCtx_t *ctx; + Elf *elf; + int fd; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + if (asm_newabssym (ctx, "tst8-out.s", 4, 0xfeedbeef, STT_FILE, STB_LOCAL) + == NULL) + { + printf ("cannot create absolute symbol: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Check the file. */ + fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open generated file: %m\n"); + result = 1; + goto out; + } + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close; + } + if (elf_kind (elf) != ELF_K_ELF) + { + puts ("not a valid ELF file"); + result = 1; + goto out_close2; + } + + for (cnt = 1; 1; ++cnt) + { + Elf_Scn *scn; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr; + + scn = elf_getscn (elf, cnt); + if (scn == NULL) + { + printf ("cannot get section %Zd: %s\n", cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + shdr = gelf_getshdr (scn, &shdr_mem); + if (shdr == NULL) + { + printf ("cannot get section header for section %Zd: %s\n", + cnt, elf_errmsg (-1)); + result = 1; + continue; + } + /* We are looking for the symbol table. */ + if (shdr->sh_type != SHT_SYMTAB) + continue; + + for (cnt = 1; cnt< (shdr->sh_size + / gelf_fsize (elf, ELF_T_SYM, 1, EV_CURRENT)); + ++cnt) + { + GElf_Sym sym_mem; + GElf_Sym *sym; + + if (cnt > 1) + { + puts ("too many symbol"); + result = 1; + break; + } + + sym = gelf_getsym (elf_getdata (scn, NULL), cnt, &sym_mem); + if (sym == NULL) + { + printf ("cannot get symbol %zu: %s\n", cnt, elf_errmsg (-1)); + result = 1; + } + else + { + if (sym->st_shndx != SHN_ABS) + { + printf ("expected common symbol, got section %u\n", + (unsigned int) sym->st_shndx); + result = 1; + } + + if (sym->st_value != 0xfeedbeef) + { + printf ("requested value 0xfeedbeef, is %#" PRIxMAX "\n", + (uintmax_t) sym->st_value); + result = 1; + } + + if (sym->st_size != 4) + { + printf ("requested size 4, is %" PRIuMAX "\n", + (uintmax_t) sym->st_value); + result = 1; + } + + if (GELF_ST_TYPE (sym->st_info) != STT_FILE) + { + printf ("requested type FILE, is %u\n", + (unsigned int) GELF_ST_TYPE (sym->st_info)); + result = 1; + } + } + } + + break; + } + + out_close2: + elf_end (elf); + out_close: + close (fd); + out: + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/asm-tst9.c b/tests/asm-tst9.c new file mode 100644 index 0000000..ad25275 --- /dev/null +++ b/tests/asm-tst9.c @@ -0,0 +1,343 @@ +/* Copyright (C) 2002-2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(asm) +#include <libelf.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + + +static const char fname[] = "asm-tst9-out.o"; + + +static int32_t input[] = + { + 0, 1, 129, 510, 2000, 33000, 0x7ffffff, 0x7fffffff + }; +#define ninput (sizeof (input) / sizeof (input[0])) + + +static const GElf_Ehdr expected_ehdr = + { + .e_ident = { [EI_MAG0] = ELFMAG0, + [EI_MAG1] = ELFMAG1, + [EI_MAG2] = ELFMAG2, + [EI_MAG3] = ELFMAG3, + [EI_CLASS] = ELFCLASS32, + [EI_DATA] = ELFDATA2LSB, + [EI_VERSION] = EV_CURRENT }, + .e_type = ET_REL, + .e_machine = EM_386, + .e_version = EV_CURRENT, + .e_shoff = 180, + .e_ehsize = sizeof (Elf32_Ehdr), + .e_shentsize = sizeof (Elf32_Shdr), + .e_shnum = 3, + .e_shstrndx = 2 + }; + + +static const char *scnnames[3] = + { + [0] = "", + [1] = ".data", + [2] = ".shstrtab" + }; + + +static const char expecteddata[] = + { + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x7f, + 0x81, 0x01, 0x81, 0x01, 0xff, 0xfe, 0xff, 0xff, 0x0f, 0xff, 0x7e, 0xfe, + 0x03, 0xfe, 0x03, 0x82, 0xfc, 0xff, 0xff, 0x0f, 0x82, 0x7c, 0xd0, 0x0f, + 0xd0, 0x0f, 0xb0, 0xf0, 0xff, 0xff, 0x0f, 0xb0, 0x70, 0xe8, 0x81, 0x02, + 0xe8, 0x81, 0x02, 0x98, 0xfe, 0xfd, 0xff, 0x0f, 0x98, 0xfe, 0x7d, 0xff, + 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0x3f, 0x81, 0x80, 0x80, 0xc0, 0x0f, + 0x81, 0x80, 0x80, 0x40, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, + 0xff, 0x07, 0x81, 0x80, 0x80, 0x80, 0x08, 0x81, 0x80, 0x80, 0x80, 0x78 + }; + + +int +main (void) +{ + AsmCtx_t *ctx; + AsmScn_t *scn; + int result = 0; + int fd; + Elf *elf; + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr; + size_t cnt; + + elf_version (EV_CURRENT); + + Ebl *ebl = ebl_openbackend_machine (EM_386); + if (ebl == NULL) + { + puts ("cannot open backend library"); + return 1; + } + + ctx = asm_begin (fname, ebl, false); + if (ctx == NULL) + { + printf ("cannot create assembler context: %s\n", asm_errmsg (-1)); + return 1; + } + + /* Create two sections. */ + scn = asm_newscn (ctx, ".data", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE); + if (scn == NULL) + { + printf ("cannot create section in output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Special alignment for the .text section. */ + if (asm_align (scn, 16) != 0) + { + printf ("cannot align .text section: %s\n", asm_errmsg (-1)); + result = 1; + } + + /* Add a few ULEB128 and SLEB128 numbers. */ + for (cnt = 0; cnt < ninput; ++cnt) + { + if (asm_adduleb128 (scn, input[cnt]) != 0) + { + printf ("cannot insert uleb %" PRIu32 ": %s\n", + (uint32_t) input[cnt], asm_errmsg (-1)); + result = 1; + } + + if (asm_addsleb128 (scn, input[cnt]) != 0) + { + printf ("cannot insert sleb %" PRId32 ": %s\n", + input[cnt], asm_errmsg (-1)); + result = 1; + } + + if (asm_adduleb128 (scn, -input[cnt]) != 0) + { + printf ("cannot insert uleb %" PRIu32 ": %s\n", + (uint32_t) -input[cnt], asm_errmsg (-1)); + result = 1; + } + + if (asm_addsleb128 (scn, -input[cnt]) != 0) + { + printf ("cannot insert sleb %" PRId32 ": %s\n", + -input[cnt], asm_errmsg (-1)); + result = 1; + } + } + + /* Create the output file. */ + if (asm_end (ctx) != 0) + { + printf ("cannot create output file: %s\n", asm_errmsg (-1)); + asm_abort (ctx); + return 1; + } + + /* Check the file. */ + fd = open (fname, O_RDONLY); + if (fd == -1) + { + printf ("cannot open generated file: %m\n"); + result = 1; + goto out; + } + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close; + } + if (elf_kind (elf) != ELF_K_ELF) + { + puts ("not a valid ELF file"); + result = 1; + goto out_close2; + } + + ehdr = gelf_getehdr (elf, &ehdr_mem); + if (ehdr == NULL) + { + printf ("cannot get ELF header: %s\n", elf_errmsg (-1)); + result = 1; + goto out_close2; + } + + if (memcmp (ehdr, &expected_ehdr, sizeof (GElf_Ehdr)) != 0) + { + puts ("ELF header does not match"); + result = 1; + goto out_close2; + } + + for (cnt = 1; cnt < 3; ++cnt) + { + Elf_Scn *escn; + GElf_Shdr shdr_mem; + GElf_Shdr *shdr; + + escn = elf_getscn (elf, cnt); + if (escn == NULL) + { + printf ("cannot get section %Zd: %s\n", cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + shdr = gelf_getshdr (escn, &shdr_mem); + if (shdr == NULL) + { + printf ("cannot get section header for section %Zd: %s\n", + cnt, elf_errmsg (-1)); + result = 1; + continue; + } + + if (strcmp (elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]) != 0) + { + printf ("section %Zd's name differs: %s vs %s\n", cnt, + elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + scnnames[cnt]); + result = 1; + } + + if (shdr->sh_type != (cnt == 2 ? SHT_STRTAB : SHT_PROGBITS)) + { + printf ("section %Zd's type differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_flags != (SHF_ALLOC | SHF_WRITE)) + || (cnt == 2 && shdr->sh_flags != 0)) + { + printf ("section %Zd's flags differs\n", cnt); + result = 1; + } + + if (shdr->sh_addr != 0) + { + printf ("section %Zd's address differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_offset != ((sizeof (Elf32_Ehdr) + 15) & ~15)) + || (cnt == 2 + && shdr->sh_offset != (((sizeof (Elf32_Ehdr) + 15) & ~15) + + sizeof (expecteddata)))) + { + printf ("section %Zd's offset differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_size != sizeof (expecteddata)) + || (cnt == 2 && shdr->sh_size != 17)) + { + printf ("section %Zd's size differs\n", cnt); + result = 1; + } + + if (shdr->sh_link != 0) + { + printf ("section %Zd's link differs\n", cnt); + result = 1; + } + + if (shdr->sh_info != 0) + { + printf ("section %Zd's info differs\n", cnt); + result = 1; + } + + if ((cnt == 1 && shdr->sh_addralign != 16) + || (cnt != 1 && shdr->sh_addralign != 1)) + { + printf ("section %Zd's addralign differs\n", cnt); + result = 1; + } + + if (shdr->sh_entsize != 0) + { + printf ("section %Zd's entsize differs\n", cnt); + result = 1; + } + + if (cnt == 1) + { + Elf_Data *data = elf_getdata (escn, NULL); + + if (data == NULL) + { + printf ("cannot get data of section %Zd\n", cnt); + result = 1; + } + else + { + if (data->d_size != sizeof (expecteddata)) + { + printf ("data block size of section %Zd wrong: got %Zd, " + "expected 96\n", cnt, data->d_size); + result = 1; + } + + if (memcmp (data->d_buf, expecteddata, sizeof (expecteddata)) + != 0) + { + printf ("data block content of section %Zd wrong\n", cnt); + result = 1; + } + } + } + } + + out_close2: + elf_end (elf); + out_close: + close (fd); + out: + /* We don't need the file anymore. */ + unlink (fname); + + ebl_closebackend (ebl); + + return result; +} diff --git a/tests/coverage.sh b/tests/coverage.sh new file mode 100755 index 0000000..5cc353c --- /dev/null +++ b/tests/coverage.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +if [ "x$1" = "x-v" ]; then + verbose=yes +else + verbose=no +fi + +cd .. + +for d in lib libasm libdw libdwfl libebl libelf backends src; do + tmp=$d-data + cd $d + unused=0 + unused_files= + 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)) + unused_files="$unused_files $fc" + 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 + if [ $verbose = yes ]; then + for f in $unused_files; do + printf '%-42s%s\n' '' $f + done + fi + cd .. +done diff --git a/tests/dwarf-getmacros.c b/tests/dwarf-getmacros.c new file mode 100644 index 0000000..5c38097 --- /dev/null +++ b/tests/dwarf-getmacros.c @@ -0,0 +1,64 @@ +/* Test program for dwfl_module_return_value_location. + Copyright (C) 2009 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include ELFUTILS_HEADER(dw) +#include <dwarf.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> + +int +main (int argc __attribute__ ((unused)), char *argv[]) +{ + const char *name = argv[1]; + ptrdiff_t cuoff = strtol (argv[2], NULL, 0); + + int fd = open (name, O_RDONLY); + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + + Dwarf_Die cudie_mem, *cudie = dwarf_offdie (dbg, cuoff, &cudie_mem); + int mac (Dwarf_Macro *macro, void *data __attribute__ ((unused))) + { + unsigned int opcode; + dwarf_macro_opcode (macro, &opcode); + if (opcode == DW_MACINFO_define) + { + const char *value; + dwarf_macro_param2 (macro, NULL, &value); + puts (value); + } + return DWARF_CB_ABORT; + } + + ptrdiff_t off = 0; + while ((off = dwarf_getmacros (cudie, mac, NULL, off)) > 0) + ; + + return 0; +} diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c new file mode 100644 index 0000000..62d1154 --- /dev/null +++ b/tests/dwfl-addr-sect.c @@ -0,0 +1,88 @@ +/* Test program for libdwfl ... foo + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> +#include <locale.h> +#include <argp.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> + +static int +handle_address (Dwfl *dwfl, Dwarf_Addr address) +{ + Dwfl_Module *mod = dwfl_addrmodule (dwfl, address); + Dwarf_Addr adjusted = address; + Dwarf_Addr bias; + Elf_Scn *scn = dwfl_module_address_section (mod, &adjusted, &bias); + if (scn == NULL) + { + error (0, 0, "%#" PRIx64 ": dwfl_module_address_section: %s", + address, dwfl_errmsg (-1)); + return 1; + } + printf ("address %#" PRIx64 " => module \"%s\" section %zu + %#" PRIx64 "\n", + address, + dwfl_module_info (mod, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + elf_ndxscn (scn), adjusted); + return 0; +} + +int +main (int argc, char **argv) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + int remaining; + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining, &dwfl); + assert (dwfl != NULL); + + int result = 0; + for (; remaining < argc; ++remaining) + { + char *endp; + uintmax_t addr = strtoumax (argv[remaining], &endp, 0); + if (endp != argv[remaining]) + result |= handle_address (dwfl, addr); + else + result = 1; + } + + dwfl_end (dwfl); + + return result; +} diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c new file mode 100644 index 0000000..0e875da --- /dev/null +++ b/tests/dwfl-bug-addr-overflow.c @@ -0,0 +1,81 @@ +/* Test program for libdwfl basic module tracking, relocation. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <error.h> +#include <locale.h> +#include ELFUTILS_HEADER(dwfl) + + +static const Dwfl_Callbacks offline_callbacks = + { + .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo), + .section_address = INTUSE(dwfl_offline_section_address), + }; + + +int +main (void) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = dwfl_begin (&offline_callbacks); + assert (dwfl != NULL); + + Dwfl_Module *high = dwfl_report_module (dwfl, "high", + UINT64_C (0xffffffff00010000), + UINT64_C (0xffffffff00020000)); + assert (high); + Dwfl_Module *low = dwfl_report_module (dwfl, "low", + UINT64_C (0x00010000), + UINT64_C (0x00020000)); + assert (low); + Dwfl_Module *middle = dwfl_report_module (dwfl, "middle", + UINT64_C (0xffff00010000), + UINT64_C (0xffff00020000)); + assert (middle); + + int ret = dwfl_report_end (dwfl, NULL, NULL); + assert (ret == 0); + + Dwfl_Module *mod = dwfl_addrmodule (dwfl, UINT64_C (0xffffffff00010123)); + assert (mod == high); + mod = dwfl_addrmodule (dwfl, UINT64_C (0x00010123)); + assert (mod == low); + mod = dwfl_addrmodule (dwfl, UINT64_C (0xffff00010123)); + assert (mod == middle); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c new file mode 100644 index 0000000..37ff402 --- /dev/null +++ b/tests/dwfl-bug-fd-leak.c @@ -0,0 +1,110 @@ +/* Test program for libdwfl file decriptors leakage. + Copyright (C) 2007, 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <locale.h> +#include <dirent.h> +#include <stdlib.h> +#include <errno.h> +#include <error.h> +#include <unistd.h> +#include <dwarf.h> +#include <sys/resource.h> +#include ELFUTILS_HEADER(dwfl) + + +static Dwfl * +elfutils_open (pid_t pid, Dwarf_Addr address) +{ + static char *debuginfo_path; + static const Dwfl_Callbacks proc_callbacks = + { + .find_debuginfo = dwfl_standard_find_debuginfo, + .debuginfo_path = &debuginfo_path, + + .find_elf = dwfl_linux_proc_find_elf, + }; + Dwfl *dwfl = dwfl_begin (&proc_callbacks); + if (dwfl == NULL) + error (2, 0, "dwfl_begin: %s", dwfl_errmsg (-1)); + + int result = dwfl_linux_proc_report (dwfl, pid); + if (result < 0) + error (2, 0, "dwfl_linux_proc_report: %s", dwfl_errmsg (-1)); + else if (result > 0) + error (2, result, "dwfl_linux_proc_report"); + + if (dwfl_report_end (dwfl, NULL, NULL) != 0) + error (2, 0, "dwfl_report_end: %s", dwfl_errmsg (-1)); + + Dwarf_Addr bias; + Dwarf *dbg = dwfl_addrdwarf (dwfl, address, &bias); + if (dbg != NULL) + { + Elf *elf = dwarf_getelf (dbg); + if (elf == NULL) + error (2, 0, "dwarf_getelf: %s", dwarf_errmsg (-1)); + } + else + { + Elf *elf = dwfl_module_getelf (dwfl_addrmodule (dwfl, address), &bias); + if (elf == NULL) + error (2, 0, "dwfl_module_getelf: %s", dwfl_errmsg (-1)); + } + + return dwfl; +} + +static void +elfutils_close (Dwfl *dwfl) +{ + dwfl_end (dwfl); +} + +int +main (void) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + struct rlimit fd_limit = { .rlim_cur = 32, .rlim_max = 32 }; + if (setrlimit (RLIMIT_NOFILE, &fd_limit) < 0) + error (2, errno, "setrlimit"); + + for (int i = 0; i < 5000; ++i) + { + Dwfl *dwfl = elfutils_open (getpid (), (Dwarf_Addr) (uintptr_t) &main); + elfutils_close (dwfl); + } + + return 0; +} diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c new file mode 100644 index 0000000..f7042c0 --- /dev/null +++ b/tests/dwfl-bug-getmodules.c @@ -0,0 +1,74 @@ +/* Test program for dwfl_getmodules bug. + Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include ELFUTILS_HEADER(dwfl) + +#include <error.h> + +static const Dwfl_Callbacks callbacks = + { + .find_elf = dwfl_linux_proc_find_elf, + .find_debuginfo = dwfl_standard_find_debuginfo, + }; + +static int +iterate (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + Dwarf_Addr base, void *arg) +{ + if (base != 0x2000) + return DWARF_CB_OK; + + if (dwfl_addrmodule (arg, 0x2100) == NULL) + error (1, 0, "dwfl_addrmodule: %s", dwfl_errmsg (-1)); + + return DWARF_CB_ABORT; +} + +int +main (void) +{ + Dwfl *dwfl = dwfl_begin (&callbacks); + + dwfl_report_module (dwfl, "m1", 0, 0x1000); + dwfl_report_module (dwfl, "m2", 0x2000, 0x3000); + dwfl_report_module (dwfl, "m3", 0x4000, 0x5000); + + dwfl_report_end (dwfl, NULL, NULL); + + ptrdiff_t offset = dwfl_getmodules (dwfl, &iterate, dwfl, 0); + if (offset <= 0) + error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + offset = dwfl_getmodules (dwfl, &iterate, NULL, offset); + if (offset != 0) + error (1, 0, "dwfl_getmodules (%d): %s", (int) offset, dwfl_errmsg (-1)); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/dwfl-bug-report.c b/tests/dwfl-bug-report.c new file mode 100644 index 0000000..459a41a --- /dev/null +++ b/tests/dwfl-bug-report.c @@ -0,0 +1,56 @@ +/* Test program for dwfl_report_end bug. + Copyright (C) 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include ELFUTILS_HEADER(dwfl) + +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> + +static const Dwfl_Callbacks callbacks = + { + .find_elf = dwfl_linux_proc_find_elf, + .find_debuginfo = dwfl_standard_find_debuginfo, + }; + +int +main (void) +{ + Dwfl *dwfl = dwfl_begin (&callbacks); + + for (int i = 0; i < 5; ++i) + { + dwfl_report_begin (dwfl); + dwfl_report_module (dwfl, "module1", 0, 10); + dwfl_report_end (dwfl, NULL, NULL); + } + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c new file mode 100644 index 0000000..94f960f --- /dev/null +++ b/tests/dwflmodtest.c @@ -0,0 +1,295 @@ +/* Test program for libdwfl basic module tracking, relocation. + Copyright (C) 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include <sys/types.h> +#include <stdio.h> +#include <stdio_ext.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> +#include <locale.h> +#include <argp.h> +#include ELFUTILS_HEADER(dwfl) +#include <dwarf.h> + +static bool show_inlines; + +struct info +{ + Dwarf_Die *cudie; + Dwarf_Addr dwbias; +}; + +static int +print_instance (Dwarf_Die *instance, void *arg) +{ + const struct info *info = arg; + + printf (" inlined"); + + Dwarf_Files *files; + if (dwarf_getsrcfiles (info->cudie, &files, NULL) == 0) + { + Dwarf_Attribute attr_mem; + Dwarf_Word val; + if (dwarf_formudata (dwarf_attr (instance, DW_AT_call_file, + &attr_mem), &val) == 0) + { + const char *file = dwarf_filesrc (files, val, NULL, NULL); + int lineno = 0, colno = 0; + if (dwarf_formudata (dwarf_attr (instance, DW_AT_call_line, + &attr_mem), &val) == 0) + lineno = val; + if (dwarf_formudata (dwarf_attr (instance, DW_AT_call_column, + &attr_mem), &val) == 0) + colno = val; + if (lineno == 0) + { + if (file != NULL) + printf (" from %s", file); + } + else if (colno == 0) + printf (" at %s:%u", file, lineno); + else + printf (" at %s:%u:%u", file, lineno, colno); + } + } + + Dwarf_Addr lo = -1, hi = -1, entry = -1; + if (dwarf_lowpc (instance, &lo) == 0) + lo += info->dwbias; + else + printf (" (lowpc => %s)", dwarf_errmsg (-1)); + if (dwarf_highpc (instance, &hi) == 0) + hi += info->dwbias; + else + printf (" (highpc => %s)", dwarf_errmsg (-1)); + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr (instance, DW_AT_entry_pc, &attr_mem); + if (attr != NULL) + { + if (dwarf_formaddr (attr, &entry) == 0) + entry += info->dwbias; + else + printf (" (entrypc => %s)", dwarf_errmsg (-1)); + } + + if (lo != (Dwarf_Addr) -1 || hi != (Dwarf_Addr) -1) + printf (" %#" PRIx64 "..%#" PRIx64, lo, hi); + if (entry != (Dwarf_Addr) -1) + printf (" => %#" PRIx64 "\n", entry); + else + puts (""); + + return DWARF_CB_OK; +} + +static void +print_inline (Dwarf_Die *func, void *arg) +{ + if (dwarf_func_inline_instances (func, &print_instance, arg) != 0) + printf (" error finding instances: %s\n", dwarf_errmsg (-1)); +} + +static int +print_func (Dwarf_Die *func, void *arg) +{ + const struct info *info = arg; + + const char *file = dwarf_decl_file (func); + int line = -1; + dwarf_decl_line (func, &line); + const char *fct = dwarf_diename (func); + + printf (" %s:%d: %s:", file, line, fct); + + if (dwarf_func_inline (func)) + { + puts (" inline function"); + if (show_inlines) + print_inline (func, arg); + } + else + { + Dwarf_Addr lo = -1, hi = -1, entry = -1; + if (dwarf_lowpc (func, &lo) == 0) + lo += info->dwbias; + else + printf (" (lowpc => %s)", dwarf_errmsg (-1)); + if (dwarf_highpc (func, &hi) == 0) + hi += info->dwbias; + else + printf (" (highpc => %s)", dwarf_errmsg (-1)); + if (dwarf_entrypc (func, &entry) == 0) + entry += info->dwbias; + else + printf (" (entrypc => %s)", dwarf_errmsg (-1)); + + if (lo != (Dwarf_Addr) -1 || hi != (Dwarf_Addr) -1 + || entry != (Dwarf_Addr) -1) + printf (" %#" PRIx64 "..%#" PRIx64 " => %#" PRIx64 "\n", + lo, hi, entry); + else + puts (""); + } + + return DWARF_CB_OK; +} + +static int +list_module (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name, Dwarf_Addr base, + void *arg __attribute__ ((unused))) +{ + Dwarf_Addr start; + Dwarf_Addr end; + const char *file; + const char *debug; + if (dwfl_module_info (mod, NULL, &start, &end, + NULL, NULL, &file, &debug) != name + || start != base) + abort (); + printf ("module: %30s %08" PRIx64 "..%08" PRIx64 " %s %s\n", + name, start, end, file, debug); + return DWARF_CB_OK; +} + +static int +print_module (Dwfl_Module *mod __attribute__ ((unused)), + void **userdata __attribute__ ((unused)), + const char *name, Dwarf_Addr base, + Dwarf *dw, Dwarf_Addr bias, + void *arg) +{ + printf ("module: %30s %08" PRIx64 " %s %" PRIx64 " (%s)\n", + name, base, dw == NULL ? "no" : "DWARF", bias, dwfl_errmsg (-1)); + + if (dw != NULL && *(const bool *) arg) + { + Dwarf_Off off = 0; + size_t cuhl; + Dwarf_Off noff; + + while (dwarf_nextcu (dw, off, &noff, &cuhl, NULL, NULL, NULL) == 0) + { + Dwarf_Die die_mem; + struct info info = { dwarf_offdie (dw, off + cuhl, &die_mem), bias }; + (void) dwarf_getfuncs (info.cudie, print_func, &info, 0); + + off = noff; + } + } + + return DWARF_CB_OK; +} + +static bool show_functions; + +/* gettext helper macro. */ +#undef N_ +#define N_(Str) Str + +static const struct argp_option options[] = + { + { "functions", 'f', NULL, 0, N_("Additionally show function names"), 0 }, + { "inlines", 'i', NULL, 0, N_("Show instances of inlined functions"), 0 }, + { NULL, 0, NULL, 0, NULL, 0 } + }; + +static error_t +parse_opt (int key, char *arg __attribute__ ((unused)), + struct argp_state *state __attribute__ ((unused))) +{ + switch (key) + { + case ARGP_KEY_INIT: + state->child_inputs[0] = state->input; + break; + + case 'f': + show_functions = true; + break; + + case 'i': + show_inlines = show_functions = true; + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +int +main (int argc, char **argv) +{ + /* We use no threads here which can interfere with handling a stream. */ + (void) __fsetlocking (stdout, FSETLOCKING_BYCALLER); + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + const struct argp_child argp_children[] = + { + { .argp = dwfl_standard_argp () }, + { .argp = NULL } + }; + const struct argp argp = + { + options, parse_opt, NULL, NULL, argp_children, NULL, NULL + }; + (void) argp_parse (&argp, argc, argv, 0, NULL, &dwfl); + assert (dwfl != NULL); + + ptrdiff_t p = 0; + do + p = dwfl_getmodules (dwfl, &list_module, NULL, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + do + p = dwfl_getdwarf (dwfl, &print_module, &show_functions, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getdwarf: %s", dwfl_errmsg (-1)); + + p = 0; + do + p = dwfl_getmodules (dwfl, &list_module, NULL, p); + while (p > 0); + if (p < 0) + error (2, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1)); + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/early-offscn.c b/tests/early-offscn.c new file mode 100644 index 0000000..8778d50 --- /dev/null +++ b/tests/early-offscn.c @@ -0,0 +1,60 @@ +/* Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <stdio.h> +#include <stdlib.h> + +int +main (int argc, char *argv[]) +{ + if (argc < 2) + error (1, 0, "Usage: %s FILE OFFSET", argv[0]); + + /* Set the ELF version. */ + elf_version (EV_CURRENT); + + /* Open the archive. */ + int fd = open (argv[1], O_RDONLY); + if (fd < 0) + error (1, errno, "cannot open '%s'", argv[1]); + + Elf *elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + error (2, 0, "elf_begin: %s", elf_errmsg (-1)); + + Elf_Scn *scn = gelf_offscn (elf, strtoull (argv[2], NULL, 0)); + if (scn == NULL) + error (3, 0, "gelf_offscn: %s", elf_errmsg (-1)); + + elf_end (elf); + return 0; +} diff --git a/tests/ecp.c b/tests/ecp.c new file mode 100644 index 0000000..9d0a706 --- /dev/null +++ b/tests/ecp.c @@ -0,0 +1,103 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <stdlib.h> +#include <unistd.h> + +int +main (int argc, char *argv[]) +{ + if (argc < 3) + error (EXIT_FAILURE, 0, "usage: %s FROMNAME TONAME", argv[0]); + + elf_version (EV_CURRENT); + + int infd = open (argv[1], O_RDONLY); + if (infd == -1) + error (EXIT_FAILURE, errno, "cannot open input file '%s'", argv[1]); + + Elf *inelf = elf_begin (infd, ELF_C_READ, NULL); + if (inelf == NULL) + error (EXIT_FAILURE, 0, "problems opening '%s' as ELF file: %s", + argv[1], elf_errmsg (-1)); + + int outfd = creat (argv[2], 0666); + if (outfd == -1) + error (EXIT_FAILURE, errno, "cannot open output file '%s'", argv[2]); + + Elf *outelf = elf_begin (outfd, ELF_C_WRITE, NULL); + if (outelf == NULL) + error (EXIT_FAILURE, 0, "problems opening '%s' as ELF file: %s", + argv[2], elf_errmsg (-1)); + + gelf_newehdr (outelf, gelf_getclass (inelf)); + + GElf_Ehdr ehdr_mem; + GElf_Ehdr *ehdr; + gelf_update_ehdr (outelf, (ehdr = gelf_getehdr (inelf, &ehdr_mem))); + + if (ehdr->e_phnum > 0) + { + int cnt; + + if (gelf_newphdr (outelf, ehdr->e_phnum) == 0) + error (EXIT_FAILURE, 0, "cannot create program header: %s", + elf_errmsg (-1)); + + for (cnt = 0; cnt < ehdr->e_phnum; ++cnt) + { + GElf_Phdr phdr_mem; + + gelf_update_phdr (outelf, cnt, gelf_getphdr (inelf, cnt, &phdr_mem)); + } + } + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (inelf, scn)) != NULL) + { + Elf_Scn *newscn = elf_newscn (outelf); + + GElf_Shdr shdr_mem; + gelf_update_shdr (newscn, gelf_getshdr (scn, &shdr_mem)); + + *elf_newdata (newscn) = *elf_getdata (scn, NULL); + } + + elf_flagelf (outelf, ELF_C_SET, ELF_F_LAYOUT); + + if (elf_update (outelf, ELF_C_WRITE) == -1) + error (EXIT_FAILURE, 0, "elf_update failed: %s", elf_errmsg (-1)); + + elf_end (outelf); + close (outfd); + + elf_end (inelf); + + return 0; +} diff --git a/tests/find-prologues.c b/tests/find-prologues.c new file mode 100644 index 0000000..c0e73d0 --- /dev/null +++ b/tests/find-prologues.c @@ -0,0 +1,116 @@ +/* Test program for dwarf_entry_breakpoints. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#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> + + +struct args +{ + Dwfl *dwfl; + Dwarf_Die *cu; + Dwarf_Addr dwbias; + char **argv; +}; + +static int +handle_function (Dwarf_Die *func, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_diename (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; + } + + if (dwarf_func_inline (func)) + return 0; + + Dwarf_Addr entrypc; + if (dwarf_entrypc (func, &entrypc) != 0) + error (EXIT_FAILURE, 0, "dwarf_entrypc: %s: %s", + dwarf_diename (func), dwarf_errmsg (-1)); + entrypc += a->dwbias; + + printf ("%-16s %#.16" PRIx64, dwarf_diename (func), entrypc); + + Dwarf_Addr *bkpts = NULL; + int result = dwarf_entry_breakpoints (func, &bkpts); + if (result <= 0) + printf ("\t%s\n", dwarf_errmsg (-1)); + else + { + for (int i = 0; i < result; ++i) + printf (" %#.16" PRIx64 "%s", bkpts[i] + a->dwbias, + i == result - 1 ? "\n" : ""); + free (bkpts); + } + + 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); + + dwfl_end (a.dwfl); + + return result; +} diff --git a/tests/funcretval.c b/tests/funcretval.c new file mode 100644 index 0000000..3a8750f --- /dev/null +++ b/tests/funcretval.c @@ -0,0 +1,114 @@ +/* Test program for dwfl_module_return_value_location. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#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> + + +struct args +{ + Dwfl *dwfl; + Dwarf_Die *cu; + Dwarf_Addr dwbias; + char **argv; +}; + +static int +handle_function (Dwarf_Die *funcdie, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_diename (funcdie); + char **argv = a->argv; + if (argv[0] != NULL) + { + bool match; + do + match = fnmatch (*argv, name, 0) == 0; + while (!match && *++argv); + if (!match) + return 0; + } + + printf ("(%s) %s: ", dwfl_module_info (dwfl_cumodule (a->cu), NULL, + NULL, NULL, + NULL, NULL, + NULL, NULL), name); + + const Dwarf_Op *locops; + int nlocops = dwfl_module_return_value_location (dwfl_cumodule (a->cu), + funcdie, &locops); + if (nlocops < 0) + error (EXIT_FAILURE, 0, "dwfl_module_return_value_location: %s", + dwfl_errmsg (-1)); + else if (nlocops == 0) + puts ("returns no value"); + else + { + printf ("return value location:"); + for (int i = 0; i < nlocops; ++i) + printf (" {%#x, %#" PRIx64 "}", locops[i].atom, locops[i].number); + puts (""); + } + + 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); + + dwfl_end (a.dwfl); + + return result; +} diff --git a/tests/funcscopes.c b/tests/funcscopes.c new file mode 100644 index 0000000..4b58369 --- /dev/null +++ b/tests/funcscopes.c @@ -0,0 +1,202 @@ +/* Test program for dwarf_getscopes. + Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> +#include <assert.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dwfl) +#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_Die *funcdie, void *arg) +{ + struct args *a = arg; + + const char *name = dwarf_diename (funcdie); + 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 *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); + + dwfl_end (a.dwfl); + + return result; +} diff --git a/tests/get-aranges.c b/tests/get-aranges.c new file mode 100644 index 0000000..c6cd511 --- /dev/null +++ b/tests/get-aranges.c @@ -0,0 +1,150 @@ +/* Copyright (C) 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <libelf.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +static const Dwarf_Addr testaddr[] = +{ + 0x804842b, 0x804842c, 0x804843c, 0x8048459, 0x804845a, + 0x804845b, 0x804845c, 0x8048460, 0x8048465, 0x8048466, + 0x8048467, 0x8048468, 0x8048470, 0x8048471, 0x8048472 +}; +#define ntestaddr (sizeof (testaddr) / sizeof (testaddr[0])) + + +int +main (int argc, char *argv[]) +{ + int result = 0; + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable\n", argv[cnt]); + result = 1; + close (fd); + continue; + } + + Dwarf_Aranges *aranges; + size_t naranges; + if (dwarf_getaranges (dbg, &aranges, &naranges) != 0) + printf ("%s: cannot get aranges\n", argv[cnt]); + else + { + for (size_t i = 0; i < ntestaddr; ++i) + { + Dwarf_Arange *found; + + found = dwarf_getarange_addr (aranges, testaddr[i]); + if (found != NULL) + { + Dwarf_Off cu_offset; + + if (dwarf_getarangeinfo (found, NULL, NULL, &cu_offset) != 0) + { + puts ("failed to get CU die offset"); + result = 1; + } + else + { + const char *cuname; + Dwarf_Die cu_die; + + if (dwarf_offdie (dbg, cu_offset, &cu_die) == NULL + || (cuname = dwarf_diename (&cu_die)) == NULL) + { + puts ("failed to get CU die"); + result = 1; + } + else + printf ("CU name: \"%s\"\n", cuname); + } + } + else + printf ("%#llx: not in range\n", + (unsigned long long int) testaddr[i]); + } + + for (size_t i = 0; i < naranges; ++i) + { + Dwarf_Arange *arange = dwarf_onearange (aranges, i); + if (arange == NULL) + { + printf ("cannot get arange %zu: %s\n", i, dwarf_errmsg (-1)); + break; + } + + Dwarf_Addr start; + Dwarf_Word length; + Dwarf_Off cu_offset; + + if (dwarf_getarangeinfo (arange, &start, &length, &cu_offset) + != 0) + { + printf ("cannot get info from aranges[%zu]\n", i); + result = 1; + } + else + { + printf (" [%2zu] start: %#llx, length: %llu, cu: %llu\n", + i, (unsigned long long int) start, + (unsigned long long int) length, + (unsigned long long int) cu_offset); + + const char *cuname; + Dwarf_Die cu_die; + if (dwarf_offdie (dbg, cu_offset, &cu_die) == NULL + || (cuname = dwarf_diename (&cu_die)) == NULL) + { + puts ("failed to get CU die"); + result = 1; + } + else + printf ("CU name: \"%s\"\n", cuname); + } + } + } + + dwarf_end (dbg); + close (fd); + } + + return result; +} diff --git a/tests/get-files.c b/tests/get-files.c new file mode 100644 index 0000000..81daea2 --- /dev/null +++ b/tests/get-files.c @@ -0,0 +1,115 @@ +/* Copyright (C) 2002, 2004, 2005, 2007 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <libelf.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +int +main (int argc, char *argv[]) +{ + int result = 0; + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable\n", argv[cnt]); + result = 1; + if (fd != -1) + close (fd); + continue; + } + + Dwarf_Off o = 0; + Dwarf_Off ncu; + Dwarf_Off ao; + size_t cuhl; + uint8_t asz; + uint8_t osz; + while (dwarf_nextcu (dbg, o, &ncu, &cuhl, &ao, &asz, &osz) == 0) + { + printf ("cuhl = %zu, o = %llu, asz = %hhu, osz = %hhu, ncu = %llu\n", + cuhl, (unsigned long long int) ao, + asz, osz, (unsigned long long int) ncu); + + Dwarf_Die die_mem; + Dwarf_Die *die = dwarf_offdie (dbg, o + cuhl, &die_mem); + if (die == NULL) + { + printf ("%s: cannot get CU die\n", argv[cnt]); + result = 1; + break; + } + + Dwarf_Files *files; + size_t nfiles; + if (dwarf_getsrcfiles (die, &files, &nfiles) != 0) + { + printf ("%s: cannot get files\n", argv[cnt]); + result = 1; + break; + } + + const char *const *dirs; + size_t ndirs; + if (dwarf_getsrcdirs (files, &dirs, &ndirs) != 0) + { + printf ("%s: cannot get include directories\n", argv[cnt]); + result = 1; + break; + } + + if (dirs[0] == NULL) + puts (" dirs[0] = (null)"); + else + printf (" dirs[0] = \"%s\"\n", dirs[0]); + for (size_t i = 1; i < ndirs; ++i) + printf (" dirs[%zu] = \"%s\"\n", i, dirs[i]); + + for (size_t i = 0; i < nfiles; ++i) + printf (" file[%zu] = \"%s\"\n", i, + dwarf_filesrc (files, i, NULL, NULL)); + + o = ncu; + } + + dwarf_end (dbg); + close (fd); + } + + return result; +} diff --git a/tests/get-lines.c b/tests/get-lines.c new file mode 100644 index 0000000..45d2c8d --- /dev/null +++ b/tests/get-lines.c @@ -0,0 +1,145 @@ +/* Copyright (C) 2002, 2004 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <inttypes.h> +#include <libelf.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +int +main (int argc, char *argv[]) +{ + int result = 0; + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable: %s\n", argv[cnt], dwarf_errmsg (-1)); + close (fd); + continue; + } + + Dwarf_Off cuoff = 0; + Dwarf_Off old_cuoff = 0; + size_t hsize; + Dwarf_Off ao; + uint8_t asz; + uint8_t osz; + while (dwarf_nextcu (dbg, cuoff, &cuoff, &hsize, &ao, &asz, &osz) == 0) + { + printf ("cuhl = %zu, o = %llu, asz = %hhu, osz = %hhu, ncu = %llu\n", + hsize, (unsigned long long int) ao, + asz, osz, (unsigned long long int) cuoff); + + /* Get the DIE for the CU. */ + Dwarf_Die die; + if (dwarf_offdie (dbg, old_cuoff + hsize, &die) == NULL) + { + /* Something went wrong. */ + printf ("%s: cannot get CU die\n", argv[cnt]); + result = 1; + break; + } + old_cuoff = cuoff; + + Dwarf_Lines *lb; + size_t nlb; + if (dwarf_getsrclines (&die, &lb, &nlb) != 0) + { + printf ("%s: cannot get lines\n", argv[cnt]); + result = 1; + break; + } + + printf (" %zu lines\n", nlb); + + for (size_t i = 0; i < nlb; ++i) + { + Dwarf_Line *l = dwarf_onesrcline (lb, i); + if (l == NULL) + { + printf ("%s: cannot get individual line\n", argv[cnt]); + result = 1; + break; + } + + Dwarf_Addr addr; + if (dwarf_lineaddr (l, &addr) != 0) + addr = 0; + const char *file = dwarf_linesrc (l, NULL, NULL); + int line; + if (dwarf_lineno (l, &line) != 0) + line = 0; + + printf ("%" PRIx64 ": %s:%d:", (uint64_t) addr, + file ?: "???", line); + + int column; + if (dwarf_linecol (l, &column) != 0) + column = 0; + if (column >= 0) + printf ("%d:", column); + + bool is_stmt; + if (dwarf_linebeginstatement (l, &is_stmt) != 0) + is_stmt = false; + bool end_sequence; + if (dwarf_lineendsequence (l, &end_sequence) != 0) + end_sequence = false; + bool basic_block; + if (dwarf_lineblock (l, &basic_block) != 0) + basic_block = false; + bool prologue_end; + if (dwarf_lineprologueend (l, &prologue_end) != 0) + prologue_end = false; + bool epilogue_begin; + if (dwarf_lineepiloguebegin (l, &epilogue_begin) != 0) + epilogue_begin = false; + + printf (" is_stmt:%s, end_seq:%s, bb:%s, prologue:%s, epilogue:%s\n", + is_stmt ? "yes" : "no", end_sequence ? "yes" : "no", + basic_block ? "yes" : "no", prologue_end ? "yes" : "no", + epilogue_begin ? "yes" : "no"); + } + } + + dwarf_end (dbg); + close (fd); + } + + return result; +} diff --git a/tests/get-pubnames.c b/tests/get-pubnames.c new file mode 100644 index 0000000..f1361c6 --- /dev/null +++ b/tests/get-pubnames.c @@ -0,0 +1,106 @@ +/* Copyright (C) 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <libelf.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +static int globcnt; + +static int +callback (Dwarf *dbg, Dwarf_Global *gl, void *arg __attribute__ ((unused))) +{ + int result = DWARF_CB_OK; + + printf (" [%2d] \"%s\", die: %llu, cu: %llu\n", + globcnt++, gl->name, (unsigned long long int) gl->die_offset, + (unsigned long long int) gl->cu_offset); + + Dwarf_Die cu_die; + const char *cuname; + if (dwarf_offdie (dbg, gl->cu_offset, &cu_die) == NULL + || (cuname = dwarf_diename (&cu_die)) == NULL) + { + puts ("failed to get CU die"); + result = DWARF_CB_ABORT; + } + else + printf ("CU name: \"%s\"\n", cuname); + + const char *diename; + Dwarf_Die die; + if (dwarf_offdie (dbg, gl->die_offset, &die) == NULL + || (diename = dwarf_diename (&die)) == NULL) + { + puts ("failed to get object die"); + result = DWARF_CB_ABORT; + } + else + printf ("object name: \"%s\"\n", diename); + + return result; +} + + +int +main (int argc, char *argv[]) +{ + int result = 0; + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable: %s\n", argv[cnt], dwarf_errmsg (-1)); + result = 1; + close (fd); + continue; + } + + globcnt = 0; + + if (dwarf_getpubnames (dbg, callback, NULL, 0) != 0) + { + printf ("dwarf_get_pubnames didn't return zero: %s\n", + dwarf_errmsg (-1)); + result = 1; + } + + dwarf_end (dbg); + close (fd); + } + + return result; +} diff --git a/tests/hash.c b/tests/hash.c new file mode 100644 index 0000000..ab7efeb --- /dev/null +++ b/tests/hash.c @@ -0,0 +1,53 @@ +/* Copyright (C) 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libelf.h> +#include <stdio.h> + + +static int +check (const char *name, unsigned long int expected) +{ + unsigned long int actual = elf_hash (name); + + return actual != expected; +} + + +int +main (void) +{ + int status; + + /* Check some names. We know what the expected result is. */ + status = check ("_DYNAMIC", 165832675); + status |= check ("_GLOBAL_OFFSET_TABLE_", 102264335); + + return status; +} diff --git a/tests/line2addr.c b/tests/line2addr.c new file mode 100644 index 0000000..5630da3 --- /dev/null +++ b/tests/line2addr.c @@ -0,0 +1,156 @@ +/* Copyright (C) 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <assert.h> +#include ELFUTILS_HEADER(dwfl) +#include <argp.h> +#include <stdio.h> +#include <locale.h> +#include <stdlib.h> +#include <string.h> +#include <error.h> + + +static void +print_address (Dwfl_Module *mod, Dwarf_Addr address) +{ + int n = dwfl_module_relocations (mod); + if (n < 0) + error (0, 0, "dwfl_module_relocations: %s", dwfl_errmsg (-1)); + else if (n > 0) + { + int i = dwfl_module_relocate_address (mod, &address); + if (i < 0) + error (0, 0, "dwfl_module_relocate_address: %s", dwfl_errmsg (-1)); + else + { + const char *modname = dwfl_module_info (mod, NULL, NULL, NULL, + NULL, NULL, NULL, NULL); + const char *secname = dwfl_module_relocation_info (mod, i, NULL); + if (n > 1 || secname[0] != '\0') + printf ("%s(%s)+%#" PRIx64, modname, secname, address); + else + printf ("%s+%#" PRIx64, modname, address); + return; + } + } + + printf ("%#" PRIx64, address); +} + + +struct args +{ + const char *arg; + char *file; + int line; +}; + +static int +handle_module (Dwfl_Module *mod __attribute__ ((unused)), + void **udata __attribute__ ((unused)), + const char *modname, Dwarf_Addr base __attribute__ ((unused)), + Dwarf *dbg __attribute__ ((unused)), + Dwarf_Addr bias __attribute__ ((unused)), void *arg) +{ + const struct args *const a = arg; + + Dwfl_Line **lines = NULL; + size_t nlines = 0; + + if (dwfl_module_getsrc_file (mod, a->file, a->line, 0, &lines, &nlines) == 0) + { + for (size_t inner = 0; inner < nlines; ++inner) + { + Dwarf_Addr addr; + int line = a->line, col = 0; + const char *file = dwfl_lineinfo (lines[inner], &addr, &line, &col, + NULL, NULL); + if (file != NULL) + { + printf ("%s -> ", a->arg); + print_address (mod, addr); + if (modname[0] != '\0') + printf (" (%s:", modname); + if (strcmp (file, a->file) || line != a->line || col != 0) + printf (" %s%s:%d", modname[0] != '\0' ? "" : "(", + file, line); + if (col != 0) + printf (":%d", col); + if (modname[0] != '\0' + || strcmp (file, a->file) || line != a->line || col != 0) + puts (")"); + else + puts (""); + } + } + free (lines); + } + + return DWARF_CB_OK; +} + +int +main (int argc, char *argv[]) +{ + int cnt; + + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + + Dwfl *dwfl = NULL; + (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &cnt, &dwfl); + assert (dwfl != NULL); + + for (; cnt < argc; ++cnt) + { + struct args a = { .arg = argv[cnt] }; + + switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line)) + { + default: + case 0: + printf ("ignored %s\n", argv[cnt]); + continue; + case 1: + a.line = 0; + break; + case 2: + break; + } + + (void) dwfl_getdwarf (dwfl, &handle_module, &a, 0); + + free (a.file); + } + + dwfl_end (dwfl); + + return 0; +} diff --git a/tests/msg_tst.c b/tests/msg_tst.c new file mode 100644 index 0000000..f239096 --- /dev/null +++ b/tests/msg_tst.c @@ -0,0 +1,112 @@ +/* Copyright (C) 2002, 2005, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <libelfP.h> + +static struct +{ + int id; + const char *expected; +} libelf_msgs[ELF_E_NUM] = + { + { ELF_E_NOERROR, "no error" }, + { ELF_E_UNKNOWN_ERROR, "unknown error" }, + { ELF_E_UNKNOWN_VERSION, "unknown version" }, + { ELF_E_UNKNOWN_TYPE, "unknown type" }, + { ELF_E_INVALID_HANDLE, "invalid `Elf' handle" }, + { ELF_E_SOURCE_SIZE, "invalid size of source operand" }, + { ELF_E_DEST_SIZE, "invalid size of destination operand" }, + { ELF_E_INVALID_ENCODING, "invalid encoding" }, + { ELF_E_NOMEM, "out of memory" }, + { ELF_E_INVALID_FILE, "invalid file descriptor" }, + { ELF_E_INVALID_OP, "invalid operation" }, + { ELF_E_NO_VERSION, "ELF version not set" }, + { ELF_E_INVALID_CMD, "invalid command" }, + { ELF_E_RANGE, "offset out of range" }, + { ELF_E_ARCHIVE_FMAG, "invalid fmag field in archive header" }, + { ELF_E_INVALID_ARCHIVE, "invalid archive file" }, + { ELF_E_NO_ARCHIVE, "descriptor is not for an archive" }, + { ELF_E_NO_INDEX, "no index available" }, + { ELF_E_READ_ERROR, "cannot read data from file" }, + { ELF_E_WRITE_ERROR, "cannot write data to file" }, + { ELF_E_INVALID_CLASS, "invalid binary class" }, + { ELF_E_INVALID_INDEX, "invalid section index" }, + { ELF_E_INVALID_OPERAND, "invalid operand" }, + { ELF_E_INVALID_SECTION, "invalid section" }, + { ELF_E_INVALID_COMMAND, "invalid command" }, + { ELF_E_WRONG_ORDER_EHDR, "executable header not created first" }, + { ELF_E_FD_DISABLED, "file descriptor disabled" }, + { ELF_E_FD_MISMATCH, "archive/member file descriptor mismatch" }, + { ELF_E_OFFSET_RANGE, "offset out of range" }, + { ELF_E_NOT_NUL_SECTION, "cannot manipulate null section" }, + { ELF_E_DATA_MISMATCH, "data/scn mismatch" }, + { ELF_E_INVALID_SECTION_HEADER, "invalid section header" }, + { ELF_E_INVALID_DATA, "invalid data" }, + { ELF_E_DATA_ENCODING, "unknown data encoding" }, + { ELF_E_SECTION_TOO_SMALL, "section `sh_size' too small for data" }, + { ELF_E_INVALID_ALIGN, "invalid section alignment" }, + { ELF_E_INVALID_SHENTSIZE, "invalid section entry size" }, + { ELF_E_UPDATE_RO, "update() for write on read-only file" }, + { ELF_E_NOFILE, "no such file" }, + { ELF_E_GROUP_NOT_REL, + "only relocatable files can contain section groups" }, + { ELF_E_INVALID_PHDR, + "program header only allowed in executables, shared objects, \ +and core files" }, + { ELF_E_NO_PHDR, "file has no program header" }, + { ELF_E_INVALID_OFFSET, "invalid offset" } + }; + + +int +main (void) +{ + size_t cnt; + int result = EXIT_SUCCESS; + + /* Clear the error state. */ + (void) elf_errno (); + + /* Check all the messages of libelf. */ + for (cnt = 1; cnt < ELF_E_NUM; ++cnt) + { + const char *str = elf_errmsg (libelf_msgs[cnt].id); + + if (strcmp (str, libelf_msgs[cnt].expected) != 0) + { + printf ("libelf msg %zu: expected \"%s\", got \"%s\"\n", + cnt, libelf_msgs[cnt].expected, str); + result = EXIT_FAILURE; + } + } + + return result; +} diff --git a/tests/newfile.c b/tests/newfile.c new file mode 100644 index 0000000..f8b132f --- /dev/null +++ b/tests/newfile.c @@ -0,0 +1,178 @@ +/* Copyright (C) 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1999. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +static void +print_ehdr (Elf32_Ehdr *ehdr) +{ + int n; + + for (n = 0; n < EI_NIDENT; ++n) + printf (" %02x", ehdr->e_ident[n]); + + printf ("\ntype = %d\nmachine = %d\nversion = %d\nentry = %d\n" + "phoff = %d\nshoff = %d\nflags = %d\nehsize = %d\n" + "phentsize = %d\nphnum = %d\nshentsize = %d\nshnum = %d\n" + "shstrndx = %d\n", + ehdr->e_type, + ehdr->e_machine, + ehdr->e_version, + ehdr->e_entry, + ehdr->e_phoff, + ehdr->e_shoff, + ehdr->e_flags, + ehdr->e_ehsize, + ehdr->e_phentsize, + ehdr->e_phnum, + ehdr->e_shentsize, + ehdr->e_shnum, + ehdr->e_shstrndx); +} + +int +main (int argc, char *argv[] __attribute__ ((unused))) +{ + Elf *elf; + int result = 0; + int fd; + char fname[] = "newfile-XXXXXX"; + + fd = mkstemp (fname); + if (fd == -1) + { + printf ("cannot create temporary file: %m\n"); + exit (1); + } + /* Remove the file when we exit. */ + unlink (fname); + + elf_version (EV_CURRENT); + elf = elf_begin (fd, ELF_C_WRITE, NULL); + if (elf == NULL) + { + printf ("elf_begin: %s\n", elf_errmsg (-1)); + result = 1; + } + else + { + if (elf32_newehdr (elf) == NULL) + { + printf ("elf32_newehdr: %s\n", elf_errmsg (-1)); + result = 1; + } + else + { + Elf32_Ehdr *ehdr = elf32_getehdr (elf); + + if (ehdr == NULL) + { + printf ("elf32_getehdr: %s\n", elf_errmsg (-1)); + result = 1; + } + else + { + int i; + + if (argc > 1) + /* Use argc as a debugging flag. */ + print_ehdr (ehdr); + + /* Some tests. */ + for (i = 0; i < EI_NIDENT; ++i) + if (ehdr->e_ident[i] != 0) + { + printf ("ehdr->e_ident[%d] != 0\n", i); + result = 1; + break; + } + +#define VALUE_TEST(name, val) \ + if (ehdr->name != val) \ + { \ + printf ("ehdr->%s != %d\n", #name, val); \ + result = 1; \ + } +#define ZERO_TEST(name) VALUE_TEST (name, 0) + ZERO_TEST (e_type); + ZERO_TEST (e_machine); + ZERO_TEST (e_version); + ZERO_TEST (e_entry); + ZERO_TEST (e_phoff); + ZERO_TEST (e_shoff); + ZERO_TEST (e_flags); + ZERO_TEST (e_ehsize); + ZERO_TEST (e_phentsize); + ZERO_TEST (e_phnum); + ZERO_TEST (e_shentsize); + ZERO_TEST (e_shnum); + ZERO_TEST (e_shstrndx); + + if (elf32_newphdr (elf, 10) == NULL) + { + printf ("elf32_newphdr: %s\n", elf_errmsg (-1)); + result = 1; + } + else + { + if (argc > 1) + print_ehdr (ehdr); + + ehdr = elf32_getehdr (elf); + if (ehdr == NULL) + { + printf ("elf32_getehdr (#2): %s\n", elf_errmsg (-1)); + result = 1; + } + else + { + ZERO_TEST (e_type); + ZERO_TEST (e_machine); + ZERO_TEST (e_version); + ZERO_TEST (e_entry); + ZERO_TEST (e_phoff); + ZERO_TEST (e_shoff); + ZERO_TEST (e_flags); + ZERO_TEST (e_ehsize); + VALUE_TEST (e_phentsize, (int) sizeof (Elf32_Phdr)); + VALUE_TEST (e_phnum, 10); + ZERO_TEST (e_shentsize); + ZERO_TEST (e_shnum); + ZERO_TEST (e_shstrndx); + } + } + } + } + + (void) elf_end (elf); + } + + return result; +} diff --git a/tests/newscn.c b/tests/newscn.c new file mode 100644 index 0000000..56eae97 --- /dev/null +++ b/tests/newscn.c @@ -0,0 +1,74 @@ +/* Copyright (C) 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +int +main (void) +{ + Elf *elf; + int fd; + Elf_Scn *section; + + if (elf_version (EV_CURRENT) == EV_NONE) + { + fprintf (stderr, "library fd of date\n"); + exit (1); + } + + char name[] = "test.XXXXXX"; + fd = mkstemp (name); + if (fd < 0) + { + fprintf (stderr, "Failed to open fdput file: %s\n", name); + exit (1); + } + unlink (name); + + elf = elf_begin (fd, ELF_C_WRITE, NULL); + if (elf == NULL) + { + fprintf (stderr, "Failed to elf_begin fdput file: %s\n", name); + exit (1); + } + + section = elf_newscn (elf); + section = elf_nextscn (elf, section); + assert (section == NULL); + + elf_end (elf); + close (fd); + + return 0; +} diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c new file mode 100644 index 0000000..263be0f --- /dev/null +++ b/tests/rdwrmmap.c @@ -0,0 +1,29 @@ +#include <errno.h> +#include <error.h> +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <libelf.h> + +int +main (int argc __attribute__ ((unused)), char *argv[]) +{ + int fd = open (argv[1], O_RDWR); + if (fd < 0) + error (2, errno, "open: %s", argv[1]); + + if (elf_version (EV_CURRENT) == EV_NONE) + error (1, 0, "libelf version mismatch"); + + Elf *elf = elf_begin (fd, ELF_C_RDWR_MMAP, NULL); + if (elf == NULL) + error (1, 0, "elf_begin: %s", elf_errmsg (-1)); + + if (elf_update (elf, ELF_C_WRITE) < 0) + error (1, 0, "elf_update: %s", elf_errmsg (-1)); + + elf_end (elf); + close (fd); + + return 0; +} diff --git a/tests/run-addrname-test.sh b/tests/run-addrname-test.sh new file mode 100755 index 0000000..d525523 --- /dev/null +++ b/tests/run-addrname-test.sh @@ -0,0 +1,222 @@ +#! /bin/sh +# Copyright (C) 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile34 testfile38 testfile41 testfile49 + +testrun_compare ../src/addr2line -f -e testfile34 \ + 0x08048074 0x08048075 0x08048076 \ + 0x08049078 0x08048080 0x08049080 <<\EOF +foo +??:0 +bar +??:0 +_etext +??:0 +data1 +??:0 +?? +??:0 +_end +??:0 +EOF + +testrun_compare ../src/addr2line -S -e testfile38 0x02 0x10a 0x211 0x31a <<\EOF +t1_global_outer+0x2 +??:0 +t2_global_symbol+0x2 +??:0 +t3_global_after_0+0x1 +??:0 +(.text)+0x31a +??:0 +EOF + +testrun_compare ../src/addr2line -S -e testfile41 0x1 0x104 <<\EOF +small_global_at_large_global+0x1 +??:0 +small_global_first_at_large_global+0x1 +??:0 +EOF + +testfiles testfile12 testfile14 +tempfiles testmaps + +cat > testmaps <<EOF +00400000-00401000 r-xp 00000000 fd:01 4006812 `pwd`/testfile14 +00500000-00501000 rw-p 00000000 fd:01 4006812 `pwd`/testfile14 +01000000-01001000 r-xp 00000000 fd:01 1234567 `pwd`/testfile12 +01100000-01011000 rw-p 00000000 fd:01 1234567 `pwd`/testfile12 +2aaaaaaab000-2aaaaaaad000 rw-p 2aaaaaaab000 00:00 0 +2aaaaaae2000-2aaaaaae3000 rw-p 2aaaaaae2000 00:00 0 +7fff61068000-7fff6107d000 rw-p 7ffffffea000 00:00 0 [stack] +7fff611fe000-7fff61200000 r-xp 7fff611fe000 00:00 0 [vdso] +ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] +EOF + +testrun_compare ../src/addr2line -S -M testmaps 0x40047c 0x10009db <<\EOF +caller+0x14 +/home/drepper/local/elfutils-build/20050425/v.c:11 +foo+0xb +/home/drepper/local/elfutils-build/20030710/u.c:5 +EOF + +# .section .text +# nop #0 +#sizeless_foo: +# nop #1 +# nop #2 +#sized_bar: +# nop #3 +# nop #4 +#sizeless_baz: +# nop #5 +# nop #6 +# .size sized_bar, . - sized_bar +# nop #7 +# nop #8 +#sizeless_x: +# nop #9 +# .org 0x100 +# nop #0 +# .globl global_outer +#global_outer: +# nop #1 +# nop #2 +# .globl global_in_global +#global_in_global: +# nop #3 +# nop #4 +# .size global_in_global, . - global_in_global +#local_in_global: +# nop #5 +# nop #6 +# .size local_in_global, . - local_in_global +# nop #7 +# nop #8 +#.Lsizeless1: +# nop #9 +# nop #10 +# .size global_outer, . - global_outer +# nop #11 +# .org 0x200 +# nop #0 +#local_outer: +# nop #1 +# nop #2 +# .globl global_in_local +#global_in_local: +# nop #3 +# nop #4 +# .size global_in_local, . - global_in_local +#local_in_local: +# nop #5 +# nop #6 +# .size local_in_local, . - local_in_local +# nop #7 +# nop #8 +#.Lsizeless2: +# nop #9 +# nop #10 +# .size local_outer, . - local_outer +# nop #11 +testrun_compare ../src/addr2line -S -e testfile49 \ + 0 1 2 3 4 5 6 7 8 9 \ + 0x100 0x101 0x102 0x103 0x104 0x105 \ + 0x106 0x107 0x108 0x109 0x10a 0x10b \ + 0x200 0x201 0x202 0x203 0x204 0x205 \ + 0x206 0x207 0x208 0x209 0x20a 0x20b <<\EOF +(.text)+0 +??:0 +sizeless_foo +??:0 +sizeless_foo+0x1 +??:0 +sized_bar +??:0 +sized_bar+0x1 +??:0 +sized_bar+0x2 +??:0 +sized_bar+0x3 +??:0 +(.text)+0x7 +??:0 +(.text)+0x8 +??:0 +sizeless_x +??:0 +sizeless_x+0xf7 +??:0 +global_outer +??:0 +global_outer+0x1 +??:0 +global_in_global +??:0 +global_in_global+0x1 +??:0 +global_outer+0x4 +??:0 +global_outer+0x5 +??:0 +global_outer+0x6 +??:0 +global_outer+0x7 +??:0 +global_outer+0x8 +??:0 +global_outer+0x9 +??:0 +(.text)+0x10b +??:0 +(.text)+0x200 +??:0 +local_outer +??:0 +local_outer+0x1 +??:0 +global_in_local +??:0 +global_in_local+0x1 +??:0 +local_in_local +??:0 +local_in_local+0x1 +??:0 +local_outer+0x6 +??:0 +local_outer+0x7 +??:0 +local_outer+0x8 +??:0 +local_outer+0x9 +??:0 +(.text)+0x20b +??:0 +EOF + +exit 0 diff --git a/tests/run-addrscopes.sh b/tests/run-addrscopes.sh new file mode 100755 index 0000000..d13c55d --- /dev/null +++ b/tests/run-addrscopes.sh @@ -0,0 +1,51 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile22 + +testrun_compare ./addrscopes -e testfile22 0x8048353 <<\EOF +0x8048353: + tests/foo.c (0x11): 0x8048348 (tests/foo.c:5) .. 0x804837e (tests/foo.c:16) + global [ be] + function (0x2e): 0x8048348 (tests/foo.c:5) .. 0x804835b (tests/foo.c:14) + local [ 8f] +EOF + +test_cleanup + +testfiles testfile24 +testrun_compare ./addrscopes -e testfile24 0x804834e <<\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 + +exit 0 diff --git a/tests/run-allfcts.sh b/tests/run-allfcts.sh new file mode 100755 index 0000000..e990a63 --- /dev/null +++ b/tests/run-allfcts.sh @@ -0,0 +1,48 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 testfile8 + +testrun_compare ./allfcts testfile testfile2 testfile8 <<\EOF +/home/drepper/gnu/new-bu/build/ttt/m.c:5:main +/home/drepper/gnu/new-bu/build/ttt/b.c:4:bar +/home/drepper/gnu/new-bu/build/ttt/f.c:3:foo +/shoggoth/drepper/b.c:4:bar +/shoggoth/drepper/f.c:3:foo +/shoggoth/drepper/m.c:5:main +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:107:main +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:159:print_version +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:173:parse_opt +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:201:more_help +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:217:process_file +/usr/include/sys/stat.h:375:stat64 +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:291:crc32_file +/home/drepper/gnu/elfutils/build/src/../../src/strip.c:313:handle_elf +EOF + +exit 0 diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh new file mode 100755 index 0000000..7ebaa71 --- /dev/null +++ b/tests/run-allregs.sh @@ -0,0 +1,2595 @@ +#! /bin/sh +# Copyright (C) 2005, 2006, 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +regs_test() +{ + tempfiles good.regs + cat > good.regs + testfiles "$@" + for f; do testrun_compare ./allregs -e $f < good.regs; done + test_cleanup +} + +regs_test testfile11 <<\EOF +integer registers: + 0: %eax (eax), signed 32 bits + 1: %ecx (ecx), signed 32 bits + 2: %edx (edx), signed 32 bits + 3: %ebx (ebx), signed 32 bits + 4: %esp (esp), address 32 bits + 5: %ebp (ebp), address 32 bits + 6: %esi (esi), signed 32 bits + 7: %edi (edi), signed 32 bits + 8: %eip (eip), address 32 bits + 9: %eflags (eflags), unsigned 32 bits + 10: %trapno (trapno), unsigned 32 bits +FPU-control registers: + 37: %fctrl (fctrl), unsigned 16 bits + 38: %fstat (fstat), unsigned 16 bits + 39: %mxcsr (mxcsr), unsigned 32 bits +MMX registers: + 29: %mm0 (mm0), unsigned 64 bits + 30: %mm1 (mm1), unsigned 64 bits + 31: %mm2 (mm2), unsigned 64 bits + 32: %mm3 (mm3), unsigned 64 bits + 33: %mm4 (mm4), unsigned 64 bits + 34: %mm5 (mm5), unsigned 64 bits + 35: %mm6 (mm6), unsigned 64 bits + 36: %mm7 (mm7), unsigned 64 bits +SSE registers: + 21: %xmm0 (xmm0), unsigned 128 bits + 22: %xmm1 (xmm1), unsigned 128 bits + 23: %xmm2 (xmm2), unsigned 128 bits + 24: %xmm3 (xmm3), unsigned 128 bits + 25: %xmm4 (xmm4), unsigned 128 bits + 26: %xmm5 (xmm5), unsigned 128 bits + 27: %xmm6 (xmm6), unsigned 128 bits + 28: %xmm7 (xmm7), unsigned 128 bits +segment registers: + 40: %es (es), unsigned 16 bits + 41: %cs (cs), unsigned 16 bits + 42: %ss (ss), unsigned 16 bits + 43: %ds (ds), unsigned 16 bits + 44: %fs (fs), unsigned 16 bits + 45: %gs (gs), unsigned 16 bits +x87 registers: + 11: %st0 (st0), float 80 bits + 12: %st1 (st1), float 80 bits + 13: %st2 (st2), float 80 bits + 14: %st3 (st3), float 80 bits + 15: %st4 (st4), float 80 bits + 16: %st5 (st5), float 80 bits + 17: %st6 (st6), float 80 bits + 18: %st7 (st7), float 80 bits +EOF + +regs_test testfile12 <<\EOF +integer registers: + 0: %rax (rax), signed 64 bits + 1: %rdx (rdx), signed 64 bits + 2: %rcx (rcx), signed 64 bits + 3: %rbx (rbx), signed 64 bits + 4: %rsi (rsi), signed 64 bits + 5: %rdi (rdi), signed 64 bits + 6: %rbp (rbp), address 64 bits + 7: %rsp (rsp), address 64 bits + 8: %r8 (r8), signed 64 bits + 9: %r9 (r9), signed 64 bits + 10: %r10 (r10), signed 64 bits + 11: %r11 (r11), signed 64 bits + 12: %r12 (r12), signed 64 bits + 13: %r13 (r13), signed 64 bits + 14: %r14 (r14), signed 64 bits + 15: %r15 (r15), signed 64 bits + 16: %rip (rip), address 64 bits + 49: %rflags (rflags), unsigned 64 bits +MMX registers: + 41: %mm0 (mm0), unsigned 64 bits + 42: %mm1 (mm1), unsigned 64 bits + 43: %mm2 (mm2), unsigned 64 bits + 44: %mm3 (mm3), unsigned 64 bits + 45: %mm4 (mm4), unsigned 64 bits + 46: %mm5 (mm5), unsigned 64 bits + 47: %mm6 (mm6), unsigned 64 bits + 48: %mm7 (mm7), unsigned 64 bits +SSE registers: + 17: %xmm0 (xmm0), unsigned 128 bits + 18: %xmm1 (xmm1), unsigned 128 bits + 19: %xmm2 (xmm2), unsigned 128 bits + 20: %xmm3 (xmm3), unsigned 128 bits + 21: %xmm4 (xmm4), unsigned 128 bits + 22: %xmm5 (xmm5), unsigned 128 bits + 23: %xmm6 (xmm6), unsigned 128 bits + 24: %xmm7 (xmm7), unsigned 128 bits + 25: %xmm8 (xmm8), unsigned 128 bits + 26: %xmm9 (xmm9), unsigned 128 bits + 27: %xmm10 (xmm10), unsigned 128 bits + 28: %xmm11 (xmm11), unsigned 128 bits + 29: %xmm12 (xmm12), unsigned 128 bits + 30: %xmm13 (xmm13), unsigned 128 bits + 31: %xmm14 (xmm14), unsigned 128 bits + 32: %xmm15 (xmm15), unsigned 128 bits +control registers: + 62: %tr (tr), unsigned 64 bits + 63: %ldtr (ldtr), unsigned 64 bits + 64: %mxcsr (mxcsr), unsigned 64 bits + 65: %fcw (fcw), unsigned 16 bits + 66: %fsw (fsw), unsigned 16 bits +segment registers: + 50: %es (es), unsigned 16 bits + 51: %cs (cs), unsigned 16 bits + 52: %ss (ss), unsigned 16 bits + 53: %ds (ds), unsigned 16 bits + 54: %fs (fs), unsigned 16 bits + 55: %gs (gs), unsigned 16 bits + 58: %fs.base (fs.base), address 64 bits + 59: %gs.base (gs.base), address 64 bits +x87 registers: + 33: %st0 (st0), float 80 bits + 34: %st1 (st1), float 80 bits + 35: %st2 (st2), float 80 bits + 36: %st3 (st3), float 80 bits + 37: %st4 (st4), float 80 bits + 38: %st5 (st5), float 80 bits + 39: %st6 (st6), float 80 bits + 40: %st7 (st7), float 80 bits +EOF + +regs_test testfile2 <<\EOF +integer registers: + 0: r0 (r0), signed 32 bits + 1: r1 (r1), signed 32 bits + 2: r2 (r2), signed 32 bits + 3: r3 (r3), signed 32 bits + 4: r4 (r4), signed 32 bits + 5: r5 (r5), signed 32 bits + 6: r6 (r6), signed 32 bits + 7: r7 (r7), signed 32 bits + 8: r8 (r8), signed 32 bits + 9: r9 (r9), signed 32 bits + 10: r10 (r10), signed 32 bits + 11: r11 (r11), signed 32 bits + 12: r12 (r12), signed 32 bits + 13: r13 (r13), signed 32 bits + 14: r14 (r14), signed 32 bits + 15: r15 (r15), signed 32 bits + 16: r16 (r16), signed 32 bits + 17: r17 (r17), signed 32 bits + 18: r18 (r18), signed 32 bits + 19: r19 (r19), signed 32 bits + 20: r20 (r20), signed 32 bits + 21: r21 (r21), signed 32 bits + 22: r22 (r22), signed 32 bits + 23: r23 (r23), signed 32 bits + 24: r24 (r24), signed 32 bits + 25: r25 (r25), signed 32 bits + 26: r26 (r26), signed 32 bits + 27: r27 (r27), signed 32 bits + 28: r28 (r28), signed 32 bits + 29: r29 (r29), signed 32 bits + 30: r30 (r30), signed 32 bits + 31: r31 (r31), signed 32 bits + 64: cr (cr), unsigned 32 bits + 66: msr (msr), unsigned 32 bits +FPU registers: + 32: f0 (f0), float 64 bits + 33: f1 (f1), float 64 bits + 34: f2 (f2), float 64 bits + 35: f3 (f3), float 64 bits + 36: f4 (f4), float 64 bits + 37: f5 (f5), float 64 bits + 38: f6 (f6), float 64 bits + 39: f7 (f7), float 64 bits + 40: f8 (f8), float 64 bits + 41: f9 (f9), float 64 bits + 42: f10 (f10), float 64 bits + 43: f11 (f11), float 64 bits + 44: f12 (f12), float 64 bits + 45: f13 (f13), float 64 bits + 46: f14 (f14), float 64 bits + 47: f15 (f15), float 64 bits + 48: f16 (f16), float 64 bits + 49: f17 (f17), float 64 bits + 50: f18 (f18), float 64 bits + 51: f19 (f19), float 64 bits + 52: f20 (f20), float 64 bits + 53: f21 (f21), float 64 bits + 54: f22 (f22), float 64 bits + 55: f23 (f23), float 64 bits + 56: f24 (f24), float 64 bits + 57: f25 (f25), float 64 bits + 58: f26 (f26), float 64 bits + 59: f27 (f27), float 64 bits + 60: f28 (f28), float 64 bits + 61: f29 (f29), float 64 bits + 62: f30 (f30), float 64 bits + 63: f31 (f31), float 64 bits + 65: fpscr (fpscr), unsigned 32 bits +privileged registers: + 70: sr0 (sr0), unsigned 32 bits + 71: sr1 (sr1), unsigned 32 bits + 72: sr2 (sr2), unsigned 32 bits + 73: sr3 (sr3), unsigned 32 bits + 74: sr4 (sr4), unsigned 32 bits + 75: sr5 (sr5), unsigned 32 bits + 76: sr6 (sr6), unsigned 32 bits + 77: sr7 (sr7), unsigned 32 bits + 78: sr8 (sr8), unsigned 32 bits + 79: sr9 (sr9), unsigned 32 bits + 80: sr10 (sr10), unsigned 32 bits + 81: sr11 (sr11), unsigned 32 bits + 82: sr12 (sr12), unsigned 32 bits + 83: sr13 (sr13), unsigned 32 bits + 84: sr14 (sr14), unsigned 32 bits + 85: sr15 (sr15), unsigned 32 bits + 100: mq (mq), unsigned 32 bits + 101: xer (xer), unsigned 32 bits + 102: spr2 (spr2), unsigned 32 bits + 103: spr3 (spr3), unsigned 32 bits + 104: spr4 (spr4), unsigned 32 bits + 105: spr5 (spr5), unsigned 32 bits + 106: spr6 (spr6), unsigned 32 bits + 107: spr7 (spr7), unsigned 32 bits + 108: lr (lr), unsigned 32 bits + 109: ctr (ctr), unsigned 32 bits + 110: spr10 (spr10), unsigned 32 bits + 111: spr11 (spr11), unsigned 32 bits + 112: spr12 (spr12), unsigned 32 bits + 113: spr13 (spr13), unsigned 32 bits + 114: spr14 (spr14), unsigned 32 bits + 115: spr15 (spr15), unsigned 32 bits + 116: spr16 (spr16), unsigned 32 bits + 117: spr17 (spr17), unsigned 32 bits + 118: dsisr (dsisr), unsigned 32 bits + 119: dar (dar), unsigned 32 bits + 120: spr20 (spr20), unsigned 32 bits + 121: spr21 (spr21), unsigned 32 bits + 122: dec (dec), unsigned 32 bits + 123: spr23 (spr23), unsigned 32 bits + 124: spr24 (spr24), unsigned 32 bits + 125: spr25 (spr25), unsigned 32 bits + 126: spr26 (spr26), unsigned 32 bits + 127: spr27 (spr27), unsigned 32 bits + 128: spr28 (spr28), unsigned 32 bits + 129: spr29 (spr29), unsigned 32 bits + 130: spr30 (spr30), unsigned 32 bits + 131: spr31 (spr31), unsigned 32 bits + 132: spr32 (spr32), unsigned 32 bits + 133: spr33 (spr33), unsigned 32 bits + 134: spr34 (spr34), unsigned 32 bits + 135: spr35 (spr35), unsigned 32 bits + 136: spr36 (spr36), unsigned 32 bits + 137: spr37 (spr37), unsigned 32 bits + 138: spr38 (spr38), unsigned 32 bits + 139: spr39 (spr39), unsigned 32 bits + 140: spr40 (spr40), unsigned 32 bits + 141: spr41 (spr41), unsigned 32 bits + 142: spr42 (spr42), unsigned 32 bits + 143: spr43 (spr43), unsigned 32 bits + 144: spr44 (spr44), unsigned 32 bits + 145: spr45 (spr45), unsigned 32 bits + 146: spr46 (spr46), unsigned 32 bits + 147: spr47 (spr47), unsigned 32 bits + 148: spr48 (spr48), unsigned 32 bits + 149: spr49 (spr49), unsigned 32 bits + 150: spr50 (spr50), unsigned 32 bits + 151: spr51 (spr51), unsigned 32 bits + 152: spr52 (spr52), unsigned 32 bits + 153: spr53 (spr53), unsigned 32 bits + 154: spr54 (spr54), unsigned 32 bits + 155: spr55 (spr55), unsigned 32 bits + 156: spr56 (spr56), unsigned 32 bits + 157: spr57 (spr57), unsigned 32 bits + 158: spr58 (spr58), unsigned 32 bits + 159: spr59 (spr59), unsigned 32 bits + 160: spr60 (spr60), unsigned 32 bits + 161: spr61 (spr61), unsigned 32 bits + 162: spr62 (spr62), unsigned 32 bits + 163: spr63 (spr63), unsigned 32 bits + 164: spr64 (spr64), unsigned 32 bits + 165: spr65 (spr65), unsigned 32 bits + 166: spr66 (spr66), unsigned 32 bits + 167: spr67 (spr67), unsigned 32 bits + 168: spr68 (spr68), unsigned 32 bits + 169: spr69 (spr69), unsigned 32 bits + 170: spr70 (spr70), unsigned 32 bits + 171: spr71 (spr71), unsigned 32 bits + 172: spr72 (spr72), unsigned 32 bits + 173: spr73 (spr73), unsigned 32 bits + 174: spr74 (spr74), unsigned 32 bits + 175: spr75 (spr75), unsigned 32 bits + 176: spr76 (spr76), unsigned 32 bits + 177: spr77 (spr77), unsigned 32 bits + 178: spr78 (spr78), unsigned 32 bits + 179: spr79 (spr79), unsigned 32 bits + 180: spr80 (spr80), unsigned 32 bits + 181: spr81 (spr81), unsigned 32 bits + 182: spr82 (spr82), unsigned 32 bits + 183: spr83 (spr83), unsigned 32 bits + 184: spr84 (spr84), unsigned 32 bits + 185: spr85 (spr85), unsigned 32 bits + 186: spr86 (spr86), unsigned 32 bits + 187: spr87 (spr87), unsigned 32 bits + 188: spr88 (spr88), unsigned 32 bits + 189: spr89 (spr89), unsigned 32 bits + 190: spr90 (spr90), unsigned 32 bits + 191: spr91 (spr91), unsigned 32 bits + 192: spr92 (spr92), unsigned 32 bits + 193: spr93 (spr93), unsigned 32 bits + 194: spr94 (spr94), unsigned 32 bits + 195: spr95 (spr95), unsigned 32 bits + 196: spr96 (spr96), unsigned 32 bits + 197: spr97 (spr97), unsigned 32 bits + 198: spr98 (spr98), unsigned 32 bits + 199: spr99 (spr99), unsigned 32 bits + 200: spr100 (spr100), unsigned 32 bits + 201: spr101 (spr101), unsigned 32 bits + 202: spr102 (spr102), unsigned 32 bits + 203: spr103 (spr103), unsigned 32 bits + 204: spr104 (spr104), unsigned 32 bits + 205: spr105 (spr105), unsigned 32 bits + 206: spr106 (spr106), unsigned 32 bits + 207: spr107 (spr107), unsigned 32 bits + 208: spr108 (spr108), unsigned 32 bits + 209: spr109 (spr109), unsigned 32 bits + 210: spr110 (spr110), unsigned 32 bits + 211: spr111 (spr111), unsigned 32 bits + 212: spr112 (spr112), unsigned 32 bits + 213: spr113 (spr113), unsigned 32 bits + 214: spr114 (spr114), unsigned 32 bits + 215: spr115 (spr115), unsigned 32 bits + 216: spr116 (spr116), unsigned 32 bits + 217: spr117 (spr117), unsigned 32 bits + 218: spr118 (spr118), unsigned 32 bits + 219: spr119 (spr119), unsigned 32 bits + 220: spr120 (spr120), unsigned 32 bits + 221: spr121 (spr121), unsigned 32 bits + 222: spr122 (spr122), unsigned 32 bits + 223: spr123 (spr123), unsigned 32 bits + 224: spr124 (spr124), unsigned 32 bits + 225: spr125 (spr125), unsigned 32 bits + 226: spr126 (spr126), unsigned 32 bits + 227: spr127 (spr127), unsigned 32 bits + 228: spr128 (spr128), unsigned 32 bits + 229: spr129 (spr129), unsigned 32 bits + 230: spr130 (spr130), unsigned 32 bits + 231: spr131 (spr131), unsigned 32 bits + 232: spr132 (spr132), unsigned 32 bits + 233: spr133 (spr133), unsigned 32 bits + 234: spr134 (spr134), unsigned 32 bits + 235: spr135 (spr135), unsigned 32 bits + 236: spr136 (spr136), unsigned 32 bits + 237: spr137 (spr137), unsigned 32 bits + 238: spr138 (spr138), unsigned 32 bits + 239: spr139 (spr139), unsigned 32 bits + 240: spr140 (spr140), unsigned 32 bits + 241: spr141 (spr141), unsigned 32 bits + 242: spr142 (spr142), unsigned 32 bits + 243: spr143 (spr143), unsigned 32 bits + 244: spr144 (spr144), unsigned 32 bits + 245: spr145 (spr145), unsigned 32 bits + 246: spr146 (spr146), unsigned 32 bits + 247: spr147 (spr147), unsigned 32 bits + 248: spr148 (spr148), unsigned 32 bits + 249: spr149 (spr149), unsigned 32 bits + 250: spr150 (spr150), unsigned 32 bits + 251: spr151 (spr151), unsigned 32 bits + 252: spr152 (spr152), unsigned 32 bits + 253: spr153 (spr153), unsigned 32 bits + 254: spr154 (spr154), unsigned 32 bits + 255: spr155 (spr155), unsigned 32 bits + 256: spr156 (spr156), unsigned 32 bits + 257: spr157 (spr157), unsigned 32 bits + 258: spr158 (spr158), unsigned 32 bits + 259: spr159 (spr159), unsigned 32 bits + 260: spr160 (spr160), unsigned 32 bits + 261: spr161 (spr161), unsigned 32 bits + 262: spr162 (spr162), unsigned 32 bits + 263: spr163 (spr163), unsigned 32 bits + 264: spr164 (spr164), unsigned 32 bits + 265: spr165 (spr165), unsigned 32 bits + 266: spr166 (spr166), unsigned 32 bits + 267: spr167 (spr167), unsigned 32 bits + 268: spr168 (spr168), unsigned 32 bits + 269: spr169 (spr169), unsigned 32 bits + 270: spr170 (spr170), unsigned 32 bits + 271: spr171 (spr171), unsigned 32 bits + 272: spr172 (spr172), unsigned 32 bits + 273: spr173 (spr173), unsigned 32 bits + 274: spr174 (spr174), unsigned 32 bits + 275: spr175 (spr175), unsigned 32 bits + 276: spr176 (spr176), unsigned 32 bits + 277: spr177 (spr177), unsigned 32 bits + 278: spr178 (spr178), unsigned 32 bits + 279: spr179 (spr179), unsigned 32 bits + 280: spr180 (spr180), unsigned 32 bits + 281: spr181 (spr181), unsigned 32 bits + 282: spr182 (spr182), unsigned 32 bits + 283: spr183 (spr183), unsigned 32 bits + 284: spr184 (spr184), unsigned 32 bits + 285: spr185 (spr185), unsigned 32 bits + 286: spr186 (spr186), unsigned 32 bits + 287: spr187 (spr187), unsigned 32 bits + 288: spr188 (spr188), unsigned 32 bits + 289: spr189 (spr189), unsigned 32 bits + 290: spr190 (spr190), unsigned 32 bits + 291: spr191 (spr191), unsigned 32 bits + 292: spr192 (spr192), unsigned 32 bits + 293: spr193 (spr193), unsigned 32 bits + 294: spr194 (spr194), unsigned 32 bits + 295: spr195 (spr195), unsigned 32 bits + 296: spr196 (spr196), unsigned 32 bits + 297: spr197 (spr197), unsigned 32 bits + 298: spr198 (spr198), unsigned 32 bits + 299: spr199 (spr199), unsigned 32 bits + 300: spr200 (spr200), unsigned 32 bits + 301: spr201 (spr201), unsigned 32 bits + 302: spr202 (spr202), unsigned 32 bits + 303: spr203 (spr203), unsigned 32 bits + 304: spr204 (spr204), unsigned 32 bits + 305: spr205 (spr205), unsigned 32 bits + 306: spr206 (spr206), unsigned 32 bits + 307: spr207 (spr207), unsigned 32 bits + 308: spr208 (spr208), unsigned 32 bits + 309: spr209 (spr209), unsigned 32 bits + 310: spr210 (spr210), unsigned 32 bits + 311: spr211 (spr211), unsigned 32 bits + 312: spr212 (spr212), unsigned 32 bits + 313: spr213 (spr213), unsigned 32 bits + 314: spr214 (spr214), unsigned 32 bits + 315: spr215 (spr215), unsigned 32 bits + 316: spr216 (spr216), unsigned 32 bits + 317: spr217 (spr217), unsigned 32 bits + 318: spr218 (spr218), unsigned 32 bits + 319: spr219 (spr219), unsigned 32 bits + 320: spr220 (spr220), unsigned 32 bits + 321: spr221 (spr221), unsigned 32 bits + 322: spr222 (spr222), unsigned 32 bits + 323: spr223 (spr223), unsigned 32 bits + 324: spr224 (spr224), unsigned 32 bits + 325: spr225 (spr225), unsigned 32 bits + 326: spr226 (spr226), unsigned 32 bits + 327: spr227 (spr227), unsigned 32 bits + 328: spr228 (spr228), unsigned 32 bits + 329: spr229 (spr229), unsigned 32 bits + 330: spr230 (spr230), unsigned 32 bits + 331: spr231 (spr231), unsigned 32 bits + 332: spr232 (spr232), unsigned 32 bits + 333: spr233 (spr233), unsigned 32 bits + 334: spr234 (spr234), unsigned 32 bits + 335: spr235 (spr235), unsigned 32 bits + 336: spr236 (spr236), unsigned 32 bits + 337: spr237 (spr237), unsigned 32 bits + 338: spr238 (spr238), unsigned 32 bits + 339: spr239 (spr239), unsigned 32 bits + 340: spr240 (spr240), unsigned 32 bits + 341: spr241 (spr241), unsigned 32 bits + 342: spr242 (spr242), unsigned 32 bits + 343: spr243 (spr243), unsigned 32 bits + 344: spr244 (spr244), unsigned 32 bits + 345: spr245 (spr245), unsigned 32 bits + 346: spr246 (spr246), unsigned 32 bits + 347: spr247 (spr247), unsigned 32 bits + 348: spr248 (spr248), unsigned 32 bits + 349: spr249 (spr249), unsigned 32 bits + 350: spr250 (spr250), unsigned 32 bits + 351: spr251 (spr251), unsigned 32 bits + 352: spr252 (spr252), unsigned 32 bits + 353: spr253 (spr253), unsigned 32 bits + 354: spr254 (spr254), unsigned 32 bits + 355: spr255 (spr255), unsigned 32 bits + 357: spr257 (spr257), unsigned 32 bits + 358: spr258 (spr258), unsigned 32 bits + 359: spr259 (spr259), unsigned 32 bits + 360: spr260 (spr260), unsigned 32 bits + 361: spr261 (spr261), unsigned 32 bits + 362: spr262 (spr262), unsigned 32 bits + 363: spr263 (spr263), unsigned 32 bits + 364: spr264 (spr264), unsigned 32 bits + 365: spr265 (spr265), unsigned 32 bits + 366: spr266 (spr266), unsigned 32 bits + 367: spr267 (spr267), unsigned 32 bits + 368: spr268 (spr268), unsigned 32 bits + 369: spr269 (spr269), unsigned 32 bits + 370: spr270 (spr270), unsigned 32 bits + 371: spr271 (spr271), unsigned 32 bits + 372: spr272 (spr272), unsigned 32 bits + 373: spr273 (spr273), unsigned 32 bits + 374: spr274 (spr274), unsigned 32 bits + 375: spr275 (spr275), unsigned 32 bits + 376: spr276 (spr276), unsigned 32 bits + 377: spr277 (spr277), unsigned 32 bits + 378: spr278 (spr278), unsigned 32 bits + 379: spr279 (spr279), unsigned 32 bits + 380: spr280 (spr280), unsigned 32 bits + 381: spr281 (spr281), unsigned 32 bits + 382: spr282 (spr282), unsigned 32 bits + 383: spr283 (spr283), unsigned 32 bits + 384: spr284 (spr284), unsigned 32 bits + 385: spr285 (spr285), unsigned 32 bits + 386: spr286 (spr286), unsigned 32 bits + 387: spr287 (spr287), unsigned 32 bits + 388: spr288 (spr288), unsigned 32 bits + 389: spr289 (spr289), unsigned 32 bits + 390: spr290 (spr290), unsigned 32 bits + 391: spr291 (spr291), unsigned 32 bits + 392: spr292 (spr292), unsigned 32 bits + 393: spr293 (spr293), unsigned 32 bits + 394: spr294 (spr294), unsigned 32 bits + 395: spr295 (spr295), unsigned 32 bits + 396: spr296 (spr296), unsigned 32 bits + 397: spr297 (spr297), unsigned 32 bits + 398: spr298 (spr298), unsigned 32 bits + 399: spr299 (spr299), unsigned 32 bits + 400: spr300 (spr300), unsigned 32 bits + 401: spr301 (spr301), unsigned 32 bits + 402: spr302 (spr302), unsigned 32 bits + 403: spr303 (spr303), unsigned 32 bits + 404: spr304 (spr304), unsigned 32 bits + 405: spr305 (spr305), unsigned 32 bits + 406: spr306 (spr306), unsigned 32 bits + 407: spr307 (spr307), unsigned 32 bits + 408: spr308 (spr308), unsigned 32 bits + 409: spr309 (spr309), unsigned 32 bits + 410: spr310 (spr310), unsigned 32 bits + 411: spr311 (spr311), unsigned 32 bits + 412: spr312 (spr312), unsigned 32 bits + 413: spr313 (spr313), unsigned 32 bits + 414: spr314 (spr314), unsigned 32 bits + 415: spr315 (spr315), unsigned 32 bits + 416: spr316 (spr316), unsigned 32 bits + 417: spr317 (spr317), unsigned 32 bits + 418: spr318 (spr318), unsigned 32 bits + 419: spr319 (spr319), unsigned 32 bits + 420: spr320 (spr320), unsigned 32 bits + 421: spr321 (spr321), unsigned 32 bits + 422: spr322 (spr322), unsigned 32 bits + 423: spr323 (spr323), unsigned 32 bits + 424: spr324 (spr324), unsigned 32 bits + 425: spr325 (spr325), unsigned 32 bits + 426: spr326 (spr326), unsigned 32 bits + 427: spr327 (spr327), unsigned 32 bits + 428: spr328 (spr328), unsigned 32 bits + 429: spr329 (spr329), unsigned 32 bits + 430: spr330 (spr330), unsigned 32 bits + 431: spr331 (spr331), unsigned 32 bits + 432: spr332 (spr332), unsigned 32 bits + 433: spr333 (spr333), unsigned 32 bits + 434: spr334 (spr334), unsigned 32 bits + 435: spr335 (spr335), unsigned 32 bits + 436: spr336 (spr336), unsigned 32 bits + 437: spr337 (spr337), unsigned 32 bits + 438: spr338 (spr338), unsigned 32 bits + 439: spr339 (spr339), unsigned 32 bits + 440: spr340 (spr340), unsigned 32 bits + 441: spr341 (spr341), unsigned 32 bits + 442: spr342 (spr342), unsigned 32 bits + 443: spr343 (spr343), unsigned 32 bits + 444: spr344 (spr344), unsigned 32 bits + 445: spr345 (spr345), unsigned 32 bits + 446: spr346 (spr346), unsigned 32 bits + 447: spr347 (spr347), unsigned 32 bits + 448: spr348 (spr348), unsigned 32 bits + 449: spr349 (spr349), unsigned 32 bits + 450: spr350 (spr350), unsigned 32 bits + 451: spr351 (spr351), unsigned 32 bits + 452: spr352 (spr352), unsigned 32 bits + 453: spr353 (spr353), unsigned 32 bits + 454: spr354 (spr354), unsigned 32 bits + 455: spr355 (spr355), unsigned 32 bits + 456: spr356 (spr356), unsigned 32 bits + 457: spr357 (spr357), unsigned 32 bits + 458: spr358 (spr358), unsigned 32 bits + 459: spr359 (spr359), unsigned 32 bits + 460: spr360 (spr360), unsigned 32 bits + 461: spr361 (spr361), unsigned 32 bits + 462: spr362 (spr362), unsigned 32 bits + 463: spr363 (spr363), unsigned 32 bits + 464: spr364 (spr364), unsigned 32 bits + 465: spr365 (spr365), unsigned 32 bits + 466: spr366 (spr366), unsigned 32 bits + 467: spr367 (spr367), unsigned 32 bits + 468: spr368 (spr368), unsigned 32 bits + 469: spr369 (spr369), unsigned 32 bits + 470: spr370 (spr370), unsigned 32 bits + 471: spr371 (spr371), unsigned 32 bits + 472: spr372 (spr372), unsigned 32 bits + 473: spr373 (spr373), unsigned 32 bits + 474: spr374 (spr374), unsigned 32 bits + 475: spr375 (spr375), unsigned 32 bits + 476: spr376 (spr376), unsigned 32 bits + 477: spr377 (spr377), unsigned 32 bits + 478: spr378 (spr378), unsigned 32 bits + 479: spr379 (spr379), unsigned 32 bits + 480: spr380 (spr380), unsigned 32 bits + 481: spr381 (spr381), unsigned 32 bits + 482: spr382 (spr382), unsigned 32 bits + 483: spr383 (spr383), unsigned 32 bits + 484: spr384 (spr384), unsigned 32 bits + 485: spr385 (spr385), unsigned 32 bits + 486: spr386 (spr386), unsigned 32 bits + 487: spr387 (spr387), unsigned 32 bits + 488: spr388 (spr388), unsigned 32 bits + 489: spr389 (spr389), unsigned 32 bits + 490: spr390 (spr390), unsigned 32 bits + 491: spr391 (spr391), unsigned 32 bits + 492: spr392 (spr392), unsigned 32 bits + 493: spr393 (spr393), unsigned 32 bits + 494: spr394 (spr394), unsigned 32 bits + 495: spr395 (spr395), unsigned 32 bits + 496: spr396 (spr396), unsigned 32 bits + 497: spr397 (spr397), unsigned 32 bits + 498: spr398 (spr398), unsigned 32 bits + 499: spr399 (spr399), unsigned 32 bits + 500: spr400 (spr400), unsigned 32 bits + 501: spr401 (spr401), unsigned 32 bits + 502: spr402 (spr402), unsigned 32 bits + 503: spr403 (spr403), unsigned 32 bits + 504: spr404 (spr404), unsigned 32 bits + 505: spr405 (spr405), unsigned 32 bits + 506: spr406 (spr406), unsigned 32 bits + 507: spr407 (spr407), unsigned 32 bits + 508: spr408 (spr408), unsigned 32 bits + 509: spr409 (spr409), unsigned 32 bits + 510: spr410 (spr410), unsigned 32 bits + 511: spr411 (spr411), unsigned 32 bits + 512: spr412 (spr412), unsigned 32 bits + 513: spr413 (spr413), unsigned 32 bits + 514: spr414 (spr414), unsigned 32 bits + 515: spr415 (spr415), unsigned 32 bits + 516: spr416 (spr416), unsigned 32 bits + 517: spr417 (spr417), unsigned 32 bits + 518: spr418 (spr418), unsigned 32 bits + 519: spr419 (spr419), unsigned 32 bits + 520: spr420 (spr420), unsigned 32 bits + 521: spr421 (spr421), unsigned 32 bits + 522: spr422 (spr422), unsigned 32 bits + 523: spr423 (spr423), unsigned 32 bits + 524: spr424 (spr424), unsigned 32 bits + 525: spr425 (spr425), unsigned 32 bits + 526: spr426 (spr426), unsigned 32 bits + 527: spr427 (spr427), unsigned 32 bits + 528: spr428 (spr428), unsigned 32 bits + 529: spr429 (spr429), unsigned 32 bits + 530: spr430 (spr430), unsigned 32 bits + 531: spr431 (spr431), unsigned 32 bits + 532: spr432 (spr432), unsigned 32 bits + 533: spr433 (spr433), unsigned 32 bits + 534: spr434 (spr434), unsigned 32 bits + 535: spr435 (spr435), unsigned 32 bits + 536: spr436 (spr436), unsigned 32 bits + 537: spr437 (spr437), unsigned 32 bits + 538: spr438 (spr438), unsigned 32 bits + 539: spr439 (spr439), unsigned 32 bits + 540: spr440 (spr440), unsigned 32 bits + 541: spr441 (spr441), unsigned 32 bits + 542: spr442 (spr442), unsigned 32 bits + 543: spr443 (spr443), unsigned 32 bits + 544: spr444 (spr444), unsigned 32 bits + 545: spr445 (spr445), unsigned 32 bits + 546: spr446 (spr446), unsigned 32 bits + 547: spr447 (spr447), unsigned 32 bits + 548: spr448 (spr448), unsigned 32 bits + 549: spr449 (spr449), unsigned 32 bits + 550: spr450 (spr450), unsigned 32 bits + 551: spr451 (spr451), unsigned 32 bits + 552: spr452 (spr452), unsigned 32 bits + 553: spr453 (spr453), unsigned 32 bits + 554: spr454 (spr454), unsigned 32 bits + 555: spr455 (spr455), unsigned 32 bits + 556: spr456 (spr456), unsigned 32 bits + 557: spr457 (spr457), unsigned 32 bits + 558: spr458 (spr458), unsigned 32 bits + 559: spr459 (spr459), unsigned 32 bits + 560: spr460 (spr460), unsigned 32 bits + 561: spr461 (spr461), unsigned 32 bits + 562: spr462 (spr462), unsigned 32 bits + 563: spr463 (spr463), unsigned 32 bits + 564: spr464 (spr464), unsigned 32 bits + 565: spr465 (spr465), unsigned 32 bits + 566: spr466 (spr466), unsigned 32 bits + 567: spr467 (spr467), unsigned 32 bits + 568: spr468 (spr468), unsigned 32 bits + 569: spr469 (spr469), unsigned 32 bits + 570: spr470 (spr470), unsigned 32 bits + 571: spr471 (spr471), unsigned 32 bits + 572: spr472 (spr472), unsigned 32 bits + 573: spr473 (spr473), unsigned 32 bits + 574: spr474 (spr474), unsigned 32 bits + 575: spr475 (spr475), unsigned 32 bits + 576: spr476 (spr476), unsigned 32 bits + 577: spr477 (spr477), unsigned 32 bits + 578: spr478 (spr478), unsigned 32 bits + 579: spr479 (spr479), unsigned 32 bits + 580: spr480 (spr480), unsigned 32 bits + 581: spr481 (spr481), unsigned 32 bits + 582: spr482 (spr482), unsigned 32 bits + 583: spr483 (spr483), unsigned 32 bits + 584: spr484 (spr484), unsigned 32 bits + 585: spr485 (spr485), unsigned 32 bits + 586: spr486 (spr486), unsigned 32 bits + 587: spr487 (spr487), unsigned 32 bits + 588: spr488 (spr488), unsigned 32 bits + 589: spr489 (spr489), unsigned 32 bits + 590: spr490 (spr490), unsigned 32 bits + 591: spr491 (spr491), unsigned 32 bits + 592: spr492 (spr492), unsigned 32 bits + 593: spr493 (spr493), unsigned 32 bits + 594: spr494 (spr494), unsigned 32 bits + 595: spr495 (spr495), unsigned 32 bits + 596: spr496 (spr496), unsigned 32 bits + 597: spr497 (spr497), unsigned 32 bits + 598: spr498 (spr498), unsigned 32 bits + 599: spr499 (spr499), unsigned 32 bits + 600: spr500 (spr500), unsigned 32 bits + 601: spr501 (spr501), unsigned 32 bits + 602: spr502 (spr502), unsigned 32 bits + 603: spr503 (spr503), unsigned 32 bits + 604: spr504 (spr504), unsigned 32 bits + 605: spr505 (spr505), unsigned 32 bits + 606: spr506 (spr506), unsigned 32 bits + 607: spr507 (spr507), unsigned 32 bits + 608: spr508 (spr508), unsigned 32 bits + 609: spr509 (spr509), unsigned 32 bits + 610: spr510 (spr510), unsigned 32 bits + 611: spr511 (spr511), unsigned 32 bits + 613: spr513 (spr513), unsigned 32 bits + 614: spr514 (spr514), unsigned 32 bits + 615: spr515 (spr515), unsigned 32 bits + 616: spr516 (spr516), unsigned 32 bits + 617: spr517 (spr517), unsigned 32 bits + 618: spr518 (spr518), unsigned 32 bits + 619: spr519 (spr519), unsigned 32 bits + 620: spr520 (spr520), unsigned 32 bits + 621: spr521 (spr521), unsigned 32 bits + 622: spr522 (spr522), unsigned 32 bits + 623: spr523 (spr523), unsigned 32 bits + 624: spr524 (spr524), unsigned 32 bits + 625: spr525 (spr525), unsigned 32 bits + 626: spr526 (spr526), unsigned 32 bits + 627: spr527 (spr527), unsigned 32 bits + 628: spr528 (spr528), unsigned 32 bits + 629: spr529 (spr529), unsigned 32 bits + 630: spr530 (spr530), unsigned 32 bits + 631: spr531 (spr531), unsigned 32 bits + 632: spr532 (spr532), unsigned 32 bits + 633: spr533 (spr533), unsigned 32 bits + 634: spr534 (spr534), unsigned 32 bits + 635: spr535 (spr535), unsigned 32 bits + 636: spr536 (spr536), unsigned 32 bits + 637: spr537 (spr537), unsigned 32 bits + 638: spr538 (spr538), unsigned 32 bits + 639: spr539 (spr539), unsigned 32 bits + 640: spr540 (spr540), unsigned 32 bits + 641: spr541 (spr541), unsigned 32 bits + 642: spr542 (spr542), unsigned 32 bits + 643: spr543 (spr543), unsigned 32 bits + 644: spr544 (spr544), unsigned 32 bits + 645: spr545 (spr545), unsigned 32 bits + 646: spr546 (spr546), unsigned 32 bits + 647: spr547 (spr547), unsigned 32 bits + 648: spr548 (spr548), unsigned 32 bits + 649: spr549 (spr549), unsigned 32 bits + 650: spr550 (spr550), unsigned 32 bits + 651: spr551 (spr551), unsigned 32 bits + 652: spr552 (spr552), unsigned 32 bits + 653: spr553 (spr553), unsigned 32 bits + 654: spr554 (spr554), unsigned 32 bits + 655: spr555 (spr555), unsigned 32 bits + 656: spr556 (spr556), unsigned 32 bits + 657: spr557 (spr557), unsigned 32 bits + 658: spr558 (spr558), unsigned 32 bits + 659: spr559 (spr559), unsigned 32 bits + 660: spr560 (spr560), unsigned 32 bits + 661: spr561 (spr561), unsigned 32 bits + 662: spr562 (spr562), unsigned 32 bits + 663: spr563 (spr563), unsigned 32 bits + 664: spr564 (spr564), unsigned 32 bits + 665: spr565 (spr565), unsigned 32 bits + 666: spr566 (spr566), unsigned 32 bits + 667: spr567 (spr567), unsigned 32 bits + 668: spr568 (spr568), unsigned 32 bits + 669: spr569 (spr569), unsigned 32 bits + 670: spr570 (spr570), unsigned 32 bits + 671: spr571 (spr571), unsigned 32 bits + 672: spr572 (spr572), unsigned 32 bits + 673: spr573 (spr573), unsigned 32 bits + 674: spr574 (spr574), unsigned 32 bits + 675: spr575 (spr575), unsigned 32 bits + 676: spr576 (spr576), unsigned 32 bits + 677: spr577 (spr577), unsigned 32 bits + 678: spr578 (spr578), unsigned 32 bits + 679: spr579 (spr579), unsigned 32 bits + 680: spr580 (spr580), unsigned 32 bits + 681: spr581 (spr581), unsigned 32 bits + 682: spr582 (spr582), unsigned 32 bits + 683: spr583 (spr583), unsigned 32 bits + 684: spr584 (spr584), unsigned 32 bits + 685: spr585 (spr585), unsigned 32 bits + 686: spr586 (spr586), unsigned 32 bits + 687: spr587 (spr587), unsigned 32 bits + 688: spr588 (spr588), unsigned 32 bits + 689: spr589 (spr589), unsigned 32 bits + 690: spr590 (spr590), unsigned 32 bits + 691: spr591 (spr591), unsigned 32 bits + 692: spr592 (spr592), unsigned 32 bits + 693: spr593 (spr593), unsigned 32 bits + 694: spr594 (spr594), unsigned 32 bits + 695: spr595 (spr595), unsigned 32 bits + 696: spr596 (spr596), unsigned 32 bits + 697: spr597 (spr597), unsigned 32 bits + 698: spr598 (spr598), unsigned 32 bits + 699: spr599 (spr599), unsigned 32 bits + 700: spr600 (spr600), unsigned 32 bits + 701: spr601 (spr601), unsigned 32 bits + 702: spr602 (spr602), unsigned 32 bits + 703: spr603 (spr603), unsigned 32 bits + 704: spr604 (spr604), unsigned 32 bits + 705: spr605 (spr605), unsigned 32 bits + 706: spr606 (spr606), unsigned 32 bits + 707: spr607 (spr607), unsigned 32 bits + 708: spr608 (spr608), unsigned 32 bits + 709: spr609 (spr609), unsigned 32 bits + 710: spr610 (spr610), unsigned 32 bits + 711: spr611 (spr611), unsigned 32 bits + 712: spr612 (spr612), unsigned 32 bits + 713: spr613 (spr613), unsigned 32 bits + 714: spr614 (spr614), unsigned 32 bits + 715: spr615 (spr615), unsigned 32 bits + 716: spr616 (spr616), unsigned 32 bits + 717: spr617 (spr617), unsigned 32 bits + 718: spr618 (spr618), unsigned 32 bits + 719: spr619 (spr619), unsigned 32 bits + 720: spr620 (spr620), unsigned 32 bits + 721: spr621 (spr621), unsigned 32 bits + 722: spr622 (spr622), unsigned 32 bits + 723: spr623 (spr623), unsigned 32 bits + 724: spr624 (spr624), unsigned 32 bits + 725: spr625 (spr625), unsigned 32 bits + 726: spr626 (spr626), unsigned 32 bits + 727: spr627 (spr627), unsigned 32 bits + 728: spr628 (spr628), unsigned 32 bits + 729: spr629 (spr629), unsigned 32 bits + 730: spr630 (spr630), unsigned 32 bits + 731: spr631 (spr631), unsigned 32 bits + 732: spr632 (spr632), unsigned 32 bits + 733: spr633 (spr633), unsigned 32 bits + 734: spr634 (spr634), unsigned 32 bits + 735: spr635 (spr635), unsigned 32 bits + 736: spr636 (spr636), unsigned 32 bits + 737: spr637 (spr637), unsigned 32 bits + 738: spr638 (spr638), unsigned 32 bits + 739: spr639 (spr639), unsigned 32 bits + 740: spr640 (spr640), unsigned 32 bits + 741: spr641 (spr641), unsigned 32 bits + 742: spr642 (spr642), unsigned 32 bits + 743: spr643 (spr643), unsigned 32 bits + 744: spr644 (spr644), unsigned 32 bits + 745: spr645 (spr645), unsigned 32 bits + 746: spr646 (spr646), unsigned 32 bits + 747: spr647 (spr647), unsigned 32 bits + 748: spr648 (spr648), unsigned 32 bits + 749: spr649 (spr649), unsigned 32 bits + 750: spr650 (spr650), unsigned 32 bits + 751: spr651 (spr651), unsigned 32 bits + 752: spr652 (spr652), unsigned 32 bits + 753: spr653 (spr653), unsigned 32 bits + 754: spr654 (spr654), unsigned 32 bits + 755: spr655 (spr655), unsigned 32 bits + 756: spr656 (spr656), unsigned 32 bits + 757: spr657 (spr657), unsigned 32 bits + 758: spr658 (spr658), unsigned 32 bits + 759: spr659 (spr659), unsigned 32 bits + 760: spr660 (spr660), unsigned 32 bits + 761: spr661 (spr661), unsigned 32 bits + 762: spr662 (spr662), unsigned 32 bits + 763: spr663 (spr663), unsigned 32 bits + 764: spr664 (spr664), unsigned 32 bits + 765: spr665 (spr665), unsigned 32 bits + 766: spr666 (spr666), unsigned 32 bits + 767: spr667 (spr667), unsigned 32 bits + 768: spr668 (spr668), unsigned 32 bits + 769: spr669 (spr669), unsigned 32 bits + 770: spr670 (spr670), unsigned 32 bits + 771: spr671 (spr671), unsigned 32 bits + 772: spr672 (spr672), unsigned 32 bits + 773: spr673 (spr673), unsigned 32 bits + 774: spr674 (spr674), unsigned 32 bits + 775: spr675 (spr675), unsigned 32 bits + 776: spr676 (spr676), unsigned 32 bits + 777: spr677 (spr677), unsigned 32 bits + 778: spr678 (spr678), unsigned 32 bits + 779: spr679 (spr679), unsigned 32 bits + 780: spr680 (spr680), unsigned 32 bits + 781: spr681 (spr681), unsigned 32 bits + 782: spr682 (spr682), unsigned 32 bits + 783: spr683 (spr683), unsigned 32 bits + 784: spr684 (spr684), unsigned 32 bits + 785: spr685 (spr685), unsigned 32 bits + 786: spr686 (spr686), unsigned 32 bits + 787: spr687 (spr687), unsigned 32 bits + 788: spr688 (spr688), unsigned 32 bits + 789: spr689 (spr689), unsigned 32 bits + 790: spr690 (spr690), unsigned 32 bits + 791: spr691 (spr691), unsigned 32 bits + 792: spr692 (spr692), unsigned 32 bits + 793: spr693 (spr693), unsigned 32 bits + 794: spr694 (spr694), unsigned 32 bits + 795: spr695 (spr695), unsigned 32 bits + 796: spr696 (spr696), unsigned 32 bits + 797: spr697 (spr697), unsigned 32 bits + 798: spr698 (spr698), unsigned 32 bits + 799: spr699 (spr699), unsigned 32 bits + 800: spr700 (spr700), unsigned 32 bits + 801: spr701 (spr701), unsigned 32 bits + 802: spr702 (spr702), unsigned 32 bits + 803: spr703 (spr703), unsigned 32 bits + 804: spr704 (spr704), unsigned 32 bits + 805: spr705 (spr705), unsigned 32 bits + 806: spr706 (spr706), unsigned 32 bits + 807: spr707 (spr707), unsigned 32 bits + 808: spr708 (spr708), unsigned 32 bits + 809: spr709 (spr709), unsigned 32 bits + 810: spr710 (spr710), unsigned 32 bits + 811: spr711 (spr711), unsigned 32 bits + 812: spr712 (spr712), unsigned 32 bits + 813: spr713 (spr713), unsigned 32 bits + 814: spr714 (spr714), unsigned 32 bits + 815: spr715 (spr715), unsigned 32 bits + 816: spr716 (spr716), unsigned 32 bits + 817: spr717 (spr717), unsigned 32 bits + 818: spr718 (spr718), unsigned 32 bits + 819: spr719 (spr719), unsigned 32 bits + 820: spr720 (spr720), unsigned 32 bits + 821: spr721 (spr721), unsigned 32 bits + 822: spr722 (spr722), unsigned 32 bits + 823: spr723 (spr723), unsigned 32 bits + 824: spr724 (spr724), unsigned 32 bits + 825: spr725 (spr725), unsigned 32 bits + 826: spr726 (spr726), unsigned 32 bits + 827: spr727 (spr727), unsigned 32 bits + 828: spr728 (spr728), unsigned 32 bits + 829: spr729 (spr729), unsigned 32 bits + 830: spr730 (spr730), unsigned 32 bits + 831: spr731 (spr731), unsigned 32 bits + 832: spr732 (spr732), unsigned 32 bits + 833: spr733 (spr733), unsigned 32 bits + 834: spr734 (spr734), unsigned 32 bits + 835: spr735 (spr735), unsigned 32 bits + 836: spr736 (spr736), unsigned 32 bits + 837: spr737 (spr737), unsigned 32 bits + 838: spr738 (spr738), unsigned 32 bits + 839: spr739 (spr739), unsigned 32 bits + 840: spr740 (spr740), unsigned 32 bits + 841: spr741 (spr741), unsigned 32 bits + 842: spr742 (spr742), unsigned 32 bits + 843: spr743 (spr743), unsigned 32 bits + 844: spr744 (spr744), unsigned 32 bits + 845: spr745 (spr745), unsigned 32 bits + 846: spr746 (spr746), unsigned 32 bits + 847: spr747 (spr747), unsigned 32 bits + 848: spr748 (spr748), unsigned 32 bits + 849: spr749 (spr749), unsigned 32 bits + 850: spr750 (spr750), unsigned 32 bits + 851: spr751 (spr751), unsigned 32 bits + 852: spr752 (spr752), unsigned 32 bits + 853: spr753 (spr753), unsigned 32 bits + 854: spr754 (spr754), unsigned 32 bits + 855: spr755 (spr755), unsigned 32 bits + 856: spr756 (spr756), unsigned 32 bits + 857: spr757 (spr757), unsigned 32 bits + 858: spr758 (spr758), unsigned 32 bits + 859: spr759 (spr759), unsigned 32 bits + 860: spr760 (spr760), unsigned 32 bits + 861: spr761 (spr761), unsigned 32 bits + 862: spr762 (spr762), unsigned 32 bits + 863: spr763 (spr763), unsigned 32 bits + 864: spr764 (spr764), unsigned 32 bits + 865: spr765 (spr765), unsigned 32 bits + 866: spr766 (spr766), unsigned 32 bits + 867: spr767 (spr767), unsigned 32 bits + 868: spr768 (spr768), unsigned 32 bits + 869: spr769 (spr769), unsigned 32 bits + 870: spr770 (spr770), unsigned 32 bits + 871: spr771 (spr771), unsigned 32 bits + 872: spr772 (spr772), unsigned 32 bits + 873: spr773 (spr773), unsigned 32 bits + 874: spr774 (spr774), unsigned 32 bits + 875: spr775 (spr775), unsigned 32 bits + 876: spr776 (spr776), unsigned 32 bits + 877: spr777 (spr777), unsigned 32 bits + 878: spr778 (spr778), unsigned 32 bits + 879: spr779 (spr779), unsigned 32 bits + 880: spr780 (spr780), unsigned 32 bits + 881: spr781 (spr781), unsigned 32 bits + 882: spr782 (spr782), unsigned 32 bits + 883: spr783 (spr783), unsigned 32 bits + 884: spr784 (spr784), unsigned 32 bits + 885: spr785 (spr785), unsigned 32 bits + 886: spr786 (spr786), unsigned 32 bits + 887: spr787 (spr787), unsigned 32 bits + 888: spr788 (spr788), unsigned 32 bits + 889: spr789 (spr789), unsigned 32 bits + 890: spr790 (spr790), unsigned 32 bits + 891: spr791 (spr791), unsigned 32 bits + 892: spr792 (spr792), unsigned 32 bits + 893: spr793 (spr793), unsigned 32 bits + 894: spr794 (spr794), unsigned 32 bits + 895: spr795 (spr795), unsigned 32 bits + 896: spr796 (spr796), unsigned 32 bits + 897: spr797 (spr797), unsigned 32 bits + 898: spr798 (spr798), unsigned 32 bits + 899: spr799 (spr799), unsigned 32 bits + 900: spr800 (spr800), unsigned 32 bits + 901: spr801 (spr801), unsigned 32 bits + 902: spr802 (spr802), unsigned 32 bits + 903: spr803 (spr803), unsigned 32 bits + 904: spr804 (spr804), unsigned 32 bits + 905: spr805 (spr805), unsigned 32 bits + 906: spr806 (spr806), unsigned 32 bits + 907: spr807 (spr807), unsigned 32 bits + 908: spr808 (spr808), unsigned 32 bits + 909: spr809 (spr809), unsigned 32 bits + 910: spr810 (spr810), unsigned 32 bits + 911: spr811 (spr811), unsigned 32 bits + 912: spr812 (spr812), unsigned 32 bits + 913: spr813 (spr813), unsigned 32 bits + 914: spr814 (spr814), unsigned 32 bits + 915: spr815 (spr815), unsigned 32 bits + 916: spr816 (spr816), unsigned 32 bits + 917: spr817 (spr817), unsigned 32 bits + 918: spr818 (spr818), unsigned 32 bits + 919: spr819 (spr819), unsigned 32 bits + 920: spr820 (spr820), unsigned 32 bits + 921: spr821 (spr821), unsigned 32 bits + 922: spr822 (spr822), unsigned 32 bits + 923: spr823 (spr823), unsigned 32 bits + 924: spr824 (spr824), unsigned 32 bits + 925: spr825 (spr825), unsigned 32 bits + 926: spr826 (spr826), unsigned 32 bits + 927: spr827 (spr827), unsigned 32 bits + 928: spr828 (spr828), unsigned 32 bits + 929: spr829 (spr829), unsigned 32 bits + 930: spr830 (spr830), unsigned 32 bits + 931: spr831 (spr831), unsigned 32 bits + 932: spr832 (spr832), unsigned 32 bits + 933: spr833 (spr833), unsigned 32 bits + 934: spr834 (spr834), unsigned 32 bits + 935: spr835 (spr835), unsigned 32 bits + 936: spr836 (spr836), unsigned 32 bits + 937: spr837 (spr837), unsigned 32 bits + 938: spr838 (spr838), unsigned 32 bits + 939: spr839 (spr839), unsigned 32 bits + 940: spr840 (spr840), unsigned 32 bits + 941: spr841 (spr841), unsigned 32 bits + 942: spr842 (spr842), unsigned 32 bits + 943: spr843 (spr843), unsigned 32 bits + 944: spr844 (spr844), unsigned 32 bits + 945: spr845 (spr845), unsigned 32 bits + 946: spr846 (spr846), unsigned 32 bits + 947: spr847 (spr847), unsigned 32 bits + 948: spr848 (spr848), unsigned 32 bits + 949: spr849 (spr849), unsigned 32 bits + 950: spr850 (spr850), unsigned 32 bits + 951: spr851 (spr851), unsigned 32 bits + 952: spr852 (spr852), unsigned 32 bits + 953: spr853 (spr853), unsigned 32 bits + 954: spr854 (spr854), unsigned 32 bits + 955: spr855 (spr855), unsigned 32 bits + 956: spr856 (spr856), unsigned 32 bits + 957: spr857 (spr857), unsigned 32 bits + 958: spr858 (spr858), unsigned 32 bits + 959: spr859 (spr859), unsigned 32 bits + 960: spr860 (spr860), unsigned 32 bits + 961: spr861 (spr861), unsigned 32 bits + 962: spr862 (spr862), unsigned 32 bits + 963: spr863 (spr863), unsigned 32 bits + 964: spr864 (spr864), unsigned 32 bits + 965: spr865 (spr865), unsigned 32 bits + 966: spr866 (spr866), unsigned 32 bits + 967: spr867 (spr867), unsigned 32 bits + 968: spr868 (spr868), unsigned 32 bits + 969: spr869 (spr869), unsigned 32 bits + 970: spr870 (spr870), unsigned 32 bits + 971: spr871 (spr871), unsigned 32 bits + 972: spr872 (spr872), unsigned 32 bits + 973: spr873 (spr873), unsigned 32 bits + 974: spr874 (spr874), unsigned 32 bits + 975: spr875 (spr875), unsigned 32 bits + 976: spr876 (spr876), unsigned 32 bits + 977: spr877 (spr877), unsigned 32 bits + 978: spr878 (spr878), unsigned 32 bits + 979: spr879 (spr879), unsigned 32 bits + 980: spr880 (spr880), unsigned 32 bits + 981: spr881 (spr881), unsigned 32 bits + 982: spr882 (spr882), unsigned 32 bits + 983: spr883 (spr883), unsigned 32 bits + 984: spr884 (spr884), unsigned 32 bits + 985: spr885 (spr885), unsigned 32 bits + 986: spr886 (spr886), unsigned 32 bits + 987: spr887 (spr887), unsigned 32 bits + 988: spr888 (spr888), unsigned 32 bits + 989: spr889 (spr889), unsigned 32 bits + 990: spr890 (spr890), unsigned 32 bits + 991: spr891 (spr891), unsigned 32 bits + 992: spr892 (spr892), unsigned 32 bits + 993: spr893 (spr893), unsigned 32 bits + 994: spr894 (spr894), unsigned 32 bits + 995: spr895 (spr895), unsigned 32 bits + 996: spr896 (spr896), unsigned 32 bits + 997: spr897 (spr897), unsigned 32 bits + 998: spr898 (spr898), unsigned 32 bits + 999: spr899 (spr899), unsigned 32 bits +vector registers: + 67: vscr (vscr), unsigned 32 bits + 356: vrsave (vrsave), unsigned 32 bits + 612: spefscr (spefscr), unsigned 32 bits + 1124: vr0 (vr0), unsigned 128 bits + 1125: vr1 (vr1), unsigned 128 bits + 1126: vr2 (vr2), unsigned 128 bits + 1127: vr3 (vr3), unsigned 128 bits + 1128: vr4 (vr4), unsigned 128 bits + 1129: vr5 (vr5), unsigned 128 bits + 1130: vr6 (vr6), unsigned 128 bits + 1131: vr7 (vr7), unsigned 128 bits + 1132: vr8 (vr8), unsigned 128 bits + 1133: vr9 (vr9), unsigned 128 bits + 1134: vr10 (vr10), unsigned 128 bits + 1135: vr11 (vr11), unsigned 128 bits + 1136: vr12 (vr12), unsigned 128 bits + 1137: vr13 (vr13), unsigned 128 bits + 1138: vr14 (vr14), unsigned 128 bits + 1139: vr15 (vr15), unsigned 128 bits + 1140: vr16 (vr16), unsigned 128 bits + 1141: vr17 (vr17), unsigned 128 bits + 1142: vr18 (vr18), unsigned 128 bits + 1143: vr19 (vr19), unsigned 128 bits + 1144: vr20 (vr20), unsigned 128 bits + 1145: vr21 (vr21), unsigned 128 bits + 1146: vr22 (vr22), unsigned 128 bits + 1147: vr23 (vr23), unsigned 128 bits + 1148: vr24 (vr24), unsigned 128 bits + 1149: vr25 (vr25), unsigned 128 bits + 1150: vr26 (vr26), unsigned 128 bits + 1151: vr27 (vr27), unsigned 128 bits + 1152: vr28 (vr28), unsigned 128 bits + 1153: vr29 (vr29), unsigned 128 bits + 1154: vr30 (vr30), unsigned 128 bits + 1155: vr31 (vr31), unsigned 128 bits +EOF + +regs_test testfile23 <<\EOF +integer registers: + 0: r0 (r0), signed 64 bits + 1: r1 (r1), signed 64 bits + 2: r2 (r2), signed 64 bits + 3: r3 (r3), signed 64 bits + 4: r4 (r4), signed 64 bits + 5: r5 (r5), signed 64 bits + 6: r6 (r6), signed 64 bits + 7: r7 (r7), signed 64 bits + 8: r8 (r8), signed 64 bits + 9: r9 (r9), signed 64 bits + 10: r10 (r10), signed 64 bits + 11: r11 (r11), signed 64 bits + 12: r12 (r12), signed 64 bits + 13: r13 (r13), signed 64 bits + 14: r14 (r14), signed 64 bits + 15: r15 (r15), signed 64 bits + 16: r16 (r16), signed 64 bits + 17: r17 (r17), signed 64 bits + 18: r18 (r18), signed 64 bits + 19: r19 (r19), signed 64 bits + 20: r20 (r20), signed 64 bits + 21: r21 (r21), signed 64 bits + 22: r22 (r22), signed 64 bits + 23: r23 (r23), signed 64 bits + 24: r24 (r24), signed 64 bits + 25: r25 (r25), signed 64 bits + 26: r26 (r26), signed 64 bits + 27: r27 (r27), signed 64 bits + 28: r28 (r28), signed 64 bits + 29: r29 (r29), signed 64 bits + 30: r30 (r30), signed 64 bits + 31: r31 (r31), signed 64 bits + 64: cr (cr), unsigned 64 bits + 66: msr (msr), unsigned 64 bits +FPU registers: + 32: f0 (f0), float 64 bits + 33: f1 (f1), float 64 bits + 34: f2 (f2), float 64 bits + 35: f3 (f3), float 64 bits + 36: f4 (f4), float 64 bits + 37: f5 (f5), float 64 bits + 38: f6 (f6), float 64 bits + 39: f7 (f7), float 64 bits + 40: f8 (f8), float 64 bits + 41: f9 (f9), float 64 bits + 42: f10 (f10), float 64 bits + 43: f11 (f11), float 64 bits + 44: f12 (f12), float 64 bits + 45: f13 (f13), float 64 bits + 46: f14 (f14), float 64 bits + 47: f15 (f15), float 64 bits + 48: f16 (f16), float 64 bits + 49: f17 (f17), float 64 bits + 50: f18 (f18), float 64 bits + 51: f19 (f19), float 64 bits + 52: f20 (f20), float 64 bits + 53: f21 (f21), float 64 bits + 54: f22 (f22), float 64 bits + 55: f23 (f23), float 64 bits + 56: f24 (f24), float 64 bits + 57: f25 (f25), float 64 bits + 58: f26 (f26), float 64 bits + 59: f27 (f27), float 64 bits + 60: f28 (f28), float 64 bits + 61: f29 (f29), float 64 bits + 62: f30 (f30), float 64 bits + 63: f31 (f31), float 64 bits + 65: fpscr (fpscr), unsigned 64 bits +privileged registers: + 70: sr0 (sr0), unsigned 64 bits + 71: sr1 (sr1), unsigned 64 bits + 72: sr2 (sr2), unsigned 64 bits + 73: sr3 (sr3), unsigned 64 bits + 74: sr4 (sr4), unsigned 64 bits + 75: sr5 (sr5), unsigned 64 bits + 76: sr6 (sr6), unsigned 64 bits + 77: sr7 (sr7), unsigned 64 bits + 78: sr8 (sr8), unsigned 64 bits + 79: sr9 (sr9), unsigned 64 bits + 80: sr10 (sr10), unsigned 64 bits + 81: sr11 (sr11), unsigned 64 bits + 82: sr12 (sr12), unsigned 64 bits + 83: sr13 (sr13), unsigned 64 bits + 84: sr14 (sr14), unsigned 64 bits + 85: sr15 (sr15), unsigned 64 bits + 100: spr0 (spr0), unsigned 64 bits + 101: xer (xer), unsigned 64 bits + 102: spr2 (spr2), unsigned 64 bits + 103: spr3 (spr3), unsigned 64 bits + 104: spr4 (spr4), unsigned 64 bits + 105: spr5 (spr5), unsigned 64 bits + 106: spr6 (spr6), unsigned 64 bits + 107: spr7 (spr7), unsigned 64 bits + 108: lr (lr), unsigned 64 bits + 109: ctr (ctr), unsigned 64 bits + 110: spr10 (spr10), unsigned 64 bits + 111: spr11 (spr11), unsigned 64 bits + 112: spr12 (spr12), unsigned 64 bits + 113: spr13 (spr13), unsigned 64 bits + 114: spr14 (spr14), unsigned 64 bits + 115: spr15 (spr15), unsigned 64 bits + 116: spr16 (spr16), unsigned 64 bits + 117: spr17 (spr17), unsigned 64 bits + 118: dsisr (dsisr), unsigned 64 bits + 119: dar (dar), unsigned 64 bits + 120: spr20 (spr20), unsigned 64 bits + 121: spr21 (spr21), unsigned 64 bits + 122: dec (dec), unsigned 64 bits + 123: spr23 (spr23), unsigned 64 bits + 124: spr24 (spr24), unsigned 64 bits + 125: spr25 (spr25), unsigned 64 bits + 126: spr26 (spr26), unsigned 64 bits + 127: spr27 (spr27), unsigned 64 bits + 128: spr28 (spr28), unsigned 64 bits + 129: spr29 (spr29), unsigned 64 bits + 130: spr30 (spr30), unsigned 64 bits + 131: spr31 (spr31), unsigned 64 bits + 132: spr32 (spr32), unsigned 64 bits + 133: spr33 (spr33), unsigned 64 bits + 134: spr34 (spr34), unsigned 64 bits + 135: spr35 (spr35), unsigned 64 bits + 136: spr36 (spr36), unsigned 64 bits + 137: spr37 (spr37), unsigned 64 bits + 138: spr38 (spr38), unsigned 64 bits + 139: spr39 (spr39), unsigned 64 bits + 140: spr40 (spr40), unsigned 64 bits + 141: spr41 (spr41), unsigned 64 bits + 142: spr42 (spr42), unsigned 64 bits + 143: spr43 (spr43), unsigned 64 bits + 144: spr44 (spr44), unsigned 64 bits + 145: spr45 (spr45), unsigned 64 bits + 146: spr46 (spr46), unsigned 64 bits + 147: spr47 (spr47), unsigned 64 bits + 148: spr48 (spr48), unsigned 64 bits + 149: spr49 (spr49), unsigned 64 bits + 150: spr50 (spr50), unsigned 64 bits + 151: spr51 (spr51), unsigned 64 bits + 152: spr52 (spr52), unsigned 64 bits + 153: spr53 (spr53), unsigned 64 bits + 154: spr54 (spr54), unsigned 64 bits + 155: spr55 (spr55), unsigned 64 bits + 156: spr56 (spr56), unsigned 64 bits + 157: spr57 (spr57), unsigned 64 bits + 158: spr58 (spr58), unsigned 64 bits + 159: spr59 (spr59), unsigned 64 bits + 160: spr60 (spr60), unsigned 64 bits + 161: spr61 (spr61), unsigned 64 bits + 162: spr62 (spr62), unsigned 64 bits + 163: spr63 (spr63), unsigned 64 bits + 164: spr64 (spr64), unsigned 64 bits + 165: spr65 (spr65), unsigned 64 bits + 166: spr66 (spr66), unsigned 64 bits + 167: spr67 (spr67), unsigned 64 bits + 168: spr68 (spr68), unsigned 64 bits + 169: spr69 (spr69), unsigned 64 bits + 170: spr70 (spr70), unsigned 64 bits + 171: spr71 (spr71), unsigned 64 bits + 172: spr72 (spr72), unsigned 64 bits + 173: spr73 (spr73), unsigned 64 bits + 174: spr74 (spr74), unsigned 64 bits + 175: spr75 (spr75), unsigned 64 bits + 176: spr76 (spr76), unsigned 64 bits + 177: spr77 (spr77), unsigned 64 bits + 178: spr78 (spr78), unsigned 64 bits + 179: spr79 (spr79), unsigned 64 bits + 180: spr80 (spr80), unsigned 64 bits + 181: spr81 (spr81), unsigned 64 bits + 182: spr82 (spr82), unsigned 64 bits + 183: spr83 (spr83), unsigned 64 bits + 184: spr84 (spr84), unsigned 64 bits + 185: spr85 (spr85), unsigned 64 bits + 186: spr86 (spr86), unsigned 64 bits + 187: spr87 (spr87), unsigned 64 bits + 188: spr88 (spr88), unsigned 64 bits + 189: spr89 (spr89), unsigned 64 bits + 190: spr90 (spr90), unsigned 64 bits + 191: spr91 (spr91), unsigned 64 bits + 192: spr92 (spr92), unsigned 64 bits + 193: spr93 (spr93), unsigned 64 bits + 194: spr94 (spr94), unsigned 64 bits + 195: spr95 (spr95), unsigned 64 bits + 196: spr96 (spr96), unsigned 64 bits + 197: spr97 (spr97), unsigned 64 bits + 198: spr98 (spr98), unsigned 64 bits + 199: spr99 (spr99), unsigned 64 bits + 200: spr100 (spr100), unsigned 64 bits + 201: spr101 (spr101), unsigned 64 bits + 202: spr102 (spr102), unsigned 64 bits + 203: spr103 (spr103), unsigned 64 bits + 204: spr104 (spr104), unsigned 64 bits + 205: spr105 (spr105), unsigned 64 bits + 206: spr106 (spr106), unsigned 64 bits + 207: spr107 (spr107), unsigned 64 bits + 208: spr108 (spr108), unsigned 64 bits + 209: spr109 (spr109), unsigned 64 bits + 210: spr110 (spr110), unsigned 64 bits + 211: spr111 (spr111), unsigned 64 bits + 212: spr112 (spr112), unsigned 64 bits + 213: spr113 (spr113), unsigned 64 bits + 214: spr114 (spr114), unsigned 64 bits + 215: spr115 (spr115), unsigned 64 bits + 216: spr116 (spr116), unsigned 64 bits + 217: spr117 (spr117), unsigned 64 bits + 218: spr118 (spr118), unsigned 64 bits + 219: spr119 (spr119), unsigned 64 bits + 220: spr120 (spr120), unsigned 64 bits + 221: spr121 (spr121), unsigned 64 bits + 222: spr122 (spr122), unsigned 64 bits + 223: spr123 (spr123), unsigned 64 bits + 224: spr124 (spr124), unsigned 64 bits + 225: spr125 (spr125), unsigned 64 bits + 226: spr126 (spr126), unsigned 64 bits + 227: spr127 (spr127), unsigned 64 bits + 228: spr128 (spr128), unsigned 64 bits + 229: spr129 (spr129), unsigned 64 bits + 230: spr130 (spr130), unsigned 64 bits + 231: spr131 (spr131), unsigned 64 bits + 232: spr132 (spr132), unsigned 64 bits + 233: spr133 (spr133), unsigned 64 bits + 234: spr134 (spr134), unsigned 64 bits + 235: spr135 (spr135), unsigned 64 bits + 236: spr136 (spr136), unsigned 64 bits + 237: spr137 (spr137), unsigned 64 bits + 238: spr138 (spr138), unsigned 64 bits + 239: spr139 (spr139), unsigned 64 bits + 240: spr140 (spr140), unsigned 64 bits + 241: spr141 (spr141), unsigned 64 bits + 242: spr142 (spr142), unsigned 64 bits + 243: spr143 (spr143), unsigned 64 bits + 244: spr144 (spr144), unsigned 64 bits + 245: spr145 (spr145), unsigned 64 bits + 246: spr146 (spr146), unsigned 64 bits + 247: spr147 (spr147), unsigned 64 bits + 248: spr148 (spr148), unsigned 64 bits + 249: spr149 (spr149), unsigned 64 bits + 250: spr150 (spr150), unsigned 64 bits + 251: spr151 (spr151), unsigned 64 bits + 252: spr152 (spr152), unsigned 64 bits + 253: spr153 (spr153), unsigned 64 bits + 254: spr154 (spr154), unsigned 64 bits + 255: spr155 (spr155), unsigned 64 bits + 256: spr156 (spr156), unsigned 64 bits + 257: spr157 (spr157), unsigned 64 bits + 258: spr158 (spr158), unsigned 64 bits + 259: spr159 (spr159), unsigned 64 bits + 260: spr160 (spr160), unsigned 64 bits + 261: spr161 (spr161), unsigned 64 bits + 262: spr162 (spr162), unsigned 64 bits + 263: spr163 (spr163), unsigned 64 bits + 264: spr164 (spr164), unsigned 64 bits + 265: spr165 (spr165), unsigned 64 bits + 266: spr166 (spr166), unsigned 64 bits + 267: spr167 (spr167), unsigned 64 bits + 268: spr168 (spr168), unsigned 64 bits + 269: spr169 (spr169), unsigned 64 bits + 270: spr170 (spr170), unsigned 64 bits + 271: spr171 (spr171), unsigned 64 bits + 272: spr172 (spr172), unsigned 64 bits + 273: spr173 (spr173), unsigned 64 bits + 274: spr174 (spr174), unsigned 64 bits + 275: spr175 (spr175), unsigned 64 bits + 276: spr176 (spr176), unsigned 64 bits + 277: spr177 (spr177), unsigned 64 bits + 278: spr178 (spr178), unsigned 64 bits + 279: spr179 (spr179), unsigned 64 bits + 280: spr180 (spr180), unsigned 64 bits + 281: spr181 (spr181), unsigned 64 bits + 282: spr182 (spr182), unsigned 64 bits + 283: spr183 (spr183), unsigned 64 bits + 284: spr184 (spr184), unsigned 64 bits + 285: spr185 (spr185), unsigned 64 bits + 286: spr186 (spr186), unsigned 64 bits + 287: spr187 (spr187), unsigned 64 bits + 288: spr188 (spr188), unsigned 64 bits + 289: spr189 (spr189), unsigned 64 bits + 290: spr190 (spr190), unsigned 64 bits + 291: spr191 (spr191), unsigned 64 bits + 292: spr192 (spr192), unsigned 64 bits + 293: spr193 (spr193), unsigned 64 bits + 294: spr194 (spr194), unsigned 64 bits + 295: spr195 (spr195), unsigned 64 bits + 296: spr196 (spr196), unsigned 64 bits + 297: spr197 (spr197), unsigned 64 bits + 298: spr198 (spr198), unsigned 64 bits + 299: spr199 (spr199), unsigned 64 bits + 300: spr200 (spr200), unsigned 64 bits + 301: spr201 (spr201), unsigned 64 bits + 302: spr202 (spr202), unsigned 64 bits + 303: spr203 (spr203), unsigned 64 bits + 304: spr204 (spr204), unsigned 64 bits + 305: spr205 (spr205), unsigned 64 bits + 306: spr206 (spr206), unsigned 64 bits + 307: spr207 (spr207), unsigned 64 bits + 308: spr208 (spr208), unsigned 64 bits + 309: spr209 (spr209), unsigned 64 bits + 310: spr210 (spr210), unsigned 64 bits + 311: spr211 (spr211), unsigned 64 bits + 312: spr212 (spr212), unsigned 64 bits + 313: spr213 (spr213), unsigned 64 bits + 314: spr214 (spr214), unsigned 64 bits + 315: spr215 (spr215), unsigned 64 bits + 316: spr216 (spr216), unsigned 64 bits + 317: spr217 (spr217), unsigned 64 bits + 318: spr218 (spr218), unsigned 64 bits + 319: spr219 (spr219), unsigned 64 bits + 320: spr220 (spr220), unsigned 64 bits + 321: spr221 (spr221), unsigned 64 bits + 322: spr222 (spr222), unsigned 64 bits + 323: spr223 (spr223), unsigned 64 bits + 324: spr224 (spr224), unsigned 64 bits + 325: spr225 (spr225), unsigned 64 bits + 326: spr226 (spr226), unsigned 64 bits + 327: spr227 (spr227), unsigned 64 bits + 328: spr228 (spr228), unsigned 64 bits + 329: spr229 (spr229), unsigned 64 bits + 330: spr230 (spr230), unsigned 64 bits + 331: spr231 (spr231), unsigned 64 bits + 332: spr232 (spr232), unsigned 64 bits + 333: spr233 (spr233), unsigned 64 bits + 334: spr234 (spr234), unsigned 64 bits + 335: spr235 (spr235), unsigned 64 bits + 336: spr236 (spr236), unsigned 64 bits + 337: spr237 (spr237), unsigned 64 bits + 338: spr238 (spr238), unsigned 64 bits + 339: spr239 (spr239), unsigned 64 bits + 340: spr240 (spr240), unsigned 64 bits + 341: spr241 (spr241), unsigned 64 bits + 342: spr242 (spr242), unsigned 64 bits + 343: spr243 (spr243), unsigned 64 bits + 344: spr244 (spr244), unsigned 64 bits + 345: spr245 (spr245), unsigned 64 bits + 346: spr246 (spr246), unsigned 64 bits + 347: spr247 (spr247), unsigned 64 bits + 348: spr248 (spr248), unsigned 64 bits + 349: spr249 (spr249), unsigned 64 bits + 350: spr250 (spr250), unsigned 64 bits + 351: spr251 (spr251), unsigned 64 bits + 352: spr252 (spr252), unsigned 64 bits + 353: spr253 (spr253), unsigned 64 bits + 354: spr254 (spr254), unsigned 64 bits + 355: spr255 (spr255), unsigned 64 bits + 357: spr257 (spr257), unsigned 64 bits + 358: spr258 (spr258), unsigned 64 bits + 359: spr259 (spr259), unsigned 64 bits + 360: spr260 (spr260), unsigned 64 bits + 361: spr261 (spr261), unsigned 64 bits + 362: spr262 (spr262), unsigned 64 bits + 363: spr263 (spr263), unsigned 64 bits + 364: spr264 (spr264), unsigned 64 bits + 365: spr265 (spr265), unsigned 64 bits + 366: spr266 (spr266), unsigned 64 bits + 367: spr267 (spr267), unsigned 64 bits + 368: spr268 (spr268), unsigned 64 bits + 369: spr269 (spr269), unsigned 64 bits + 370: spr270 (spr270), unsigned 64 bits + 371: spr271 (spr271), unsigned 64 bits + 372: spr272 (spr272), unsigned 64 bits + 373: spr273 (spr273), unsigned 64 bits + 374: spr274 (spr274), unsigned 64 bits + 375: spr275 (spr275), unsigned 64 bits + 376: spr276 (spr276), unsigned 64 bits + 377: spr277 (spr277), unsigned 64 bits + 378: spr278 (spr278), unsigned 64 bits + 379: spr279 (spr279), unsigned 64 bits + 380: spr280 (spr280), unsigned 64 bits + 381: spr281 (spr281), unsigned 64 bits + 382: spr282 (spr282), unsigned 64 bits + 383: spr283 (spr283), unsigned 64 bits + 384: spr284 (spr284), unsigned 64 bits + 385: spr285 (spr285), unsigned 64 bits + 386: spr286 (spr286), unsigned 64 bits + 387: spr287 (spr287), unsigned 64 bits + 388: spr288 (spr288), unsigned 64 bits + 389: spr289 (spr289), unsigned 64 bits + 390: spr290 (spr290), unsigned 64 bits + 391: spr291 (spr291), unsigned 64 bits + 392: spr292 (spr292), unsigned 64 bits + 393: spr293 (spr293), unsigned 64 bits + 394: spr294 (spr294), unsigned 64 bits + 395: spr295 (spr295), unsigned 64 bits + 396: spr296 (spr296), unsigned 64 bits + 397: spr297 (spr297), unsigned 64 bits + 398: spr298 (spr298), unsigned 64 bits + 399: spr299 (spr299), unsigned 64 bits + 400: spr300 (spr300), unsigned 64 bits + 401: spr301 (spr301), unsigned 64 bits + 402: spr302 (spr302), unsigned 64 bits + 403: spr303 (spr303), unsigned 64 bits + 404: spr304 (spr304), unsigned 64 bits + 405: spr305 (spr305), unsigned 64 bits + 406: spr306 (spr306), unsigned 64 bits + 407: spr307 (spr307), unsigned 64 bits + 408: spr308 (spr308), unsigned 64 bits + 409: spr309 (spr309), unsigned 64 bits + 410: spr310 (spr310), unsigned 64 bits + 411: spr311 (spr311), unsigned 64 bits + 412: spr312 (spr312), unsigned 64 bits + 413: spr313 (spr313), unsigned 64 bits + 414: spr314 (spr314), unsigned 64 bits + 415: spr315 (spr315), unsigned 64 bits + 416: spr316 (spr316), unsigned 64 bits + 417: spr317 (spr317), unsigned 64 bits + 418: spr318 (spr318), unsigned 64 bits + 419: spr319 (spr319), unsigned 64 bits + 420: spr320 (spr320), unsigned 64 bits + 421: spr321 (spr321), unsigned 64 bits + 422: spr322 (spr322), unsigned 64 bits + 423: spr323 (spr323), unsigned 64 bits + 424: spr324 (spr324), unsigned 64 bits + 425: spr325 (spr325), unsigned 64 bits + 426: spr326 (spr326), unsigned 64 bits + 427: spr327 (spr327), unsigned 64 bits + 428: spr328 (spr328), unsigned 64 bits + 429: spr329 (spr329), unsigned 64 bits + 430: spr330 (spr330), unsigned 64 bits + 431: spr331 (spr331), unsigned 64 bits + 432: spr332 (spr332), unsigned 64 bits + 433: spr333 (spr333), unsigned 64 bits + 434: spr334 (spr334), unsigned 64 bits + 435: spr335 (spr335), unsigned 64 bits + 436: spr336 (spr336), unsigned 64 bits + 437: spr337 (spr337), unsigned 64 bits + 438: spr338 (spr338), unsigned 64 bits + 439: spr339 (spr339), unsigned 64 bits + 440: spr340 (spr340), unsigned 64 bits + 441: spr341 (spr341), unsigned 64 bits + 442: spr342 (spr342), unsigned 64 bits + 443: spr343 (spr343), unsigned 64 bits + 444: spr344 (spr344), unsigned 64 bits + 445: spr345 (spr345), unsigned 64 bits + 446: spr346 (spr346), unsigned 64 bits + 447: spr347 (spr347), unsigned 64 bits + 448: spr348 (spr348), unsigned 64 bits + 449: spr349 (spr349), unsigned 64 bits + 450: spr350 (spr350), unsigned 64 bits + 451: spr351 (spr351), unsigned 64 bits + 452: spr352 (spr352), unsigned 64 bits + 453: spr353 (spr353), unsigned 64 bits + 454: spr354 (spr354), unsigned 64 bits + 455: spr355 (spr355), unsigned 64 bits + 456: spr356 (spr356), unsigned 64 bits + 457: spr357 (spr357), unsigned 64 bits + 458: spr358 (spr358), unsigned 64 bits + 459: spr359 (spr359), unsigned 64 bits + 460: spr360 (spr360), unsigned 64 bits + 461: spr361 (spr361), unsigned 64 bits + 462: spr362 (spr362), unsigned 64 bits + 463: spr363 (spr363), unsigned 64 bits + 464: spr364 (spr364), unsigned 64 bits + 465: spr365 (spr365), unsigned 64 bits + 466: spr366 (spr366), unsigned 64 bits + 467: spr367 (spr367), unsigned 64 bits + 468: spr368 (spr368), unsigned 64 bits + 469: spr369 (spr369), unsigned 64 bits + 470: spr370 (spr370), unsigned 64 bits + 471: spr371 (spr371), unsigned 64 bits + 472: spr372 (spr372), unsigned 64 bits + 473: spr373 (spr373), unsigned 64 bits + 474: spr374 (spr374), unsigned 64 bits + 475: spr375 (spr375), unsigned 64 bits + 476: spr376 (spr376), unsigned 64 bits + 477: spr377 (spr377), unsigned 64 bits + 478: spr378 (spr378), unsigned 64 bits + 479: spr379 (spr379), unsigned 64 bits + 480: spr380 (spr380), unsigned 64 bits + 481: spr381 (spr381), unsigned 64 bits + 482: spr382 (spr382), unsigned 64 bits + 483: spr383 (spr383), unsigned 64 bits + 484: spr384 (spr384), unsigned 64 bits + 485: spr385 (spr385), unsigned 64 bits + 486: spr386 (spr386), unsigned 64 bits + 487: spr387 (spr387), unsigned 64 bits + 488: spr388 (spr388), unsigned 64 bits + 489: spr389 (spr389), unsigned 64 bits + 490: spr390 (spr390), unsigned 64 bits + 491: spr391 (spr391), unsigned 64 bits + 492: spr392 (spr392), unsigned 64 bits + 493: spr393 (spr393), unsigned 64 bits + 494: spr394 (spr394), unsigned 64 bits + 495: spr395 (spr395), unsigned 64 bits + 496: spr396 (spr396), unsigned 64 bits + 497: spr397 (spr397), unsigned 64 bits + 498: spr398 (spr398), unsigned 64 bits + 499: spr399 (spr399), unsigned 64 bits + 500: spr400 (spr400), unsigned 64 bits + 501: spr401 (spr401), unsigned 64 bits + 502: spr402 (spr402), unsigned 64 bits + 503: spr403 (spr403), unsigned 64 bits + 504: spr404 (spr404), unsigned 64 bits + 505: spr405 (spr405), unsigned 64 bits + 506: spr406 (spr406), unsigned 64 bits + 507: spr407 (spr407), unsigned 64 bits + 508: spr408 (spr408), unsigned 64 bits + 509: spr409 (spr409), unsigned 64 bits + 510: spr410 (spr410), unsigned 64 bits + 511: spr411 (spr411), unsigned 64 bits + 512: spr412 (spr412), unsigned 64 bits + 513: spr413 (spr413), unsigned 64 bits + 514: spr414 (spr414), unsigned 64 bits + 515: spr415 (spr415), unsigned 64 bits + 516: spr416 (spr416), unsigned 64 bits + 517: spr417 (spr417), unsigned 64 bits + 518: spr418 (spr418), unsigned 64 bits + 519: spr419 (spr419), unsigned 64 bits + 520: spr420 (spr420), unsigned 64 bits + 521: spr421 (spr421), unsigned 64 bits + 522: spr422 (spr422), unsigned 64 bits + 523: spr423 (spr423), unsigned 64 bits + 524: spr424 (spr424), unsigned 64 bits + 525: spr425 (spr425), unsigned 64 bits + 526: spr426 (spr426), unsigned 64 bits + 527: spr427 (spr427), unsigned 64 bits + 528: spr428 (spr428), unsigned 64 bits + 529: spr429 (spr429), unsigned 64 bits + 530: spr430 (spr430), unsigned 64 bits + 531: spr431 (spr431), unsigned 64 bits + 532: spr432 (spr432), unsigned 64 bits + 533: spr433 (spr433), unsigned 64 bits + 534: spr434 (spr434), unsigned 64 bits + 535: spr435 (spr435), unsigned 64 bits + 536: spr436 (spr436), unsigned 64 bits + 537: spr437 (spr437), unsigned 64 bits + 538: spr438 (spr438), unsigned 64 bits + 539: spr439 (spr439), unsigned 64 bits + 540: spr440 (spr440), unsigned 64 bits + 541: spr441 (spr441), unsigned 64 bits + 542: spr442 (spr442), unsigned 64 bits + 543: spr443 (spr443), unsigned 64 bits + 544: spr444 (spr444), unsigned 64 bits + 545: spr445 (spr445), unsigned 64 bits + 546: spr446 (spr446), unsigned 64 bits + 547: spr447 (spr447), unsigned 64 bits + 548: spr448 (spr448), unsigned 64 bits + 549: spr449 (spr449), unsigned 64 bits + 550: spr450 (spr450), unsigned 64 bits + 551: spr451 (spr451), unsigned 64 bits + 552: spr452 (spr452), unsigned 64 bits + 553: spr453 (spr453), unsigned 64 bits + 554: spr454 (spr454), unsigned 64 bits + 555: spr455 (spr455), unsigned 64 bits + 556: spr456 (spr456), unsigned 64 bits + 557: spr457 (spr457), unsigned 64 bits + 558: spr458 (spr458), unsigned 64 bits + 559: spr459 (spr459), unsigned 64 bits + 560: spr460 (spr460), unsigned 64 bits + 561: spr461 (spr461), unsigned 64 bits + 562: spr462 (spr462), unsigned 64 bits + 563: spr463 (spr463), unsigned 64 bits + 564: spr464 (spr464), unsigned 64 bits + 565: spr465 (spr465), unsigned 64 bits + 566: spr466 (spr466), unsigned 64 bits + 567: spr467 (spr467), unsigned 64 bits + 568: spr468 (spr468), unsigned 64 bits + 569: spr469 (spr469), unsigned 64 bits + 570: spr470 (spr470), unsigned 64 bits + 571: spr471 (spr471), unsigned 64 bits + 572: spr472 (spr472), unsigned 64 bits + 573: spr473 (spr473), unsigned 64 bits + 574: spr474 (spr474), unsigned 64 bits + 575: spr475 (spr475), unsigned 64 bits + 576: spr476 (spr476), unsigned 64 bits + 577: spr477 (spr477), unsigned 64 bits + 578: spr478 (spr478), unsigned 64 bits + 579: spr479 (spr479), unsigned 64 bits + 580: spr480 (spr480), unsigned 64 bits + 581: spr481 (spr481), unsigned 64 bits + 582: spr482 (spr482), unsigned 64 bits + 583: spr483 (spr483), unsigned 64 bits + 584: spr484 (spr484), unsigned 64 bits + 585: spr485 (spr485), unsigned 64 bits + 586: spr486 (spr486), unsigned 64 bits + 587: spr487 (spr487), unsigned 64 bits + 588: spr488 (spr488), unsigned 64 bits + 589: spr489 (spr489), unsigned 64 bits + 590: spr490 (spr490), unsigned 64 bits + 591: spr491 (spr491), unsigned 64 bits + 592: spr492 (spr492), unsigned 64 bits + 593: spr493 (spr493), unsigned 64 bits + 594: spr494 (spr494), unsigned 64 bits + 595: spr495 (spr495), unsigned 64 bits + 596: spr496 (spr496), unsigned 64 bits + 597: spr497 (spr497), unsigned 64 bits + 598: spr498 (spr498), unsigned 64 bits + 599: spr499 (spr499), unsigned 64 bits + 600: spr500 (spr500), unsigned 64 bits + 601: spr501 (spr501), unsigned 64 bits + 602: spr502 (spr502), unsigned 64 bits + 603: spr503 (spr503), unsigned 64 bits + 604: spr504 (spr504), unsigned 64 bits + 605: spr505 (spr505), unsigned 64 bits + 606: spr506 (spr506), unsigned 64 bits + 607: spr507 (spr507), unsigned 64 bits + 608: spr508 (spr508), unsigned 64 bits + 609: spr509 (spr509), unsigned 64 bits + 610: spr510 (spr510), unsigned 64 bits + 611: spr511 (spr511), unsigned 64 bits + 613: spr513 (spr513), unsigned 64 bits + 614: spr514 (spr514), unsigned 64 bits + 615: spr515 (spr515), unsigned 64 bits + 616: spr516 (spr516), unsigned 64 bits + 617: spr517 (spr517), unsigned 64 bits + 618: spr518 (spr518), unsigned 64 bits + 619: spr519 (spr519), unsigned 64 bits + 620: spr520 (spr520), unsigned 64 bits + 621: spr521 (spr521), unsigned 64 bits + 622: spr522 (spr522), unsigned 64 bits + 623: spr523 (spr523), unsigned 64 bits + 624: spr524 (spr524), unsigned 64 bits + 625: spr525 (spr525), unsigned 64 bits + 626: spr526 (spr526), unsigned 64 bits + 627: spr527 (spr527), unsigned 64 bits + 628: spr528 (spr528), unsigned 64 bits + 629: spr529 (spr529), unsigned 64 bits + 630: spr530 (spr530), unsigned 64 bits + 631: spr531 (spr531), unsigned 64 bits + 632: spr532 (spr532), unsigned 64 bits + 633: spr533 (spr533), unsigned 64 bits + 634: spr534 (spr534), unsigned 64 bits + 635: spr535 (spr535), unsigned 64 bits + 636: spr536 (spr536), unsigned 64 bits + 637: spr537 (spr537), unsigned 64 bits + 638: spr538 (spr538), unsigned 64 bits + 639: spr539 (spr539), unsigned 64 bits + 640: spr540 (spr540), unsigned 64 bits + 641: spr541 (spr541), unsigned 64 bits + 642: spr542 (spr542), unsigned 64 bits + 643: spr543 (spr543), unsigned 64 bits + 644: spr544 (spr544), unsigned 64 bits + 645: spr545 (spr545), unsigned 64 bits + 646: spr546 (spr546), unsigned 64 bits + 647: spr547 (spr547), unsigned 64 bits + 648: spr548 (spr548), unsigned 64 bits + 649: spr549 (spr549), unsigned 64 bits + 650: spr550 (spr550), unsigned 64 bits + 651: spr551 (spr551), unsigned 64 bits + 652: spr552 (spr552), unsigned 64 bits + 653: spr553 (spr553), unsigned 64 bits + 654: spr554 (spr554), unsigned 64 bits + 655: spr555 (spr555), unsigned 64 bits + 656: spr556 (spr556), unsigned 64 bits + 657: spr557 (spr557), unsigned 64 bits + 658: spr558 (spr558), unsigned 64 bits + 659: spr559 (spr559), unsigned 64 bits + 660: spr560 (spr560), unsigned 64 bits + 661: spr561 (spr561), unsigned 64 bits + 662: spr562 (spr562), unsigned 64 bits + 663: spr563 (spr563), unsigned 64 bits + 664: spr564 (spr564), unsigned 64 bits + 665: spr565 (spr565), unsigned 64 bits + 666: spr566 (spr566), unsigned 64 bits + 667: spr567 (spr567), unsigned 64 bits + 668: spr568 (spr568), unsigned 64 bits + 669: spr569 (spr569), unsigned 64 bits + 670: spr570 (spr570), unsigned 64 bits + 671: spr571 (spr571), unsigned 64 bits + 672: spr572 (spr572), unsigned 64 bits + 673: spr573 (spr573), unsigned 64 bits + 674: spr574 (spr574), unsigned 64 bits + 675: spr575 (spr575), unsigned 64 bits + 676: spr576 (spr576), unsigned 64 bits + 677: spr577 (spr577), unsigned 64 bits + 678: spr578 (spr578), unsigned 64 bits + 679: spr579 (spr579), unsigned 64 bits + 680: spr580 (spr580), unsigned 64 bits + 681: spr581 (spr581), unsigned 64 bits + 682: spr582 (spr582), unsigned 64 bits + 683: spr583 (spr583), unsigned 64 bits + 684: spr584 (spr584), unsigned 64 bits + 685: spr585 (spr585), unsigned 64 bits + 686: spr586 (spr586), unsigned 64 bits + 687: spr587 (spr587), unsigned 64 bits + 688: spr588 (spr588), unsigned 64 bits + 689: spr589 (spr589), unsigned 64 bits + 690: spr590 (spr590), unsigned 64 bits + 691: spr591 (spr591), unsigned 64 bits + 692: spr592 (spr592), unsigned 64 bits + 693: spr593 (spr593), unsigned 64 bits + 694: spr594 (spr594), unsigned 64 bits + 695: spr595 (spr595), unsigned 64 bits + 696: spr596 (spr596), unsigned 64 bits + 697: spr597 (spr597), unsigned 64 bits + 698: spr598 (spr598), unsigned 64 bits + 699: spr599 (spr599), unsigned 64 bits + 700: spr600 (spr600), unsigned 64 bits + 701: spr601 (spr601), unsigned 64 bits + 702: spr602 (spr602), unsigned 64 bits + 703: spr603 (spr603), unsigned 64 bits + 704: spr604 (spr604), unsigned 64 bits + 705: spr605 (spr605), unsigned 64 bits + 706: spr606 (spr606), unsigned 64 bits + 707: spr607 (spr607), unsigned 64 bits + 708: spr608 (spr608), unsigned 64 bits + 709: spr609 (spr609), unsigned 64 bits + 710: spr610 (spr610), unsigned 64 bits + 711: spr611 (spr611), unsigned 64 bits + 712: spr612 (spr612), unsigned 64 bits + 713: spr613 (spr613), unsigned 64 bits + 714: spr614 (spr614), unsigned 64 bits + 715: spr615 (spr615), unsigned 64 bits + 716: spr616 (spr616), unsigned 64 bits + 717: spr617 (spr617), unsigned 64 bits + 718: spr618 (spr618), unsigned 64 bits + 719: spr619 (spr619), unsigned 64 bits + 720: spr620 (spr620), unsigned 64 bits + 721: spr621 (spr621), unsigned 64 bits + 722: spr622 (spr622), unsigned 64 bits + 723: spr623 (spr623), unsigned 64 bits + 724: spr624 (spr624), unsigned 64 bits + 725: spr625 (spr625), unsigned 64 bits + 726: spr626 (spr626), unsigned 64 bits + 727: spr627 (spr627), unsigned 64 bits + 728: spr628 (spr628), unsigned 64 bits + 729: spr629 (spr629), unsigned 64 bits + 730: spr630 (spr630), unsigned 64 bits + 731: spr631 (spr631), unsigned 64 bits + 732: spr632 (spr632), unsigned 64 bits + 733: spr633 (spr633), unsigned 64 bits + 734: spr634 (spr634), unsigned 64 bits + 735: spr635 (spr635), unsigned 64 bits + 736: spr636 (spr636), unsigned 64 bits + 737: spr637 (spr637), unsigned 64 bits + 738: spr638 (spr638), unsigned 64 bits + 739: spr639 (spr639), unsigned 64 bits + 740: spr640 (spr640), unsigned 64 bits + 741: spr641 (spr641), unsigned 64 bits + 742: spr642 (spr642), unsigned 64 bits + 743: spr643 (spr643), unsigned 64 bits + 744: spr644 (spr644), unsigned 64 bits + 745: spr645 (spr645), unsigned 64 bits + 746: spr646 (spr646), unsigned 64 bits + 747: spr647 (spr647), unsigned 64 bits + 748: spr648 (spr648), unsigned 64 bits + 749: spr649 (spr649), unsigned 64 bits + 750: spr650 (spr650), unsigned 64 bits + 751: spr651 (spr651), unsigned 64 bits + 752: spr652 (spr652), unsigned 64 bits + 753: spr653 (spr653), unsigned 64 bits + 754: spr654 (spr654), unsigned 64 bits + 755: spr655 (spr655), unsigned 64 bits + 756: spr656 (spr656), unsigned 64 bits + 757: spr657 (spr657), unsigned 64 bits + 758: spr658 (spr658), unsigned 64 bits + 759: spr659 (spr659), unsigned 64 bits + 760: spr660 (spr660), unsigned 64 bits + 761: spr661 (spr661), unsigned 64 bits + 762: spr662 (spr662), unsigned 64 bits + 763: spr663 (spr663), unsigned 64 bits + 764: spr664 (spr664), unsigned 64 bits + 765: spr665 (spr665), unsigned 64 bits + 766: spr666 (spr666), unsigned 64 bits + 767: spr667 (spr667), unsigned 64 bits + 768: spr668 (spr668), unsigned 64 bits + 769: spr669 (spr669), unsigned 64 bits + 770: spr670 (spr670), unsigned 64 bits + 771: spr671 (spr671), unsigned 64 bits + 772: spr672 (spr672), unsigned 64 bits + 773: spr673 (spr673), unsigned 64 bits + 774: spr674 (spr674), unsigned 64 bits + 775: spr675 (spr675), unsigned 64 bits + 776: spr676 (spr676), unsigned 64 bits + 777: spr677 (spr677), unsigned 64 bits + 778: spr678 (spr678), unsigned 64 bits + 779: spr679 (spr679), unsigned 64 bits + 780: spr680 (spr680), unsigned 64 bits + 781: spr681 (spr681), unsigned 64 bits + 782: spr682 (spr682), unsigned 64 bits + 783: spr683 (spr683), unsigned 64 bits + 784: spr684 (spr684), unsigned 64 bits + 785: spr685 (spr685), unsigned 64 bits + 786: spr686 (spr686), unsigned 64 bits + 787: spr687 (spr687), unsigned 64 bits + 788: spr688 (spr688), unsigned 64 bits + 789: spr689 (spr689), unsigned 64 bits + 790: spr690 (spr690), unsigned 64 bits + 791: spr691 (spr691), unsigned 64 bits + 792: spr692 (spr692), unsigned 64 bits + 793: spr693 (spr693), unsigned 64 bits + 794: spr694 (spr694), unsigned 64 bits + 795: spr695 (spr695), unsigned 64 bits + 796: spr696 (spr696), unsigned 64 bits + 797: spr697 (spr697), unsigned 64 bits + 798: spr698 (spr698), unsigned 64 bits + 799: spr699 (spr699), unsigned 64 bits + 800: spr700 (spr700), unsigned 64 bits + 801: spr701 (spr701), unsigned 64 bits + 802: spr702 (spr702), unsigned 64 bits + 803: spr703 (spr703), unsigned 64 bits + 804: spr704 (spr704), unsigned 64 bits + 805: spr705 (spr705), unsigned 64 bits + 806: spr706 (spr706), unsigned 64 bits + 807: spr707 (spr707), unsigned 64 bits + 808: spr708 (spr708), unsigned 64 bits + 809: spr709 (spr709), unsigned 64 bits + 810: spr710 (spr710), unsigned 64 bits + 811: spr711 (spr711), unsigned 64 bits + 812: spr712 (spr712), unsigned 64 bits + 813: spr713 (spr713), unsigned 64 bits + 814: spr714 (spr714), unsigned 64 bits + 815: spr715 (spr715), unsigned 64 bits + 816: spr716 (spr716), unsigned 64 bits + 817: spr717 (spr717), unsigned 64 bits + 818: spr718 (spr718), unsigned 64 bits + 819: spr719 (spr719), unsigned 64 bits + 820: spr720 (spr720), unsigned 64 bits + 821: spr721 (spr721), unsigned 64 bits + 822: spr722 (spr722), unsigned 64 bits + 823: spr723 (spr723), unsigned 64 bits + 824: spr724 (spr724), unsigned 64 bits + 825: spr725 (spr725), unsigned 64 bits + 826: spr726 (spr726), unsigned 64 bits + 827: spr727 (spr727), unsigned 64 bits + 828: spr728 (spr728), unsigned 64 bits + 829: spr729 (spr729), unsigned 64 bits + 830: spr730 (spr730), unsigned 64 bits + 831: spr731 (spr731), unsigned 64 bits + 832: spr732 (spr732), unsigned 64 bits + 833: spr733 (spr733), unsigned 64 bits + 834: spr734 (spr734), unsigned 64 bits + 835: spr735 (spr735), unsigned 64 bits + 836: spr736 (spr736), unsigned 64 bits + 837: spr737 (spr737), unsigned 64 bits + 838: spr738 (spr738), unsigned 64 bits + 839: spr739 (spr739), unsigned 64 bits + 840: spr740 (spr740), unsigned 64 bits + 841: spr741 (spr741), unsigned 64 bits + 842: spr742 (spr742), unsigned 64 bits + 843: spr743 (spr743), unsigned 64 bits + 844: spr744 (spr744), unsigned 64 bits + 845: spr745 (spr745), unsigned 64 bits + 846: spr746 (spr746), unsigned 64 bits + 847: spr747 (spr747), unsigned 64 bits + 848: spr748 (spr748), unsigned 64 bits + 849: spr749 (spr749), unsigned 64 bits + 850: spr750 (spr750), unsigned 64 bits + 851: spr751 (spr751), unsigned 64 bits + 852: spr752 (spr752), unsigned 64 bits + 853: spr753 (spr753), unsigned 64 bits + 854: spr754 (spr754), unsigned 64 bits + 855: spr755 (spr755), unsigned 64 bits + 856: spr756 (spr756), unsigned 64 bits + 857: spr757 (spr757), unsigned 64 bits + 858: spr758 (spr758), unsigned 64 bits + 859: spr759 (spr759), unsigned 64 bits + 860: spr760 (spr760), unsigned 64 bits + 861: spr761 (spr761), unsigned 64 bits + 862: spr762 (spr762), unsigned 64 bits + 863: spr763 (spr763), unsigned 64 bits + 864: spr764 (spr764), unsigned 64 bits + 865: spr765 (spr765), unsigned 64 bits + 866: spr766 (spr766), unsigned 64 bits + 867: spr767 (spr767), unsigned 64 bits + 868: spr768 (spr768), unsigned 64 bits + 869: spr769 (spr769), unsigned 64 bits + 870: spr770 (spr770), unsigned 64 bits + 871: spr771 (spr771), unsigned 64 bits + 872: spr772 (spr772), unsigned 64 bits + 873: spr773 (spr773), unsigned 64 bits + 874: spr774 (spr774), unsigned 64 bits + 875: spr775 (spr775), unsigned 64 bits + 876: spr776 (spr776), unsigned 64 bits + 877: spr777 (spr777), unsigned 64 bits + 878: spr778 (spr778), unsigned 64 bits + 879: spr779 (spr779), unsigned 64 bits + 880: spr780 (spr780), unsigned 64 bits + 881: spr781 (spr781), unsigned 64 bits + 882: spr782 (spr782), unsigned 64 bits + 883: spr783 (spr783), unsigned 64 bits + 884: spr784 (spr784), unsigned 64 bits + 885: spr785 (spr785), unsigned 64 bits + 886: spr786 (spr786), unsigned 64 bits + 887: spr787 (spr787), unsigned 64 bits + 888: spr788 (spr788), unsigned 64 bits + 889: spr789 (spr789), unsigned 64 bits + 890: spr790 (spr790), unsigned 64 bits + 891: spr791 (spr791), unsigned 64 bits + 892: spr792 (spr792), unsigned 64 bits + 893: spr793 (spr793), unsigned 64 bits + 894: spr794 (spr794), unsigned 64 bits + 895: spr795 (spr795), unsigned 64 bits + 896: spr796 (spr796), unsigned 64 bits + 897: spr797 (spr797), unsigned 64 bits + 898: spr798 (spr798), unsigned 64 bits + 899: spr799 (spr799), unsigned 64 bits + 900: spr800 (spr800), unsigned 64 bits + 901: spr801 (spr801), unsigned 64 bits + 902: spr802 (spr802), unsigned 64 bits + 903: spr803 (spr803), unsigned 64 bits + 904: spr804 (spr804), unsigned 64 bits + 905: spr805 (spr805), unsigned 64 bits + 906: spr806 (spr806), unsigned 64 bits + 907: spr807 (spr807), unsigned 64 bits + 908: spr808 (spr808), unsigned 64 bits + 909: spr809 (spr809), unsigned 64 bits + 910: spr810 (spr810), unsigned 64 bits + 911: spr811 (spr811), unsigned 64 bits + 912: spr812 (spr812), unsigned 64 bits + 913: spr813 (spr813), unsigned 64 bits + 914: spr814 (spr814), unsigned 64 bits + 915: spr815 (spr815), unsigned 64 bits + 916: spr816 (spr816), unsigned 64 bits + 917: spr817 (spr817), unsigned 64 bits + 918: spr818 (spr818), unsigned 64 bits + 919: spr819 (spr819), unsigned 64 bits + 920: spr820 (spr820), unsigned 64 bits + 921: spr821 (spr821), unsigned 64 bits + 922: spr822 (spr822), unsigned 64 bits + 923: spr823 (spr823), unsigned 64 bits + 924: spr824 (spr824), unsigned 64 bits + 925: spr825 (spr825), unsigned 64 bits + 926: spr826 (spr826), unsigned 64 bits + 927: spr827 (spr827), unsigned 64 bits + 928: spr828 (spr828), unsigned 64 bits + 929: spr829 (spr829), unsigned 64 bits + 930: spr830 (spr830), unsigned 64 bits + 931: spr831 (spr831), unsigned 64 bits + 932: spr832 (spr832), unsigned 64 bits + 933: spr833 (spr833), unsigned 64 bits + 934: spr834 (spr834), unsigned 64 bits + 935: spr835 (spr835), unsigned 64 bits + 936: spr836 (spr836), unsigned 64 bits + 937: spr837 (spr837), unsigned 64 bits + 938: spr838 (spr838), unsigned 64 bits + 939: spr839 (spr839), unsigned 64 bits + 940: spr840 (spr840), unsigned 64 bits + 941: spr841 (spr841), unsigned 64 bits + 942: spr842 (spr842), unsigned 64 bits + 943: spr843 (spr843), unsigned 64 bits + 944: spr844 (spr844), unsigned 64 bits + 945: spr845 (spr845), unsigned 64 bits + 946: spr846 (spr846), unsigned 64 bits + 947: spr847 (spr847), unsigned 64 bits + 948: spr848 (spr848), unsigned 64 bits + 949: spr849 (spr849), unsigned 64 bits + 950: spr850 (spr850), unsigned 64 bits + 951: spr851 (spr851), unsigned 64 bits + 952: spr852 (spr852), unsigned 64 bits + 953: spr853 (spr853), unsigned 64 bits + 954: spr854 (spr854), unsigned 64 bits + 955: spr855 (spr855), unsigned 64 bits + 956: spr856 (spr856), unsigned 64 bits + 957: spr857 (spr857), unsigned 64 bits + 958: spr858 (spr858), unsigned 64 bits + 959: spr859 (spr859), unsigned 64 bits + 960: spr860 (spr860), unsigned 64 bits + 961: spr861 (spr861), unsigned 64 bits + 962: spr862 (spr862), unsigned 64 bits + 963: spr863 (spr863), unsigned 64 bits + 964: spr864 (spr864), unsigned 64 bits + 965: spr865 (spr865), unsigned 64 bits + 966: spr866 (spr866), unsigned 64 bits + 967: spr867 (spr867), unsigned 64 bits + 968: spr868 (spr868), unsigned 64 bits + 969: spr869 (spr869), unsigned 64 bits + 970: spr870 (spr870), unsigned 64 bits + 971: spr871 (spr871), unsigned 64 bits + 972: spr872 (spr872), unsigned 64 bits + 973: spr873 (spr873), unsigned 64 bits + 974: spr874 (spr874), unsigned 64 bits + 975: spr875 (spr875), unsigned 64 bits + 976: spr876 (spr876), unsigned 64 bits + 977: spr877 (spr877), unsigned 64 bits + 978: spr878 (spr878), unsigned 64 bits + 979: spr879 (spr879), unsigned 64 bits + 980: spr880 (spr880), unsigned 64 bits + 981: spr881 (spr881), unsigned 64 bits + 982: spr882 (spr882), unsigned 64 bits + 983: spr883 (spr883), unsigned 64 bits + 984: spr884 (spr884), unsigned 64 bits + 985: spr885 (spr885), unsigned 64 bits + 986: spr886 (spr886), unsigned 64 bits + 987: spr887 (spr887), unsigned 64 bits + 988: spr888 (spr888), unsigned 64 bits + 989: spr889 (spr889), unsigned 64 bits + 990: spr890 (spr890), unsigned 64 bits + 991: spr891 (spr891), unsigned 64 bits + 992: spr892 (spr892), unsigned 64 bits + 993: spr893 (spr893), unsigned 64 bits + 994: spr894 (spr894), unsigned 64 bits + 995: spr895 (spr895), unsigned 64 bits + 996: spr896 (spr896), unsigned 64 bits + 997: spr897 (spr897), unsigned 64 bits + 998: spr898 (spr898), unsigned 64 bits + 999: spr899 (spr899), unsigned 64 bits +vector registers: + 67: vscr (vscr), unsigned 32 bits + 356: vrsave (vrsave), unsigned 32 bits + 612: spefscr (spefscr), unsigned 32 bits + 1124: vr0 (vr0), unsigned 128 bits + 1125: vr1 (vr1), unsigned 128 bits + 1126: vr2 (vr2), unsigned 128 bits + 1127: vr3 (vr3), unsigned 128 bits + 1128: vr4 (vr4), unsigned 128 bits + 1129: vr5 (vr5), unsigned 128 bits + 1130: vr6 (vr6), unsigned 128 bits + 1131: vr7 (vr7), unsigned 128 bits + 1132: vr8 (vr8), unsigned 128 bits + 1133: vr9 (vr9), unsigned 128 bits + 1134: vr10 (vr10), unsigned 128 bits + 1135: vr11 (vr11), unsigned 128 bits + 1136: vr12 (vr12), unsigned 128 bits + 1137: vr13 (vr13), unsigned 128 bits + 1138: vr14 (vr14), unsigned 128 bits + 1139: vr15 (vr15), unsigned 128 bits + 1140: vr16 (vr16), unsigned 128 bits + 1141: vr17 (vr17), unsigned 128 bits + 1142: vr18 (vr18), unsigned 128 bits + 1143: vr19 (vr19), unsigned 128 bits + 1144: vr20 (vr20), unsigned 128 bits + 1145: vr21 (vr21), unsigned 128 bits + 1146: vr22 (vr22), unsigned 128 bits + 1147: vr23 (vr23), unsigned 128 bits + 1148: vr24 (vr24), unsigned 128 bits + 1149: vr25 (vr25), unsigned 128 bits + 1150: vr26 (vr26), unsigned 128 bits + 1151: vr27 (vr27), unsigned 128 bits + 1152: vr28 (vr28), unsigned 128 bits + 1153: vr29 (vr29), unsigned 128 bits + 1154: vr30 (vr30), unsigned 128 bits + 1155: vr31 (vr31), unsigned 128 bits +EOF + +regs_test testfile26 <<\EOF +integer registers: + 0: %r0 (r0), signed 32 bits + 1: %r1 (r1), signed 32 bits + 2: %r2 (r2), signed 32 bits + 3: %r3 (r3), signed 32 bits + 4: %r4 (r4), signed 32 bits + 5: %r5 (r5), signed 32 bits + 6: %r6 (r6), signed 32 bits + 7: %r7 (r7), signed 32 bits + 8: %r8 (r8), signed 32 bits + 9: %r9 (r9), signed 32 bits + 10: %r10 (r10), signed 32 bits + 11: %r11 (r11), signed 32 bits + 12: %r12 (r12), signed 32 bits + 13: %r13 (r13), signed 32 bits + 14: %r14 (r14), signed 32 bits + 15: %r15 (r15), signed 32 bits +FPU registers: + 16: %f0 (f0), float 64 bits + 17: %f2 (f2), float 64 bits + 18: %f4 (f4), float 64 bits + 19: %f6 (f6), float 64 bits + 20: %f1 (f1), float 64 bits + 21: %f3 (f3), float 64 bits + 22: %f5 (f5), float 64 bits + 23: %f7 (f7), float 64 bits + 24: %f8 (f8), float 64 bits + 25: %f10 (f10), float 64 bits + 26: %f12 (f12), float 64 bits + 27: %f14 (f14), float 64 bits + 28: %f9 (f9), float 64 bits + 29: %f11 (f11), float 64 bits + 30: %f13 (f13), float 64 bits + 31: %f15 (f15), float 64 bits +access registers: + 48: %a0 (a0), unsigned 32 bits + 49: %a1 (a1), unsigned 32 bits + 50: %a2 (a2), unsigned 32 bits + 51: %a3 (a3), unsigned 32 bits + 52: %a4 (a4), unsigned 32 bits + 53: %a5 (a5), unsigned 32 bits + 54: %a6 (a6), unsigned 32 bits + 55: %a7 (a7), unsigned 32 bits + 56: %a8 (a8), unsigned 32 bits + 57: %a9 (a9), unsigned 32 bits + 58: %a10 (a10), unsigned 32 bits + 59: %a11 (a11), unsigned 32 bits + 60: %a12 (a12), unsigned 32 bits + 61: %a13 (a13), unsigned 32 bits + 62: %a14 (a14), unsigned 32 bits + 63: %a15 (a15), unsigned 32 bits +control registers: + 32: %c0 (c0), unsigned 32 bits + 33: %c1 (c1), unsigned 32 bits + 34: %c2 (c2), unsigned 32 bits + 35: %c3 (c3), unsigned 32 bits + 36: %c4 (c4), unsigned 32 bits + 37: %c5 (c5), unsigned 32 bits + 38: %c6 (c6), unsigned 32 bits + 39: %c7 (c7), unsigned 32 bits + 40: %c8 (c8), unsigned 32 bits + 41: %c9 (c9), unsigned 32 bits + 42: %c10 (c10), unsigned 32 bits + 43: %c11 (c11), unsigned 32 bits + 44: %c12 (c12), unsigned 32 bits + 45: %c13 (c13), unsigned 32 bits + 46: %c14 (c14), unsigned 32 bits + 47: %c15 (c15), unsigned 32 bits + 64: %pswm (pswm), unsigned 32 bits + 65: %pswa (pswa), address 32 bits +EOF + +regs_test testfile27 <<\EOF +integer registers: + 0: %r0 (r0), signed 64 bits + 1: %r1 (r1), signed 64 bits + 2: %r2 (r2), signed 64 bits + 3: %r3 (r3), signed 64 bits + 4: %r4 (r4), signed 64 bits + 5: %r5 (r5), signed 64 bits + 6: %r6 (r6), signed 64 bits + 7: %r7 (r7), signed 64 bits + 8: %r8 (r8), signed 64 bits + 9: %r9 (r9), signed 64 bits + 10: %r10 (r10), signed 64 bits + 11: %r11 (r11), signed 64 bits + 12: %r12 (r12), signed 64 bits + 13: %r13 (r13), signed 64 bits + 14: %r14 (r14), signed 64 bits + 15: %r15 (r15), signed 64 bits +FPU registers: + 16: %f0 (f0), float 64 bits + 17: %f2 (f2), float 64 bits + 18: %f4 (f4), float 64 bits + 19: %f6 (f6), float 64 bits + 20: %f1 (f1), float 64 bits + 21: %f3 (f3), float 64 bits + 22: %f5 (f5), float 64 bits + 23: %f7 (f7), float 64 bits + 24: %f8 (f8), float 64 bits + 25: %f10 (f10), float 64 bits + 26: %f12 (f12), float 64 bits + 27: %f14 (f14), float 64 bits + 28: %f9 (f9), float 64 bits + 29: %f11 (f11), float 64 bits + 30: %f13 (f13), float 64 bits + 31: %f15 (f15), float 64 bits +access registers: + 48: %a0 (a0), unsigned 32 bits + 49: %a1 (a1), unsigned 32 bits + 50: %a2 (a2), unsigned 32 bits + 51: %a3 (a3), unsigned 32 bits + 52: %a4 (a4), unsigned 32 bits + 53: %a5 (a5), unsigned 32 bits + 54: %a6 (a6), unsigned 32 bits + 55: %a7 (a7), unsigned 32 bits + 56: %a8 (a8), unsigned 32 bits + 57: %a9 (a9), unsigned 32 bits + 58: %a10 (a10), unsigned 32 bits + 59: %a11 (a11), unsigned 32 bits + 60: %a12 (a12), unsigned 32 bits + 61: %a13 (a13), unsigned 32 bits + 62: %a14 (a14), unsigned 32 bits + 63: %a15 (a15), unsigned 32 bits +control registers: + 32: %c0 (c0), unsigned 64 bits + 33: %c1 (c1), unsigned 64 bits + 34: %c2 (c2), unsigned 64 bits + 35: %c3 (c3), unsigned 64 bits + 36: %c4 (c4), unsigned 64 bits + 37: %c5 (c5), unsigned 64 bits + 38: %c6 (c6), unsigned 64 bits + 39: %c7 (c7), unsigned 64 bits + 40: %c8 (c8), unsigned 64 bits + 41: %c9 (c9), unsigned 64 bits + 42: %c10 (c10), unsigned 64 bits + 43: %c11 (c11), unsigned 64 bits + 44: %c12 (c12), unsigned 64 bits + 45: %c13 (c13), unsigned 64 bits + 46: %c14 (c14), unsigned 64 bits + 47: %c15 (c15), unsigned 64 bits + 64: %pswm (pswm), unsigned 64 bits + 65: %pswa (pswa), address 64 bits +EOF + +regs_test testfile30 <<\EOF +integer registers: + 0: %g0 (g0), signed 32 bits + 1: %g1 (g1), signed 32 bits + 2: %g2 (g2), signed 32 bits + 3: %g3 (g3), signed 32 bits + 4: %g4 (g4), signed 32 bits + 5: %g5 (g5), signed 32 bits + 6: %g6 (g6), signed 32 bits + 7: %g7 (g7), signed 32 bits + 8: %o0 (o0), signed 32 bits + 9: %o1 (o1), signed 32 bits + 10: %o2 (o2), signed 32 bits + 11: %o3 (o3), signed 32 bits + 12: %o4 (o4), signed 32 bits + 13: %o5 (o5), signed 32 bits + 14: %o6 (o6), address 32 bits + 15: %o7 (o7), signed 32 bits + 16: %l0 (l0), signed 32 bits + 17: %l1 (l1), signed 32 bits + 18: %l2 (l2), signed 32 bits + 19: %l3 (l3), signed 32 bits + 20: %l4 (l4), signed 32 bits + 21: %l5 (l5), signed 32 bits + 22: %l6 (l6), signed 32 bits + 23: %l7 (l7), signed 32 bits + 24: %i0 (i0), signed 32 bits + 25: %i1 (i1), signed 32 bits + 26: %i2 (i2), signed 32 bits + 27: %i3 (i3), signed 32 bits + 28: %i4 (i4), signed 32 bits + 29: %i5 (i5), signed 32 bits + 30: %i6 (i6), address 32 bits + 31: %i7 (i7), signed 32 bits +FPU registers: + 32: %f0 (f0), float 32 bits + 33: %f1 (f1), float 32 bits + 34: %f2 (f2), float 32 bits + 35: %f3 (f3), float 32 bits + 36: %f4 (f4), float 32 bits + 37: %f5 (f5), float 32 bits + 38: %f6 (f6), float 32 bits + 39: %f7 (f7), float 32 bits + 40: %f8 (f8), float 32 bits + 41: %f9 (f9), float 32 bits + 42: %f10 (f10), float 32 bits + 43: %f11 (f11), float 32 bits + 44: %f12 (f12), float 32 bits + 45: %f13 (f13), float 32 bits + 46: %f14 (f14), float 32 bits + 47: %f15 (f15), float 32 bits + 48: %f16 (f16), float 32 bits + 49: %f17 (f17), float 32 bits + 50: %f18 (f18), float 32 bits + 51: %f19 (f19), float 32 bits + 52: %f20 (f20), float 32 bits + 53: %f21 (f21), float 32 bits + 54: %f22 (f22), float 32 bits + 55: %f23 (f23), float 32 bits + 56: %f24 (f24), float 32 bits + 57: %f25 (f25), float 32 bits + 58: %f26 (f26), float 32 bits + 59: %f27 (f27), float 32 bits + 60: %f28 (f28), float 32 bits + 61: %f29 (f29), float 32 bits + 62: %f30 (f30), float 32 bits + 63: %f31 (f31), float 32 bits +control registers: + 64: %y (y), unsigned 32 bits + 65: %psr (psr), unsigned 32 bits + 66: %wim (wim), unsigned 32 bits + 67: %tbr (tbr), unsigned 32 bits + 68: %pc (pc), address 32 bits + 69: %npc (npc), address 32 bits + 70: %fsr (fsr), unsigned 32 bits + 71: %csr (csr), unsigned 32 bits +EOF + +regs_test testfile31 <<\EOF +integer registers: + 0: %g0 (g0), signed 64 bits + 1: %g1 (g1), signed 64 bits + 2: %g2 (g2), signed 64 bits + 3: %g3 (g3), signed 64 bits + 4: %g4 (g4), signed 64 bits + 5: %g5 (g5), signed 64 bits + 6: %g6 (g6), signed 64 bits + 7: %g7 (g7), signed 64 bits + 8: %o0 (o0), signed 64 bits + 9: %o1 (o1), signed 64 bits + 10: %o2 (o2), signed 64 bits + 11: %o3 (o3), signed 64 bits + 12: %o4 (o4), signed 64 bits + 13: %o5 (o5), signed 64 bits + 14: %o6 (o6), address 64 bits + 15: %o7 (o7), signed 64 bits + 16: %l0 (l0), signed 64 bits + 17: %l1 (l1), signed 64 bits + 18: %l2 (l2), signed 64 bits + 19: %l3 (l3), signed 64 bits + 20: %l4 (l4), signed 64 bits + 21: %l5 (l5), signed 64 bits + 22: %l6 (l6), signed 64 bits + 23: %l7 (l7), signed 64 bits + 24: %i0 (i0), signed 64 bits + 25: %i1 (i1), signed 64 bits + 26: %i2 (i2), signed 64 bits + 27: %i3 (i3), signed 64 bits + 28: %i4 (i4), signed 64 bits + 29: %i5 (i5), signed 64 bits + 30: %i6 (i6), address 64 bits + 31: %i7 (i7), signed 64 bits +FPU registers: + 32: %f0 (f0), float 32 bits + 33: %f1 (f1), float 32 bits + 34: %f2 (f2), float 32 bits + 35: %f3 (f3), float 32 bits + 36: %f4 (f4), float 32 bits + 37: %f5 (f5), float 32 bits + 38: %f6 (f6), float 32 bits + 39: %f7 (f7), float 32 bits + 40: %f8 (f8), float 32 bits + 41: %f9 (f9), float 32 bits + 42: %f10 (f10), float 32 bits + 43: %f11 (f11), float 32 bits + 44: %f12 (f12), float 32 bits + 45: %f13 (f13), float 32 bits + 46: %f14 (f14), float 32 bits + 47: %f15 (f15), float 32 bits + 48: %f16 (f16), float 32 bits + 49: %f17 (f17), float 32 bits + 50: %f18 (f18), float 32 bits + 51: %f19 (f19), float 32 bits + 52: %f20 (f20), float 32 bits + 53: %f21 (f21), float 32 bits + 54: %f22 (f22), float 32 bits + 55: %f23 (f23), float 32 bits + 56: %f24 (f24), float 32 bits + 57: %f25 (f25), float 32 bits + 58: %f26 (f26), float 32 bits + 59: %f27 (f27), float 32 bits + 60: %f28 (f28), float 32 bits + 61: %f29 (f29), float 32 bits + 62: %f30 (f30), float 32 bits + 63: %f31 (f31), float 32 bits + 64: %f32 (f32), float 64 bits + 65: %f34 (f34), float 64 bits + 66: %f36 (f36), float 64 bits + 67: %f38 (f38), float 64 bits + 68: %f40 (f40), float 64 bits + 69: %f42 (f42), float 64 bits + 70: %f44 (f44), float 64 bits + 71: %f46 (f46), float 64 bits + 72: %f48 (f48), float 64 bits + 73: %f50 (f50), float 64 bits + 74: %f52 (f52), float 64 bits + 75: %f54 (f54), float 64 bits + 76: %f56 (f56), float 64 bits + 77: %f58 (f58), float 64 bits + 78: %f60 (f60), float 64 bits + 79: %f62 (f62), float 64 bits +control registers: + 80: %pc (pc), address 64 bits + 81: %npc (npc), address 64 bits + 82: %state (state), unsigned 64 bits + 83: %fsr (fsr), unsigned 64 bits + 84: %fprs (fprs), unsigned 64 bits + 85: %y (y), unsigned 64 bits +EOF + +regs_test testfile10 <<\EOF +integer registers: + 0: $v0 (v0), signed 64 bits + 1: $t0 (t0), signed 64 bits + 2: $t1 (t1), signed 64 bits + 3: $t2 (t2), signed 64 bits + 4: $t3 (t3), signed 64 bits + 5: $t4 (t4), signed 64 bits + 6: $t5 (t5), signed 64 bits + 7: $t6 (t6), signed 64 bits + 8: $t7 (t7), signed 64 bits + 9: $s0 (s0), signed 64 bits + 10: $s1 (s1), signed 64 bits + 11: $s2 (s2), signed 64 bits + 12: $s3 (s3), signed 64 bits + 13: $s4 (s4), signed 64 bits + 14: $s5 (s5), signed 64 bits + 15: $s6 (s6), signed 64 bits + 16: $a0 (a0), signed 64 bits + 17: $a1 (a1), signed 64 bits + 18: $a2 (a2), signed 64 bits + 19: $a3 (a3), signed 64 bits + 20: $a4 (a4), signed 64 bits + 21: $a5 (a5), signed 64 bits + 22: $t8 (t8), signed 64 bits + 23: $t9 (t9), signed 64 bits + 24: $t10 (t10), signed 64 bits + 25: $t11 (t11), signed 64 bits + 26: $ra (ra), address 64 bits + 27: $t12 (t12), signed 64 bits + 28: $at (at), signed 64 bits + 29: $gp (gp), address 64 bits + 30: $sp (sp), address 64 bits + 31: $zero (zero), signed 64 bits + 64: $pc (pc), address 64 bits + 66: $unique (unique), address 64 bits +FPU registers: + 32: $f0 (f0), float 64 bits + 33: $f1 (f1), float 64 bits + 34: $f2 (f2), float 64 bits + 35: $f3 (f3), float 64 bits + 36: $f4 (f4), float 64 bits + 37: $f5 (f5), float 64 bits + 38: $f6 (f6), float 64 bits + 39: $f7 (f7), float 64 bits + 40: $f8 (f8), float 64 bits + 41: $f9 (f9), float 64 bits + 42: $f10 (f10), float 64 bits + 43: $f11 (f11), float 64 bits + 44: $f12 (f12), float 64 bits + 45: $f13 (f13), float 64 bits + 46: $f14 (f14), float 64 bits + 47: $f15 (f15), float 64 bits + 48: $f16 (f16), float 64 bits + 49: $f17 (f17), float 64 bits + 50: $f18 (f18), float 64 bits + 51: $f19 (f19), float 64 bits + 52: $f20 (f20), float 64 bits + 53: $f21 (f21), float 64 bits + 54: $f22 (f22), float 64 bits + 55: $f23 (f23), float 64 bits + 56: $f24 (f24), float 64 bits + 57: $f25 (f25), float 64 bits + 58: $f26 (f26), float 64 bits + 59: $f27 (f27), float 64 bits + 60: $f28 (f28), float 64 bits + 61: $f29 (f29), float 64 bits + 62: $f30 (f30), float 64 bits + 63: $fpcr (fpcr), unsigned 64 bits +EOF + +exit 0 diff --git a/tests/run-arextract.sh b/tests/run-arextract.sh new file mode 100755 index 0000000..29119a1 --- /dev/null +++ b/tests/run-arextract.sh @@ -0,0 +1,48 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2005, 2006 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +tempfiles arextract.test + +archive=../libelf/libelf.a +if test -f $archive; then + # The file is really available (i.e., no shared-only built). + echo -n "Extracting symbols... $ac_c" + + # The files we are looking at. + for f in ../libelf/*.o; do + testrun ./arextract $archive `basename $f` arextract.test || exit 1 + cmp $f arextract.test || { + echo "Extraction of $1 failed" + exit 1 + } + done + + echo "done" +fi + +exit 0 diff --git a/tests/run-arsymtest.sh b/tests/run-arsymtest.sh new file mode 100755 index 0000000..d47df7a --- /dev/null +++ b/tests/run-arsymtest.sh @@ -0,0 +1,55 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2006 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +lib=../libelf/libelf.a +okfile=arsymtest.ok +tmpfile=arsymtest.tmp +testfile=arsymtest.test + +tempfiles $okfile $tmpfile $testfile + +result=77 +if test -f $lib; then + # Generate list using `nm' we check against. + nm -s $lib | + sed -e '1,/^Arch/d' -e '/^$/,$d' | + sort > $okfile + + # Now run our program using libelf. + testrun ./arsymtest $lib $tmpfile || exit 1 + sort $tmpfile > $testfile + + # Compare the outputs. + if cmp $okfile $testfile; then + result=0 + else + result=1 + fi +fi + +exit $result diff --git a/tests/run-bug1-test.sh b/tests/run-bug1-test.sh new file mode 100755 index 0000000..7367a4e --- /dev/null +++ b/tests/run-bug1-test.sh @@ -0,0 +1,42 @@ +#! /bin/sh +# Copyright (C) 2006 Red Hat, Inc. +# Written by Ulrich Drepper <drepper@redhat.com>, 2006. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile28 testfile28.rdwr + +testrun ./rdwrmmap testfile28 + +cmp testfile28 testfile28.rdwr + +test_cleanup + +testfiles testfile29 testfile29.rdwr + +testrun ./rdwrmmap testfile29 + +cmp testfile29 testfile29.rdwr + +exit 0 diff --git a/tests/run-disasm-x86-64.sh b/tests/run-disasm-x86-64.sh new file mode 100755 index 0000000..01803c0 --- /dev/null +++ b/tests/run-disasm-x86-64.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +# Run x86-64 test. +case "`uname -m`" in + x86_64) + tempfiles testfile45.o + testfiles testfile45.S testfile45.expect + gcc -m64 -c -o testfile45.o testfile45.S + testrun_compare ../src/objdump -d testfile45.o < testfile45.expect + ;; +esac diff --git a/tests/run-disasm-x86.sh b/tests/run-disasm-x86.sh new file mode 100755 index 0000000..efd734c --- /dev/null +++ b/tests/run-disasm-x86.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +# Run x86 test. +case "`uname -m`" in + x86_64 | i?86 ) + tempfiles testfile44.o + testfiles testfile44.S testfile44.expect + gcc -m32 -c -o testfile44.o testfile44.S + testrun_compare ../src/objdump -d testfile44.o < testfile44.expect + ;; +esac diff --git a/tests/run-dwarf-getmacros.sh b/tests/run-dwarf-getmacros.sh new file mode 100755 index 0000000..d29c534 --- /dev/null +++ b/tests/run-dwarf-getmacros.sh @@ -0,0 +1,296 @@ +#! /bin/sh +# Copyright (C) 2009 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile51 + +testrun_compare ./dwarf-getmacros testfile51 0xb <<\EOF +__STDC__ 1 +__STDC_HOSTED__ 1 +__GNUC__ 4 +__GNUC_MINOR__ 3 +__GNUC_PATCHLEVEL__ 2 +__GNUC_RH_RELEASE__ 7 +__SIZE_TYPE__ long unsigned int +__PTRDIFF_TYPE__ long int +__WCHAR_TYPE__ int +__WINT_TYPE__ unsigned int +__INTMAX_TYPE__ long int +__UINTMAX_TYPE__ long unsigned int +__GXX_ABI_VERSION 1002 +__SCHAR_MAX__ 127 +__SHRT_MAX__ 32767 +__INT_MAX__ 2147483647 +__LONG_MAX__ 9223372036854775807L +__LONG_LONG_MAX__ 9223372036854775807LL +__WCHAR_MAX__ 2147483647 +__CHAR_BIT__ 8 +__INTMAX_MAX__ 9223372036854775807L +__FLT_EVAL_METHOD__ 0 +__DEC_EVAL_METHOD__ 2 +__FLT_RADIX__ 2 +__FLT_MANT_DIG__ 24 +__FLT_DIG__ 6 +__FLT_MIN_EXP__ (-125) +__FLT_MIN_10_EXP__ (-37) +__FLT_MAX_EXP__ 128 +__FLT_MAX_10_EXP__ 38 +__FLT_MAX__ 3.40282347e+38F +__FLT_MIN__ 1.17549435e-38F +__FLT_EPSILON__ 1.19209290e-7F +__FLT_DENORM_MIN__ 1.40129846e-45F +__FLT_HAS_DENORM__ 1 +__FLT_HAS_INFINITY__ 1 +__FLT_HAS_QUIET_NAN__ 1 +__DBL_MANT_DIG__ 53 +__DBL_DIG__ 15 +__DBL_MIN_EXP__ (-1021) +__DBL_MIN_10_EXP__ (-307) +__DBL_MAX_EXP__ 1024 +__DBL_MAX_10_EXP__ 308 +__DBL_MAX__ 1.7976931348623157e+308 +__DBL_MIN__ 2.2250738585072014e-308 +__DBL_EPSILON__ 2.2204460492503131e-16 +__DBL_DENORM_MIN__ 4.9406564584124654e-324 +__DBL_HAS_DENORM__ 1 +__DBL_HAS_INFINITY__ 1 +__DBL_HAS_QUIET_NAN__ 1 +__LDBL_MANT_DIG__ 64 +__LDBL_DIG__ 18 +__LDBL_MIN_EXP__ (-16381) +__LDBL_MIN_10_EXP__ (-4931) +__LDBL_MAX_EXP__ 16384 +__LDBL_MAX_10_EXP__ 4932 +__DECIMAL_DIG__ 21 +__LDBL_MAX__ 1.18973149535723176502e+4932L +__LDBL_MIN__ 3.36210314311209350626e-4932L +__LDBL_EPSILON__ 1.08420217248550443401e-19L +__LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +__LDBL_HAS_DENORM__ 1 +__LDBL_HAS_INFINITY__ 1 +__LDBL_HAS_QUIET_NAN__ 1 +__DEC32_MANT_DIG__ 7 +__DEC32_MIN_EXP__ (-95) +__DEC32_MAX_EXP__ 96 +__DEC32_MIN__ 1E-95DF +__DEC32_MAX__ 9.999999E96DF +__DEC32_EPSILON__ 1E-6DF +__DEC32_DEN__ 0.000001E-95DF +__DEC64_MANT_DIG__ 16 +__DEC64_MIN_EXP__ (-383) +__DEC64_MAX_EXP__ 384 +__DEC64_MIN__ 1E-383DD +__DEC64_MAX__ 9.999999999999999E384DD +__DEC64_EPSILON__ 1E-15DD +__DEC64_DEN__ 0.000000000000001E-383DD +__DEC128_MANT_DIG__ 34 +__DEC128_MIN_EXP__ (-6143) +__DEC128_MAX_EXP__ 6144 +__DEC128_MIN__ 1E-6143DL +__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +__DEC128_EPSILON__ 1E-33DL +__DEC128_DEN__ 0.000000000000000000000000000000001E-6143DL +__REGISTER_PREFIX__ +__USER_LABEL_PREFIX__ +__VERSION__ "4.3.2 20081105 (Red Hat 4.3.2-7)" +__GNUC_GNU_INLINE__ 1 +_LP64 1 +__LP64__ 1 +__NO_INLINE__ 1 +__FINITE_MATH_ONLY__ 0 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +__SIZEOF_INT__ 4 +__SIZEOF_LONG__ 8 +__SIZEOF_LONG_LONG__ 8 +__SIZEOF_SHORT__ 2 +__SIZEOF_FLOAT__ 4 +__SIZEOF_DOUBLE__ 8 +__SIZEOF_LONG_DOUBLE__ 16 +__SIZEOF_SIZE_T__ 8 +__SIZEOF_WCHAR_T__ 4 +__SIZEOF_WINT_T__ 4 +__SIZEOF_PTRDIFF_T__ 8 +__SIZEOF_POINTER__ 8 +__amd64 1 +__amd64__ 1 +__x86_64 1 +__x86_64__ 1 +__k8 1 +__k8__ 1 +__MMX__ 1 +__SSE__ 1 +__SSE2__ 1 +__SSE_MATH__ 1 +__SSE2_MATH__ 1 +__gnu_linux__ 1 +__linux 1 +__linux__ 1 +linux 1 +__unix 1 +__unix__ 1 +unix 1 +__ELF__ 1 +__DECIMAL_BID_FORMAT__ 1 +macro1 ble +EOF + +testrun_compare ./dwarf-getmacros testfile51 0x84 <<\EOF +__STDC__ 1 +__STDC_HOSTED__ 1 +__GNUC__ 4 +__GNUC_MINOR__ 3 +__GNUC_PATCHLEVEL__ 2 +__GNUC_RH_RELEASE__ 7 +__SIZE_TYPE__ long unsigned int +__PTRDIFF_TYPE__ long int +__WCHAR_TYPE__ int +__WINT_TYPE__ unsigned int +__INTMAX_TYPE__ long int +__UINTMAX_TYPE__ long unsigned int +__GXX_ABI_VERSION 1002 +__SCHAR_MAX__ 127 +__SHRT_MAX__ 32767 +__INT_MAX__ 2147483647 +__LONG_MAX__ 9223372036854775807L +__LONG_LONG_MAX__ 9223372036854775807LL +__WCHAR_MAX__ 2147483647 +__CHAR_BIT__ 8 +__INTMAX_MAX__ 9223372036854775807L +__FLT_EVAL_METHOD__ 0 +__DEC_EVAL_METHOD__ 2 +__FLT_RADIX__ 2 +__FLT_MANT_DIG__ 24 +__FLT_DIG__ 6 +__FLT_MIN_EXP__ (-125) +__FLT_MIN_10_EXP__ (-37) +__FLT_MAX_EXP__ 128 +__FLT_MAX_10_EXP__ 38 +__FLT_MAX__ 3.40282347e+38F +__FLT_MIN__ 1.17549435e-38F +__FLT_EPSILON__ 1.19209290e-7F +__FLT_DENORM_MIN__ 1.40129846e-45F +__FLT_HAS_DENORM__ 1 +__FLT_HAS_INFINITY__ 1 +__FLT_HAS_QUIET_NAN__ 1 +__DBL_MANT_DIG__ 53 +__DBL_DIG__ 15 +__DBL_MIN_EXP__ (-1021) +__DBL_MIN_10_EXP__ (-307) +__DBL_MAX_EXP__ 1024 +__DBL_MAX_10_EXP__ 308 +__DBL_MAX__ 1.7976931348623157e+308 +__DBL_MIN__ 2.2250738585072014e-308 +__DBL_EPSILON__ 2.2204460492503131e-16 +__DBL_DENORM_MIN__ 4.9406564584124654e-324 +__DBL_HAS_DENORM__ 1 +__DBL_HAS_INFINITY__ 1 +__DBL_HAS_QUIET_NAN__ 1 +__LDBL_MANT_DIG__ 64 +__LDBL_DIG__ 18 +__LDBL_MIN_EXP__ (-16381) +__LDBL_MIN_10_EXP__ (-4931) +__LDBL_MAX_EXP__ 16384 +__LDBL_MAX_10_EXP__ 4932 +__DECIMAL_DIG__ 21 +__LDBL_MAX__ 1.18973149535723176502e+4932L +__LDBL_MIN__ 3.36210314311209350626e-4932L +__LDBL_EPSILON__ 1.08420217248550443401e-19L +__LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +__LDBL_HAS_DENORM__ 1 +__LDBL_HAS_INFINITY__ 1 +__LDBL_HAS_QUIET_NAN__ 1 +__DEC32_MANT_DIG__ 7 +__DEC32_MIN_EXP__ (-95) +__DEC32_MAX_EXP__ 96 +__DEC32_MIN__ 1E-95DF +__DEC32_MAX__ 9.999999E96DF +__DEC32_EPSILON__ 1E-6DF +__DEC32_DEN__ 0.000001E-95DF +__DEC64_MANT_DIG__ 16 +__DEC64_MIN_EXP__ (-383) +__DEC64_MAX_EXP__ 384 +__DEC64_MIN__ 1E-383DD +__DEC64_MAX__ 9.999999999999999E384DD +__DEC64_EPSILON__ 1E-15DD +__DEC64_DEN__ 0.000000000000001E-383DD +__DEC128_MANT_DIG__ 34 +__DEC128_MIN_EXP__ (-6143) +__DEC128_MAX_EXP__ 6144 +__DEC128_MIN__ 1E-6143DL +__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +__DEC128_EPSILON__ 1E-33DL +__DEC128_DEN__ 0.000000000000000000000000000000001E-6143DL +__REGISTER_PREFIX__ +__USER_LABEL_PREFIX__ +__VERSION__ "4.3.2 20081105 (Red Hat 4.3.2-7)" +__GNUC_GNU_INLINE__ 1 +_LP64 1 +__LP64__ 1 +__NO_INLINE__ 1 +__FINITE_MATH_ONLY__ 0 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +__SIZEOF_INT__ 4 +__SIZEOF_LONG__ 8 +__SIZEOF_LONG_LONG__ 8 +__SIZEOF_SHORT__ 2 +__SIZEOF_FLOAT__ 4 +__SIZEOF_DOUBLE__ 8 +__SIZEOF_LONG_DOUBLE__ 16 +__SIZEOF_SIZE_T__ 8 +__SIZEOF_WCHAR_T__ 4 +__SIZEOF_WINT_T__ 4 +__SIZEOF_PTRDIFF_T__ 8 +__SIZEOF_POINTER__ 8 +__amd64 1 +__amd64__ 1 +__x86_64 1 +__x86_64__ 1 +__k8 1 +__k8__ 1 +__MMX__ 1 +__SSE__ 1 +__SSE2__ 1 +__SSE_MATH__ 1 +__SSE2_MATH__ 1 +__gnu_linux__ 1 +__linux 1 +__linux__ 1 +linux 1 +__unix 1 +__unix__ 1 +unix 1 +__ELF__ 1 +__DECIMAL_BID_FORMAT__ 1 +macro2 ble +EOF + +exit 0 diff --git a/tests/run-dwfl-addr-sect.sh b/tests/run-dwfl-addr-sect.sh new file mode 100755 index 0000000..f33a6e4 --- /dev/null +++ b/tests/run-dwfl-addr-sect.sh @@ -0,0 +1,40 @@ +#! /bin/sh +# Copyright (C) 2007-2009 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile43 testfile50 + +testrun_compare ./dwfl-addr-sect -e testfile43 0x64 0x8 0x98 <<\EOF +address 0x64 => module "" section 4 + 0 +address 0x8 => module "" section 1 + 0x8 +address 0x98 => module "" section 7 + 0 +EOF + +testrun_compare ./dwfl-addr-sect -e testfile50 0x1 <<\EOF +address 0x1 => module "" section 1 + 0x1 +EOF + +exit 0 diff --git a/tests/run-dwfl-bug-offline-rel.sh b/tests/run-dwfl-bug-offline-rel.sh new file mode 100755 index 0000000..d1f6149 --- /dev/null +++ b/tests/run-dwfl-bug-offline-rel.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile36 testfile36.debug + +testrun_compare ./dwflmodtest -e testfile36 <<\EOF +module: 00000000..00002308 testfile36 (null) +module: 00000000 DWARF 0 (no error) +module: 00000000..00002308 testfile36 testfile36.debug +EOF + +exit 0 diff --git a/tests/run-early-offscn.sh b/tests/run-early-offscn.sh new file mode 100755 index 0000000..70be219 --- /dev/null +++ b/tests/run-early-offscn.sh @@ -0,0 +1,32 @@ +#! /bin/sh +# Copyright (C) 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile + +testrun ./early-offscn testfile 0x500 + +exit 0 diff --git a/tests/run-ecp-test.sh b/tests/run-ecp-test.sh new file mode 100755 index 0000000..941f3e9 --- /dev/null +++ b/tests/run-ecp-test.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Jakub Jelinek <jakub@redhat.com>, 2002. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile10 +tempfiles testfile10.tmp + +testrun ./ecp testfile10 testfile10.tmp + +cmp testfile10 testfile10.tmp + +exit 0 diff --git a/tests/run-ecp-test2.sh b/tests/run-ecp-test2.sh new file mode 100755 index 0000000..4231708 --- /dev/null +++ b/tests/run-ecp-test2.sh @@ -0,0 +1,34 @@ +#! /bin/sh +# Copyright (C) 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Jakub Jelinek <jakub@redhat.com>, 2002. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile2 +tempfiles testfile2.tmp + +testrun ./ecp testfile2 testfile2.tmp + +exit 0 diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh new file mode 100755 index 0000000..7da0886 --- /dev/null +++ b/tests/run-elflint-self.sh @@ -0,0 +1,62 @@ +#! /bin/sh +# Copyright (C) 2005, 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +status=0 +runtest() { +# Uncomment for debuging +# echo $1 + if [ -f $1 ]; then + testrun ../src/elflint --quiet --gnu-ld $1 || + { echo "*** failure in $1"; status=1; } + fi +} + +runtest ../src/addr2line +runtest ../src/elfcmp +runtest ../src/elflint +runtest ../src/findtextrel +runtest ../src/ld +runtest ../src/nm +runtest ../src/objdump +runtest ../src/readelf +runtest ../src/size +runtest ../src/strip +runtest ../libelf/libelf.so +runtest ../libdw/libdw.so +runtest ../libasm/libasm.so +runtest ../libebl/libebl_alpha.so +runtest ../libebl/libebl_arm.so +runtest ../libebl/libebl_i386.so +runtest ../libebl/libebl_ia64.so +runtest ../libebl/libebl_ppc.so +runtest ../libebl/libebl_ppc64.so +runtest ../libebl/libebl_sh.so +runtest ../libebl/libebl_sparc.so +runtest ../libebl/libebl_x86_64.so + +exit $status diff --git a/tests/run-elflint-test.sh b/tests/run-elflint-test.sh new file mode 100755 index 0000000..e0e1c54 --- /dev/null +++ b/tests/run-elflint-test.sh @@ -0,0 +1,47 @@ +#! /bin/sh +# Copyright (C) 2005, 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile18 + +testrun_compare ../src/elflint --gnu-ld testfile18 <<\EOF +section [ 8] '.rela.dyn': relocation 1: copy relocation against symbol of type FUNC +EOF + +testfiles testfile32 +testrun ../src/elflint -q testfile32 + +testfiles testfile33 +testrun ../src/elflint -q testfile33 + +testfiles testfile42 +testrun ../src/elflint -q --gnu-ld testfile42 + +testfiles testfile46 +testrun ../src/elflint -q testfile46 + +exit 0 diff --git a/tests/run-find-prologues.sh b/tests/run-find-prologues.sh new file mode 100755 index 0000000..eddc9ee --- /dev/null +++ b/tests/run-find-prologues.sh @@ -0,0 +1,93 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile11 testfile22 testfile24 \ + testfile25 testfile3 testfile4 testfile5 testfile6 + +testrun_compare ./find-prologues -e testfile <<\EOF +main 0x000000000804842c 0x0000000008048432 +bar 0x000000000804845c 0x000000000804845f +foo 0x0000000008048468 0x000000000804846b +EOF + +testrun_compare ./find-prologues -e testfile11 <<\EOF +main 0x00000000080489b8 0x00000000080489cd +gnu_obj_2 0x0000000008048c9e 0x0000000008048ca4 +gnu_obj_3 0x0000000008048cd8 0x0000000008048cde +gnu_obj_2 0x0000000008048cf4 0x0000000008048cfa +~invalid_argument 0x0000000008048d2e 0x0000000008048d34 +gnu_obj_1 0x0000000008048d62 0x0000000008048d65 +gnu_obj_1 0x0000000008048d8a 0x0000000008048d8d +~invalid_argument 0x0000000008048db2 0x0000000008048db8 +EOF + +testrun_compare ./find-prologues -e testfile22 <<\EOF +function 0x0000000008048348 0x000000000804834e +main 0x000000000804835b 0x0000000008048377 +EOF + +testrun_compare ./find-prologues -e testfile24 <<\EOF +incr 0x0000000008048348 0x000000000804834e +main 0x0000000008048354 0x0000000008048360 +EOF + +testrun_compare ./find-prologues -e testfile25 <<\EOF +incr 0x0000000008048348 0x000000000804834c +EOF + +testrun_compare ./find-prologues -e testfile3 <<\EOF +main 0x000000000804842c 0x0000000008048433 +bar 0x0000000008048458 0x000000000804845b +foo 0x0000000008048464 0x0000000008048467 +EOF + +testrun_compare ./find-prologues -e testfile4 <<\EOF +get 0x00000000080493fc 0x0000000008049402 +main 0x0000000008049498 0x000000000804949e +a 0x000000000804d85c 0x000000000804d85c +__tfPCc 0x000000000804d86c 0x000000000804d872 +__tfCc 0x000000000804d8a4 0x000000000804d8a4 +EOF + +testrun_compare ./find-prologues -e testfile5 <<\EOF +bar 0x000000000804842c 0x000000000804842f +foo 0x0000000008048438 0x000000000804843b +main 0x0000000008048444 0x000000000804844a +EOF + +testrun_compare ./find-prologues -e testfile6 <<\EOF +main 0x00000000080489b8 0x00000000080489cd +gnu_obj_2 0x0000000008048c9e 0x0000000008048ca4 +gnu_obj_3 0x0000000008048cd8 0x0000000008048cde +gnu_obj_2 0x0000000008048cf4 0x0000000008048cfa +~invalid_argument 0x0000000008048d2e 0x0000000008048d34 +gnu_obj_1 0x0000000008048d62 0x0000000008048d65 +gnu_obj_1 0x0000000008048d8a 0x0000000008048d8d +~invalid_argument 0x0000000008048db2 0x0000000008048db8 +EOF + +exit 0 diff --git a/tests/run-funcscopes.sh b/tests/run-funcscopes.sh new file mode 100755 index 0000000..52e50f4 --- /dev/null +++ b/tests/run-funcscopes.sh @@ -0,0 +1,37 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile25 + +testrun_compare ./funcscopes -e testfile25 incr <<\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 + +exit 0 diff --git a/tests/run-get-aranges.sh b/tests/run-get-aranges.sh new file mode 100755 index 0000000..f78a4a1 --- /dev/null +++ b/tests/run-get-aranges.sh @@ -0,0 +1,76 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 + +testrun_compare ./get-aranges testfile testfile2 <<\EOF +0x804842b: not in range +CU name: "m.c" +CU name: "m.c" +CU name: "m.c" +0x804845a: not in range +0x804845b: not in range +CU name: "b.c" +CU name: "b.c" +CU name: "b.c" +0x8048466: not in range +0x8048467: not in range +CU name: "f.c" +CU name: "f.c" +CU name: "f.c" +0x8048472: not in range + [ 0] start: 0x804842c, length: 46, cu: 11 +CU name: "m.c" + [ 1] start: 0x804845c, length: 10, cu: 202 +CU name: "b.c" + [ 2] start: 0x8048468, length: 10, cu: 5628 +CU name: "f.c" +0x804842b: not in range +0x804842c: not in range +0x804843c: not in range +0x8048459: not in range +0x804845a: not in range +0x804845b: not in range +0x804845c: not in range +0x8048460: not in range +0x8048465: not in range +0x8048466: not in range +0x8048467: not in range +0x8048468: not in range +0x8048470: not in range +0x8048471: not in range +0x8048472: not in range + [ 0] start: 0x10000470, length: 32, cu: 11 +CU name: "b.c" + [ 1] start: 0x10000490, length: 32, cu: 2429 +CU name: "f.c" + [ 2] start: 0x100004b0, length: 100, cu: 2532 +CU name: "m.c" +EOF + +exit 0 diff --git a/tests/run-get-files.sh b/tests/run-get-files.sh new file mode 100755 index 0000000..7d51f5f --- /dev/null +++ b/tests/run-get-files.sh @@ -0,0 +1,75 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2004, 2005, 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 + +testrun_compare ./get-files testfile testfile2 <<\EOF +cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 191 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" + file[0] = "???" + file[1] = "/home/drepper/gnu/new-bu/build/ttt/m.c" +cuhl = 11, o = 114, asz = 4, osz = 4, ncu = 5617 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" + file[0] = "???" + file[1] = "/home/drepper/gnu/new-bu/build/ttt/b.c" + file[2] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h" + file[3] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h" + file[4] = "/usr/include/bits/types.h" + file[5] = "/usr/include/bits/sched.h" + file[6] = "/usr/include/bits/pthreadtypes.h" + file[7] = "/usr/include/stdio.h" + file[8] = "/usr/include/libio.h" + file[9] = "/usr/include/wchar.h" + file[10] = "/usr/include/_G_config.h" + file[11] = "/usr/include/gconv.h" +cuhl = 11, o = 412, asz = 4, osz = 4, ncu = 5752 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" + file[0] = "???" + file[1] = "/home/drepper/gnu/new-bu/build/ttt/f.c" +cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 2418 + dirs[0] = "/shoggoth/drepper" + file[0] = "???" + file[1] = "/shoggoth/drepper/b.c" + file[2] = "/home/geoffk/objs/laurel-000912-branch/lib/gcc-lib/powerpc-unknown-linux-gnu/2.96-laurel-000912/include/stddef.h" + file[3] = "/home/geoffk/objs/laurel-000912-branch/lib/gcc-lib/powerpc-unknown-linux-gnu/2.96-laurel-000912/include/stdarg.h" + file[4] = "/shoggoth/drepper/<built-in>" + file[5] = "/usr/include/bits/types.h" + file[6] = "/usr/include/stdio.h" + file[7] = "/usr/include/libio.h" + file[8] = "/usr/include/_G_config.h" +cuhl = 11, o = 213, asz = 4, osz = 4, ncu = 2521 + dirs[0] = "/shoggoth/drepper" + file[0] = "???" + file[1] = "/shoggoth/drepper/f.c" +cuhl = 11, o = 267, asz = 4, osz = 4, ncu = 2680 + dirs[0] = "/shoggoth/drepper" + file[0] = "???" + file[1] = "/shoggoth/drepper/m.c" +EOF + +exit 0 diff --git a/tests/run-get-lines.sh b/tests/run-get-lines.sh new file mode 100755 index 0000000..fb675dc --- /dev/null +++ b/tests/run-get-lines.sh @@ -0,0 +1,72 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2004, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 + +testrun_compare ./get-lines testfile testfile2 <<\EOF +cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 191 + 5 lines +804842c: /home/drepper/gnu/new-bu/build/ttt/m.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048432: /home/drepper/gnu/new-bu/build/ttt/m.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804844d: /home/drepper/gnu/new-bu/build/ttt/m.c:7:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048458: /home/drepper/gnu/new-bu/build/ttt/m.c:8:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804845a: /home/drepper/gnu/new-bu/build/ttt/m.c:8:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +cuhl = 11, o = 114, asz = 4, osz = 4, ncu = 5617 + 4 lines +804845c: /home/drepper/gnu/new-bu/build/ttt/b.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804845f: /home/drepper/gnu/new-bu/build/ttt/b.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048464: /home/drepper/gnu/new-bu/build/ttt/b.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048466: /home/drepper/gnu/new-bu/build/ttt/b.c:6:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +cuhl = 11, o = 412, asz = 4, osz = 4, ncu = 5752 + 4 lines +8048468: /home/drepper/gnu/new-bu/build/ttt/f.c:3:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804846b: /home/drepper/gnu/new-bu/build/ttt/f.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048470: /home/drepper/gnu/new-bu/build/ttt/f.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048472: /home/drepper/gnu/new-bu/build/ttt/f.c:5:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +cuhl = 11, o = 0, asz = 4, osz = 4, ncu = 2418 + 4 lines +10000470: /shoggoth/drepper/b.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +1000047c: /shoggoth/drepper/b.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +10000480: /shoggoth/drepper/b.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +10000490: /shoggoth/drepper/b.c:6:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +cuhl = 11, o = 213, asz = 4, osz = 4, ncu = 2521 + 4 lines +10000490: /shoggoth/drepper/f.c:3:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +1000049c: /shoggoth/drepper/f.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004a0: /shoggoth/drepper/f.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004b0: /shoggoth/drepper/f.c:5:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +cuhl = 11, o = 267, asz = 4, osz = 4, ncu = 2680 + 5 lines +100004b0: /shoggoth/drepper/m.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004cc: /shoggoth/drepper/m.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004e8: /shoggoth/drepper/m.c:7:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004f4: /shoggoth/drepper/m.c:8:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +10000514: /shoggoth/drepper/m.c:8:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +EOF + +exit 0 diff --git a/tests/run-get-pubnames.sh b/tests/run-get-pubnames.sh new file mode 100755 index 0000000..131baf0 --- /dev/null +++ b/tests/run-get-pubnames.sh @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2003, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 + +testrun_compare ./get-pubnames testfile testfile2 <<\EOF + [ 0] "main", die: 104, cu: 11 +CU name: "m.c" +object name: "main" + [ 1] "a", die: 174, cu: 11 +CU name: "m.c" +object name: "a" + [ 2] "bar", die: 295, cu: 202 +CU name: "b.c" +object name: "bar" + [ 3] "foo", die: 5721, cu: 5628 +CU name: "f.c" +object name: "foo" + [ 0] "bar", die: 72, cu: 11 +CU name: "b.c" +object name: "bar" + [ 1] "foo", die: 2490, cu: 2429 +CU name: "f.c" +object name: "foo" + [ 2] "main", die: 2593, cu: 2532 +CU name: "m.c" +object name: "main" + [ 3] "a", die: 2663, cu: 2532 +CU name: "m.c" +object name: "a" +EOF + +exit 0 diff --git a/tests/run-line2addr.sh b/tests/run-line2addr.sh new file mode 100755 index 0000000..3fb6f47 --- /dev/null +++ b/tests/run-line2addr.sh @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 testfile8 testfile14 testfile23 + +testrun_compare ./line2addr -e testfile f.c:4 testfile f.c:8 <<\EOF +f.c:4 -> 0x804846b (/home/drepper/gnu/new-bu/build/ttt/f.c:4) +EOF + +testrun_compare ./line2addr -e testfile2 m.c:6 b.c:1 <<\EOF +m.c:6 -> 0x100004cc (/shoggoth/drepper/m.c:6) +b.c:1 -> 0x10000470 (/shoggoth/drepper/b.c:4) +EOF + +testrun_compare ./line2addr -e testfile8 strip.c:953 strip.c:365 <<\EOF +strip.c:953 -> (.text)+0x169f (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:953) +strip.c:953 -> (.text)+0x16aa (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:953) +strip.c:365 -> (.text)+0x278b (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:365) +strip.c:365 -> (.text)+0x2797 (/home/drepper/gnu/elfutils/build/src/../../src/strip.c:365) +EOF + +testrun_compare ./line2addr -e testfile14 v.c:6 <<\EOF +v.c:6 -> 0x400468 (/home/drepper/local/elfutils-build/20050425/v.c:6) +v.c:6 -> 0x400487 (/home/drepper/local/elfutils-build/20050425/v.c:6) +EOF + +testrun_compare ./line2addr -e testfile23 foo.c:2 foo.c:6 <<\EOF +foo.c:2 -> (.init.text)+0xc (/home/roland/stock-elfutils-build/foo.c:2) +foo.c:6 -> (.text)+0xc (/home/roland/stock-elfutils-build/foo.c:6) +EOF + +exit 0 diff --git a/tests/run-native-test.sh b/tests/run-native-test.sh new file mode 100755 index 0000000..99926b0 --- /dev/null +++ b/tests/run-native-test.sh @@ -0,0 +1,89 @@ +#! /bin/sh +# Copyright (C) 2005, 2006 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +. $srcdir/test-subr.sh + +# This tests all the miscellaneous components of backend support +# against whatever this build is running on. A platform will fail +# this test if it is missing parts of the backend implementation. +# +# As new backend code is added to satisfy the test, be sure to update +# the fixed test cases (run-allregs.sh et al) to test that backend +# in all builds. + +tempfiles native.c native +echo 'main () { while (1) pause (); }' > native.c + +native=0 +kill_native() +{ + test $native -eq 0 || { + kill -9 $native 2> /dev/null || : + wait $native 2> /dev/null || : + } + native=0 +} + +native_cleanup() +{ + kill_native + test_cleanup +} + +trap native_cleanup 0 1 2 15 + +for cc in "$HOSTCC" "$HOST_CC" cc gcc "$CC"; do + test "x$cc" != x || continue + $cc -o native -g native.c > /dev/null 2>&1 && + # Some shell versions don't do this right without the braces. + { ./native > /dev/null 2>&1 & native=$! ; } && + sleep 1 && kill -0 $native 2> /dev/null && + break || + native=0 +done + +native_test() +{ + # Try the build against itself, i.e. $config_host. + testrun "$@" -e $1 > /dev/null + + # Try the build against a presumed native process, running this sh. + # For tests requiring debug information, this may not test anything. + testrun "$@" -p $$ > /dev/null + + # Try the build against the trivial native program we just built with -g. + test $native -eq 0 || testrun "$@" -p $native > /dev/null +} + +native_test ./allregs +native_test ./funcretval + +# We do this explicitly rather than letting the trap 0 cover it, +# because as of version 3.1 bash prints the "Killed" report for +# $native when we do the kill inside the exit handler. +native_cleanup + +exit 0 diff --git a/tests/run-prelink-addr-test.sh b/tests/run-prelink-addr-test.sh new file mode 100755 index 0000000..38a2130 --- /dev/null +++ b/tests/run-prelink-addr-test.sh @@ -0,0 +1,260 @@ +#! /bin/sh +# Copyright (C) 2011 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + + +# testfile52.c: +# #include <stdlib.h> +# int foo() { exit(0); } +# +# gcc -m32 -g -shared testfile52-32.c -o testfile52-32.so +# eu-strip -f testfile52-32.so.debug testfile52-32.so +# cp testfile52-32.so testfile52-32.prelink.so +# prelink -N testfile52-32.prelink.so +# cp testfile52-32.so testfile52-32.noshdrs.so +# prelink -r 0x42000000 testfile52-32.noshdrs.so +# eu-strip --remove-comment --strip-sections testfile52-32.noshdrs.so + +testfiles testfile52-32.so testfile52-32.so.debug +testfiles testfile52-32.prelink.so testfile52-32.noshdrs.so +tempfiles testmaps52-32 testfile52-32.noshdrs.so.debug +ln -s testfile52-32.so.debug testfile52-32.noshdrs.so.debug + +cat > testmaps52-32 <<EOF +00111000-00112000 r-xp 00000000 fd:01 1 `pwd`/testfile52-32.so +00112000-00113000 rw-p 00000000 fd:01 1 `pwd`/testfile52-32.so +41000000-41001000 r-xp 00000000 fd:01 2 `pwd`/testfile52-32.prelink.so +41001000-41002000 rw-p 00000000 fd:01 2 `pwd`/testfile52-32.prelink.so +42000000-42001000 r-xp 00000000 fd:01 3 `pwd`/testfile52-32.noshdrs.so +42001000-42002000 rw-p 00000000 fd:01 3 `pwd`/testfile52-32.noshdrs.so +EOF + +# Prior to commit 1743d7f, libdwfl would fail on the second address, +# because it didn't notice that prelink added a 0x20-byte offset from +# what the .debug file reports. +testrun_compare ../src/addr2line -S -M testmaps52-32 \ + 0x11140c 0x4100042d 0x4200040e <<\EOF +foo +/home/jistone/src/elfutils/tests/testfile52-32.c:2 +foo+0x1 +/home/jistone/src/elfutils/tests/testfile52-32.c:2 +foo+0x2 +/home/jistone/src/elfutils/tests/testfile52-32.c:2 +EOF + +# Repeat testfile52 for -m64. The particular REL>RELA issue doesn't exist, but +# we'll make sure the rest works anyway. +testfiles testfile52-64.so testfile52-64.so.debug +testfiles testfile52-64.prelink.so testfile52-64.noshdrs.so +tempfiles testmaps52-64 testfile52-64.noshdrs.so.debug +ln -s testfile52-64.so.debug testfile52-64.noshdrs.so.debug + +cat > testmaps52-64 <<EOF +1000000000-1000001000 r-xp 00000000 fd:11 1 `pwd`/testfile52-64.so +1000001000-1000200000 ---p 00001000 fd:11 1 `pwd`/testfile52-64.so +1000200000-1000201000 rw-p 00000000 fd:11 1 `pwd`/testfile52-64.so +3000000000-3000001000 r-xp 00000000 fd:11 2 `pwd`/testfile52-64.prelink.so +3000001000-3000200000 ---p 00001000 fd:11 2 `pwd`/testfile52-64.prelink.so +3000200000-3000201000 rw-p 00000000 fd:11 2 `pwd`/testfile52-64.prelink.so +3800000000-3800001000 r-xp 00000000 fd:11 3 `pwd`/testfile52-64.noshdrs.so +3800001000-3800200000 ---p 00001000 fd:11 3 `pwd`/testfile52-64.noshdrs.so +3800200000-3800201000 rw-p 00000000 fd:11 3 `pwd`/testfile52-64.noshdrs.so +EOF + +testrun_compare ../src/addr2line -S -M testmaps52-64 \ + 0x100000056c 0x300000056d 0x380000056e <<\EOF +foo +/home/jistone/src/elfutils/tests/testfile52-64.c:2 +foo+0x1 +/home/jistone/src/elfutils/tests/testfile52-64.c:2 +foo+0x2 +/home/jistone/src/elfutils/tests/testfile52-64.c:2 +EOF + + +# testfile53.c: +# char foo[0x1000]; +# int main() { return 0; } +# +# gcc -m32 -g testfile53-32.c -o testfile53-32 +# eu-strip -f testfile53-32.debug testfile53-32 +# cp testfile53-32 testfile53-32.prelink +# prelink -N testfile53-32.prelink +testfiles testfile53-32 testfile53-32.debug testfile53-32.prelink + +testrun_compare ../src/addr2line -S -e testfile53-32 0x8048394 0x8048395 <<\EOF +main +/home/jistone/src/elfutils/tests/testfile53-32.c:2 +main+0x1 +/home/jistone/src/elfutils/tests/testfile53-32.c:2 +EOF + +# prelink shuffled some of the sections, but .text is in the same place. +testrun_compare ../src/addr2line -S -e testfile53-32.prelink 0x8048396 0x8048397 <<\EOF +main+0x2 +/home/jistone/src/elfutils/tests/testfile53-32.c:2 +main+0x3 +/home/jistone/src/elfutils/tests/testfile53-32.c:2 +EOF + +# Repeat testfile53 in 64-bit, except use foo[0x800] to achieve the same +# prelink section shuffling. +testfiles testfile53-64 testfile53-64.debug testfile53-64.prelink + +testrun_compare ../src/addr2line -S -e testfile53-64 0x400474 0x400475 <<\EOF +main +/home/jistone/src/elfutils/tests/testfile53-64.c:2 +main+0x1 +/home/jistone/src/elfutils/tests/testfile53-64.c:2 +EOF + +testrun_compare ../src/addr2line -S -e testfile53-64.prelink 0x400476 0x400477 <<\EOF +main+0x2 +/home/jistone/src/elfutils/tests/testfile53-64.c:2 +main+0x3 +/home/jistone/src/elfutils/tests/testfile53-64.c:2 +EOF + + +# testfile54.c: +# extern void * stdin; +# static void * pstdin = &stdin; +# void * const foo = &pstdin; +# +# gcc -m32 -g -shared -nostartfiles testfile54-32.c -o testfile54-32.so +# eu-strip -f testfile54-32.so.debug testfile54-32.so +# cp testfile54-32.so testfile54-32.prelink.so +# prelink -N testfile54-32.prelink.so +# cp testfile54-32.so testfile54-32.noshdrs.so +# prelink -r 0x42000000 testfile54-32.noshdrs.so +# eu-strip --remove-comment --strip-sections testfile54-32.noshdrs.so +testfiles testfile54-32.so testfile54-32.so.debug +testfiles testfile54-32.prelink.so testfile54-32.noshdrs.so +tempfiles testmaps54-32 + +# Note we have no testfile54-32.noshdrs.so.debug link here, so +# this is testing finding the symbols in .dynsym via PT_DYNAMIC. + +cat > testmaps54-32 <<EOF +00111000-00112000 r--p 00000000 fd:01 1 `pwd`/testfile54-32.so +00112000-00113000 rw-p 00000000 fd:01 1 `pwd`/testfile54-32.so +41000000-41001000 r--p 00000000 fd:01 2 `pwd`/testfile54-32.prelink.so +41001000-41002000 rw-p 00000000 fd:01 2 `pwd`/testfile54-32.prelink.so +42000000-42001000 r--p 00000000 fd:01 3 `pwd`/testfile54-32.noshdrs.so +42001000-42002000 rw-p 00000000 fd:01 3 `pwd`/testfile54-32.noshdrs.so +EOF + +testrun_compare ../src/addr2line -S -M testmaps54-32 \ + 0x1111fc 0x1122a4 0x410001fd 0x410012a5 0x420001fe <<\EOF +foo +??:0 +pstdin +??:0 +foo+0x1 +??:0 +pstdin+0x1 +??:0 +foo+0x2 +??:0 +EOF + +# Repeat testfile64 in 64-bit +testfiles testfile54-64.so testfile54-64.so.debug +testfiles testfile54-64.prelink.so testfile54-64.noshdrs.so +tempfiles testmaps54-64 + +# Note we have no testfile54-64.noshdrs.so.debug link here, so +# this is testing finding the symbols in .dynsym via PT_DYNAMIC. + +cat > testmaps54-64 <<EOF +1000000000-1000001000 r--p 00000000 fd:11 1 `pwd`/testfile54-64.so +1000001000-1000200000 ---p 00001000 fd:11 1 `pwd`/testfile54-64.so +1000200000-1000201000 rw-p 00000000 fd:11 1 `pwd`/testfile54-64.so +3000000000-3000001000 r--p 00000000 fd:11 2 `pwd`/testfile54-64.prelink.so +3000001000-3000200000 ---p 00001000 fd:11 2 `pwd`/testfile54-64.prelink.so +3000200000-3000201000 rw-p 00000000 fd:11 2 `pwd`/testfile54-64.prelink.so +3800000000-3800001000 r--p 00000000 fd:11 3 `pwd`/testfile54-64.noshdrs.so +3800001000-3800200000 ---p 00001000 fd:11 3 `pwd`/testfile54-64.noshdrs.so +3800200000-3800201000 rw-p 00000000 fd:11 3 `pwd`/testfile54-64.noshdrs.so +EOF + +testrun_compare ../src/addr2line -S -M testmaps54-64 \ + 0x10000002f8 0x1000200448 0x30000002f9 0x3000200449 0x38000002fa <<\EOF +foo +??:0 +pstdin +??:0 +foo+0x1 +??:0 +pstdin+0x1 +??:0 +foo+0x2 +??:0 +EOF + + +# testfile55.c: +# extern void *stdin; +# int main() { return !stdin; } +# +# gcc -m32 -g testfile55-32.c -o testfile55-32 +# eu-strip -f testfile55-32.debug testfile55-32 +# cp testfile55-32 testfile55-32.prelink +# prelink -N testfile55-32.prelink +testfiles testfile55-32 testfile55-32.debug testfile55-32.prelink + +testrun_compare ../src/addr2line -S -e testfile55-32 0x80483b4 0x80483b5 <<\EOF +main +/home/jistone/src/elfutils/tests/testfile55-32.c:2 +main+0x1 +/home/jistone/src/elfutils/tests/testfile55-32.c:2 +EOF + +# prelink splits .bss into .dynbss+.bss, so the start of .bss changes, but the +# total size remains the same, and .text doesn't move at all. +testrun_compare ../src/addr2line -S -e testfile55-32.prelink 0x80483b6 0x80483b7 <<\EOF +main+0x2 +/home/jistone/src/elfutils/tests/testfile55-32.c:2 +main+0x3 +/home/jistone/src/elfutils/tests/testfile55-32.c:2 +EOF + +# Repeat testfile55 in 64-bit +testfiles testfile55-64 testfile55-64.debug testfile55-64.prelink + +testrun_compare ../src/addr2line -S -e testfile55-64 0x4004b4 0x4004b5 <<\EOF +main +/home/jistone/src/elfutils/tests/testfile55-64.c:2 +main+0x1 +/home/jistone/src/elfutils/tests/testfile55-64.c:2 +EOF + +testrun_compare ../src/addr2line -S -e testfile55-64.prelink 0x4004b6 0x4004b7 <<\EOF +main+0x2 +/home/jistone/src/elfutils/tests/testfile55-64.c:2 +main+0x3 +/home/jistone/src/elfutils/tests/testfile55-64.c:2 +EOF diff --git a/tests/run-ranlib-test.sh b/tests/run-ranlib-test.sh new file mode 100755 index 0000000..01c0d0b --- /dev/null +++ b/tests/run-ranlib-test.sh @@ -0,0 +1,46 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +tempfiles ranlib-test.a ranlib-test.a-copy + +cat > ranlib-test.a <<"EOF" +!<arch> +foo/ 1124128960 500 500 100664 4 ` +foo +bar/ 1124128965 500 500 100664 4 ` +bar +EOF + +cp ranlib-test.a ranlib-test.a-copy + +testrun ../src/ranlib ranlib-test.a + +# The ranlib call should not have changed anything. +cmp ranlib-test.a ranlib-test.a-copy + +exit 0 diff --git a/tests/run-ranlib-test2.sh b/tests/run-ranlib-test2.sh new file mode 100755 index 0000000..8704037 --- /dev/null +++ b/tests/run-ranlib-test2.sh @@ -0,0 +1,45 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile19} +indexed=${indexed:-testfile19.index} + +testfiles $original $indexed + +testrun ../src/ranlib $original + +if test -z "$noindex"; then + # The date in the index is different. The reference file has it blanked + # out, we do the same here. + echo " " | + dd of=$original seek=24 bs=1 count=12 conv=notrunc 2>/dev/null +fi + +cmp $original $indexed + +exit 0 diff --git a/tests/run-ranlib-test3.sh b/tests/run-ranlib-test3.sh new file mode 100755 index 0000000..7be6ddd --- /dev/null +++ b/tests/run-ranlib-test3.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +original=testfile20 +indexed=testfile20.index +. $srcdir/run-ranlib-test2.sh diff --git a/tests/run-ranlib-test4.sh b/tests/run-ranlib-test4.sh new file mode 100755 index 0000000..eeeb56f --- /dev/null +++ b/tests/run-ranlib-test4.sh @@ -0,0 +1,31 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +original=testfile21 +indexed=testfile21.index +noindex=1 +. $srcdir/run-ranlib-test2.sh diff --git a/tests/run-readelf-test1.sh b/tests/run-readelf-test1.sh new file mode 100755 index 0000000..aaa03ed --- /dev/null +++ b/tests/run-readelf-test1.sh @@ -0,0 +1,53 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile11} +stripped=${stripped:-testfile7} +debugout=${debugfile:+-f testfile.debug.temp -F $debugfile} + +testfiles testfile3 + +tempfiles testfile.temp + +testrun ../src/readelf -r testfile3 > testfile.temp + +diff -u - testfile.temp <<EOF + +Relocation section [ 8] '.rel.got' for section [19] '.got' at offset 0x294 contains 1 entry: + Offset Type Value Name + 0x08049544 386_GLOB_DAT 0000000000 __gmon_start__ + +Relocation section [ 9] '.rel.plt' for section [11] '.plt' at offset 0x29c contains 4 entries: + Offset Type Value Name + 0x08049534 386_JMP_SLOT 0x080482e4 __register_frame_info + 0x08049538 386_JMP_SLOT 0x080482f4 __deregister_frame_info + 0x0804953c 386_JMP_SLOT 0x08048304 __libc_start_main + 0x08049540 386_JMP_SLOT 0x08048314 __cxa_finalize +EOF + +exit 0 diff --git a/tests/run-readelf-test2.sh b/tests/run-readelf-test2.sh new file mode 100755 index 0000000..4edaea6 --- /dev/null +++ b/tests/run-readelf-test2.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile28 + +testrun_compare ../src/readelf -x .strtab testfile28 <<\EOF + +Hex dump of section [6] '.strtab', 1 bytes at offset 0x290: + 0x00000000 00 . +EOF + +exit 0 diff --git a/tests/run-readelf-test3.sh b/tests/run-readelf-test3.sh new file mode 100755 index 0000000..71dd8ae --- /dev/null +++ b/tests/run-readelf-test3.sh @@ -0,0 +1,39 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile40.debug + +testrun_compare ../src/readelf -n testfile40.debug <<\EOF + +Note section [ 6] '.note' of 60 bytes at offset 0x120: + Owner Data size Type + GNU 20 GNU_BUILD_ID + Build ID: 34072edcd87ef6728f4b4a7956167b2fcfc3f1d3 + Linux 4 <unknown>: 0 +EOF + +exit 0 diff --git a/tests/run-readelf-test4.sh b/tests/run-readelf-test4.sh new file mode 100755 index 0000000..85e76ed --- /dev/null +++ b/tests/run-readelf-test4.sh @@ -0,0 +1,41 @@ +#! /bin/sh +# Copyright (C) 2007 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile19.index + +testrun_compare ../src/readelf -c testfile19.index <<\EOF + +Index of archive 'testfile19.index' has 4 entries: +Archive member 'u1.o' contains: + a +Archive member 'u2.o' contains: + aa +Archive member 'u3.o' contains: + a +EOF + +exit 0 diff --git a/tests/run-show-abbrev.sh b/tests/run-show-abbrev.sh new file mode 100755 index 0000000..a148dff --- /dev/null +++ b/tests/run-show-abbrev.sh @@ -0,0 +1,360 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 + +testrun_compare ./show-abbrev testfile testfile2 <<\EOF +abbrev[0]: code = 1, tag = 17, children = 1 +abbrev[0]: attr[0]: code = 16, form = 6, offset = 0 +abbrev[0]: attr[1]: code = 18, form = 1, offset = 2 +abbrev[0]: attr[2]: code = 17, form = 1, offset = 4 +abbrev[0]: attr[3]: code = 3, form = 8, offset = 6 +abbrev[0]: attr[4]: code = 27, form = 8, offset = 8 +abbrev[0]: attr[5]: code = 37, form = 8, offset = 10 +abbrev[0]: attr[6]: code = 19, form = 11, offset = 12 +abbrev[19]: code = 2, tag = 46, children = 1 +abbrev[19]: attr[0]: code = 1, form = 19, offset = 19 +abbrev[19]: attr[1]: code = 63, form = 12, offset = 21 +abbrev[19]: attr[2]: code = 3, form = 8, offset = 23 +abbrev[19]: attr[3]: code = 58, form = 11, offset = 25 +abbrev[19]: attr[4]: code = 59, form = 11, offset = 27 +abbrev[19]: attr[5]: code = 39, form = 12, offset = 29 +abbrev[19]: attr[6]: code = 73, form = 19, offset = 31 +abbrev[19]: attr[7]: code = 17, form = 1, offset = 33 +abbrev[19]: attr[8]: code = 18, form = 1, offset = 35 +abbrev[19]: attr[9]: code = 64, form = 10, offset = 37 +abbrev[44]: code = 3, tag = 46, children = 1 +abbrev[44]: attr[0]: code = 1, form = 19, offset = 44 +abbrev[44]: attr[1]: code = 63, form = 12, offset = 46 +abbrev[44]: attr[2]: code = 3, form = 8, offset = 48 +abbrev[44]: attr[3]: code = 58, form = 11, offset = 50 +abbrev[44]: attr[4]: code = 59, form = 11, offset = 52 +abbrev[44]: attr[5]: code = 73, form = 19, offset = 54 +abbrev[44]: attr[6]: code = 60, form = 12, offset = 56 +abbrev[63]: code = 4, tag = 24, children = 0 +abbrev[68]: code = 5, tag = 46, children = 1 +abbrev[68]: attr[0]: code = 63, form = 12, offset = 68 +abbrev[68]: attr[1]: code = 3, form = 8, offset = 70 +abbrev[68]: attr[2]: code = 58, form = 11, offset = 72 +abbrev[68]: attr[3]: code = 59, form = 11, offset = 74 +abbrev[68]: attr[4]: code = 73, form = 19, offset = 76 +abbrev[68]: attr[5]: code = 60, form = 12, offset = 78 +abbrev[85]: code = 6, tag = 36, children = 0 +abbrev[85]: attr[0]: code = 3, form = 8, offset = 85 +abbrev[85]: attr[1]: code = 11, form = 11, offset = 87 +abbrev[85]: attr[2]: code = 62, form = 11, offset = 89 +abbrev[96]: code = 7, tag = 52, children = 0 +abbrev[96]: attr[0]: code = 3, form = 8, offset = 96 +abbrev[96]: attr[1]: code = 58, form = 11, offset = 98 +abbrev[96]: attr[2]: code = 59, form = 11, offset = 100 +abbrev[96]: attr[3]: code = 73, form = 19, offset = 102 +abbrev[96]: attr[4]: code = 63, form = 12, offset = 104 +abbrev[96]: attr[5]: code = 2, form = 10, offset = 106 +abbrev[0]: code = 1, tag = 17, children = 1 +abbrev[0]: attr[0]: code = 16, form = 6, offset = 114 +abbrev[0]: attr[1]: code = 18, form = 1, offset = 116 +abbrev[0]: attr[2]: code = 17, form = 1, offset = 118 +abbrev[0]: attr[3]: code = 3, form = 8, offset = 120 +abbrev[0]: attr[4]: code = 27, form = 8, offset = 122 +abbrev[0]: attr[5]: code = 37, form = 8, offset = 124 +abbrev[0]: attr[6]: code = 19, form = 11, offset = 126 +abbrev[19]: code = 2, tag = 46, children = 0 +abbrev[19]: attr[0]: code = 63, form = 12, offset = 133 +abbrev[19]: attr[1]: code = 3, form = 8, offset = 135 +abbrev[19]: attr[2]: code = 58, form = 11, offset = 137 +abbrev[19]: attr[3]: code = 59, form = 11, offset = 139 +abbrev[19]: attr[4]: code = 39, form = 12, offset = 141 +abbrev[19]: attr[5]: code = 73, form = 19, offset = 143 +abbrev[19]: attr[6]: code = 17, form = 1, offset = 145 +abbrev[19]: attr[7]: code = 18, form = 1, offset = 147 +abbrev[19]: attr[8]: code = 64, form = 10, offset = 149 +abbrev[42]: code = 3, tag = 36, children = 0 +abbrev[42]: attr[0]: code = 3, form = 8, offset = 156 +abbrev[42]: attr[1]: code = 11, form = 11, offset = 158 +abbrev[42]: attr[2]: code = 62, form = 11, offset = 160 +abbrev[53]: code = 4, tag = 22, children = 0 +abbrev[53]: attr[0]: code = 3, form = 8, offset = 167 +abbrev[53]: attr[1]: code = 58, form = 11, offset = 169 +abbrev[53]: attr[2]: code = 59, form = 11, offset = 171 +abbrev[53]: attr[3]: code = 73, form = 19, offset = 173 +abbrev[66]: code = 5, tag = 15, children = 0 +abbrev[66]: attr[0]: code = 11, form = 11, offset = 180 +abbrev[73]: code = 6, tag = 15, children = 0 +abbrev[73]: attr[0]: code = 11, form = 11, offset = 187 +abbrev[73]: attr[1]: code = 73, form = 19, offset = 189 +abbrev[82]: code = 7, tag = 19, children = 1 +abbrev[82]: attr[0]: code = 1, form = 19, offset = 196 +abbrev[82]: attr[1]: code = 11, form = 11, offset = 198 +abbrev[82]: attr[2]: code = 58, form = 11, offset = 200 +abbrev[82]: attr[3]: code = 59, form = 11, offset = 202 +abbrev[95]: code = 8, tag = 13, children = 0 +abbrev[95]: attr[0]: code = 3, form = 8, offset = 209 +abbrev[95]: attr[1]: code = 58, form = 11, offset = 211 +abbrev[95]: attr[2]: code = 59, form = 11, offset = 213 +abbrev[95]: attr[3]: code = 73, form = 19, offset = 215 +abbrev[95]: attr[4]: code = 56, form = 10, offset = 217 +abbrev[110]: code = 9, tag = 1, children = 1 +abbrev[110]: attr[0]: code = 1, form = 19, offset = 224 +abbrev[110]: attr[1]: code = 73, form = 19, offset = 226 +abbrev[119]: code = 10, tag = 33, children = 0 +abbrev[119]: attr[0]: code = 73, form = 19, offset = 233 +abbrev[119]: attr[1]: code = 47, form = 11, offset = 235 +abbrev[128]: code = 11, tag = 19, children = 1 +abbrev[128]: attr[0]: code = 1, form = 19, offset = 242 +abbrev[128]: attr[1]: code = 3, form = 8, offset = 244 +abbrev[128]: attr[2]: code = 11, form = 11, offset = 246 +abbrev[128]: attr[3]: code = 58, form = 11, offset = 248 +abbrev[128]: attr[4]: code = 59, form = 11, offset = 250 +abbrev[143]: code = 12, tag = 19, children = 0 +abbrev[143]: attr[0]: code = 3, form = 8, offset = 257 +abbrev[143]: attr[1]: code = 60, form = 12, offset = 259 +abbrev[152]: code = 13, tag = 13, children = 0 +abbrev[152]: attr[0]: code = 3, form = 8, offset = 266 +abbrev[152]: attr[1]: code = 58, form = 11, offset = 268 +abbrev[152]: attr[2]: code = 59, form = 5, offset = 270 +abbrev[152]: attr[3]: code = 73, form = 19, offset = 272 +abbrev[152]: attr[4]: code = 56, form = 10, offset = 274 +abbrev[167]: code = 14, tag = 22, children = 0 +abbrev[167]: attr[0]: code = 3, form = 8, offset = 281 +abbrev[167]: attr[1]: code = 58, form = 11, offset = 283 +abbrev[167]: attr[2]: code = 59, form = 5, offset = 285 +abbrev[167]: attr[3]: code = 73, form = 19, offset = 287 +abbrev[180]: code = 15, tag = 23, children = 1 +abbrev[180]: attr[0]: code = 1, form = 19, offset = 294 +abbrev[180]: attr[1]: code = 11, form = 11, offset = 296 +abbrev[180]: attr[2]: code = 58, form = 11, offset = 298 +abbrev[180]: attr[3]: code = 59, form = 11, offset = 300 +abbrev[193]: code = 16, tag = 13, children = 0 +abbrev[193]: attr[0]: code = 3, form = 8, offset = 307 +abbrev[193]: attr[1]: code = 58, form = 11, offset = 309 +abbrev[193]: attr[2]: code = 59, form = 11, offset = 311 +abbrev[193]: attr[3]: code = 73, form = 19, offset = 313 +abbrev[206]: code = 17, tag = 4, children = 1 +abbrev[206]: attr[0]: code = 1, form = 19, offset = 320 +abbrev[206]: attr[1]: code = 11, form = 11, offset = 322 +abbrev[206]: attr[2]: code = 58, form = 11, offset = 324 +abbrev[206]: attr[3]: code = 59, form = 11, offset = 326 +abbrev[219]: code = 18, tag = 40, children = 0 +abbrev[219]: attr[0]: code = 3, form = 8, offset = 333 +abbrev[219]: attr[1]: code = 28, form = 11, offset = 335 +abbrev[228]: code = 19, tag = 38, children = 0 +abbrev[228]: attr[0]: code = 73, form = 19, offset = 342 +abbrev[235]: code = 20, tag = 21, children = 1 +abbrev[235]: attr[0]: code = 1, form = 19, offset = 349 +abbrev[235]: attr[1]: code = 39, form = 12, offset = 351 +abbrev[235]: attr[2]: code = 73, form = 19, offset = 353 +abbrev[246]: code = 21, tag = 5, children = 0 +abbrev[246]: attr[0]: code = 73, form = 19, offset = 360 +abbrev[253]: code = 22, tag = 21, children = 1 +abbrev[253]: attr[0]: code = 1, form = 19, offset = 367 +abbrev[253]: attr[1]: code = 39, form = 12, offset = 369 +abbrev[262]: code = 23, tag = 33, children = 0 +abbrev[262]: attr[0]: code = 73, form = 19, offset = 376 +abbrev[262]: attr[1]: code = 47, form = 6, offset = 378 +abbrev[271]: code = 24, tag = 22, children = 0 +abbrev[271]: attr[0]: code = 3, form = 8, offset = 385 +abbrev[271]: attr[1]: code = 58, form = 11, offset = 387 +abbrev[271]: attr[2]: code = 59, form = 11, offset = 389 +abbrev[282]: code = 25, tag = 4, children = 1 +abbrev[282]: attr[0]: code = 1, form = 19, offset = 396 +abbrev[282]: attr[1]: code = 3, form = 8, offset = 398 +abbrev[282]: attr[2]: code = 11, form = 11, offset = 400 +abbrev[282]: attr[3]: code = 58, form = 11, offset = 402 +abbrev[282]: attr[4]: code = 59, form = 11, offset = 404 +abbrev[0]: code = 1, tag = 17, children = 1 +abbrev[0]: attr[0]: code = 16, form = 6, offset = 412 +abbrev[0]: attr[1]: code = 18, form = 1, offset = 414 +abbrev[0]: attr[2]: code = 17, form = 1, offset = 416 +abbrev[0]: attr[3]: code = 3, form = 8, offset = 418 +abbrev[0]: attr[4]: code = 27, form = 8, offset = 420 +abbrev[0]: attr[5]: code = 37, form = 8, offset = 422 +abbrev[0]: attr[6]: code = 19, form = 11, offset = 424 +abbrev[19]: code = 2, tag = 46, children = 0 +abbrev[19]: attr[0]: code = 63, form = 12, offset = 431 +abbrev[19]: attr[1]: code = 3, form = 8, offset = 433 +abbrev[19]: attr[2]: code = 58, form = 11, offset = 435 +abbrev[19]: attr[3]: code = 59, form = 11, offset = 437 +abbrev[19]: attr[4]: code = 39, form = 12, offset = 439 +abbrev[19]: attr[5]: code = 73, form = 19, offset = 441 +abbrev[19]: attr[6]: code = 17, form = 1, offset = 443 +abbrev[19]: attr[7]: code = 18, form = 1, offset = 445 +abbrev[19]: attr[8]: code = 64, form = 10, offset = 447 +abbrev[42]: code = 3, tag = 36, children = 0 +abbrev[42]: attr[0]: code = 3, form = 8, offset = 454 +abbrev[42]: attr[1]: code = 11, form = 11, offset = 456 +abbrev[42]: attr[2]: code = 62, form = 11, offset = 458 +abbrev[0]: code = 1, tag = 17, children = 1 +abbrev[0]: attr[0]: code = 16, form = 6, offset = 0 +abbrev[0]: attr[1]: code = 18, form = 1, offset = 2 +abbrev[0]: attr[2]: code = 17, form = 1, offset = 4 +abbrev[0]: attr[3]: code = 3, form = 8, offset = 6 +abbrev[0]: attr[4]: code = 27, form = 8, offset = 8 +abbrev[0]: attr[5]: code = 37, form = 8, offset = 10 +abbrev[0]: attr[6]: code = 19, form = 11, offset = 12 +abbrev[19]: code = 2, tag = 46, children = 0 +abbrev[19]: attr[0]: code = 63, form = 12, offset = 19 +abbrev[19]: attr[1]: code = 3, form = 8, offset = 21 +abbrev[19]: attr[2]: code = 58, form = 11, offset = 23 +abbrev[19]: attr[3]: code = 59, form = 11, offset = 25 +abbrev[19]: attr[4]: code = 39, form = 12, offset = 27 +abbrev[19]: attr[5]: code = 73, form = 19, offset = 29 +abbrev[19]: attr[6]: code = 17, form = 1, offset = 31 +abbrev[19]: attr[7]: code = 18, form = 1, offset = 33 +abbrev[19]: attr[8]: code = 64, form = 10, offset = 35 +abbrev[42]: code = 3, tag = 36, children = 0 +abbrev[42]: attr[0]: code = 3, form = 8, offset = 42 +abbrev[42]: attr[1]: code = 11, form = 11, offset = 44 +abbrev[42]: attr[2]: code = 62, form = 11, offset = 46 +abbrev[53]: code = 4, tag = 22, children = 0 +abbrev[53]: attr[0]: code = 3, form = 8, offset = 53 +abbrev[53]: attr[1]: code = 58, form = 11, offset = 55 +abbrev[53]: attr[2]: code = 59, form = 11, offset = 57 +abbrev[53]: attr[3]: code = 73, form = 19, offset = 59 +abbrev[66]: code = 5, tag = 1, children = 1 +abbrev[66]: attr[0]: code = 1, form = 19, offset = 66 +abbrev[66]: attr[1]: code = 3, form = 8, offset = 68 +abbrev[66]: attr[2]: code = 73, form = 19, offset = 70 +abbrev[77]: code = 6, tag = 33, children = 0 +abbrev[77]: attr[0]: code = 73, form = 19, offset = 77 +abbrev[77]: attr[1]: code = 47, form = 11, offset = 79 +abbrev[86]: code = 7, tag = 19, children = 1 +abbrev[86]: attr[0]: code = 1, form = 19, offset = 86 +abbrev[86]: attr[1]: code = 3, form = 8, offset = 88 +abbrev[86]: attr[2]: code = 11, form = 11, offset = 90 +abbrev[86]: attr[3]: code = 58, form = 11, offset = 92 +abbrev[86]: attr[4]: code = 59, form = 11, offset = 94 +abbrev[101]: code = 8, tag = 13, children = 0 +abbrev[101]: attr[0]: code = 3, form = 8, offset = 101 +abbrev[101]: attr[1]: code = 58, form = 11, offset = 103 +abbrev[101]: attr[2]: code = 59, form = 11, offset = 105 +abbrev[101]: attr[3]: code = 73, form = 19, offset = 107 +abbrev[101]: attr[4]: code = 56, form = 10, offset = 109 +abbrev[116]: code = 9, tag = 15, children = 0 +abbrev[116]: attr[0]: code = 11, form = 11, offset = 116 +abbrev[123]: code = 10, tag = 15, children = 0 +abbrev[123]: attr[0]: code = 11, form = 11, offset = 123 +abbrev[123]: attr[1]: code = 73, form = 19, offset = 125 +abbrev[132]: code = 11, tag = 19, children = 1 +abbrev[132]: attr[0]: code = 1, form = 19, offset = 132 +abbrev[132]: attr[1]: code = 11, form = 11, offset = 134 +abbrev[132]: attr[2]: code = 58, form = 11, offset = 136 +abbrev[132]: attr[3]: code = 59, form = 11, offset = 138 +abbrev[145]: code = 12, tag = 1, children = 1 +abbrev[145]: attr[0]: code = 1, form = 19, offset = 145 +abbrev[145]: attr[1]: code = 73, form = 19, offset = 147 +abbrev[154]: code = 13, tag = 22, children = 0 +abbrev[154]: attr[0]: code = 3, form = 8, offset = 154 +abbrev[154]: attr[1]: code = 58, form = 11, offset = 156 +abbrev[154]: attr[2]: code = 59, form = 5, offset = 158 +abbrev[154]: attr[3]: code = 73, form = 19, offset = 160 +abbrev[167]: code = 14, tag = 19, children = 0 +abbrev[167]: attr[0]: code = 3, form = 8, offset = 167 +abbrev[167]: attr[1]: code = 60, form = 12, offset = 169 +abbrev[176]: code = 15, tag = 22, children = 0 +abbrev[176]: attr[0]: code = 3, form = 8, offset = 176 +abbrev[176]: attr[1]: code = 58, form = 11, offset = 178 +abbrev[176]: attr[2]: code = 59, form = 11, offset = 180 +abbrev[187]: code = 16, tag = 21, children = 1 +abbrev[187]: attr[0]: code = 1, form = 19, offset = 187 +abbrev[187]: attr[1]: code = 39, form = 12, offset = 189 +abbrev[187]: attr[2]: code = 73, form = 19, offset = 191 +abbrev[198]: code = 17, tag = 5, children = 0 +abbrev[198]: attr[0]: code = 73, form = 19, offset = 198 +abbrev[205]: code = 18, tag = 38, children = 0 +abbrev[205]: attr[0]: code = 73, form = 19, offset = 205 +abbrev[0]: code = 1, tag = 17, children = 1 +abbrev[0]: attr[0]: code = 16, form = 6, offset = 213 +abbrev[0]: attr[1]: code = 18, form = 1, offset = 215 +abbrev[0]: attr[2]: code = 17, form = 1, offset = 217 +abbrev[0]: attr[3]: code = 3, form = 8, offset = 219 +abbrev[0]: attr[4]: code = 27, form = 8, offset = 221 +abbrev[0]: attr[5]: code = 37, form = 8, offset = 223 +abbrev[0]: attr[6]: code = 19, form = 11, offset = 225 +abbrev[19]: code = 2, tag = 46, children = 0 +abbrev[19]: attr[0]: code = 63, form = 12, offset = 232 +abbrev[19]: attr[1]: code = 3, form = 8, offset = 234 +abbrev[19]: attr[2]: code = 58, form = 11, offset = 236 +abbrev[19]: attr[3]: code = 59, form = 11, offset = 238 +abbrev[19]: attr[4]: code = 39, form = 12, offset = 240 +abbrev[19]: attr[5]: code = 73, form = 19, offset = 242 +abbrev[19]: attr[6]: code = 17, form = 1, offset = 244 +abbrev[19]: attr[7]: code = 18, form = 1, offset = 246 +abbrev[19]: attr[8]: code = 64, form = 10, offset = 248 +abbrev[42]: code = 3, tag = 36, children = 0 +abbrev[42]: attr[0]: code = 3, form = 8, offset = 255 +abbrev[42]: attr[1]: code = 11, form = 11, offset = 257 +abbrev[42]: attr[2]: code = 62, form = 11, offset = 259 +abbrev[0]: code = 1, tag = 17, children = 1 +abbrev[0]: attr[0]: code = 16, form = 6, offset = 267 +abbrev[0]: attr[1]: code = 18, form = 1, offset = 269 +abbrev[0]: attr[2]: code = 17, form = 1, offset = 271 +abbrev[0]: attr[3]: code = 3, form = 8, offset = 273 +abbrev[0]: attr[4]: code = 27, form = 8, offset = 275 +abbrev[0]: attr[5]: code = 37, form = 8, offset = 277 +abbrev[0]: attr[6]: code = 19, form = 11, offset = 279 +abbrev[19]: code = 2, tag = 46, children = 1 +abbrev[19]: attr[0]: code = 1, form = 19, offset = 286 +abbrev[19]: attr[1]: code = 63, form = 12, offset = 288 +abbrev[19]: attr[2]: code = 3, form = 8, offset = 290 +abbrev[19]: attr[3]: code = 58, form = 11, offset = 292 +abbrev[19]: attr[4]: code = 59, form = 11, offset = 294 +abbrev[19]: attr[5]: code = 39, form = 12, offset = 296 +abbrev[19]: attr[6]: code = 73, form = 19, offset = 298 +abbrev[19]: attr[7]: code = 17, form = 1, offset = 300 +abbrev[19]: attr[8]: code = 18, form = 1, offset = 302 +abbrev[19]: attr[9]: code = 64, form = 10, offset = 304 +abbrev[44]: code = 3, tag = 46, children = 1 +abbrev[44]: attr[0]: code = 1, form = 19, offset = 311 +abbrev[44]: attr[1]: code = 63, form = 12, offset = 313 +abbrev[44]: attr[2]: code = 3, form = 8, offset = 315 +abbrev[44]: attr[3]: code = 58, form = 11, offset = 317 +abbrev[44]: attr[4]: code = 59, form = 11, offset = 319 +abbrev[44]: attr[5]: code = 73, form = 19, offset = 321 +abbrev[44]: attr[6]: code = 60, form = 12, offset = 323 +abbrev[63]: code = 4, tag = 24, children = 0 +abbrev[68]: code = 5, tag = 46, children = 1 +abbrev[68]: attr[0]: code = 63, form = 12, offset = 335 +abbrev[68]: attr[1]: code = 3, form = 8, offset = 337 +abbrev[68]: attr[2]: code = 58, form = 11, offset = 339 +abbrev[68]: attr[3]: code = 59, form = 11, offset = 341 +abbrev[68]: attr[4]: code = 73, form = 19, offset = 343 +abbrev[68]: attr[5]: code = 60, form = 12, offset = 345 +abbrev[85]: code = 6, tag = 36, children = 0 +abbrev[85]: attr[0]: code = 3, form = 8, offset = 352 +abbrev[85]: attr[1]: code = 11, form = 11, offset = 354 +abbrev[85]: attr[2]: code = 62, form = 11, offset = 356 +abbrev[96]: code = 7, tag = 52, children = 0 +abbrev[96]: attr[0]: code = 3, form = 8, offset = 363 +abbrev[96]: attr[1]: code = 58, form = 11, offset = 365 +abbrev[96]: attr[2]: code = 59, form = 11, offset = 367 +abbrev[96]: attr[3]: code = 73, form = 19, offset = 369 +abbrev[96]: attr[4]: code = 63, form = 12, offset = 371 +abbrev[96]: attr[5]: code = 2, form = 10, offset = 373 +EOF + +exit 0 diff --git a/tests/run-show-ciefde.sh b/tests/run-show-ciefde.sh new file mode 100755 index 0000000..37505c0 --- /dev/null +++ b/tests/run-show-ciefde.sh @@ -0,0 +1,324 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile3 testfile4 + +testrun_compare ./show-ciefde testfile3 testfile4 <<\EOF +testfile3 has 1 CIEs and 1 FDEs +CIE[0]: bytes_in_cie = 16, version = 1, augmenter = "" +CIE[0]: code_alignment_factor = 1 +CIE[0]: data_alignment_factor = fffffffffffffffc +CIE[0]: return_address_register = 8 +CIE[0]: bytes = 0c 04 04 88 01 00 00 +FDE[0]: low_pc = 0x804842c, length = 41 +FDE[0]: bytes = 18 00 00 00 18 00 00 00 2c 84 04 08 29 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[0]: cie_offset = 0, cie_index = 0, fde_offset = 24 +FDE[0]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +no FDE at 8048400 +FDE[@804842c]: cie_offset = 0, cie_index = 0, fde_offset = 24 +FDE[@8048454]: cie_offset = 0, cie_index = 0, fde_offset = 24 +no FDE at 8048455 +no FDE at 80493fc +testfile4 has 5 CIEs and 61 FDEs +CIE[0]: bytes_in_cie = 20, version = 1, augmenter = "eh" +CIE[0]: code_alignment_factor = 1 +CIE[0]: data_alignment_factor = fffffffffffffffc +CIE[0]: return_address_register = 8 +CIE[0]: bytes = 0c 04 04 88 01 +CIE[1]: bytes_in_cie = 16, version = 1, augmenter = "" +CIE[1]: code_alignment_factor = 1 +CIE[1]: data_alignment_factor = fffffffffffffffc +CIE[1]: return_address_register = 8 +CIE[1]: bytes = 0c 04 04 88 01 00 00 +CIE[2]: bytes_in_cie = 16, version = 1, augmenter = "" +CIE[2]: code_alignment_factor = 1 +CIE[2]: data_alignment_factor = fffffffffffffffc +CIE[2]: return_address_register = 8 +CIE[2]: bytes = 0c 04 04 88 01 00 00 +CIE[3]: bytes_in_cie = 20, version = 1, augmenter = "eh" +CIE[3]: code_alignment_factor = 1 +CIE[3]: data_alignment_factor = fffffffffffffffc +CIE[3]: return_address_register = 8 +CIE[3]: bytes = 0c 04 04 88 01 +CIE[4]: bytes_in_cie = 16, version = 1, augmenter = "" +CIE[4]: code_alignment_factor = 1 +CIE[4]: data_alignment_factor = fffffffffffffffc +CIE[4]: return_address_register = 8 +CIE[4]: bytes = 0c 04 04 88 01 00 00 +FDE[0]: low_pc = 0x80493fc, length = 154 +FDE[0]: bytes = 2c 00 00 00 1c 00 00 00 fc 93 04 08 9a 00 00 00 41 0e 08 85 02 42 0d 05 53 2e 08 50 2e 10 48 2e 00 58 2e 10 62 2e 00 63 2e 10 45 2e 00 00 00 00 +FDE[0]: cie_offset = 0, cie_index = 0, fde_offset = 28 +FDE[0]: instructions = 41 0e 08 85 02 42 0d 05 53 2e 08 50 2e 10 48 2e 00 58 2e 10 62 2e 00 63 2e 10 45 2e 00 00 00 00 +FDE[1]: low_pc = 0x8049498, length = 49 +FDE[1]: bytes = 18 00 00 00 4c 00 00 00 98 94 04 08 31 00 00 00 41 0e 08 85 02 42 0d 05 4c 2e 10 00 +FDE[1]: cie_offset = 0, cie_index = 0, fde_offset = 76 +FDE[1]: instructions = 41 0e 08 85 02 42 0d 05 4c 2e 10 00 +FDE[2]: low_pc = 0x80494d4, length = 23 +FDE[2]: bytes = 18 00 00 00 18 00 00 00 d4 94 04 08 17 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[2]: cie_offset = 100, cie_index = 1, fde_offset = 24 +FDE[2]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[3]: low_pc = 0x80494f0, length = 26 +FDE[3]: bytes = 18 00 00 00 34 00 00 00 f0 94 04 08 1a 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[3]: cie_offset = 100, cie_index = 1, fde_offset = 52 +FDE[3]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[4]: low_pc = 0x8049560, length = 85 +FDE[4]: bytes = 24 00 00 00 50 00 00 00 60 95 04 08 55 00 00 00 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 53 2e 10 4e 2e 00 55 2e 10 00 +FDE[4]: cie_offset = 100, cie_index = 1, fde_offset = 80 +FDE[4]: instructions = 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 53 2e 10 4e 2e 00 55 2e 10 00 +FDE[5]: low_pc = 0x80495c0, length = 66 +FDE[5]: bytes = 20 00 00 00 78 00 00 00 c0 95 04 08 42 00 00 00 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 5e 2e 10 00 00 00 +FDE[5]: cie_offset = 100, cie_index = 1, fde_offset = 120 +FDE[5]: instructions = 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 5e 2e 10 00 00 00 +FDE[6]: low_pc = 0x8049610, length = 28 +FDE[6]: bytes = 18 00 00 00 9c 00 00 00 10 96 04 08 1c 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[6]: cie_offset = 100, cie_index = 1, fde_offset = 156 +FDE[6]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[7]: low_pc = 0x8049630, length = 31 +FDE[7]: bytes = 18 00 00 00 b8 00 00 00 30 96 04 08 1f 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[7]: cie_offset = 100, cie_index = 1, fde_offset = 184 +FDE[7]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[8]: low_pc = 0x80496e0, length = 71 +FDE[8]: bytes = 1c 00 00 00 d4 00 00 00 e0 96 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 5c 2e 10 00 00 +FDE[8]: cie_offset = 100, cie_index = 1, fde_offset = 212 +FDE[8]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 5c 2e 10 00 00 +FDE[9]: low_pc = 0x8049730, length = 165 +FDE[9]: bytes = 20 00 00 00 f4 00 00 00 30 97 04 08 a5 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 69 2e 10 02 66 2e 00 00 00 +FDE[9]: cie_offset = 100, cie_index = 1, fde_offset = 244 +FDE[9]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 69 2e 10 02 66 2e 00 00 00 +FDE[10]: low_pc = 0x80497e0, length = 89 +FDE[10]: bytes = 1c 00 00 00 18 01 00 00 e0 97 04 08 59 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 74 2e 10 00 00 +FDE[10]: cie_offset = 100, cie_index = 1, fde_offset = 280 +FDE[10]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 74 2e 10 00 00 +FDE[11]: low_pc = 0x8049840, length = 89 +FDE[11]: bytes = 28 00 00 00 38 01 00 00 40 98 04 08 59 00 00 00 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 55 2e 10 4e 2e 00 52 2e 10 4c 2e 00 00 00 +FDE[11]: cie_offset = 100, cie_index = 1, fde_offset = 312 +FDE[11]: instructions = 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 55 2e 10 4e 2e 00 52 2e 10 4c 2e 00 00 00 +FDE[12]: low_pc = 0x80498a0, length = 176 +FDE[12]: bytes = 24 00 00 00 64 01 00 00 a0 98 04 08 b0 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5e 2e 10 4c 2e 00 00 +FDE[12]: cie_offset = 100, cie_index = 1, fde_offset = 356 +FDE[12]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5e 2e 10 4c 2e 00 00 +FDE[13]: low_pc = 0x8049950, length = 116 +FDE[13]: bytes = 24 00 00 00 8c 01 00 00 50 99 04 08 74 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 5e 2e 10 00 00 00 +FDE[13]: cie_offset = 100, cie_index = 1, fde_offset = 396 +FDE[13]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 5e 2e 10 00 00 00 +FDE[14]: low_pc = 0x80499d0, length = 31 +FDE[14]: bytes = 18 00 00 00 b4 01 00 00 d0 99 04 08 1f 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[14]: cie_offset = 100, cie_index = 1, fde_offset = 436 +FDE[14]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[15]: low_pc = 0x80499f0, length = 313 +FDE[15]: bytes = 24 00 00 00 d0 01 00 00 f0 99 04 08 39 01 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 d8 2e 10 62 2e 00 +FDE[15]: cie_offset = 100, cie_index = 1, fde_offset = 464 +FDE[15]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 d8 2e 10 62 2e 00 +FDE[16]: low_pc = 0x8049b30, length = 262 +FDE[16]: bytes = 24 00 00 00 f8 01 00 00 30 9b 04 08 06 01 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 c8 2e 10 62 2e 00 +FDE[16]: cie_offset = 100, cie_index = 1, fde_offset = 504 +FDE[16]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 c8 2e 10 62 2e 00 +FDE[17]: low_pc = 0x8049c40, length = 95 +FDE[17]: bytes = 1c 00 00 00 20 02 00 00 40 9c 04 08 5f 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 6e 2e 10 00 00 +FDE[17]: cie_offset = 100, cie_index = 1, fde_offset = 544 +FDE[17]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 6e 2e 10 00 00 +FDE[18]: low_pc = 0x8049d60, length = 230 +FDE[18]: bytes = 20 00 00 00 40 02 00 00 60 9d 04 08 e6 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 02 9a 2e 10 00 00 +FDE[18]: cie_offset = 100, cie_index = 1, fde_offset = 576 +FDE[18]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 02 9a 2e 10 00 00 +FDE[19]: low_pc = 0x8049e50, length = 85 +FDE[19]: bytes = 18 00 00 00 64 02 00 00 50 9e 04 08 55 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[19]: cie_offset = 100, cie_index = 1, fde_offset = 612 +FDE[19]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[20]: low_pc = 0x8049eb0, length = 144 +FDE[20]: bytes = 20 00 00 00 80 02 00 00 b0 9e 04 08 90 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5b 2e 10 +FDE[20]: cie_offset = 100, cie_index = 1, fde_offset = 640 +FDE[20]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5b 2e 10 +FDE[21]: low_pc = 0x8049f40, length = 115 +FDE[21]: bytes = 20 00 00 00 a4 02 00 00 40 9f 04 08 73 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 59 2e 10 +FDE[21]: cie_offset = 100, cie_index = 1, fde_offset = 676 +FDE[21]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 59 2e 10 +FDE[22]: low_pc = 0x8049fd0, length = 948 +FDE[22]: bytes = 30 00 00 00 c8 02 00 00 d0 9f 04 08 b4 03 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 f7 2e 20 02 64 2e 10 03 15 01 2e 00 02 9f 2e 10 00 00 +FDE[22]: cie_offset = 100, cie_index = 1, fde_offset = 712 +FDE[22]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 f7 2e 20 02 64 2e 10 03 15 01 2e 00 02 9f 2e 10 00 00 +FDE[23]: low_pc = 0x804a390, length = 201 +FDE[23]: bytes = 28 00 00 00 fc 02 00 00 90 a3 04 08 c9 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 58 2e 10 52 2e 00 75 2e 10 00 +FDE[23]: cie_offset = 100, cie_index = 1, fde_offset = 764 +FDE[23]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 58 2e 10 52 2e 00 75 2e 10 00 +FDE[24]: low_pc = 0x804a460, length = 206 +FDE[24]: bytes = 28 00 00 00 28 03 00 00 60 a4 04 08 ce 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 64 2e 10 52 2e 00 6e 2e 10 00 +FDE[24]: cie_offset = 100, cie_index = 1, fde_offset = 808 +FDE[24]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 64 2e 10 52 2e 00 6e 2e 10 00 +FDE[25]: low_pc = 0x804b970, length = 1274 +FDE[25]: bytes = 44 00 00 00 18 00 00 00 70 b9 04 08 fa 04 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 66 2e 10 7b 2e 20 03 7f 01 2e 10 53 2e 08 4c 2e 10 79 2e 20 02 54 2e 10 7e 2e 20 03 6c 01 2e 10 02 45 2e 20 00 00 00 +FDE[25]: cie_offset = 948, cie_index = 2, fde_offset = 24 +FDE[25]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 66 2e 10 7b 2e 20 03 7f 01 2e 10 53 2e 08 4c 2e 10 79 2e 20 02 54 2e 10 7e 2e 20 03 6c 01 2e 10 02 45 2e 20 00 00 00 +FDE[26]: low_pc = 0x804be70, length = 60 +FDE[26]: bytes = 1c 00 00 00 60 00 00 00 70 be 04 08 3c 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 5e 2e 10 00 00 +FDE[26]: cie_offset = 948, cie_index = 2, fde_offset = 96 +FDE[26]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 5e 2e 10 00 00 +FDE[27]: low_pc = 0x804c090, length = 85 +FDE[27]: bytes = 24 00 00 00 80 00 00 00 90 c0 04 08 55 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 66 2e 04 4d 2e 0c 4c 2e 04 46 2e 20 00 +FDE[27]: cie_offset = 948, cie_index = 2, fde_offset = 128 +FDE[27]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 66 2e 04 4d 2e 0c 4c 2e 04 46 2e 20 00 +FDE[28]: low_pc = 0x804c0f0, length = 75 +FDE[28]: bytes = 2c 00 00 00 a8 00 00 00 f0 c0 04 08 4b 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5b 2e 04 4a 2e 0c 4d 2e 04 46 2e 20 00 00 00 +FDE[28]: cie_offset = 948, cie_index = 2, fde_offset = 168 +FDE[28]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5b 2e 04 4a 2e 0c 4d 2e 04 46 2e 20 00 00 00 +FDE[29]: low_pc = 0x804d8e0, length = 71 +FDE[29]: bytes = 20 00 00 00 d8 00 00 00 e0 d8 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[29]: cie_offset = 948, cie_index = 2, fde_offset = 216 +FDE[29]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[30]: low_pc = 0x804d980, length = 71 +FDE[30]: bytes = 20 00 00 00 fc 00 00 00 80 d9 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[30]: cie_offset = 948, cie_index = 2, fde_offset = 252 +FDE[30]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[31]: low_pc = 0x804da20, length = 71 +FDE[31]: bytes = 20 00 00 00 20 01 00 00 20 da 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[31]: cie_offset = 948, cie_index = 2, fde_offset = 288 +FDE[31]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[32]: low_pc = 0x804dac0, length = 71 +FDE[32]: bytes = 20 00 00 00 44 01 00 00 c0 da 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[32]: cie_offset = 948, cie_index = 2, fde_offset = 324 +FDE[32]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[33]: low_pc = 0x804db60, length = 71 +FDE[33]: bytes = 20 00 00 00 68 01 00 00 60 db 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[33]: cie_offset = 948, cie_index = 2, fde_offset = 360 +FDE[33]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[34]: low_pc = 0x804dc00, length = 71 +FDE[34]: bytes = 20 00 00 00 8c 01 00 00 00 dc 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[34]: cie_offset = 948, cie_index = 2, fde_offset = 396 +FDE[34]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[35]: low_pc = 0x804dca0, length = 71 +FDE[35]: bytes = 20 00 00 00 b0 01 00 00 a0 dc 04 08 47 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[35]: cie_offset = 948, cie_index = 2, fde_offset = 432 +FDE[35]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 60 2e 10 +FDE[36]: low_pc = 0x804c5b4, length = 26 +FDE[36]: bytes = 18 00 00 00 1c 00 00 00 b4 c5 04 08 1a 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[36]: cie_offset = 1412, cie_index = 3, fde_offset = 28 +FDE[36]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[37]: low_pc = 0x804c5d0, length = 23 +FDE[37]: bytes = 18 00 00 00 38 00 00 00 d0 c5 04 08 17 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[37]: cie_offset = 1412, cie_index = 3, fde_offset = 56 +FDE[37]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[38]: low_pc = 0x804c640, length = 24 +FDE[38]: bytes = 18 00 00 00 54 00 00 00 40 c6 04 08 18 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[38]: cie_offset = 1412, cie_index = 3, fde_offset = 84 +FDE[38]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[39]: low_pc = 0x804c660, length = 32 +FDE[39]: bytes = 18 00 00 00 70 00 00 00 60 c6 04 08 20 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[39]: cie_offset = 1412, cie_index = 3, fde_offset = 112 +FDE[39]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[40]: low_pc = 0x804c680, length = 29 +FDE[40]: bytes = 18 00 00 00 8c 00 00 00 80 c6 04 08 1d 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[40]: cie_offset = 1412, cie_index = 3, fde_offset = 140 +FDE[40]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[41]: low_pc = 0x804c6a0, length = 36 +FDE[41]: bytes = 18 00 00 00 a8 00 00 00 a0 c6 04 08 24 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[41]: cie_offset = 1412, cie_index = 3, fde_offset = 168 +FDE[41]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[42]: low_pc = 0x804c6d0, length = 98 +FDE[42]: bytes = 24 00 00 00 c4 00 00 00 d0 c6 04 08 62 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 43 2e 10 00 00 00 +FDE[42]: cie_offset = 1412, cie_index = 3, fde_offset = 196 +FDE[42]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 43 2e 10 00 00 00 +FDE[43]: low_pc = 0x804c740, length = 107 +FDE[43]: bytes = 24 00 00 00 ec 00 00 00 40 c7 04 08 6b 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 53 2e 10 7b 2e 00 00 +FDE[43]: cie_offset = 1412, cie_index = 3, fde_offset = 236 +FDE[43]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 53 2e 10 7b 2e 00 00 +FDE[44]: low_pc = 0x804c7b0, length = 256 +FDE[44]: bytes = 24 00 00 00 14 01 00 00 b0 c7 04 08 00 01 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 bf 2e 10 00 00 00 +FDE[44]: cie_offset = 1412, cie_index = 3, fde_offset = 276 +FDE[44]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 02 bf 2e 10 00 00 00 +FDE[45]: low_pc = 0x804c8b0, length = 78 +FDE[45]: bytes = 1c 00 00 00 3c 01 00 00 b0 c8 04 08 4e 00 00 00 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 00 00 +FDE[45]: cie_offset = 1412, cie_index = 3, fde_offset = 316 +FDE[45]: instructions = 41 0e 08 85 02 42 0d 05 41 86 03 41 83 04 00 00 +FDE[46]: low_pc = 0x804c900, length = 480 +FDE[46]: bytes = 40 00 00 00 5c 01 00 00 00 c9 04 08 e0 01 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 7d 2e 10 4c 2e 00 02 48 2e 10 02 54 2e 00 78 2e 10 4c 2e 00 02 44 2e 10 79 2e 08 49 2e 10 48 2e 00 00 00 +FDE[46]: cie_offset = 1412, cie_index = 3, fde_offset = 348 +FDE[46]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 7d 2e 10 4c 2e 00 02 48 2e 10 02 54 2e 00 78 2e 10 4c 2e 00 02 44 2e 10 79 2e 08 49 2e 10 48 2e 00 00 00 +FDE[47]: low_pc = 0x804cae0, length = 37 +FDE[47]: bytes = 1c 00 00 00 a0 01 00 00 e0 ca 04 08 25 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 52 2e 10 00 00 +FDE[47]: cie_offset = 1412, cie_index = 3, fde_offset = 416 +FDE[47]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 52 2e 10 00 00 +FDE[48]: low_pc = 0x804cb10, length = 128 +FDE[48]: bytes = 2c 00 00 00 c0 01 00 00 10 cb 04 08 80 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 62 2e 10 56 2e 08 49 2e 10 48 2e 00 6c 2e 10 +FDE[48]: cie_offset = 1412, cie_index = 3, fde_offset = 448 +FDE[48]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 62 2e 10 56 2e 08 49 2e 10 48 2e 00 6c 2e 10 +FDE[49]: low_pc = 0x804cb90, length = 128 +FDE[49]: bytes = 2c 00 00 00 f0 01 00 00 90 cb 04 08 80 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 62 2e 10 56 2e 08 49 2e 10 48 2e 00 6c 2e 10 +FDE[49]: cie_offset = 1412, cie_index = 3, fde_offset = 496 +FDE[49]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 62 2e 10 56 2e 08 49 2e 10 48 2e 00 6c 2e 10 +FDE[50]: low_pc = 0x804cc10, length = 45 +FDE[50]: bytes = 18 00 00 00 20 02 00 00 10 cc 04 08 2d 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[50]: cie_offset = 1412, cie_index = 3, fde_offset = 544 +FDE[50]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[51]: low_pc = 0x804cc40, length = 43 +FDE[51]: bytes = 18 00 00 00 3c 02 00 00 40 cc 04 08 2b 00 00 00 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[51]: cie_offset = 1412, cie_index = 3, fde_offset = 572 +FDE[51]: instructions = 41 0e 08 85 02 42 0d 05 41 83 03 00 +FDE[52]: low_pc = 0x804cde0, length = 89 +FDE[52]: bytes = 20 00 00 00 18 00 00 00 e0 cd 04 08 59 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 6d 2e 20 00 00 00 +FDE[52]: cie_offset = 2008, cie_index = 4, fde_offset = 24 +FDE[52]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 6d 2e 20 00 00 00 +FDE[53]: low_pc = 0x804ce40, length = 217 +FDE[53]: bytes = 20 00 00 00 3c 00 00 00 40 ce 04 08 d9 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 02 40 2e 20 00 00 +FDE[53]: cie_offset = 2008, cie_index = 4, fde_offset = 60 +FDE[53]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 02 40 2e 20 00 00 +FDE[54]: low_pc = 0x804d010, length = 117 +FDE[54]: bytes = 24 00 00 00 60 00 00 00 10 d0 04 08 75 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5c 2e 10 02 48 2e 20 +FDE[54]: cie_offset = 2008, cie_index = 4, fde_offset = 96 +FDE[54]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 5c 2e 10 02 48 2e 20 +FDE[55]: low_pc = 0x804d090, length = 190 +FDE[55]: bytes = 24 00 00 00 88 00 00 00 90 d0 04 08 be 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 64 2e 10 02 89 2e 20 +FDE[55]: cie_offset = 2008, cie_index = 4, fde_offset = 136 +FDE[55]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 64 2e 10 02 89 2e 20 +FDE[56]: low_pc = 0x804d150, length = 101 +FDE[56]: bytes = 24 00 00 00 b0 00 00 00 50 d1 04 08 65 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 61 2e 10 73 2e 20 00 +FDE[56]: cie_offset = 2008, cie_index = 4, fde_offset = 176 +FDE[56]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 61 2e 10 73 2e 20 00 +FDE[57]: low_pc = 0x804d1c0, length = 480 +FDE[57]: bytes = 28 00 00 00 d8 00 00 00 c0 d1 04 08 e0 01 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 56 2e 10 02 f5 2e 20 02 91 2e 10 +FDE[57]: cie_offset = 2008, cie_index = 4, fde_offset = 216 +FDE[57]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 56 2e 10 02 f5 2e 20 02 91 2e 10 +FDE[58]: low_pc = 0x804d3a0, length = 897 +FDE[58]: bytes = 28 00 00 00 04 01 00 00 a0 d3 04 08 81 03 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 61 2e 10 03 61 01 2e 20 00 00 00 +FDE[58]: cie_offset = 2008, cie_index = 4, fde_offset = 260 +FDE[58]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 61 2e 10 03 61 01 2e 20 00 00 00 +FDE[59]: low_pc = 0x804d730, length = 238 +FDE[59]: bytes = 24 00 00 00 30 01 00 00 30 d7 04 08 ee 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 61 2e 10 02 8f 2e 20 +FDE[59]: cie_offset = 2008, cie_index = 4, fde_offset = 304 +FDE[59]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 41 86 04 41 83 05 61 2e 10 02 8f 2e 20 +FDE[60]: low_pc = 0x804e220, length = 73 +FDE[60]: bytes = 20 00 00 00 58 01 00 00 20 e2 04 08 49 00 00 00 41 0e 08 85 02 42 0d 05 41 87 03 44 86 04 74 2e 20 00 00 00 +FDE[60]: cie_offset = 2008, cie_index = 4, fde_offset = 344 +FDE[60]: instructions = 41 0e 08 85 02 42 0d 05 41 87 03 44 86 04 74 2e 20 00 00 00 +no FDE at 8048400 +no FDE at 804842c +no FDE at 8048454 +no FDE at 8048455 +FDE[@80493fc]: cie_offset = 0, cie_index = 0, fde_offset = 28 +EOF + +exit 0 diff --git a/tests/run-show-die-info.sh b/tests/run-show-die-info.sh new file mode 100755 index 0000000..47b5151 --- /dev/null +++ b/tests/run-show-die-info.sh @@ -0,0 +1,993 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile5 testfile2 + +testrun_compare ./show-die-info testfile5 testfile2 <<\EOF +file: testfile5 +New CU: off = 0, hsize = 11, ab = 0, as = 4, os = 4 + DW_TAG_compile_unit + Name : b.c + Offset : 11 + CU offset : 11 + Attrs : name stmt_list low_pc high_pc language comp_dir producer + low PC : 0x804842c + high PC : 0x8048436 + language : 1 + directory : /home/drepper/gnu/new-bu/build/ttt + producer : GNU C 2.96 20000731 (Red Hat Linux 7.0) + DW_TAG_subprogram + Name : bar + Offset : 104 + CU offset : 104 + Attrs : name low_pc high_pc prototyped decl_file decl_line external frame_base type + low PC : 0x804842c + high PC : 0x8048436 + DW_TAG_base_type + Name : int + Offset : 127 + CU offset : 127 + Attrs : name byte_size encoding + byte size : 4 +New CU: off = 135, hsize = 11, ab = 54, as = 4, os = 4 + DW_TAG_compile_unit + Name : f.c + Offset : 146 + CU offset : 11 + Attrs : name stmt_list low_pc high_pc language comp_dir producer + low PC : 0x8048438 + high PC : 0x8048442 + language : 1 + directory : /home/drepper/gnu/new-bu/build/ttt + producer : GNU C 2.96 20000731 (Red Hat Linux 7.0) + DW_TAG_subprogram + Name : foo + Offset : 239 + CU offset : 104 + Attrs : name low_pc high_pc prototyped decl_file decl_line external frame_base type + low PC : 0x8048438 + high PC : 0x8048442 + DW_TAG_base_type + Name : int + Offset : 262 + CU offset : 127 + Attrs : name byte_size encoding + byte size : 4 +New CU: off = 270, hsize = 11, ab = 108, as = 4, os = 4 + DW_TAG_compile_unit + Name : m.c + Offset : 281 + CU offset : 11 + Attrs : name stmt_list low_pc high_pc language comp_dir producer + low PC : 0x8048444 + high PC : 0x8048472 + language : 1 + directory : /home/drepper/gnu/new-bu/build/ttt + producer : GNU C 2.96 20000731 (Red Hat Linux 7.0) + DW_TAG_subprogram + Name : main + Offset : 374 + CU offset : 104 + Attrs : sibling name low_pc high_pc prototyped decl_file decl_line external frame_base type + low PC : 0x8048444 + high PC : 0x8048472 + DW_TAG_subprogram + Name : bar + Offset : 402 + CU offset : 132 + Attrs : sibling name decl_file decl_line declaration external type + DW_TAG_unspecified_parameters + Name : * NO NAME * + Offset : 419 + CU offset : 149 + Attrs : + DW_TAG_subprogram + Name : foo + Offset : 421 + CU offset : 151 + Attrs : name decl_file decl_line declaration external type + DW_TAG_unspecified_parameters + Name : * NO NAME * + Offset : 434 + CU offset : 164 + Attrs : + DW_TAG_base_type + Name : int + Offset : 437 + CU offset : 167 + Attrs : name byte_size encoding + byte size : 4 + DW_TAG_variable + Name : a + Offset : 444 + CU offset : 174 + Attrs : location name decl_file decl_line external type +file: testfile2 +New CU: off = 0, hsize = 11, ab = 0, as = 4, os = 4 + DW_TAG_compile_unit + Name : b.c + Offset : 11 + CU offset : 11 + Attrs : name stmt_list low_pc high_pc language comp_dir producer + low PC : 0x10000470 + high PC : 0x10000490 + language : 1 + directory : /shoggoth/drepper + producer : GNU C 2.96-laurel-000912 + DW_TAG_subprogram + Name : bar + Offset : 72 + CU offset : 72 + Attrs : name low_pc high_pc prototyped decl_file decl_line external frame_base type + low PC : 0x10000470 + high PC : 0x10000490 + DW_TAG_base_type + Name : int + Offset : 95 + CU offset : 95 + Attrs : name byte_size encoding + byte size : 4 + DW_TAG_typedef + Name : size_t + Offset : 102 + CU offset : 102 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : unsigned int + Offset : 116 + CU offset : 116 + Attrs : name byte_size encoding + byte size : 4 + DW_TAG_typedef + Name : __gnuc_va_list + Offset : 132 + CU offset : 132 + Attrs : name decl_file decl_line type + DW_TAG_array_type + Name : __builtin_va_list + Offset : 154 + CU offset : 154 + Attrs : sibling name type + DW_TAG_subrange_type + Name : * NO NAME * + Offset : 181 + CU offset : 181 + Attrs : upper_bound type + DW_TAG_base_type + Name : unsigned int + Offset : 188 + CU offset : 188 + Attrs : name byte_size encoding + byte size : 4 + DW_TAG_structure_type + Name : __va_list_tag + Offset : 204 + CU offset : 204 + Attrs : sibling name byte_size decl_file decl_line + byte size : 12 + DW_TAG_member + Name : gpr + Offset : 226 + CU offset : 226 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : fpr + Offset : 240 + CU offset : 240 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : overflow_arg_area + Offset : 254 + CU offset : 254 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : reg_save_area + Offset : 282 + CU offset : 282 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_base_type + Name : unsigned char + Offset : 307 + CU offset : 307 + Attrs : name byte_size encoding + byte size : 1 + DW_TAG_pointer_type + Name : * NO NAME * + Offset : 324 + CU offset : 324 + Attrs : byte_size + byte size : 4 + DW_TAG_typedef + Name : __u_char + Offset : 326 + CU offset : 326 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __u_short + Offset : 342 + CU offset : 342 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : short unsigned int + Offset : 359 + CU offset : 359 + Attrs : name byte_size encoding + byte size : 2 + DW_TAG_typedef + Name : __u_int + Offset : 381 + CU offset : 381 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __u_long + Offset : 396 + CU offset : 396 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : long unsigned int + Offset : 412 + CU offset : 412 + Attrs : name byte_size encoding + byte size : 4 + DW_TAG_typedef + Name : __u_quad_t + Offset : 433 + CU offset : 433 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : long long unsigned int + Offset : 451 + CU offset : 451 + Attrs : name byte_size encoding + byte size : 8 + DW_TAG_typedef + Name : __quad_t + Offset : 477 + CU offset : 477 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : long long int + Offset : 493 + CU offset : 493 + Attrs : name byte_size encoding + byte size : 8 + DW_TAG_typedef + Name : __int8_t + Offset : 510 + CU offset : 510 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : signed char + Offset : 526 + CU offset : 526 + Attrs : name byte_size encoding + byte size : 1 + DW_TAG_typedef + Name : __uint8_t + Offset : 541 + CU offset : 541 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __int16_t + Offset : 558 + CU offset : 558 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : short int + Offset : 575 + CU offset : 575 + Attrs : name byte_size encoding + byte size : 2 + DW_TAG_typedef + Name : __uint16_t + Offset : 588 + CU offset : 588 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __int32_t + Offset : 606 + CU offset : 606 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __uint32_t + Offset : 623 + CU offset : 623 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __int64_t + Offset : 641 + CU offset : 641 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __uint64_t + Offset : 658 + CU offset : 658 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __qaddr_t + Offset : 676 + CU offset : 676 + Attrs : name decl_file decl_line type + DW_TAG_pointer_type + Name : * NO NAME * + Offset : 693 + CU offset : 693 + Attrs : byte_size type + byte size : 4 + DW_TAG_typedef + Name : __dev_t + Offset : 699 + CU offset : 699 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __uid_t + Offset : 714 + CU offset : 714 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __gid_t + Offset : 729 + CU offset : 729 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __ino_t + Offset : 744 + CU offset : 744 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __mode_t + Offset : 759 + CU offset : 759 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __nlink_t + Offset : 775 + CU offset : 775 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __off_t + Offset : 792 + CU offset : 792 + Attrs : name decl_file decl_line type + DW_TAG_base_type + Name : long int + Offset : 807 + CU offset : 807 + Attrs : name byte_size encoding + byte size : 4 + DW_TAG_typedef + Name : __loff_t + Offset : 819 + CU offset : 819 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __pid_t + Offset : 835 + CU offset : 835 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __ssize_t + Offset : 850 + CU offset : 850 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __rlim_t + Offset : 867 + CU offset : 867 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __rlim64_t + Offset : 883 + CU offset : 883 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __id_t + Offset : 901 + CU offset : 901 + Attrs : name decl_file decl_line type + DW_TAG_structure_type + Name : * NO NAME * + Offset : 915 + CU offset : 915 + Attrs : sibling byte_size decl_file decl_line + byte size : 8 + DW_TAG_member + Name : __val + Offset : 923 + CU offset : 923 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_array_type + Name : * NO NAME * + Offset : 940 + CU offset : 940 + Attrs : sibling type + DW_TAG_subrange_type + Name : * NO NAME * + Offset : 949 + CU offset : 949 + Attrs : upper_bound type + DW_TAG_typedef + Name : __fsid_t + Offset : 956 + CU offset : 956 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __daddr_t + Offset : 972 + CU offset : 972 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __caddr_t + Offset : 989 + CU offset : 989 + Attrs : name decl_file decl_line type + DW_TAG_pointer_type + Name : * NO NAME * + Offset : 1006 + CU offset : 1006 + Attrs : byte_size type + byte size : 4 + DW_TAG_base_type + Name : char + Offset : 1012 + CU offset : 1012 + Attrs : name byte_size encoding + byte size : 1 + DW_TAG_typedef + Name : __time_t + Offset : 1020 + CU offset : 1020 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __swblk_t + Offset : 1036 + CU offset : 1036 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __clock_t + Offset : 1053 + CU offset : 1053 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __fd_mask + Offset : 1070 + CU offset : 1070 + Attrs : name decl_file decl_line type + DW_TAG_structure_type + Name : * NO NAME * + Offset : 1087 + CU offset : 1087 + Attrs : sibling byte_size decl_file decl_line + byte size : 128 + DW_TAG_member + Name : __fds_bits + Offset : 1095 + CU offset : 1095 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_array_type + Name : * NO NAME * + Offset : 1117 + CU offset : 1117 + Attrs : sibling type + DW_TAG_subrange_type + Name : * NO NAME * + Offset : 1126 + CU offset : 1126 + Attrs : upper_bound type + DW_TAG_typedef + Name : __fd_set + Offset : 1133 + CU offset : 1133 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __key_t + Offset : 1149 + CU offset : 1149 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __ipc_pid_t + Offset : 1164 + CU offset : 1164 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __blkcnt_t + Offset : 1183 + CU offset : 1183 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __blkcnt64_t + Offset : 1201 + CU offset : 1201 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __fsblkcnt_t + Offset : 1221 + CU offset : 1221 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __fsblkcnt64_t + Offset : 1241 + CU offset : 1241 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __fsfilcnt_t + Offset : 1263 + CU offset : 1263 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __fsfilcnt64_t + Offset : 1283 + CU offset : 1283 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __ino64_t + Offset : 1305 + CU offset : 1305 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __off64_t + Offset : 1322 + CU offset : 1322 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __t_scalar_t + Offset : 1339 + CU offset : 1339 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __t_uscalar_t + Offset : 1359 + CU offset : 1359 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : __intptr_t + Offset : 1380 + CU offset : 1380 + Attrs : name decl_file decl_line type + DW_TAG_structure_type + Name : _IO_FILE + Offset : 1398 + CU offset : 1398 + Attrs : sibling name byte_size decl_file decl_line + byte size : 152 + DW_TAG_member + Name : _flags + Offset : 1415 + CU offset : 1415 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_read_ptr + Offset : 1432 + CU offset : 1432 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_read_end + Offset : 1455 + CU offset : 1455 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_read_base + Offset : 1478 + CU offset : 1478 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_write_base + Offset : 1502 + CU offset : 1502 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_write_ptr + Offset : 1527 + CU offset : 1527 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_write_end + Offset : 1551 + CU offset : 1551 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_buf_base + Offset : 1575 + CU offset : 1575 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_buf_end + Offset : 1598 + CU offset : 1598 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_save_base + Offset : 1620 + CU offset : 1620 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_backup_base + Offset : 1644 + CU offset : 1644 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _IO_save_end + Offset : 1670 + CU offset : 1670 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _markers + Offset : 1693 + CU offset : 1693 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _chain + Offset : 1712 + CU offset : 1712 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _fileno + Offset : 1729 + CU offset : 1729 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _blksize + Offset : 1747 + CU offset : 1747 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _old_offset + Offset : 1766 + CU offset : 1766 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _cur_column + Offset : 1788 + CU offset : 1788 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _vtable_offset + Offset : 1810 + CU offset : 1810 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _shortbuf + Offset : 1835 + CU offset : 1835 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _lock + Offset : 1855 + CU offset : 1855 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _offset + Offset : 1871 + CU offset : 1871 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _unused2 + Offset : 1889 + CU offset : 1889 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_structure_type + Name : _IO_marker + Offset : 1909 + CU offset : 1909 + Attrs : sibling name byte_size decl_file decl_line + byte size : 12 + DW_TAG_member + Name : _next + Offset : 1928 + CU offset : 1928 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _sbuf + Offset : 1944 + CU offset : 1944 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_member + Name : _pos + Offset : 1960 + CU offset : 1960 + Attrs : name data_member_location decl_file decl_line type + DW_TAG_pointer_type + Name : * NO NAME * + Offset : 1976 + CU offset : 1976 + Attrs : byte_size type + byte size : 4 + DW_TAG_pointer_type + Name : * NO NAME * + Offset : 1982 + CU offset : 1982 + Attrs : byte_size type + byte size : 4 + DW_TAG_array_type + Name : * NO NAME * + Offset : 1988 + CU offset : 1988 + Attrs : sibling type + DW_TAG_subrange_type + Name : * NO NAME * + Offset : 1997 + CU offset : 1997 + Attrs : upper_bound type + DW_TAG_pointer_type + Name : * NO NAME * + Offset : 2004 + CU offset : 2004 + Attrs : byte_size + byte size : 4 + DW_TAG_array_type + Name : * NO NAME * + Offset : 2006 + CU offset : 2006 + Attrs : sibling type + DW_TAG_subrange_type + Name : * NO NAME * + Offset : 2015 + CU offset : 2015 + Attrs : upper_bound type + DW_TAG_typedef + Name : FILE + Offset : 2022 + CU offset : 2022 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : wchar_t + Offset : 2034 + CU offset : 2034 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : wint_t + Offset : 2050 + CU offset : 2050 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : _G_int16_t + Offset : 2065 + CU offset : 2065 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : _G_int32_t + Offset : 2083 + CU offset : 2083 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : _G_uint16_t + Offset : 2101 + CU offset : 2101 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : _G_uint32_t + Offset : 2120 + CU offset : 2120 + Attrs : name decl_file decl_line type + DW_TAG_structure_type + Name : _IO_jump_t + Offset : 2139 + CU offset : 2139 + Attrs : name declaration + DW_TAG_typedef + Name : _IO_lock_t + Offset : 2152 + CU offset : 2152 + Attrs : name decl_file decl_line + DW_TAG_typedef + Name : _IO_FILE + Offset : 2166 + CU offset : 2166 + Attrs : name decl_file decl_line type + DW_TAG_structure_type + Name : _IO_FILE_plus + Offset : 2182 + CU offset : 2182 + Attrs : name declaration + DW_TAG_typedef + Name : __io_read_fn + Offset : 2198 + CU offset : 2198 + Attrs : name decl_file decl_line type + DW_TAG_subroutine_type + Name : * NO NAME * + Offset : 2219 + CU offset : 2219 + Attrs : sibling prototyped type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2229 + CU offset : 2229 + Attrs : type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2234 + CU offset : 2234 + Attrs : type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2239 + CU offset : 2239 + Attrs : type + DW_TAG_typedef + Name : __io_write_fn + Offset : 2245 + CU offset : 2245 + Attrs : name decl_file decl_line type + DW_TAG_subroutine_type + Name : * NO NAME * + Offset : 2267 + CU offset : 2267 + Attrs : sibling prototyped type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2277 + CU offset : 2277 + Attrs : type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2282 + CU offset : 2282 + Attrs : type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2287 + CU offset : 2287 + Attrs : type + DW_TAG_pointer_type + Name : * NO NAME * + Offset : 2293 + CU offset : 2293 + Attrs : byte_size type + byte size : 4 + DW_TAG_const_type + Name : * NO NAME * + Offset : 2299 + CU offset : 2299 + Attrs : type + DW_TAG_typedef + Name : __io_seek_fn + Offset : 2304 + CU offset : 2304 + Attrs : name decl_file decl_line type + DW_TAG_subroutine_type + Name : * NO NAME * + Offset : 2325 + CU offset : 2325 + Attrs : sibling prototyped type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2335 + CU offset : 2335 + Attrs : type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2340 + CU offset : 2340 + Attrs : type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2345 + CU offset : 2345 + Attrs : type + DW_TAG_typedef + Name : __io_close_fn + Offset : 2351 + CU offset : 2351 + Attrs : name decl_file decl_line type + DW_TAG_subroutine_type + Name : * NO NAME * + Offset : 2373 + CU offset : 2373 + Attrs : sibling prototyped type + DW_TAG_formal_parameter + Name : * NO NAME * + Offset : 2383 + CU offset : 2383 + Attrs : type + DW_TAG_typedef + Name : fpos_t + Offset : 2389 + CU offset : 2389 + Attrs : name decl_file decl_line type + DW_TAG_typedef + Name : off_t + Offset : 2403 + CU offset : 2403 + Attrs : name decl_file decl_line type +New CU: off = 2418, hsize = 11, ab = 213, as = 4, os = 4 + DW_TAG_compile_unit + Name : f.c + Offset : 2429 + CU offset : 11 + Attrs : name stmt_list low_pc high_pc language comp_dir producer + low PC : 0x10000490 + high PC : 0x100004b0 + language : 1 + directory : /shoggoth/drepper + producer : GNU C 2.96-laurel-000912 + DW_TAG_subprogram + Name : foo + Offset : 2490 + CU offset : 72 + Attrs : name low_pc high_pc prototyped decl_file decl_line external frame_base type + low PC : 0x10000490 + high PC : 0x100004b0 + DW_TAG_base_type + Name : int + Offset : 2513 + CU offset : 95 + Attrs : name byte_size encoding + byte size : 4 +New CU: off = 2521, hsize = 11, ab = 267, as = 4, os = 4 + DW_TAG_compile_unit + Name : m.c + Offset : 2532 + CU offset : 11 + Attrs : name stmt_list low_pc high_pc language comp_dir producer + low PC : 0x100004b0 + high PC : 0x10000514 + language : 1 + directory : /shoggoth/drepper + producer : GNU C 2.96-laurel-000912 + DW_TAG_subprogram + Name : main + Offset : 2593 + CU offset : 72 + Attrs : sibling name low_pc high_pc prototyped decl_file decl_line external frame_base type + low PC : 0x100004b0 + high PC : 0x10000514 + DW_TAG_subprogram + Name : bar + Offset : 2621 + CU offset : 100 + Attrs : sibling name decl_file decl_line declaration external type + DW_TAG_unspecified_parameters + Name : * NO NAME * + Offset : 2638 + CU offset : 117 + Attrs : + DW_TAG_subprogram + Name : foo + Offset : 2640 + CU offset : 119 + Attrs : name decl_file decl_line declaration external type + DW_TAG_unspecified_parameters + Name : * NO NAME * + Offset : 2653 + CU offset : 132 + Attrs : + DW_TAG_base_type + Name : int + Offset : 2656 + CU offset : 135 + Attrs : name byte_size encoding + byte size : 4 + DW_TAG_variable + Name : a + Offset : 2663 + CU offset : 142 + Attrs : location name decl_file decl_line external type +EOF + +exit 0 diff --git a/tests/run-strings-test.sh b/tests/run-strings-test.sh new file mode 100755 index 0000000..a5dac63 --- /dev/null +++ b/tests/run-strings-test.sh @@ -0,0 +1,478 @@ +#! /bin/sh +# Copyright (C) 2005, 2006, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 2005. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +files="testfile `seq 2 9 | while read n; do echo testfile$n; done`" +testfiles $files + +testrun_compare ../src/strings -tx -f $files <<\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 + +exit 0 diff --git a/tests/run-strip-test.sh b/tests/run-strip-test.sh new file mode 100755 index 0000000..e056f89 --- /dev/null +++ b/tests/run-strip-test.sh @@ -0,0 +1,64 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2003, 2005, 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile11} +stripped=${stripped:-testfile7} +debugout=${debugfile:+-f testfile.debug.temp -F $debugfile} + +testfiles $original +test x$stripped = xtestfile.temp || testfiles $stripped $debugfile + +tempfiles testfile.temp testfile.debug.temp testfile.unstrip + +testrun ../src/strip -o testfile.temp $debugout $original + +status=0 + +cmp $stripped testfile.temp || status=$? + +# Check elflint and the expected result. +testrun ../src/elflint -q testfile.temp || status=$? + +test -z "$debugfile" || { +cmp $debugfile testfile.debug.temp || status=$? + +# Check elflint and the expected result. +testrun ../src/elflint -q -d testfile.debug.temp || status=$? + +# Now test unstrip recombining those files. +testrun ../src/unstrip -o testfile.unstrip testfile.temp testfile.debug.temp + +# Check that it came back whole. +testrun ../src/elfcmp --hash-inexact $original testfile.unstrip +} + +tempfiles testfile.sections +testrun ../src/readelf -S testfile.temp > testfile.sections || status=$? +fgrep ' .debug_' testfile.sections && status=1 + +exit $status diff --git a/tests/run-strip-test2.sh b/tests/run-strip-test2.sh new file mode 100755 index 0000000..a5858d2 --- /dev/null +++ b/tests/run-strip-test2.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +original=testfile8 +stripped=testfile9 +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test3.sh b/tests/run-strip-test3.sh new file mode 100755 index 0000000..3d52f6e --- /dev/null +++ b/tests/run-strip-test3.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Copyright (C) 1999, 2000, 2002, 2003, 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# Written by Ulrich Drepper <drepper@redhat.com>, 1999. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +original=testfile12 +stripped=testfile13 +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test4.sh b/tests/run-strip-test4.sh new file mode 100755 index 0000000..64924a9 --- /dev/null +++ b/tests/run-strip-test4.sh @@ -0,0 +1,5 @@ +original=testfile11 +stripped=testfile37 +debugfile=testfile37.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test5.sh b/tests/run-strip-test5.sh new file mode 100755 index 0000000..9fa9ebe --- /dev/null +++ b/tests/run-strip-test5.sh @@ -0,0 +1,5 @@ +original=testfile8 +stripped=testfile16 +debugfile=testfile16.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test6.sh b/tests/run-strip-test6.sh new file mode 100755 index 0000000..c59bf5e --- /dev/null +++ b/tests/run-strip-test6.sh @@ -0,0 +1,5 @@ +original=testfile12 +stripped=testfile35 +debugfile=testfile35.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test7.sh b/tests/run-strip-test7.sh new file mode 100755 index 0000000..c65cd05 --- /dev/null +++ b/tests/run-strip-test7.sh @@ -0,0 +1,5 @@ +original=testfile39 +stripped=testfile40 +debugfile=testfile40.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-strip-test8.sh b/tests/run-strip-test8.sh new file mode 100755 index 0000000..fb9fa08 --- /dev/null +++ b/tests/run-strip-test8.sh @@ -0,0 +1,5 @@ +original=testfile47 +stripped=testfile48 +debugfile=testfile48.debug + +. $srcdir/run-strip-test.sh diff --git a/tests/run-test-flag-nobits.sh b/tests/run-test-flag-nobits.sh new file mode 100755 index 0000000..1fae660 --- /dev/null +++ b/tests/run-test-flag-nobits.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Copyright (C) 2010 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +testfiles testfile + +testrun ./test-flag-nobits testfile diff --git a/tests/run-unstrip-test.sh b/tests/run-unstrip-test.sh new file mode 100755 index 0000000..b9959a1 --- /dev/null +++ b/tests/run-unstrip-test.sh @@ -0,0 +1,51 @@ +#! /bin/sh +# Copyright (C) 2007-2010 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + +. $srcdir/test-subr.sh + +original=${original:-testfile12} +stripped=${stripped:-testfile17} +debugfile=${debugfile:-${stripped}.debug} + +testfiles $original $stripped $debugfile +tempfiles testfile.unstrip testfile.inplace + +# These are old reference output from run-test-strip6.sh, when +# strip left the .debug file with unchanged sh_size in +# stripped sections that shrank in the stripped file. strip +# no longer does that, but unstrip must still handle it. + +testrun ../src/unstrip -o testfile.unstrip $stripped $debugfile + +testrun ../src/elfcmp --hash-inexact $original testfile.unstrip + +# Also test modifying the file in place. + +rm -f testfile.inplace +cp $debugfile testfile.inplace +chmod 644 testfile.inplace +testrun ../src/unstrip $stripped testfile.inplace + +testrun ../src/elfcmp --hash-inexact $original testfile.inplace diff --git a/tests/run-unstrip-test2.sh b/tests/run-unstrip-test2.sh new file mode 100755 index 0000000..44074c1 --- /dev/null +++ b/tests/run-unstrip-test2.sh @@ -0,0 +1,5 @@ +original=testfile11 +stripped=testfile15 +debugfile=testfile15.debug + +. $srcdir/run-unstrip-test.sh diff --git a/tests/saridx.c b/tests/saridx.c new file mode 100644 index 0000000..d95777f --- /dev/null +++ b/tests/saridx.c @@ -0,0 +1,265 @@ +/* Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1998. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <unistd.h> + + +static const char *machines[] = +{ +#define MACHINE(name) [name] = #name + MACHINE (EM_NONE), + MACHINE (EM_M32), + MACHINE (EM_SPARC), + MACHINE (EM_386), + MACHINE (EM_68K), + MACHINE (EM_88K), + MACHINE (EM_860), + MACHINE (EM_MIPS), + MACHINE (EM_MIPS_RS3_LE), + MACHINE (EM_PARISC), + MACHINE (EM_VPP500), + MACHINE (EM_SPARC32PLUS), + MACHINE (EM_960), + MACHINE (EM_PPC), + MACHINE (EM_PPC64), + MACHINE (EM_V800), + MACHINE (EM_FR20), + MACHINE (EM_RH32), + MACHINE (EM_RCE), + MACHINE (EM_ARM), + MACHINE (EM_FAKE_ALPHA), + MACHINE (EM_SH), + MACHINE (EM_SPARCV9), + MACHINE (EM_TRICORE), + MACHINE (EM_ARC), + MACHINE (EM_H8_300), + MACHINE (EM_H8_300H), + MACHINE (EM_H8S), + MACHINE (EM_H8_500), + MACHINE (EM_IA_64), + MACHINE (EM_MIPS_X), + MACHINE (EM_COLDFIRE), + MACHINE (EM_68HC12), + MACHINE (EM_MMA), + MACHINE (EM_PCP), + MACHINE (EM_NCPU), + MACHINE (EM_NDR1), + MACHINE (EM_STARCORE), + MACHINE (EM_ME16), + MACHINE (EM_ST100), + MACHINE (EM_TINYJ), + MACHINE (EM_FX66), + MACHINE (EM_ST9PLUS), + MACHINE (EM_ST7), + MACHINE (EM_68HC16), + MACHINE (EM_68HC11), + MACHINE (EM_68HC08), + MACHINE (EM_68HC05), + MACHINE (EM_SVX), + MACHINE (EM_ST19), + MACHINE (EM_VAX) +}; + + +int +main (int argc, char *argv[]) +{ + int fd; + Elf *elf; + Elf_Cmd cmd; + size_t n; + int arg = 1; + int verbose = 0; + + /* Recognize optional verbosity flag. */ + if (arg < argc && strcmp (argv[arg], "-v") == 0) + { + verbose = 1; + ++arg; + } + + /* Any more arguments available. */ + if (arg >= argc) + error (EXIT_FAILURE, 0, "No input file given"); + + /* Open the input file. */ + fd = open (argv[arg], O_RDONLY); + if (fd == -1) + { + perror ("cannot open input file"); + exit (1); + } + + /* Set the ELF version we are using here. */ + if (elf_version (EV_CURRENT) == EV_NONE) + { + puts ("ELF library too old"); + exit (1); + } + + /* Start reading the file. */ + cmd = ELF_C_READ; + elf = elf_begin (fd, cmd, NULL); + if (elf == NULL) + { + printf ("elf_begin: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* If it is no archive punt. */ + if (elf_kind (elf) != ELF_K_AR) + { + printf ("%s is not an archive\n", argv[1]); + exit (1); + } + + if (verbose) + { + /* The verbose variant. We print a lot of information. */ + Elf *subelf; + char buf[100]; + time_t t; + + /* Get the elements of the archive one after the other. */ + while ((subelf = elf_begin (fd, cmd, elf)) != NULL) + { + /* The the header for this element. */ + Elf_Arhdr *arhdr = elf_getarhdr (subelf); + + if (arhdr == NULL) + { + printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); + break; + } + + switch (elf_kind (subelf)) + { + case ELF_K_ELF: + fputs ("ELF file:\n", stdout); + break; + + case ELF_K_AR: + fputs ("archive:\n", stdout); + break; + + default: + fputs ("unknown file:\n", stdout); + break; + } + + /* Print general information. */ + t = arhdr->ar_date; + strftime (buf, sizeof buf, "%Y-%m-%dT%H:%M:%S%z", gmtime (&t)); + printf (" name : \"%s\"\n" + " time : %s\n" + " uid : %ld\n" + " gid : %ld\n" + " mode : %o\n" + " size : %ld\n" + " rawname : \"%s\"\n", + arhdr->ar_name, + buf, + (long int) arhdr->ar_uid, + (long int) arhdr->ar_gid, + arhdr->ar_mode, + (long int) arhdr->ar_size, + arhdr->ar_rawname); + + /* For ELF files we can provide some more information. */ + if (elf_kind (subelf) == ELF_K_ELF) + { + GElf_Ehdr ehdr; + + /* Get the ELF header. */ + if (gelf_getehdr (subelf, &ehdr) == NULL) + printf (" *** cannot get ELF header: %s\n", elf_errmsg (-1)); + else + { + printf (" binary class : %s\n", + ehdr.e_ident[EI_CLASS] == ELFCLASS32 + ? "ELFCLASS32" : "ELFCLASS64"); + printf (" data encoding: %s\n", + ehdr.e_ident[EI_DATA] == ELFDATA2LSB + ? "ELFDATA2LSB" : "ELFDATA2MSB"); + printf (" binary type : %s\n", + ehdr.e_type == ET_REL + ? "relocatable" + : (ehdr.e_type == ET_EXEC + ? "executable" + : (ehdr.e_type == ET_DYN + ? "dynamic" + : "core file"))); + printf (" machine : %s\n", + (ehdr.e_machine >= (sizeof (machines) + / sizeof (machines[0])) + || machines[ehdr.e_machine] == NULL) + ? "???" + : machines[ehdr.e_machine]); + } + } + + /* Get next archive element. */ + cmd = elf_next (subelf); + if (elf_end (subelf) != 0) + printf ("error while freeing sub-ELF descriptor: %s\n", + elf_errmsg (-1)); + } + } + else + { + /* The simple version. Only print a bit of information. */ + Elf_Arsym *arsym = elf_getarsym (elf, &n); + + if (n == 0) + printf ("no symbol table in archive: %s\n", elf_errmsg (-1)); + else + { + --n; + + while (n-- > 0) + printf ("name = \"%s\", offset = %ld, hash = %lx\n", + arsym[n].as_name, (long int) arsym[n].as_off, + arsym[n].as_hash); + } + } + + /* Free the ELF handle. */ + if (elf_end (elf) != 0) + printf ("error while freeing ELF descriptor: %s\n", elf_errmsg (-1)); + + /* Close the underlying file. */ + close (fd); + + return 0; +} diff --git a/tests/scnnames.c b/tests/scnnames.c new file mode 100644 index 0000000..4ced85c --- /dev/null +++ b/tests/scnnames.c @@ -0,0 +1,99 @@ +/* Copyright (C) 1998, 1999, 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1998. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <errno.h> +#include <fcntl.h> +#include <gelf.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +int +main (int argc, char *argv[]) +{ + Elf *elf; + int fd; + GElf_Ehdr ehdr; + size_t strndx; + Elf_Scn *scn; + + if (argc < 2) + { + puts ("missing parameter"); + exit (1); + } + + fd = open (argv[1], O_RDONLY); + if (fd == -1) + { + printf ("cannot open \"%s\": %s\n", argv[1], strerror (errno)); + exit (1); + } + + elf_version (EV_CURRENT); + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot open ELF file: %s\n", elf_errmsg (-1)); + exit (1); + } + + if (elf_kind (elf) != ELF_K_ELF) + { + printf ("\"%s\" is not an ELF file\n", argv[1]); + exit (1); + } + + if (gelf_getehdr (elf, &ehdr) == NULL) + { + printf ("cannot get the ELF header: %s\n", elf_errmsg (-1)); + exit (1); + } + + strndx = ehdr.e_shstrndx; + + scn = NULL; + while ((scn = elf_nextscn (elf, scn)) != NULL) + { + char *name = NULL; + GElf_Shdr shdr; + + if (gelf_getshdr (scn, &shdr) != NULL) + name = elf_strptr (elf, strndx, (size_t) shdr.sh_name); + + printf ("section: `%s'\n", name); + } + + if (elf_end (elf) != 0) + { + printf ("error while freeing ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + return 0; +} diff --git a/tests/sectiondump.c b/tests/sectiondump.c new file mode 100644 index 0000000..3fdde54 --- /dev/null +++ b/tests/sectiondump.c @@ -0,0 +1,190 @@ +/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1998. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <gelf.h> +#include <inttypes.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +/* Prototypes for local functions. */ +static int handle_section (Elf *elf, Elf_Scn *scn); +static void print_bytes (Elf_Data *data); +static void print_symtab (Elf *elf, Elf_Data *data); + + +int +main (int argc, char *argv[]) +{ + Elf *elf; + int fd; + int cnt; + + if (argc <= 1) + exit (1); + + /* Open the test file. This is given as the first parameter to the + program. */ + fd = open (argv[1], O_RDONLY); + if (fd == -1) + error (EXIT_FAILURE, errno, "cannot open input file `%s'", argv[1]); + + /* Set the library versio we expect. */ + elf_version (EV_CURRENT); + + /* Create the ELF descriptor. */ + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + error (EXIT_FAILURE, 0, "cannot create ELF descriptor: %s", + elf_errmsg (0)); + + /* Now proces all the sections mentioned in the rest of the command line. */ + for (cnt = 2; cnt < argc; ++cnt) + if (handle_section (elf, elf_getscn (elf, atoi (argv[cnt]))) != 0) + /* When we encounter an error stop immediately. */ + error (EXIT_FAILURE, 0, "while processing section %d: %s", cnt, + elf_errmsg (0)); + + /* Close the descriptor. */ + if (elf_end (elf) != 0) + error (EXIT_FAILURE, 0, "failure while closing ELF descriptor: %s", + elf_errmsg (0)); + + return 0; +} + + +static int +handle_section (Elf *elf, Elf_Scn *scn) +{ + GElf_Ehdr *ehdr; + GElf_Ehdr ehdr_mem; + GElf_Shdr *shdr; + GElf_Shdr shdr_mem; + Elf_Data *data; + + /* First get the ELF and section header. */ + ehdr = gelf_getehdr (elf, &ehdr_mem); + shdr = gelf_getshdr (scn, &shdr_mem); + if (ehdr == NULL || shdr == NULL) + return 1; + + /* Print the information from the ELF section header. */ + printf ("name = %s\n" + "type = %" PRId32 "\n" + "flags = %" PRIx64 "\n" + "addr = %" PRIx64 "\n" + "offset = %" PRIx64 "\n" + "size = %" PRId64 "\n" + "link = %" PRId32 "\n" + "info = %" PRIx32 "\n" + "addralign = %" PRIx64 "\n" + "entsize = %" PRId64 "\n", + elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name), + shdr->sh_type, + shdr->sh_flags, + shdr->sh_addr, + shdr->sh_offset, + shdr->sh_size, + shdr->sh_link, + shdr->sh_info, + shdr->sh_addralign, + shdr->sh_entsize); + + /* Get the section data now. */ + data = elf_getdata (scn, NULL); + if (data == NULL) + return 1; + + /* Now proces the different section types accordingly. */ + switch (shdr->sh_type) + { + case SHT_SYMTAB: + print_symtab (elf, data); + break; + + case SHT_PROGBITS: + default: + print_bytes (data); + break; + } + + /* Separate form the next section. */ + puts (""); + + /* All done correctly. */ + return 0; +} + + +static void +print_bytes (Elf_Data *data) +{ + size_t size = data->d_size; + off_t offset = data->d_off; + unsigned char *buf = (unsigned char *) data->d_buf; + size_t cnt; + + for (cnt = 0; cnt < size; cnt += 16) + { + size_t inner; + + printf ("%*Zx: ", sizeof (size_t) == 4 ? 8 : 16, (size_t) offset + cnt); + + for (inner = 0; inner < 16 && cnt + inner < size; ++inner) + printf (" %02hhx", buf[cnt + inner]); + + puts (""); + } +} + + +static void +print_symtab (Elf *elf, Elf_Data *data) +{ + int class = gelf_getclass (elf); + size_t nsym = data->d_size / (class == ELFCLASS32 + ? sizeof (Elf32_Sym) : sizeof (Elf64_Sym)); + size_t cnt; + + for (cnt = 0; cnt < nsym; ++cnt) + { + GElf_Sym sym_mem; + GElf_Sym *sym = gelf_getsym (data, cnt, &sym_mem); + + printf ("%5Zu: %*" PRIx64 " %6" PRIx64 " %4d\n", + cnt, + class == ELFCLASS32 ? 8 : 16, + sym->st_value, + sym->st_size, + GELF_ST_TYPE (sym->st_info)); + } +} diff --git a/tests/sha1-tst.c b/tests/sha1-tst.c new file mode 100644 index 0000000..9ff8141 --- /dev/null +++ b/tests/sha1-tst.c @@ -0,0 +1,79 @@ +/* Copyright (C) 2008 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2008. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <stdio.h> +#include <string.h> + +#include <sha1.h> + + +int +main (void) +{ + char buf[1000]; + int result = 0; + + struct sha1_ctx ctx; + sha1_init_ctx (&ctx); + sha1_process_bytes ("abc", 3, &ctx); + sha1_finish_ctx (&ctx, buf); + static const char expected1[SHA1_DIGEST_SIZE] = + "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e" + "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d"; + if (memcmp (buf, expected1, SHA1_DIGEST_SIZE) != 0) + { + puts ("test 1 failed"); + result = 1; + } + + sha1_init_ctx (&ctx); + sha1_process_bytes ("\ +abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56, &ctx); + sha1_finish_ctx (&ctx, buf); + static const char expected2[SHA1_DIGEST_SIZE] = + "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae" + "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1"; + if (memcmp (buf, expected2, SHA1_DIGEST_SIZE) != 0) + { + puts ("test 2 failed"); + result = 1; + } + + sha1_init_ctx (&ctx); + memset (buf, 'a', sizeof (buf)); + for (int i = 0; i < 1000; ++i) + sha1_process_bytes (buf, sizeof (buf), &ctx); + sha1_finish_ctx (&ctx, buf); + static const char expected3[SHA1_DIGEST_SIZE] = + "\x34\xaa\x97\x3c\xd4\xc4\xda\xa4\xf6\x1e" + "\xeb\x2b\xdb\xad\x27\x31\x65\x34\x01\x6f"; + if (memcmp (buf, expected3, SHA1_DIGEST_SIZE) != 0) + { + puts ("test 3 failed"); + result = 1; + } + + return result; +} diff --git a/tests/show-abbrev.c b/tests/show-abbrev.c new file mode 100644 index 0000000..75fddf5 --- /dev/null +++ b/tests/show-abbrev.c @@ -0,0 +1,139 @@ +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1998. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <fcntl.h> +#include <inttypes.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +int +main (int argc, char *argv[]) +{ + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable: %s\n", argv[cnt], dwarf_errmsg (-1)); + close (fd); + continue; + } + + Dwarf_Off cuoff = 0; + Dwarf_Off old_cuoff = 0; + size_t hsize; + while (dwarf_nextcu (dbg, cuoff, &cuoff, &hsize, NULL, NULL, NULL) == 0) + { + /* Get the DIE for the CU. */ + Dwarf_Die die; + if (dwarf_offdie (dbg, old_cuoff + hsize, &die) == NULL) + /* Something went wrong. */ + break; + + Dwarf_Off offset = 0; + + while (1) + { + size_t length; + Dwarf_Abbrev *abbrev = dwarf_getabbrev (&die, offset, &length); + if (abbrev == NULL || abbrev == DWARF_END_ABBREV) + /* End of the list. */ + break; + + unsigned tag = dwarf_getabbrevtag (abbrev); + if (tag == 0) + { + printf ("dwarf_getabbrevtag at offset %llu returned error: %s\n", + (unsigned long long int) offset, + dwarf_errmsg (-1)); + break; + } + + unsigned code = dwarf_getabbrevcode (abbrev); + if (code == 0) + { + printf ("dwarf_getabbrevcode at offset %llu returned error: %s\n", + (unsigned long long int) offset, + dwarf_errmsg (-1)); + break; + } + + int children = dwarf_abbrevhaschildren (abbrev); + if (children < 0) + { + printf ("dwarf_abbrevhaschildren at offset %llu returned error: %s\n", + (unsigned long long int) offset, + dwarf_errmsg (-1)); + break; + } + + printf ("abbrev[%llu]: code = %u, tag = %u, children = %d\n", + (unsigned long long int) offset, code, tag, children); + + size_t attrcnt; + if (dwarf_getattrcnt (abbrev, &attrcnt) != 0) + { + printf ("dwarf_getattrcnt at offset %llu returned error: %s\n", + (unsigned long long int) offset, + dwarf_errmsg (-1)); + break; + } + + unsigned int attr_num; + unsigned int attr_form; + Dwarf_Off aboffset; + size_t j; + for (j = 0; j < attrcnt; ++j) + if (dwarf_getabbrevattr (abbrev, j, &attr_num, &attr_form, + &aboffset)) + printf ("dwarf_getabbrevattr for abbrev[%llu] and index %zu failed\n", + (unsigned long long int) offset, j); + else + printf ("abbrev[%llu]: attr[%zu]: code = %u, form = %u, offset = %" PRIu64 "\n", + (unsigned long long int) offset, j, attr_num, + attr_form, (uint64_t) aboffset); + + offset += length; + } + + old_cuoff = cuoff; + } + + if (dwarf_end (dbg) != 0) + printf ("dwarf_end failed for %s: %s\n", argv[cnt], + dwarf_errmsg (-1)); + + close (fd); + } + + return 0; +} diff --git a/tests/show-die-info.c b/tests/show-die-info.c new file mode 100644 index 0000000..19015ca --- /dev/null +++ b/tests/show-die-info.c @@ -0,0 +1,525 @@ +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1998. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <dwarf.h> +#include <inttypes.h> +#include <libelf.h> +#include ELFUTILS_HEADER(dw) +#include <fcntl.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + + +static const char *tagnames[] = +{ + [DW_TAG_array_type] = "DW_TAG_array_type", + [DW_TAG_class_type] = "DW_TAG_class_type", + [DW_TAG_entry_point] = "DW_TAG_entry_point", + [DW_TAG_enumeration_type] = "DW_TAG_enumeration_type", + [DW_TAG_formal_parameter] = "DW_TAG_formal_parameter", + [DW_TAG_imported_declaration] = "DW_TAG_imported_declaration", + [DW_TAG_label] = "DW_TAG_label", + [DW_TAG_lexical_block] = "DW_TAG_lexical_block", + [DW_TAG_member] = "DW_TAG_member", + [DW_TAG_pointer_type] = "DW_TAG_pointer_type", + [DW_TAG_reference_type] = "DW_TAG_reference_type", + [DW_TAG_compile_unit] = "DW_TAG_compile_unit", + [DW_TAG_string_type] = "DW_TAG_string_type", + [DW_TAG_structure_type] = "DW_TAG_structure_type", + [DW_TAG_subroutine_type] = "DW_TAG_subroutine_type", + [DW_TAG_typedef] = "DW_TAG_typedef", + [DW_TAG_union_type] = "DW_TAG_union_type", + [DW_TAG_unspecified_parameters] = "DW_TAG_unspecified_parameters", + [DW_TAG_variant] = "DW_TAG_variant", + [DW_TAG_common_block] = "DW_TAG_common_block", + [DW_TAG_common_inclusion] = "DW_TAG_common_inclusion", + [DW_TAG_inheritance] = "DW_TAG_inheritance", + [DW_TAG_inlined_subroutine] = "DW_TAG_inlined_subroutine", + [DW_TAG_module] = "DW_TAG_module", + [DW_TAG_ptr_to_member_type] = "DW_TAG_ptr_to_member_type", + [DW_TAG_set_type] = "DW_TAG_set_type", + [DW_TAG_subrange_type] = "DW_TAG_subrange_type", + [DW_TAG_with_stmt] = "DW_TAG_with_stmt", + [DW_TAG_access_declaration] = "DW_TAG_access_declaration", + [DW_TAG_base_type] = "DW_TAG_base_type", + [DW_TAG_catch_block] = "DW_TAG_catch_block", + [DW_TAG_const_type] = "DW_TAG_const_type", + [DW_TAG_constant] = "DW_TAG_constant", + [DW_TAG_enumerator] = "DW_TAG_enumerator", + [DW_TAG_file_type] = "DW_TAG_file_type", + [DW_TAG_friend] = "DW_TAG_friend", + [DW_TAG_namelist] = "DW_TAG_namelist", + [DW_TAG_namelist_item] = "DW_TAG_namelist_item", + [DW_TAG_packed_type] = "DW_TAG_packed_type", + [DW_TAG_subprogram] = "DW_TAG_subprogram", + [DW_TAG_template_type_parameter] = "DW_TAG_template_type_parameter", + [DW_TAG_template_value_parameter] = "DW_TAG_template_value_parameter", + [DW_TAG_thrown_type] = "DW_TAG_thrown_type", + [DW_TAG_try_block] = "DW_TAG_try_block", + [DW_TAG_variant_part] = "DW_TAG_variant_part", + [DW_TAG_variable] = "DW_TAG_variable", + [DW_TAG_volatile_type] = "DW_TAG_volatile_type", + [DW_TAG_dwarf_procedure] = "DW_TAG_dwarf_procedure", + [DW_TAG_restrict_type] = "DW_TAG_restrict_type", + [DW_TAG_interface_type] = "DW_TAG_interface_type", + [DW_TAG_namespace] = "DW_TAG_namespace", + [DW_TAG_imported_module] = "DW_TAG_imported_module", + [DW_TAG_unspecified_type] = "DW_TAG_unspecified_type", + [DW_TAG_partial_unit] = "DW_TAG_partial_unit", + [DW_TAG_imported_unit] = "DW_TAG_imported_unit", + [DW_TAG_mutable_type] = "DW_TAG_mutable_type", + [DW_TAG_condition] = "DW_TAG_condition", + [DW_TAG_shared_type] = "DW_TAG_shared_type", +}; +#define ntagnames (sizeof (tagnames) / sizeof (tagnames[0])) + + +const struct +{ + int code; + const char *name; +} attrs[] = +{ + { DW_AT_sibling, "sibling" }, + { DW_AT_location, "location" }, + { DW_AT_name, "name" }, + { DW_AT_ordering, "ordering" }, + { DW_AT_subscr_data, "subscr_data" }, + { DW_AT_byte_size, "byte_size" }, + { DW_AT_bit_offset, "bit_offset" }, + { DW_AT_bit_size, "bit_size" }, + { DW_AT_element_list, "element_list" }, + { DW_AT_stmt_list, "stmt_list" }, + { DW_AT_low_pc, "low_pc" }, + { DW_AT_high_pc, "high_pc" }, + { DW_AT_language, "language" }, + { DW_AT_member, "member" }, + { DW_AT_discr, "discr" }, + { DW_AT_discr_value, "discr_value" }, + { DW_AT_visibility, "visibility" }, + { DW_AT_import, "import" }, + { DW_AT_string_length, "string_length" }, + { DW_AT_common_reference, "common_reference" }, + { DW_AT_comp_dir, "comp_dir" }, + { DW_AT_const_value, "const_value" }, + { DW_AT_containing_type, "containing_type" }, + { DW_AT_default_value, "default_value" }, + { DW_AT_inline, "inline" }, + { DW_AT_is_optional, "is_optional" }, + { DW_AT_lower_bound, "lower_bound" }, + { DW_AT_producer, "producer" }, + { DW_AT_prototyped, "prototyped" }, + { DW_AT_return_addr, "return_addr" }, + { DW_AT_start_scope, "start_scope" }, + { DW_AT_bit_stride, "bit_stride" }, + { DW_AT_upper_bound, "upper_bound" }, + { DW_AT_abstract_origin, "abstract_origin" }, + { DW_AT_accessibility, "accessibility" }, + { DW_AT_address_class, "address_class" }, + { DW_AT_artificial, "artificial" }, + { DW_AT_base_types, "base_types" }, + { DW_AT_calling_convention, "calling_convention" }, + { DW_AT_count, "count" }, + { DW_AT_data_member_location, "data_member_location" }, + { DW_AT_decl_column, "decl_column" }, + { DW_AT_decl_file, "decl_file" }, + { DW_AT_decl_line, "decl_line" }, + { DW_AT_declaration, "declaration" }, + { DW_AT_discr_list, "discr_list" }, + { DW_AT_encoding, "encoding" }, + { DW_AT_external, "external" }, + { DW_AT_frame_base, "frame_base" }, + { DW_AT_friend, "friend" }, + { DW_AT_identifier_case, "identifier_case" }, + { DW_AT_macro_info, "macro_info" }, + { DW_AT_namelist_item, "namelist_item" }, + { DW_AT_priority, "priority" }, + { DW_AT_segment, "segment" }, + { DW_AT_specification, "specification" }, + { DW_AT_static_link, "static_link" }, + { DW_AT_type, "type" }, + { DW_AT_use_location, "use_location" }, + { DW_AT_variable_parameter, "variable_parameter" }, + { DW_AT_virtuality, "virtuality" }, + { DW_AT_vtable_elem_location, "vtable_elem_location" }, + { DW_AT_allocated, "allocated" }, + { DW_AT_associated, "associated" }, + { DW_AT_data_location, "data_location" }, + { DW_AT_byte_stride, "byte_stride" }, + { DW_AT_entry_pc, "entry_pc" }, + { DW_AT_use_UTF8, "use_UTF8" }, + { DW_AT_extension, "extension" }, + { DW_AT_ranges, "ranges" }, + { DW_AT_trampoline, "trampoline" }, + { DW_AT_call_column, "call_column" }, + { DW_AT_call_file, "call_file" }, + { DW_AT_call_line, "call_line" }, + { DW_AT_description, "description" }, + { DW_AT_binary_scale, "binary_scale" }, + { DW_AT_decimal_scale, "decimal_scale" }, + { DW_AT_small, "small" }, + { DW_AT_decimal_sign, "decimal_sign" }, + { DW_AT_digit_count, "digit_count" }, + { DW_AT_picture_string, "picture_string" }, + { DW_AT_mutable, "mutable" }, + { DW_AT_threads_scaled, "threads_scaled" }, + { DW_AT_explicit, "explicit" }, + { DW_AT_object_pointer, "object_pointer" }, + { DW_AT_endianity, "endianity" }, + { DW_AT_elemental, "elemental" }, + { DW_AT_pure, "pure" }, + { DW_AT_recursive, "recursive" }, + { DW_AT_MIPS_fde, "MIPS_fde" }, + { DW_AT_MIPS_loop_begin, "MIPS_loop_begin" }, + { DW_AT_MIPS_tail_loop_begin, "MIPS_tail_loop_begin" }, + { DW_AT_MIPS_epilog_begin, "MIPS_epilog_begin" }, + { DW_AT_MIPS_loop_unroll_factor, "MIPS_loop_unroll_factor" }, + { DW_AT_MIPS_software_pipeline_depth, "MIPS_software_pipeline_depth" }, + { DW_AT_MIPS_linkage_name, "MIPS_linkage_name" }, + { DW_AT_MIPS_stride, "MIPS_stride" }, + { DW_AT_MIPS_abstract_name, "MIPS_abstract_name" }, + { DW_AT_MIPS_clone_origin, "MIPS_clone_origin" }, + { DW_AT_MIPS_has_inlines, "MIPS_has_inlines" }, + { DW_AT_MIPS_stride_byte, "MIPS_stride_byte" }, + { DW_AT_MIPS_stride_elem, "MIPS_stride_elem" }, + { DW_AT_MIPS_ptr_dopetype, "MIPS_ptr_dopetype" }, + { DW_AT_MIPS_allocatable_dopetype, "MIPS_allocatable_dopetype" }, + { DW_AT_MIPS_assumed_shape_dopetype, "MIPS_assumed_shape_dopetype" }, + { DW_AT_MIPS_assumed_size, "MIPS_assumed_size" }, + { DW_AT_sf_names, "sf_names" }, + { DW_AT_src_info, "src_info" }, + { DW_AT_mac_info, "mac_info" }, + { DW_AT_src_coords, "src_coords" }, + { DW_AT_body_begin, "body_begin" }, + { DW_AT_body_end, "body_end" }, +}; +#define nattrs (sizeof (attrs) / sizeof (attrs[0])) + + +void +handle (Dwarf *dbg, Dwarf_Die *die, int n) +{ + Dwarf_Die child; + unsigned int tag; + const char *str; + char buf[30]; + const char *name; + Dwarf_Off off; + Dwarf_Off cuoff; + size_t cnt; + Dwarf_Addr addr; + int i; + + tag = dwarf_tag (die); + if (tag != DW_TAG_invalid) + { + if (tag < ntagnames) + str = tagnames[tag]; + else + { + snprintf (buf, sizeof buf, "%#x", tag); + str = buf; + } + } + else + str = "* NO TAG *"; + + name = dwarf_diename (die); + if (name == 0) + name = "* NO NAME *"; + + off = dwarf_dieoffset (die); + cuoff = dwarf_cuoffset (die); + + printf ("%*s%s\n", n * 5, "", str); + printf ("%*s Name : %s\n", n * 5, "", name); + printf ("%*s Offset : %lld\n", n * 5, "", (long long int) off); + printf ("%*s CU offset : %lld\n", n * 5, "", (long long int) cuoff); + + printf ("%*s Attrs :", n * 5, ""); + for (cnt = 0; cnt < nattrs; ++cnt) + if (dwarf_hasattr (die, attrs[cnt].code)) + printf (" %s", attrs[cnt].name); + puts (""); + + if (dwarf_hasattr (die, DW_AT_low_pc) && dwarf_lowpc (die, &addr) == 0) + { + Dwarf_Attribute attr; + Dwarf_Addr addr2; + printf ("%*s low PC : %#llx\n", + n * 5, "", (unsigned long long int) addr); + + if (dwarf_attr (die, DW_AT_low_pc, &attr) == NULL + || dwarf_formaddr (&attr, &addr2) != 0 + || addr != addr2) + puts ("************* DW_AT_low_pc verify failed ************"); + else if (! dwarf_hasform (&attr, DW_FORM_addr)) + puts ("************* DW_AT_low_pc form failed ************"); + else if (dwarf_whatform (&attr) != DW_FORM_addr) + puts ("************* DW_AT_low_pc form (2) failed ************"); + else if (dwarf_whatattr (&attr) != DW_AT_low_pc) + puts ("************* DW_AT_low_pc attr failed ************"); + } + if (dwarf_hasattr (die, DW_AT_high_pc) && dwarf_highpc (die, &addr) == 0) + { + Dwarf_Attribute attr; + Dwarf_Addr addr2; + printf ("%*s high PC : %#llx\n", + n * 5, "", (unsigned long long int) addr); + if (dwarf_attr (die, DW_AT_high_pc, &attr) == NULL + || dwarf_formaddr (&attr, &addr2) != 0 + || addr != addr2) + puts ("************* DW_AT_high_pc verify failed ************"); + else if (! dwarf_hasform (&attr, DW_FORM_addr)) + puts ("************* DW_AT_high_pc form failed ************"); + else if (dwarf_whatform (&attr) != DW_FORM_addr) + puts ("************* DW_AT_high_pc form (2) failed ************"); + else if (dwarf_whatattr (&attr) != DW_AT_high_pc) + puts ("************* DW_AT_high_pc attr failed ************"); + } + + if (dwarf_hasattr (die, DW_AT_byte_size) && (i = dwarf_bytesize (die)) != -1) + { + Dwarf_Attribute attr; + Dwarf_Word u2; + unsigned int u; + printf ("%*s byte size : %d\n", n * 5, "", i); + if (dwarf_attr (die, DW_AT_byte_size, &attr) == NULL + || dwarf_formudata (&attr, &u2) != 0 + || i != (int) u2) + puts ("************* DW_AT_byte_size verify failed ************"); + else if (! dwarf_hasform (&attr, DW_FORM_data1) + && ! dwarf_hasform (&attr, DW_FORM_data2) + && ! dwarf_hasform (&attr, DW_FORM_data4) + && ! dwarf_hasform (&attr, DW_FORM_data8) + && ! dwarf_hasform (&attr, DW_FORM_sdata) + && ! dwarf_hasform (&attr, DW_FORM_udata)) + puts ("************* DW_AT_byte_size form failed ************"); + else if ((u = dwarf_whatform (&attr)) == 0 + || (u != DW_FORM_data1 + && u != DW_FORM_data2 + && u != DW_FORM_data4 + && u != DW_FORM_data8 + && u != DW_FORM_sdata + && u != DW_FORM_udata)) + puts ("************* DW_AT_byte_size form (2) failed ************"); + else if (dwarf_whatattr (&attr) != DW_AT_byte_size) + puts ("************* DW_AT_byte_size attr failed ************"); + } + if (dwarf_hasattr (die, DW_AT_bit_size) && (i = dwarf_bitsize (die)) != -1) + { + Dwarf_Attribute attr; + Dwarf_Word u2; + unsigned int u; + printf ("%*s bit size : %d\n", n * 5, "", i); + if (dwarf_attr (die, DW_AT_bit_size, &attr) == NULL + || dwarf_formudata (&attr, &u2) != 0 + || i != (int) u2) + puts ("************* DW_AT_bit_size test failed ************"); + else if (! dwarf_hasform (&attr, DW_FORM_data1) + && ! dwarf_hasform (&attr, DW_FORM_data2) + && ! dwarf_hasform (&attr, DW_FORM_data4) + && ! dwarf_hasform (&attr, DW_FORM_data8) + && ! dwarf_hasform (&attr, DW_FORM_sdata) + && ! dwarf_hasform (&attr, DW_FORM_udata)) + puts ("************* DW_AT_bit_size form failed ************"); + else if ((u = dwarf_whatform (&attr)) == 0 + || (u != DW_FORM_data1 + && u != DW_FORM_data2 + && u != DW_FORM_data4 + && u != DW_FORM_data8 + && u != DW_FORM_sdata + && u != DW_FORM_udata)) + puts ("************* DW_AT_bit_size form (2) failed ************"); + else if (dwarf_whatattr (&attr) != DW_AT_bit_size) + puts ("************* DW_AT_bit_size attr failed ************"); + } + if (dwarf_hasattr (die, DW_AT_bit_offset) + && (i = dwarf_bitoffset (die)) != -1) + { + Dwarf_Attribute attr; + Dwarf_Word u2; + unsigned int u; + printf ("%*s bit offset: %d\n", n * 5, "", i); + if (dwarf_attr (die, DW_AT_bit_offset, &attr) == NULL + || dwarf_formudata (&attr, &u2) != 0 + || i != (int) u2) + puts ("************* DW_AT_bit_offset test failed ************"); + else if (! dwarf_hasform (&attr, DW_FORM_data1) + && ! dwarf_hasform (&attr, DW_FORM_data2) + && ! dwarf_hasform (&attr, DW_FORM_data4) + && ! dwarf_hasform (&attr, DW_FORM_data8) + && ! dwarf_hasform (&attr, DW_FORM_sdata) + && ! dwarf_hasform (&attr, DW_FORM_udata)) + puts ("************* DW_AT_bit_offset form failed ************"); + else if ((u = dwarf_whatform (&attr)) == 0 + || (u != DW_FORM_data1 + && u != DW_FORM_data2 + && u != DW_FORM_data4 + && u != DW_FORM_data8 + && u != DW_FORM_sdata + && u != DW_FORM_udata)) + puts ("************* DW_AT_bit_offset form (2) failed ************"); + else if (dwarf_whatattr (&attr) != DW_AT_bit_offset) + puts ("************* DW_AT_bit_offset attr failed ************"); + } + + if (dwarf_hasattr (die, DW_AT_language) && (i = dwarf_srclang (die)) != -1) + { + Dwarf_Attribute attr; + Dwarf_Word u2; + unsigned int u; + printf ("%*s language : %d\n", n * 5, "", i); + if (dwarf_attr (die, DW_AT_language, &attr) == NULL + || dwarf_formudata (&attr, &u2) != 0 + || i != (int) u2) + puts ("************* DW_AT_language test failed ************"); + else if (! dwarf_hasform (&attr, DW_FORM_data1) + && ! dwarf_hasform (&attr, DW_FORM_data2) + && ! dwarf_hasform (&attr, DW_FORM_data4) + && ! dwarf_hasform (&attr, DW_FORM_data8) + && ! dwarf_hasform (&attr, DW_FORM_sdata) + && ! dwarf_hasform (&attr, DW_FORM_udata)) + puts ("************* DW_AT_language form failed ************"); + else if ((u = dwarf_whatform (&attr)) == 0 + || (u != DW_FORM_data1 + && u != DW_FORM_data2 + && u != DW_FORM_data4 + && u != DW_FORM_data8 + && u != DW_FORM_sdata + && u != DW_FORM_udata)) + puts ("************* DW_AT_language form (2) failed ************"); + else if (dwarf_whatattr (&attr) != DW_AT_language) + puts ("************* DW_AT_language attr failed ************"); + } + + if (dwarf_hasattr (die, DW_AT_ordering) + && (i = dwarf_arrayorder (die)) != -1) + { + Dwarf_Attribute attr; + Dwarf_Word u2; + unsigned int u; + printf ("%*s ordering : %d\n", n * 5, "", i); + if (dwarf_attr (die, DW_AT_ordering, &attr) == NULL + || dwarf_formudata (&attr, &u2) != 0 + || i != (int) u2) + puts ("************* DW_AT_ordering test failed ************"); + else if (! dwarf_hasform (&attr, DW_FORM_data1) + && ! dwarf_hasform (&attr, DW_FORM_data2) + && ! dwarf_hasform (&attr, DW_FORM_data4) + && ! dwarf_hasform (&attr, DW_FORM_data8) + && ! dwarf_hasform (&attr, DW_FORM_sdata) + && ! dwarf_hasform (&attr, DW_FORM_udata)) + puts ("************* DW_AT_ordering failed ************"); + else if ((u = dwarf_whatform (&attr)) == 0 + || (u != DW_FORM_data1 + && u != DW_FORM_data2 + && u != DW_FORM_data4 + && u != DW_FORM_data8 + && u != DW_FORM_sdata + && u != DW_FORM_udata)) + puts ("************* DW_AT_ordering form (2) failed ************"); + else if (dwarf_whatattr (&attr) != DW_AT_ordering) + puts ("************* DW_AT_ordering attr failed ************"); + } + + if (dwarf_hasattr (die, DW_AT_comp_dir)) + { + Dwarf_Attribute attr; + if (dwarf_attr (die, DW_AT_comp_dir, &attr) == NULL + || (name = dwarf_formstring (&attr)) == NULL) + puts ("************* DW_AT_comp_dir attr failed ************"); + else + printf ("%*s directory : %s\n", n * 5, "", name); + } + + if (dwarf_hasattr (die, DW_AT_producer)) + { + Dwarf_Attribute attr; + if (dwarf_attr (die, DW_AT_producer, &attr) == NULL + || (name = dwarf_formstring (&attr)) == NULL) + puts ("************* DW_AT_comp_dir attr failed ************"); + else + printf ("%*s producer : %s\n", n * 5, "", name); + } + + if (dwarf_haschildren (die) != 0 && dwarf_child (die, &child) == 0) + handle (dbg, &child, n + 1); + if (dwarf_siblingof (die, die) == 0) + handle (dbg, die, n); +} + + +int +main (int argc, char *argv[]) +{ + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + Dwarf *dbg; + + printf ("file: %s\n", basename (argv[cnt])); + + dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable\n", argv[cnt]); + close (fd); + continue; + } + + Dwarf_Off off = 0; + Dwarf_Off old_off = 0; + size_t hsize; + Dwarf_Off abbrev; + uint8_t addresssize; + uint8_t offsetsize; + while (dwarf_nextcu (dbg, off, &off, &hsize, &abbrev, &addresssize, + &offsetsize) == 0) + { + printf ("New CU: off = %llu, hsize = %zu, ab = %llu, as = %" PRIu8 + ", os = %" PRIu8 "\n", + (unsigned long long int) old_off, hsize, + (unsigned long long int) abbrev, addresssize, + offsetsize); + + Dwarf_Die die; + if (dwarf_offdie (dbg, old_off + hsize, &die) != NULL) + handle (dbg, &die, 1); + + old_off = off; + } + + dwarf_end (dbg); + close (fd); + } + + return 0; +} diff --git a/tests/showptable.c b/tests/showptable.c new file mode 100644 index 0000000..bae17f3 --- /dev/null +++ b/tests/showptable.c @@ -0,0 +1,147 @@ +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 1998. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <config.h> + +#include <errno.h> +#include <fcntl.h> +#include <gelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int +main (int argc, char *argv[]) +{ + Elf *elf; + int fd; + GElf_Ehdr ehdr; + int cnt; + + if (argc < 2) + { + puts ("missing parameter"); + exit (1); + } + + fd = open (argv[1], O_RDONLY); + if (fd == -1) + { + printf ("cannot open \"%s\": %s\n", argv[1], strerror (errno)); + exit (1); + } + + elf_version (EV_CURRENT); + + elf = elf_begin (fd, ELF_C_READ, NULL); + if (elf == NULL) + { + printf ("cannot open ELF file: %s\n", elf_errmsg (-1)); + exit (1); + } + + if (elf_kind (elf) != ELF_K_ELF) + { + printf ("\"%s\" is not an ELF file\n", argv[1]); + exit (1); + } + + if (gelf_getehdr (elf, &ehdr) == NULL) + { + printf ("cannot get the ELF header: %s\n", elf_errmsg (-1)); + exit (1); + } + + printf ("idx type %*s %*s %*s %*s %*s align flags\n", + gelf_getclass (elf) == ELFCLASS32 ? 9 : 17, "offset", + gelf_getclass (elf) == ELFCLASS32 ? 10 : 18, "vaddr", + gelf_getclass (elf) == ELFCLASS32 ? 10 : 18, "paddr", + gelf_getclass (elf) == ELFCLASS32 ? 9 : 12, "filesz", + gelf_getclass (elf) == ELFCLASS32 ? 9 : 12, "memsz"); + + for (cnt = 0; cnt < ehdr.e_phnum; ++cnt) + { + static const char *typenames[] = + { + [PT_NULL] = "NULL", + [PT_LOAD] = "LOAD", + [PT_DYNAMIC] = "DYNAMIC", + [PT_INTERP] = "INTERP", + [PT_NOTE] = "NOTE", + [PT_SHLIB] = "SHLIB", + [PT_PHDR] = "PHDR" + }; + GElf_Phdr mem; + GElf_Phdr *phdr = gelf_getphdr (elf, cnt, &mem); + char buf[19]; + const char *p_type = typenames[phdr->p_type]; + + /* If we don't know the name of the type we use the number value. */ + if (phdr->p_type >= PT_NUM) + { + snprintf (buf, sizeof (buf), "%x", phdr->p_type); + p_type = buf; + } + + printf ("%3d %-7s %#0*llx %#0*llx %#0*llx %#0*llx %#0*llx %#6llx ", + cnt, p_type, + gelf_getclass (elf) == ELFCLASS32 ? 9 : 17, + (unsigned long long int) phdr->p_offset, + gelf_getclass (elf) == ELFCLASS32 ? 10 : 18, + (unsigned long long int) phdr->p_vaddr, + gelf_getclass (elf) == ELFCLASS32 ? 10 : 18, + (unsigned long long int) phdr->p_paddr, + gelf_getclass (elf) == ELFCLASS32 ? 9 : 12, + (unsigned long long int) phdr->p_filesz, + gelf_getclass (elf) == ELFCLASS32 ? 9 : 12, + (unsigned long long int) phdr->p_memsz, + (unsigned long long int) phdr->p_align); + + putc_unlocked ((phdr->p_flags & PF_X) ? 'X' : ' ', stdout); + putc_unlocked ((phdr->p_flags & PF_W) ? 'W' : ' ', stdout); + putc_unlocked ((phdr->p_flags & PF_R) ? 'R' : ' ', stdout); + + putc_unlocked ('\n', stdout); + + if (phdr->p_type == PT_INTERP) + { + /* We can show the user the name of the interpreter. */ + size_t maxsize; + char *filedata = elf_rawfile (elf, &maxsize); + + if (filedata != NULL && phdr->p_offset < maxsize) + printf ("\t[Requesting program interpreter: %s]\n", + filedata + phdr->p_offset); + } + } + + if (elf_end (elf) != 0) + { + printf ("error while freeing ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + return 0; +} diff --git a/tests/test-flag-nobits.c b/tests/test-flag-nobits.c new file mode 100644 index 0000000..3a79da9 --- /dev/null +++ b/tests/test-flag-nobits.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2010 Red Hat, Inc. + This file is part of Red Hat elfutils. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <fcntl.h> +#include <stdlib.h> +#include <gelf.h> + +int +main (int argc, char **argv) +{ + if (argc != 2) + abort (); + + elf_version (EV_CURRENT); + + int fd = open64 (argv[1], O_RDONLY); + Elf *stripped = elf_begin (fd, ELF_C_READ, NULL); + + Elf_Scn *scn = NULL; + while ((scn = elf_nextscn (stripped, scn)) != NULL) + elf_flagdata (elf_getdata (scn, NULL), ELF_C_SET, ELF_F_DIRTY); +} diff --git a/tests/test-nlist.c b/tests/test-nlist.c new file mode 100644 index 0000000..f73955f --- /dev/null +++ b/tests/test-nlist.c @@ -0,0 +1,91 @@ +/* Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#include <nlist.h> +#include <stdio.h> +#include <stdlib.h> + + +int var = 1; + +int bss; + + +int +foo (int a) +{ + return a; +} + +int +main (int argc, char *argv[] __attribute__ ((unused))) +{ + struct nlist nl[6] = + { + [0] = { .n_name = "var" }, + [1] = { .n_name = "bss" }, + [2] = { .n_name = "main" }, + [3] = { .n_name = "foo" }, + [4] = { .n_name = "not-there" }, + [5] = { .n_name = NULL }, + }; + int cnt; + int result = 0; + + if (nlist (".libs/test-nlist", nl) != 0 + && nlist ("./test-nlist", nl) != 0) + { + puts ("nlist failed"); + exit (1); + } + + for (cnt = 0; nl[cnt].n_name != NULL; ++cnt) + { + if (argc > 1) + /* For debugging. */ + printf ("nl[%d].n_name = \"%s\"\n" + "nl[%d].n_value = %ld\n" + "nl[%d].n_scnum = %d\n" + "nl[%d].n_type = %u\n" + "nl[%d].n_sclass = %d\n" + "nl[%d].n_numaux = %d\n\n", + cnt, nl[cnt].n_name, + cnt, nl[cnt].n_value, + cnt, nl[cnt].n_scnum, + cnt, nl[cnt].n_type, + cnt, nl[cnt].n_sclass, + cnt, nl[cnt].n_numaux); + + if ((cnt != 4 && nl[cnt].n_value == 0 && nl[cnt].n_scnum == 0 + && nl[cnt].n_type == 0 && nl[cnt].n_sclass == 0 + && nl[cnt].n_numaux == 0) + || (cnt == 4 && (nl[cnt].n_value != 0 || nl[cnt].n_scnum != 0 + || nl[cnt].n_type != 0 || nl[cnt].n_sclass != 0 + || nl[cnt].n_numaux != 0))) + result = 1; + } + + return foo (result); +} diff --git a/tests/test-subr.sh b/tests/test-subr.sh new file mode 100644 index 0000000..cb34b93 --- /dev/null +++ b/tests/test-subr.sh @@ -0,0 +1,112 @@ +#! /bin/sh +# Copyright (C) 2005, 2007, 2008 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +# This file is sourced by ". $srcdir/test-subr.sh" at the start of +# each test script. It defines some functions they use and sets up +# canonical sh state for test runs. + +set -e + +#LC_ALL=C +#export LC_ALL + +remove_files= +trap 'rm -f $remove_files' 0 + +tempfiles() +{ + remove_files="$remove_files $*" +} + +testfiles() +{ + for file; do + bunzip2 -c $srcdir/${file}.bz2 > ${file} 2>/dev/null || exit 77 + remove_files="$remove_files $file" + done +} + +testrun_out() +{ + outfile="$1" + shift + remove_files="$remove_files $outfile" + testrun "$@" > $outfile 2>&1 || : +} + +testrun_compare() +{ + outfile="${1##*/}.out" + testrun_out $outfile "$@" + diff -u $outfile - + # diff's exit status will kill the script. +} + +test_cleanup() +{ + rm -f $remove_files + remove_files= +} + +# See test-wrapper.sh, which sets the environment for this. +testrun() +{ + ${elfutils_testrun}_testrun "$@" +} + +built_testrun() +{ + LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"\ + "$@" +} + +installed_testrun() +{ + program="$1" + shift + case "$program" in + ./*) + if [ "x$elfutils_tests_rpath" != xno ]; then + echo >&2 installcheck not possible with --enable-tests-rpath + exit 77 + fi + ;; + ../*) + program=${bindir}/`program_transform ${program##*/}` + ;; + esac + if [ "${libdir}" != /usr/lib ] && [ "${libdir}" != /usr/lib64 ]; then + LD_LIBRARY_PATH="${libdir}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" \ + $program ${1+"$@"} + else + $program ${1+"$@"} + fi +} + +program_transform() +{ + echo "$*" | sed "${program_transform_name}" +} diff --git a/tests/test-wrapper.sh b/tests/test-wrapper.sh new file mode 100755 index 0000000..3477e38 --- /dev/null +++ b/tests/test-wrapper.sh @@ -0,0 +1,68 @@ +#! /bin/sh +# Copyright (C) 2005 Red Hat, Inc. +# This file is part of Red Hat elfutils. +# +# Red Hat elfutils 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; version 2 of the License. +# +# Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. +# +# Red Hat elfutils is an included package of the Open Invention Network. +# An included package of the Open Invention Network is a package for which +# Open Invention Network licensees cross-license their patents. No patent +# license is granted, either expressly or impliedly, by designation as an +# included package. Should you wish to participate in the Open Invention +# Network licensing program, please visit www.openinventionnetwork.com +# <http://www.openinventionnetwork.com>. + + +# We don't compile in an rpath because we want "make installcheck" to +# use the installed libraries. So for local test runs we need to point +# the library path at this build. + +# This wrapper script is called by the makefile, in one of two ways: +# $(srcdir)/test-wrapper.sh ../libelf:... run-test.sh ... +# or: +# $(srcdir)/test-wrapper.sh installed s,^,eu-, run-test.sh ... + +if [ "$1" = installed ]; then + shift + elfutils_tests_rpath=$1 + shift + program_transform_name="$1" + shift + elfutils_testrun=installed +else + built_library_path="$1" + shift + elfutils_testrun=built +fi + +case "$1" in +*.sh) + export built_library_path program_transform_name elfutils_testrun + export elfutils_tests_rpath + ;; +*) + if [ $elfutils_testrun = built ]; then + LD_LIBRARY_PATH="$built_library_path${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH + elif [ $elfutils_tests_rpath = yes ]; then + echo >&2 installcheck not possible with --enable-tests-rpath + exit 77 + elif [ "x$libdir" != x/usr/lib ] && [ "x$libdir" != x/usr/lib64 ]; then + LD_LIBRARY_PATH="$libdir${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH + fi + ;; +esac + +exec "$@" diff --git a/tests/testfile.bz2 b/tests/testfile.bz2 Binary files differnew file mode 100644 index 0000000..bde9b12 --- /dev/null +++ b/tests/testfile.bz2 diff --git a/tests/testfile10.bz2 b/tests/testfile10.bz2 Binary files differnew file mode 100644 index 0000000..e9dd504 --- /dev/null +++ b/tests/testfile10.bz2 diff --git a/tests/testfile11.bz2 b/tests/testfile11.bz2 Binary files differnew file mode 100644 index 0000000..d094b84 --- /dev/null +++ b/tests/testfile11.bz2 diff --git a/tests/testfile12.bz2 b/tests/testfile12.bz2 Binary files differnew file mode 100644 index 0000000..8bb5ad3 --- /dev/null +++ b/tests/testfile12.bz2 diff --git a/tests/testfile13.bz2 b/tests/testfile13.bz2 Binary files differnew file mode 100644 index 0000000..3b0bcb9 --- /dev/null +++ b/tests/testfile13.bz2 diff --git a/tests/testfile14.bz2 b/tests/testfile14.bz2 Binary files differnew file mode 100644 index 0000000..ac7c69e --- /dev/null +++ b/tests/testfile14.bz2 diff --git a/tests/testfile15.bz2 b/tests/testfile15.bz2 Binary files differnew file mode 100644 index 0000000..e75f457 --- /dev/null +++ b/tests/testfile15.bz2 diff --git a/tests/testfile15.debug.bz2 b/tests/testfile15.debug.bz2 Binary files differnew file mode 100644 index 0000000..5c86900 --- /dev/null +++ b/tests/testfile15.debug.bz2 diff --git a/tests/testfile16.bz2 b/tests/testfile16.bz2 Binary files differnew file mode 100644 index 0000000..4d7160c --- /dev/null +++ b/tests/testfile16.bz2 diff --git a/tests/testfile16.debug.bz2 b/tests/testfile16.debug.bz2 Binary files differnew file mode 100644 index 0000000..f02a972 --- /dev/null +++ b/tests/testfile16.debug.bz2 diff --git a/tests/testfile17.bz2 b/tests/testfile17.bz2 Binary files differnew file mode 100644 index 0000000..5a12320 --- /dev/null +++ b/tests/testfile17.bz2 diff --git a/tests/testfile17.debug.bz2 b/tests/testfile17.debug.bz2 Binary files differnew file mode 100644 index 0000000..86a76ab --- /dev/null +++ b/tests/testfile17.debug.bz2 diff --git a/tests/testfile18.bz2 b/tests/testfile18.bz2 Binary files differnew file mode 100644 index 0000000..8b5326c --- /dev/null +++ b/tests/testfile18.bz2 diff --git a/tests/testfile19.bz2 b/tests/testfile19.bz2 Binary files differnew file mode 100644 index 0000000..f3e6512 --- /dev/null +++ b/tests/testfile19.bz2 diff --git a/tests/testfile19.index.bz2 b/tests/testfile19.index.bz2 Binary files differnew file mode 100644 index 0000000..c0a0a7a --- /dev/null +++ b/tests/testfile19.index.bz2 diff --git a/tests/testfile2.bz2 b/tests/testfile2.bz2 Binary files differnew file mode 100644 index 0000000..0771311 --- /dev/null +++ b/tests/testfile2.bz2 diff --git a/tests/testfile20.bz2 b/tests/testfile20.bz2 Binary files differnew file mode 100644 index 0000000..a379f6b --- /dev/null +++ b/tests/testfile20.bz2 diff --git a/tests/testfile20.index.bz2 b/tests/testfile20.index.bz2 Binary files differnew file mode 100644 index 0000000..08dedaf --- /dev/null +++ b/tests/testfile20.index.bz2 diff --git a/tests/testfile21.bz2 b/tests/testfile21.bz2 Binary files differnew file mode 100644 index 0000000..bab7e6d --- /dev/null +++ b/tests/testfile21.bz2 diff --git a/tests/testfile21.index.bz2 b/tests/testfile21.index.bz2 Binary files differnew file mode 100644 index 0000000..5192219 --- /dev/null +++ b/tests/testfile21.index.bz2 diff --git a/tests/testfile22.bz2 b/tests/testfile22.bz2 Binary files differnew file mode 100644 index 0000000..8c26270 --- /dev/null +++ b/tests/testfile22.bz2 diff --git a/tests/testfile23.bz2 b/tests/testfile23.bz2 Binary files differnew file mode 100644 index 0000000..cf0ce55 --- /dev/null +++ b/tests/testfile23.bz2 diff --git a/tests/testfile24.bz2 b/tests/testfile24.bz2 Binary files differnew file mode 100644 index 0000000..2320acb --- /dev/null +++ b/tests/testfile24.bz2 diff --git a/tests/testfile25.bz2 b/tests/testfile25.bz2 Binary files differnew file mode 100644 index 0000000..51e0421 --- /dev/null +++ b/tests/testfile25.bz2 diff --git a/tests/testfile26.bz2 b/tests/testfile26.bz2 Binary files differnew file mode 100644 index 0000000..1f86285 --- /dev/null +++ b/tests/testfile26.bz2 diff --git a/tests/testfile27.bz2 b/tests/testfile27.bz2 Binary files differnew file mode 100644 index 0000000..9d06cd9 --- /dev/null +++ b/tests/testfile27.bz2 diff --git a/tests/testfile28.bz2 b/tests/testfile28.bz2 Binary files differnew file mode 100644 index 0000000..ca0dff3 --- /dev/null +++ b/tests/testfile28.bz2 diff --git a/tests/testfile28.rdwr.bz2 b/tests/testfile28.rdwr.bz2 Binary files differnew file mode 100644 index 0000000..4c65848 --- /dev/null +++ b/tests/testfile28.rdwr.bz2 diff --git a/tests/testfile29.bz2 b/tests/testfile29.bz2 Binary files differnew file mode 100644 index 0000000..b46451b --- /dev/null +++ b/tests/testfile29.bz2 diff --git a/tests/testfile29.rdwr.bz2 b/tests/testfile29.rdwr.bz2 Binary files differnew file mode 100644 index 0000000..42eadc7 --- /dev/null +++ b/tests/testfile29.rdwr.bz2 diff --git a/tests/testfile3.bz2 b/tests/testfile3.bz2 Binary files differnew file mode 100644 index 0000000..30a456c --- /dev/null +++ b/tests/testfile3.bz2 diff --git a/tests/testfile30.bz2 b/tests/testfile30.bz2 Binary files differnew file mode 100644 index 0000000..9ee93c0 --- /dev/null +++ b/tests/testfile30.bz2 diff --git a/tests/testfile31.bz2 b/tests/testfile31.bz2 Binary files differnew file mode 100644 index 0000000..73451d2 --- /dev/null +++ b/tests/testfile31.bz2 diff --git a/tests/testfile32.bz2 b/tests/testfile32.bz2 Binary files differnew file mode 100644 index 0000000..7e3c73e --- /dev/null +++ b/tests/testfile32.bz2 diff --git a/tests/testfile33.bz2 b/tests/testfile33.bz2 Binary files differnew file mode 100644 index 0000000..f3dbc73 --- /dev/null +++ b/tests/testfile33.bz2 diff --git a/tests/testfile34.bz2 b/tests/testfile34.bz2 Binary files differnew file mode 100644 index 0000000..a417fcb --- /dev/null +++ b/tests/testfile34.bz2 diff --git a/tests/testfile35.bz2 b/tests/testfile35.bz2 Binary files differnew file mode 100644 index 0000000..b591301 --- /dev/null +++ b/tests/testfile35.bz2 diff --git a/tests/testfile35.debug.bz2 b/tests/testfile35.debug.bz2 Binary files differnew file mode 100644 index 0000000..f191862 --- /dev/null +++ b/tests/testfile35.debug.bz2 diff --git a/tests/testfile36.bz2 b/tests/testfile36.bz2 Binary files differnew file mode 100644 index 0000000..e912a19 --- /dev/null +++ b/tests/testfile36.bz2 diff --git a/tests/testfile36.debug.bz2 b/tests/testfile36.debug.bz2 Binary files differnew file mode 100644 index 0000000..76aca42 --- /dev/null +++ b/tests/testfile36.debug.bz2 diff --git a/tests/testfile37.bz2 b/tests/testfile37.bz2 Binary files differnew file mode 100644 index 0000000..254ce32 --- /dev/null +++ b/tests/testfile37.bz2 diff --git a/tests/testfile37.debug.bz2 b/tests/testfile37.debug.bz2 Binary files differnew file mode 100644 index 0000000..74e46a8 --- /dev/null +++ b/tests/testfile37.debug.bz2 diff --git a/tests/testfile38.bz2 b/tests/testfile38.bz2 Binary files differnew file mode 100644 index 0000000..42adb77 --- /dev/null +++ b/tests/testfile38.bz2 diff --git a/tests/testfile39.bz2 b/tests/testfile39.bz2 Binary files differnew file mode 100644 index 0000000..42d0fbc --- /dev/null +++ b/tests/testfile39.bz2 diff --git a/tests/testfile4.bz2 b/tests/testfile4.bz2 Binary files differnew file mode 100644 index 0000000..25b25df --- /dev/null +++ b/tests/testfile4.bz2 diff --git a/tests/testfile40.bz2 b/tests/testfile40.bz2 Binary files differnew file mode 100644 index 0000000..ad41985 --- /dev/null +++ b/tests/testfile40.bz2 diff --git a/tests/testfile40.debug.bz2 b/tests/testfile40.debug.bz2 Binary files differnew file mode 100644 index 0000000..2eec4d7 --- /dev/null +++ b/tests/testfile40.debug.bz2 diff --git a/tests/testfile41.bz2 b/tests/testfile41.bz2 Binary files differnew file mode 100644 index 0000000..f9bf5a4 --- /dev/null +++ b/tests/testfile41.bz2 diff --git a/tests/testfile42.bz2 b/tests/testfile42.bz2 Binary files differnew file mode 100644 index 0000000..2530aba --- /dev/null +++ b/tests/testfile42.bz2 diff --git a/tests/testfile43.bz2 b/tests/testfile43.bz2 Binary files differnew file mode 100644 index 0000000..c99db24 --- /dev/null +++ b/tests/testfile43.bz2 diff --git a/tests/testfile44.S.bz2 b/tests/testfile44.S.bz2 Binary files differnew file mode 100644 index 0000000..4e87434 --- /dev/null +++ b/tests/testfile44.S.bz2 diff --git a/tests/testfile44.expect.bz2 b/tests/testfile44.expect.bz2 Binary files differnew file mode 100644 index 0000000..b3937b9 --- /dev/null +++ b/tests/testfile44.expect.bz2 diff --git a/tests/testfile45.S.bz2 b/tests/testfile45.S.bz2 Binary files differnew file mode 100644 index 0000000..00e819e --- /dev/null +++ b/tests/testfile45.S.bz2 diff --git a/tests/testfile45.expect.bz2 b/tests/testfile45.expect.bz2 Binary files differnew file mode 100644 index 0000000..b8b33e9 --- /dev/null +++ b/tests/testfile45.expect.bz2 diff --git a/tests/testfile46.bz2 b/tests/testfile46.bz2 Binary files differnew file mode 100644 index 0000000..db83b27 --- /dev/null +++ b/tests/testfile46.bz2 diff --git a/tests/testfile47.bz2 b/tests/testfile47.bz2 Binary files differnew file mode 100644 index 0000000..334bd6c --- /dev/null +++ b/tests/testfile47.bz2 diff --git a/tests/testfile48.bz2 b/tests/testfile48.bz2 Binary files differnew file mode 100644 index 0000000..da0d9da --- /dev/null +++ b/tests/testfile48.bz2 diff --git a/tests/testfile48.debug.bz2 b/tests/testfile48.debug.bz2 Binary files differnew file mode 100644 index 0000000..7b84c4c --- /dev/null +++ b/tests/testfile48.debug.bz2 diff --git a/tests/testfile49.bz2 b/tests/testfile49.bz2 Binary files differnew file mode 100644 index 0000000..8741a6b --- /dev/null +++ b/tests/testfile49.bz2 diff --git a/tests/testfile5.bz2 b/tests/testfile5.bz2 Binary files differnew file mode 100644 index 0000000..247313e --- /dev/null +++ b/tests/testfile5.bz2 diff --git a/tests/testfile50.bz2 b/tests/testfile50.bz2 Binary files differnew file mode 100644 index 0000000..fce4332 --- /dev/null +++ b/tests/testfile50.bz2 diff --git a/tests/testfile51.bz2 b/tests/testfile51.bz2 Binary files differnew file mode 100755 index 0000000..5ff45c6 --- /dev/null +++ b/tests/testfile51.bz2 diff --git a/tests/testfile52-32.noshdrs.so.bz2 b/tests/testfile52-32.noshdrs.so.bz2 Binary files differnew file mode 100755 index 0000000..01d2742 --- /dev/null +++ b/tests/testfile52-32.noshdrs.so.bz2 diff --git a/tests/testfile52-32.prelink.so.bz2 b/tests/testfile52-32.prelink.so.bz2 Binary files differnew file mode 100755 index 0000000..ccb9ae3 --- /dev/null +++ b/tests/testfile52-32.prelink.so.bz2 diff --git a/tests/testfile52-32.so.bz2 b/tests/testfile52-32.so.bz2 Binary files differnew file mode 100755 index 0000000..2a5b56e --- /dev/null +++ b/tests/testfile52-32.so.bz2 diff --git a/tests/testfile52-32.so.debug.bz2 b/tests/testfile52-32.so.debug.bz2 Binary files differnew file mode 100755 index 0000000..818b36d --- /dev/null +++ b/tests/testfile52-32.so.debug.bz2 diff --git a/tests/testfile52-64.noshdrs.so.bz2 b/tests/testfile52-64.noshdrs.so.bz2 Binary files differnew file mode 100755 index 0000000..5ca310f --- /dev/null +++ b/tests/testfile52-64.noshdrs.so.bz2 diff --git a/tests/testfile52-64.prelink.so.bz2 b/tests/testfile52-64.prelink.so.bz2 Binary files differnew file mode 100755 index 0000000..8cb8f48 --- /dev/null +++ b/tests/testfile52-64.prelink.so.bz2 diff --git a/tests/testfile52-64.so.bz2 b/tests/testfile52-64.so.bz2 Binary files differnew file mode 100755 index 0000000..8009f07 --- /dev/null +++ b/tests/testfile52-64.so.bz2 diff --git a/tests/testfile52-64.so.debug.bz2 b/tests/testfile52-64.so.debug.bz2 Binary files differnew file mode 100755 index 0000000..4397788 --- /dev/null +++ b/tests/testfile52-64.so.debug.bz2 diff --git a/tests/testfile53-32.bz2 b/tests/testfile53-32.bz2 Binary files differnew file mode 100755 index 0000000..7bf48d9 --- /dev/null +++ b/tests/testfile53-32.bz2 diff --git a/tests/testfile53-32.debug.bz2 b/tests/testfile53-32.debug.bz2 Binary files differnew file mode 100755 index 0000000..79ea566 --- /dev/null +++ b/tests/testfile53-32.debug.bz2 diff --git a/tests/testfile53-32.prelink.bz2 b/tests/testfile53-32.prelink.bz2 Binary files differnew file mode 100755 index 0000000..8e05abf --- /dev/null +++ b/tests/testfile53-32.prelink.bz2 diff --git a/tests/testfile53-64.bz2 b/tests/testfile53-64.bz2 Binary files differnew file mode 100755 index 0000000..235a763 --- /dev/null +++ b/tests/testfile53-64.bz2 diff --git a/tests/testfile53-64.debug.bz2 b/tests/testfile53-64.debug.bz2 Binary files differnew file mode 100755 index 0000000..675c6ea --- /dev/null +++ b/tests/testfile53-64.debug.bz2 diff --git a/tests/testfile53-64.prelink.bz2 b/tests/testfile53-64.prelink.bz2 Binary files differnew file mode 100755 index 0000000..853aba7 --- /dev/null +++ b/tests/testfile53-64.prelink.bz2 diff --git a/tests/testfile54-32.noshdrs.so.bz2 b/tests/testfile54-32.noshdrs.so.bz2 Binary files differnew file mode 100755 index 0000000..846bc91 --- /dev/null +++ b/tests/testfile54-32.noshdrs.so.bz2 diff --git a/tests/testfile54-32.prelink.so.bz2 b/tests/testfile54-32.prelink.so.bz2 Binary files differnew file mode 100755 index 0000000..85c8526 --- /dev/null +++ b/tests/testfile54-32.prelink.so.bz2 diff --git a/tests/testfile54-32.so.bz2 b/tests/testfile54-32.so.bz2 Binary files differnew file mode 100755 index 0000000..4bc4fa3 --- /dev/null +++ b/tests/testfile54-32.so.bz2 diff --git a/tests/testfile54-32.so.debug.bz2 b/tests/testfile54-32.so.debug.bz2 Binary files differnew file mode 100755 index 0000000..79dd614 --- /dev/null +++ b/tests/testfile54-32.so.debug.bz2 diff --git a/tests/testfile54-64.noshdrs.so.bz2 b/tests/testfile54-64.noshdrs.so.bz2 Binary files differnew file mode 100755 index 0000000..3da726a --- /dev/null +++ b/tests/testfile54-64.noshdrs.so.bz2 diff --git a/tests/testfile54-64.prelink.so.bz2 b/tests/testfile54-64.prelink.so.bz2 Binary files differnew file mode 100755 index 0000000..e296a1d --- /dev/null +++ b/tests/testfile54-64.prelink.so.bz2 diff --git a/tests/testfile54-64.so.bz2 b/tests/testfile54-64.so.bz2 Binary files differnew file mode 100755 index 0000000..6072bf1 --- /dev/null +++ b/tests/testfile54-64.so.bz2 diff --git a/tests/testfile54-64.so.debug.bz2 b/tests/testfile54-64.so.debug.bz2 Binary files differnew file mode 100755 index 0000000..6b45390 --- /dev/null +++ b/tests/testfile54-64.so.debug.bz2 diff --git a/tests/testfile55-32.bz2 b/tests/testfile55-32.bz2 Binary files differnew file mode 100755 index 0000000..d4cc986 --- /dev/null +++ b/tests/testfile55-32.bz2 diff --git a/tests/testfile55-32.debug.bz2 b/tests/testfile55-32.debug.bz2 Binary files differnew file mode 100755 index 0000000..c5aa3f6 --- /dev/null +++ b/tests/testfile55-32.debug.bz2 diff --git a/tests/testfile55-32.prelink.bz2 b/tests/testfile55-32.prelink.bz2 Binary files differnew file mode 100755 index 0000000..4fc171a --- /dev/null +++ b/tests/testfile55-32.prelink.bz2 diff --git a/tests/testfile55-64.bz2 b/tests/testfile55-64.bz2 Binary files differnew file mode 100755 index 0000000..27341fa --- /dev/null +++ b/tests/testfile55-64.bz2 diff --git a/tests/testfile55-64.debug.bz2 b/tests/testfile55-64.debug.bz2 Binary files differnew file mode 100755 index 0000000..d975c70 --- /dev/null +++ b/tests/testfile55-64.debug.bz2 diff --git a/tests/testfile55-64.prelink.bz2 b/tests/testfile55-64.prelink.bz2 Binary files differnew file mode 100755 index 0000000..a4338fe --- /dev/null +++ b/tests/testfile55-64.prelink.bz2 diff --git a/tests/testfile6.bz2 b/tests/testfile6.bz2 Binary files differnew file mode 100644 index 0000000..fd376b2 --- /dev/null +++ b/tests/testfile6.bz2 diff --git a/tests/testfile7.bz2 b/tests/testfile7.bz2 Binary files differnew file mode 100644 index 0000000..73452bb --- /dev/null +++ b/tests/testfile7.bz2 diff --git a/tests/testfile8.bz2 b/tests/testfile8.bz2 Binary files differnew file mode 100644 index 0000000..1ff4994 --- /dev/null +++ b/tests/testfile8.bz2 diff --git a/tests/testfile9.bz2 b/tests/testfile9.bz2 Binary files differnew file mode 100644 index 0000000..40454bc --- /dev/null +++ b/tests/testfile9.bz2 diff --git a/tests/update1.c b/tests/update1.c new file mode 100644 index 0000000..6c038c9 --- /dev/null +++ b/tests/update1.c @@ -0,0 +1,132 @@ +/* Test program for elf_update function. + Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <errno.h> +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +int +main (int argc, char *argv[] __attribute__ ((unused))) +{ + const char *fname = "xxx"; + int fd; + Elf *elf; + Elf32_Ehdr *ehdr; + int i; + + fd = open (fname, O_RDWR | O_CREAT | O_TRUNC, 0666); + if (fd == -1) + { + printf ("cannot open `%s': %s\n", fname, strerror (errno)); + exit (1); + } + + elf_version (EV_CURRENT); + + elf = elf_begin (fd, ELF_C_WRITE, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Create an ELF header. */ + ehdr = elf32_newehdr (elf); + if (ehdr == NULL) + { + printf ("cannot create ELF header: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + ehdr->e_ident[0] = 42; + ehdr->e_ident[4] = 1; + ehdr->e_ident[5] = 1; + ehdr->e_ident[6] = 2; + ehdr->e_ident[9] = 2; + ehdr->e_version = 1; + ehdr->e_ehsize = 1; + + /* Write out the file. */ + if (elf_update (elf, ELF_C_WRITE) < 0) + { + printf ("failure in elf_update: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Create an ELF header. */ + ehdr = elf32_newehdr (elf); + if (ehdr == NULL) + { + printf ("cannot create ELF header: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + if (elf_end (elf) != 0) + { + printf ("failure in elf_end: %s\n", elf_errmsg (-1)); + exit (1); + } + + return 0; +} diff --git a/tests/update2.c b/tests/update2.c new file mode 100644 index 0000000..330e731 --- /dev/null +++ b/tests/update2.c @@ -0,0 +1,155 @@ +/* Test program for elf_update function. + Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <errno.h> +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +int +main (int argc, char *argv[] __attribute__ ((unused))) +{ + const char *fname = "xxx"; + int fd; + Elf *elf; + Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; + int i; + + fd = open (fname, O_RDWR | O_CREAT | O_TRUNC, 0666); + if (fd == -1) + { + printf ("cannot open `%s': %s\n", fname, strerror (errno)); + exit (1); + } + + elf_version (EV_CURRENT); + + elf = elf_begin (fd, ELF_C_WRITE, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Create an ELF header. */ + ehdr = elf32_newehdr (elf); + if (ehdr == NULL) + { + printf ("cannot create ELF header: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + ehdr->e_ident[0] = 42; + ehdr->e_ident[4] = 1; + ehdr->e_ident[5] = 1; + ehdr->e_ident[6] = 2; + ehdr->e_type = ET_EXEC; + ehdr->e_version = 1; + ehdr->e_ehsize = 1; + elf_flagehdr (elf, ELF_C_SET, ELF_F_DIRTY); + + /* Create the program header. */ + phdr = elf32_newphdr (elf, 1); + if (phdr == NULL) + { + printf ("cannot create program header: %s\n", elf_errmsg (-1)); + exit (1); + } + + phdr[0].p_type = PT_PHDR; + elf_flagphdr (elf, ELF_C_SET, ELF_F_DIRTY); + + /* Let the library compute the internal structure information. */ + if (elf_update (elf, ELF_C_NULL) < 0) + { + printf ("failure in elf_update(NULL): %s\n", elf_errmsg (-1)); + exit (1); + } + + ehdr = elf32_getehdr (elf); + + phdr[0].p_offset = ehdr->e_phoff; + phdr[0].p_offset = ehdr->e_phoff; + phdr[0].p_vaddr = ehdr->e_phoff; + phdr[0].p_paddr = ehdr->e_phoff; + phdr[0].p_flags = PF_R | PF_X; + phdr[0].p_filesz = ehdr->e_phnum * elf32_fsize (ELF_T_PHDR, 1, EV_CURRENT); + phdr[0].p_memsz = ehdr->e_phnum * elf32_fsize (ELF_T_PHDR, 1, EV_CURRENT); + phdr[0].p_align = sizeof (Elf32_Word); + + /* Write out the file. */ + if (elf_update (elf, ELF_C_WRITE) < 0) + { + printf ("failure in elf_update(WRITE): %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + if (elf_end (elf) != 0) + { + printf ("failure in elf_end: %s\n", elf_errmsg (-1)); + exit (1); + } + + return 0; +} diff --git a/tests/update3.c b/tests/update3.c new file mode 100644 index 0000000..756d015 --- /dev/null +++ b/tests/update3.c @@ -0,0 +1,210 @@ +/* Test program for elf_update function. + Copyright (C) 2000, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <errno.h> +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include ELFUTILS_HEADER(ebl) + + +int +main (int argc, char *argv[] __attribute__ ((unused))) +{ + const char *fname = "xxx"; + int fd; + Elf *elf; + Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; + Elf_Scn *scn; + Elf32_Shdr *shdr; + Elf_Data *data; + struct Ebl_Strtab *shst; + struct Ebl_Strent *shstrtabse; + int i; + + fd = open (fname, O_RDWR | O_CREAT | O_TRUNC, 0666); + if (fd == -1) + { + printf ("cannot open `%s': %s\n", fname, strerror (errno)); + exit (1); + } + + elf_version (EV_CURRENT); + + elf_fill (0x42); + + elf = elf_begin (fd, ELF_C_WRITE, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Create an ELF header. */ + ehdr = elf32_newehdr (elf); + if (ehdr == NULL) + { + printf ("cannot create ELF header: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + ehdr->e_ident[0] = 42; + ehdr->e_ident[4] = 1; + ehdr->e_ident[5] = 1; + ehdr->e_ident[6] = 2; + ehdr->e_type = ET_EXEC; + ehdr->e_version = 1; + ehdr->e_ehsize = 1; + elf_flagehdr (elf, ELF_C_SET, ELF_F_DIRTY); + + /* Create the program header. */ + phdr = elf32_newphdr (elf, 1); + if (phdr == NULL) + { + printf ("cannot create program header: %s\n", elf_errmsg (-1)); + exit (1); + } + + phdr[0].p_type = PT_PHDR; + elf_flagphdr (elf, ELF_C_SET, ELF_F_DIRTY); + + shst = ebl_strtabinit (true); + + scn = elf_newscn (elf); + if (scn == NULL) + { + printf ("cannot create SHSTRTAB section: %s\n", elf_errmsg (-1)); + exit (1); + } + shdr = elf32_getshdr (scn); + if (shdr == NULL) + { + printf ("cannot get header for SHSTRTAB section: %s\n", elf_errmsg (-1)); + exit (1); + } + + shstrtabse = ebl_strtabadd (shst, ".shstrtab", 0); + + shdr->sh_type = SHT_STRTAB; + shdr->sh_flags = 0; + shdr->sh_addr = 0; + shdr->sh_link = SHN_UNDEF; + shdr->sh_info = SHN_UNDEF; + shdr->sh_addralign = 1; + shdr->sh_entsize = 0; + + /* We have to store the section index in the ELF header. */ + ehdr->e_shstrndx = elf_ndxscn (scn); + + data = elf_newdata (scn); + if (data == NULL) + { + printf ("cannot create data SHSTRTAB section: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* No more sections, finalize the section header string table. */ + ebl_strtabfinalize (shst, data); + + shdr->sh_name = ebl_strtaboffset (shstrtabse); + + /* Let the library compute the internal structure information. */ + if (elf_update (elf, ELF_C_NULL) < 0) + { + printf ("failure in elf_update(NULL): %s\n", elf_errmsg (-1)); + exit (1); + } + + ehdr = elf32_getehdr (elf); + + phdr[0].p_offset = ehdr->e_phoff; + phdr[0].p_offset = ehdr->e_phoff; + phdr[0].p_vaddr = ehdr->e_phoff; + phdr[0].p_paddr = ehdr->e_phoff; + phdr[0].p_flags = PF_R | PF_X; + phdr[0].p_filesz = ehdr->e_phnum * elf32_fsize (ELF_T_PHDR, 1, EV_CURRENT); + phdr[0].p_memsz = ehdr->e_phnum * elf32_fsize (ELF_T_PHDR, 1, EV_CURRENT); + phdr[0].p_align = sizeof (Elf32_Word); + + /* Write out the file. */ + if (elf_update (elf, ELF_C_WRITE) < 0) + { + printf ("failure in elf_update(WRITE): %s\n", elf_errmsg (-1)); + exit (1); + } + + /* We don't need the string table anymore. */ + ebl_strtabfree (shst); + + /* And the data allocated in the .shstrtab section. */ + free (data->d_buf); + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + if (elf_end (elf) != 0) + { + printf ("failure in elf_end: %s\n", elf_errmsg (-1)); + exit (1); + } + + return 0; +} diff --git a/tests/update4.c b/tests/update4.c new file mode 100644 index 0000000..e426378 --- /dev/null +++ b/tests/update4.c @@ -0,0 +1,365 @@ +/* Test program for elf_update function. + Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. + This file is part of Red Hat elfutils. + Written by Ulrich Drepper <drepper@redhat.com>, 2000. + + Red Hat elfutils 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; version 2 of the License. + + Red Hat 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 Red Hat elfutils; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. + + Red Hat elfutils is an included package of the Open Invention Network. + An included package of the Open Invention Network is a package for which + Open Invention Network licensees cross-license their patents. No patent + license is granted, either expressly or impliedly, by designation as an + included package. Should you wish to participate in the Open Invention + Network licensing program, please visit www.openinventionnetwork.com + <http://www.openinventionnetwork.com>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <errno.h> +#include <fcntl.h> +#include <libelf.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include ELFUTILS_HEADER(ebl) + + +int +main (int argc, char *argv[] __attribute__ ((unused))) +{ + const char fname[] = "xxx"; + int fd; + Elf *elf; + Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; + Elf_Scn *scn; + Elf32_Shdr *shdr; + Elf_Data *data; + struct Ebl_Strtab *shst; + struct Ebl_Strent *firstse; + struct Ebl_Strent *secondse; + struct Ebl_Strent *thirdse; + struct Ebl_Strent *fourthse; + struct Ebl_Strent *shstrtabse; + int i; + + fd = open (fname, O_RDWR | O_CREAT | O_TRUNC, 0666); + if (fd == -1) + { + printf ("cannot open `%s': %s\n", fname, strerror (errno)); + exit (1); + } + + elf_version (EV_CURRENT); + + elf_fill (0x42); + + elf = elf_begin (fd, ELF_C_WRITE, NULL); + if (elf == NULL) + { + printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Create an ELF header. */ + ehdr = elf32_newehdr (elf); + if (ehdr == NULL) + { + printf ("cannot create ELF header: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + ehdr->e_ident[0] = 42; + ehdr->e_ident[4] = 1; + ehdr->e_ident[5] = 1; + ehdr->e_ident[6] = 2; + ehdr->e_type = ET_EXEC; + ehdr->e_version = 1; + ehdr->e_ehsize = 1; + elf_flagehdr (elf, ELF_C_SET, ELF_F_DIRTY); + + /* Create the program header. */ + phdr = elf32_newphdr (elf, 1); + if (phdr == NULL) + { + printf ("cannot create program header: %s\n", elf_errmsg (-1)); + exit (1); + } + + phdr[0].p_type = PT_PHDR; + elf_flagphdr (elf, ELF_C_SET, ELF_F_DIRTY); + + shst = ebl_strtabinit (true); + + scn = elf_newscn (elf); + if (scn == NULL) + { + printf ("cannot create first section: %s\n", elf_errmsg (-1)); + exit (1); + } + shdr = elf32_getshdr (scn); + if (shdr == NULL) + { + printf ("cannot get header for first section: %s\n", elf_errmsg (-1)); + exit (1); + } + + firstse = ebl_strtabadd (shst, ".first", 0); + + shdr->sh_type = SHT_PROGBITS; + shdr->sh_flags = SHF_ALLOC | SHF_EXECINSTR; + shdr->sh_addr = 0; + shdr->sh_link = 0; + shdr->sh_info = 0; + shdr->sh_entsize = 1; + + data = elf_newdata (scn); + if (data == NULL) + { + printf ("cannot create data first section: %s\n", elf_errmsg (-1)); + exit (1); + } + + data->d_buf = "hello"; + data->d_type = ELF_T_BYTE; + data->d_version = EV_CURRENT; + data->d_size = 5; + data->d_align = 16; + + + scn = elf_newscn (elf); + if (scn == NULL) + { + printf ("cannot create second section: %s\n", elf_errmsg (-1)); + exit (1); + } + shdr = elf32_getshdr (scn); + if (shdr == NULL) + { + printf ("cannot get header for second section: %s\n", elf_errmsg (-1)); + exit (1); + } + + secondse = ebl_strtabadd (shst, ".second", 0); + + shdr->sh_type = SHT_PROGBITS; + shdr->sh_flags = SHF_ALLOC | SHF_WRITE; + shdr->sh_addr = 0; + shdr->sh_link = 0; + shdr->sh_info = 0; + shdr->sh_entsize = 1; + + data = elf_newdata (scn); + if (data == NULL) + { + printf ("cannot create data second section: %s\n", elf_errmsg (-1)); + exit (1); + } + + data->d_buf = "world"; + data->d_type = ELF_T_BYTE; + data->d_version = EV_CURRENT; + data->d_size = 5; + data->d_align = 16; + + + scn = elf_newscn (elf); + if (scn == NULL) + { + printf ("cannot create third section: %s\n", elf_errmsg (-1)); + exit (1); + } + shdr = elf32_getshdr (scn); + if (shdr == NULL) + { + printf ("cannot get header for third section: %s\n", elf_errmsg (-1)); + exit (1); + } + + thirdse = ebl_strtabadd (shst, ".third", 0); + + shdr->sh_type = SHT_PROGBITS; + shdr->sh_flags = SHF_ALLOC | SHF_EXECINSTR; + shdr->sh_addr = 0; + shdr->sh_link = 0; + shdr->sh_info = 0; + shdr->sh_entsize = 1; + + data = elf_newdata (scn); + if (data == NULL) + { + printf ("cannot create data third section: %s\n", elf_errmsg (-1)); + exit (1); + } + + data->d_buf = "!!!!!"; + data->d_type = ELF_T_BYTE; + data->d_version = EV_CURRENT; + data->d_size = 5; + data->d_align = 16; + + + scn = elf_newscn (elf); + if (scn == NULL) + { + printf ("cannot create fourth section: %s\n", elf_errmsg (-1)); + exit (1); + } + shdr = elf32_getshdr (scn); + if (shdr == NULL) + { + printf ("cannot get header for fourth section: %s\n", elf_errmsg (-1)); + exit (1); + } + + fourthse = ebl_strtabadd (shst, ".fourth", 0); + + shdr->sh_type = SHT_NOBITS; + shdr->sh_flags = SHF_ALLOC | SHF_EXECINSTR; + shdr->sh_addr = 0; + shdr->sh_link = 0; + shdr->sh_info = 0; + shdr->sh_entsize = 1; + shdr->sh_size = 100; + + data = elf_newdata (scn); + if (data == NULL) + { + printf ("cannot create data fourth section: %s\n", elf_errmsg (-1)); + exit (1); + } + + data->d_buf = NULL; + data->d_type = ELF_T_BYTE; + data->d_version = EV_CURRENT; + data->d_size = 100; + data->d_align = 16; + + + scn = elf_newscn (elf); + if (scn == NULL) + { + printf ("cannot create SHSTRTAB section: %s\n", elf_errmsg (-1)); + exit (1); + } + shdr = elf32_getshdr (scn); + if (shdr == NULL) + { + printf ("cannot get header for SHSTRTAB section: %s\n", elf_errmsg (-1)); + exit (1); + } + + shstrtabse = ebl_strtabadd (shst, ".shstrtab", 0); + + shdr->sh_type = SHT_STRTAB; + shdr->sh_flags = 0; + shdr->sh_addr = 0; + shdr->sh_link = SHN_UNDEF; + shdr->sh_info = SHN_UNDEF; + shdr->sh_entsize = 1; + + /* We have to store the section index in the ELF header. */ + ehdr->e_shstrndx = elf_ndxscn (scn); + + data = elf_newdata (scn); + if (data == NULL) + { + printf ("cannot create data SHSTRTAB section: %s\n", elf_errmsg (-1)); + exit (1); + } + + /* No more sections, finalize the section header string table. */ + ebl_strtabfinalize (shst, data); + + elf32_getshdr (elf_getscn (elf, 1))->sh_name = ebl_strtaboffset (firstse); + elf32_getshdr (elf_getscn (elf, 2))->sh_name = ebl_strtaboffset (secondse); + elf32_getshdr (elf_getscn (elf, 3))->sh_name = ebl_strtaboffset (thirdse); + elf32_getshdr (elf_getscn (elf, 4))->sh_name = ebl_strtaboffset (fourthse); + shdr->sh_name = ebl_strtaboffset (shstrtabse); + + /* Let the library compute the internal structure information. */ + if (elf_update (elf, ELF_C_NULL) < 0) + { + printf ("failure in elf_update(NULL): %s\n", elf_errmsg (-1)); + exit (1); + } + + ehdr = elf32_getehdr (elf); + + phdr[0].p_offset = ehdr->e_phoff; + phdr[0].p_offset = ehdr->e_phoff; + phdr[0].p_vaddr = ehdr->e_phoff; + phdr[0].p_paddr = ehdr->e_phoff; + phdr[0].p_flags = PF_R | PF_X; + phdr[0].p_filesz = ehdr->e_phnum * elf32_fsize (ELF_T_PHDR, 1, EV_CURRENT); + phdr[0].p_memsz = ehdr->e_phnum * elf32_fsize (ELF_T_PHDR, 1, EV_CURRENT); + phdr[0].p_align = sizeof (Elf32_Word); + + /* Write out the file. */ + if (elf_update (elf, ELF_C_WRITE) < 0) + { + printf ("failure in elf_update(WRITE): %s\n", elf_errmsg (-1)); + exit (1); + } + + /* We don't need the string table anymore. */ + ebl_strtabfree (shst); + + /* And the data allocated in the .shstrtab section. */ + free (data->d_buf); + + /* Print the ELF header values. */ + if (argc > 1) + { + for (i = 0; i < EI_NIDENT; ++i) + printf (" %02x", ehdr->e_ident[i]); + printf ("\ +\ntype = %hu\nmachine = %hu\nversion = %u\nentry = %u\nphoff = %u\n" + "shoff = %u\nflags = %u\nehsize = %hu\nphentsize = %hu\n" + "phnum = %hu\nshentsize = %hu\nshnum = %hu\nshstrndx = %hu\n", + ehdr->e_type, ehdr->e_machine, ehdr->e_version, ehdr->e_entry, + ehdr->e_phoff, ehdr->e_shoff, ehdr->e_flags, ehdr->e_ehsize, + ehdr->e_phentsize, ehdr->e_phnum, ehdr->e_shentsize, + ehdr->e_shnum, ehdr->e_shstrndx); + } + + if (elf_end (elf) != 0) + { + printf ("failure in elf_end: %s\n", elf_errmsg (-1)); + exit (1); + } + + unlink (fname); + + return 0; +} |