summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-12-19 23:20:25 +0100
committerMark Wielaard <[email protected]>2014-12-19 23:20:25 +0100
commit7555c33aca3bdc4b565ce647b87cf0693e61de9c (patch)
tree5586c46bb6dcb093c82f43e21ff29ca9d627cdf1 /tests
parentbe6ce84d68443fbe1bf3734c594031bee8e6ac77 (diff)
parent3943a3893619466d0927495485bca8a9b96a3dc9 (diff)
Merge 0.161 into mjw/RH-DTS
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog138
-rw-r--r--tests/Makefile.am22
-rw-r--r--tests/aggregate_size.c83
-rw-r--r--tests/backtrace-subr.sh13
-rw-r--r--tests/backtrace.c15
-rw-r--r--tests/deleted-lib.c27
-rw-r--r--tests/deleted.c50
-rw-r--r--tests/dwarf-getmacros.c120
-rw-r--r--tests/linkmap-cut-lib.so.bz2bin0 -> 2151 bytes
-rw-r--r--tests/linkmap-cut.bz2bin0 -> 2633 bytes
-rw-r--r--tests/linkmap-cut.core.bz2bin0 -> 21343 bytes
-rwxr-xr-xtests/run-addr2line-i-lex-test.sh71
-rwxr-xr-xtests/run-addr2line-i-test.sh4
-rwxr-xr-xtests/run-aggregate-size.sh105
-rwxr-xr-xtests/run-backtrace-dwarf.sh2
-rwxr-xr-xtests/run-deleted.sh48
-rwxr-xr-xtests/run-dwarf-getmacros.sh738
-rwxr-xr-xtests/run-linkmap-cut.sh32
-rwxr-xr-xtests/run-readelf-A.sh65
-rwxr-xr-xtests/run-unstrip-n.sh2
-rwxr-xr-xtests/testfile-lex-inlines.bz2bin0 -> 2599 bytes
-rwxr-xr-xtests/testfile-macros-0xff.bz2bin0 -> 2844 bytes
-rw-r--r--tests/testfile-macros-0xff.s153
-rw-r--r--tests/testfile-sizes1.o.bz2bin0 -> 1012 bytes
-rw-r--r--tests/testfile-sizes2.o.bz2bin0 -> 1283 bytes
-rw-r--r--tests/testfile-sizes3.o.bz2bin0 -> 1147 bytes
-rw-r--r--tests/testfileppc32attrs.o.bz2bin0 -> 228 bytes
-rw-r--r--tests/vdsosyms.c109
28 files changed, 1611 insertions, 186 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index bb0ad0d4..59048f65 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,141 @@
+2014-12-19 Mark Wielaard <[email protected]>
+
+ * run-deleted.sh: Don't check libfunc on ppc64.
+
+2014-12-19 Mark Wielaard <[email protected]>
+
+ * vdsosyms.c (vdso_seen): Removed.
+ (vdso_syms): New global.
+ (module_callback): Set and check vdso_syms.
+ (main): Return value depends on vdso_syms.
+
+2014-12-19 Mark Wielaard <[email protected]>
+
+ * backtrace-subr.sh (check_native_unsupported): Relax special ARM
+ grep a little.
+ * run-deleted.sh: Call check_native_unsupported.
+
+2014-12-18 Mark Wielaard <[email protected]>
+
+ * Makefile.am (EXTRA_DIST): Add testfile-macros-0xff.bz2.
+
+2014-12-12 Mark Wielaard <[email protected]>
+
+ * Makefile.am (deleted_lib_so_CFLAGS): Add
+ -fasynchronous-unwind-tables.
+
+2014-12-11 Josh Stone <[email protected]>
+
+ * run-addr2line-i-lex-test.sh: New test.
+ * testfile-lex-inlines.bz2: New testfile.
+ * Makefile.am (EXTRA_DIST): Add run-addr2line-i-lex-test.sh and
+ testfile-lex-inlines.bz2.
+ (TESTS): Add run-addr2line-i-lex-test.sh.
+
+2014-12-10 Josh Stone <[email protected]>
+
+ * run-addr2line-i-test.sh: Test 0x5f0 to make sure linkage_name is
+ preferred over the plain die name.
+
+2014-12-02 Petr Machata <[email protected]>
+
+ * dwarf-getmacros.c (mac): Skip over DW_MACINFO_undef,
+ DW_MACRO_GNU_undef_indirect opcodes. Add a default branch.
+ (main): Initialize off to DWARF_GETMACROS_START when an extra
+ command line argument is passed.
+ * testfile-macros-0xff.bz2: New test case.
+ * testfile-macros-0xff.s: New file (source for the above).
+ * run-dwarf-getmacros.sh: Add two tests.
+
+2014-11-27 Mark Wielaard <[email protected]>
+
+ * vdsosyms.c (main): Call dwfl_linux_proc_attach.
+
+2014-11-21 Mark Wielaard <[email protected]>
+
+ * run-readelf-A.sh: New test.
+ * testfileppc32attrs.o.bz2: New test file.
+ * Makefile.am (TESTS): Add run-readelf-A.sh.
+ (EXTRA_DIST): Add run-readelf-A.sh and testfileppc32attrs.o.bz2.
+
+2014-11-10 Mark Wielaard <[email protected]>
+
+ * vdsosyms.c: New test.
+ * Makefile.am (check_PROGRAMS): Add vdsosyms.
+ (TESTS): Likewise.
+ (vdsosyms_LDADD): New variable.
+
+2014-09-10 Petr Machata <[email protected]>
+
+ * dwarf-getmacros.c: Update to use the new macro iteration
+ interfaces.
+ * run-dwarf-getmacros.sh: Adjust, add a test that uses
+ testfile-macros.
+
+2014-10-06 Mark Wielaard <[email protected]>
+
+ * run-aggregate-size.sh: Add testfile-sizes3.o test case.
+ * testfile-sizes3.o.bz2: New test file.
+ * Makefile.am (EXTRA_DIST): Add testfile-sizes3.o.bz2.
+
+2014-10-02 Mark Wielaard <[email protected]>
+
+ * run-deleted.sh: Unset VALGRIND_CMD before running deleted.
+
+2014-10-02 Mark Wielaard <[email protected]>
+
+ * Makefile.am (check_PROGRAMS): Add aggregate_size.c.
+ (TESTS): Add run-aggregate-size.sh.
+ (EXTRA_DIST): Add run-aggregate-size.sh, testfile-sizes1.o.bz2
+ and testfile-sizes2.o.bz2.
+ (aggregate_size_LDADD): New variable.
+ * aggregate_size.c: New file.
+ * run-aggregate-size.sh: New test.
+ * testfile-sizes1.o.bz2: New test file.
+ * testfile-sizes2.o.bz2: Likewise.
+
+2014-09-26 Jan Kratochvil <[email protected]>
+
+ Support NT_FILE for locating files.
+ * Makefile.am (TESTS): Add run-linkmap-cut.sh.
+ (EXTRA_DIST): Add run-linkmap-cut.sh, linkmap-cut-lib.so.bz2,
+ linkmap-cut.bz2 and linkmap-cut.core.bz2 .
+ * linkmap-cut-lib.so.bz2: New file.
+ * linkmap-cut.bz2: New file.
+ * linkmap-cut.core.bz2: New file.
+ * run-linkmap-cut.sh: New file.
+ * run-unstrip-n.sh: Update its expected output.
+
+2014-08-28 Jan Kratochvil <[email protected]>
+
+ * Makefile.am (check_PROGRAMS): Add deleted and deleted-lib.so.
+ (TESTS, EXTRA_DIST): Add run-deleted.sh.
+ (deleted_LDADD, deleted_lib_so_LDFLAGS, deleted_lib_so_CFLAGS): New.
+ * deleted-lib.c: New file.
+ * deleted.c: New file.
+ * run-deleted.sh: New file.
+
+2014-06-15 Mark Wielaard <[email protected]>
+
+ * backtrace.c (frame_callback): Error on seeing more than 16 frames.
+
+2014-06-13 Mark Wielaard <[email protected]>
+
+ * backtrace.c (callback_verify): Accept "__libc_do_syscall" as first
+ frame symname.
+
+2014-06-13 Mark Wielaard <[email protected]>
+
+ * backtrace-subr.sh (check_native_unsupported): New function.
+ (check_native): Call it.
+ (check_native_core): Likewise.
+ * run-backtrace-dwarf.sh: Likewise.
+
+2014-06-11 Mark Wielaard <[email protected]>
+
+ * backtrace.c (main): Check that Dwfl was attached by calling
+ dwfl_pid and printing the error when it is not.
+
2014-05-18 Mark Wielaard <[email protected]>
* testfile-backtrace-demangle.cc (cxxfunc): Make non-static.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cd811a2c..ce25aa3a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -50,7 +50,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
test-elf_cntl_gelf_getshdr dwflsyms dwfllines \
dwfl-report-elf-align varlocs backtrace backtrace-child \
backtrace-data backtrace-dwarf debuglink debugaltlink \
- buildid
+ buildid deleted deleted-lib.so aggregate_size vdsosyms
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -101,7 +101,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-test-archive64.sh run-readelf-vmcoreinfo.sh \
run-readelf-mixed-corenote.sh run-dwfllines.sh \
run-dwfl-report-elf-align.sh run-addr2line-test.sh \
- run-addr2line-i-test.sh run-varlocs.sh run-funcretval.sh \
+ run-addr2line-i-test.sh run-addr2line-i-lex-test.sh \
+ run-varlocs.sh run-funcretval.sh \
run-backtrace-native.sh run-backtrace-data.sh run-backtrace-dwarf.sh \
run-backtrace-native-biarch.sh run-backtrace-native-core.sh \
run-backtrace-native-core-biarch.sh run-backtrace-core-x86_64.sh \
@@ -109,7 +110,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-backtrace-core-s390x.sh run-backtrace-core-s390.sh \
run-backtrace-core-aarch64.sh \
run-backtrace-demangle.sh run-stack-d-test.sh run-stack-i-test.sh \
- run-readelf-dwz-multi.sh run-allfcts-multi.sh
+ run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
+ run-linkmap-cut.sh run-aggregate-size.sh vdsosyms run-readelf-A.sh
if !BIARCH
export ELFUTILS_DISABLE_BIARCH = 1
@@ -187,6 +189,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.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 \
+ testfile-macros-0xff.bz2 \
run-readelf-macro.sh testfilemacro.bz2 \
run-readelf-loc.sh testfileloc.bz2 \
run-readelf-aranges.sh run-readelf-line.sh testfilefoobarbaz.bz2 \
@@ -242,6 +245,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfilenolines.bz2 test-core-lib.so.bz2 test-core.core.bz2 \
test-core.exec.bz2 run-addr2line-test.sh \
run-addr2line-i-test.sh testfile-inlines.bz2 \
+ run-addr2line-i-lex-test.sh testfile-lex-inlines.bz2 \
testfileppc32.bz2 testfileppc64.bz2 \
testfiles390.bz2 testfiles390x.bz2 \
testfilearm.bz2 testfileaarch64.bz2 \
@@ -271,7 +275,12 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile-backtrace-demangle.core.bz2 \
run-stack-d-test.sh run-stack-i-test.sh \
testfiledwarfinlines.bz2 testfiledwarfinlines.core.bz2 \
- run-readelf-zdebug.sh testfile-debug.bz2 testfile-zdebug.bz2
+ run-readelf-zdebug.sh testfile-debug.bz2 testfile-zdebug.bz2 \
+ run-deleted.sh run-linkmap-cut.sh linkmap-cut-lib.so.bz2 \
+ linkmap-cut.bz2 linkmap-cut.core.bz2 \
+ run-aggregate-size.sh testfile-sizes1.o.bz2 testfile-sizes2.o.bz2 \
+ testfile-sizes3.o.bz2 \
+ run-readelf-A.sh testfileppc32attrs.o.bz2
if USE_VALGRIND
valgrind_cmd='valgrind -q --error-exitcode=1 --run-libc-freeres=no'
@@ -408,6 +417,11 @@ backtrace_dwarf_LDADD = $(libdw) $(libelf)
debuglink_LDADD = $(libdw) $(libelf)
debugaltlink_LDADD = $(libdw) $(libelf)
buildid_LDADD = $(libdw) $(libelf)
+deleted_LDADD = ./deleted-lib.so
+deleted_lib_so_LDFLAGS = -shared -rdynamic
+deleted_lib_so_CFLAGS = -fPIC -fasynchronous-unwind-tables
+aggregate_size_LDADD = $(libdw) $(libelf)
+vdsosyms_LDADD = $(libdw) $(libelf)
if GCOV
check: check-am coverage
diff --git a/tests/aggregate_size.c b/tests/aggregate_size.c
new file mode 100644
index 00000000..930eafa7
--- /dev/null
+++ b/tests/aggregate_size.c
@@ -0,0 +1,83 @@
+/* Test program for dwarf_aggregate_size. Prints size of top-level vars.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <argp.h>
+#include <inttypes.h>
+#include <fcntl.h>
+#include ELFUTILS_HEADER(dw)
+#include ELFUTILS_HEADER(dwfl)
+#include <stdio.h>
+#include <unistd.h>
+#include <dwarf.h>
+
+void
+print_var_type_size (Dwarf_Die *var)
+{
+ Dwarf_Attribute attr_mem;
+ Dwarf_Die type_mem;
+ Dwarf_Die *type;
+ const char *name = dwarf_diename (var);
+
+ type = dwarf_formref_die (dwarf_attr (var, DW_AT_type, &attr_mem),
+ &type_mem);
+ if (type != NULL)
+ {
+ Dwarf_Word size;
+ if (dwarf_aggregate_size (type, &size) < 0)
+ printf ("%s no size: %s\n", name, dwarf_errmsg (-1));
+ else
+ printf ("%s size %" PRIu64 "\n", name, size);
+ }
+ else
+ printf ("%s has no type.\n", name);
+}
+
+int
+main (int argc, char *argv[])
+{
+
+ int remaining;
+ Dwfl *dwfl;
+ (void) argp_parse (dwfl_standard_argp (), argc, argv, 0, &remaining,
+ &dwfl);
+ assert (dwfl != NULL);
+
+ Dwarf_Die *cu = NULL;
+ Dwarf_Addr dwbias;
+ while ((cu = dwfl_nextcu (dwfl, cu, &dwbias)) != NULL)
+ {
+ Dwarf_Die die_mem;
+ Dwarf_Die *die = &die_mem;
+ dwarf_child (cu, &die_mem);
+
+ while (1)
+ {
+ if (dwarf_tag (die) == DW_TAG_variable)
+ print_var_type_size (die);
+
+ if (dwarf_siblingof (die, &die_mem) != 0)
+ break;
+ }
+ }
+
+ dwfl_end (dwfl);
+}
diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh
index 875e0b68..f04721cf 100644
--- a/tests/backtrace-subr.sh
+++ b/tests/backtrace-subr.sh
@@ -74,13 +74,20 @@ check_unsupported()
echo >&2 $testname: arch not supported
exit 77
fi
+}
+
+check_native_unsupported()
+{
+ err=$1
+ testname=$2
+ check_unsupported $err $testname
# ARM is special. It is supported, but it doesn't use .eh_frame by default
# making the native tests fail unless debuginfo (for glibc) is installed
# and we can fall back on .debug_frame for the CFI.
case "`uname -m`" in
arm* )
- if grep 'dwfl_thread_getframes: No DWARF information found' $1; then
+ if egrep 'dwfl_thread_getframes(.*)No DWARF information found' $err; then
echo >&2 $testname: arm needs debuginfo installed for all libraries
exit 77
fi
@@ -109,7 +116,7 @@ check_native()
tempfiles $child.{bt,err}
(set +ex; testrun ${abs_builddir}/backtrace --backtrace-exec=${abs_builddir}/$child 1>$child.bt 2>$child.err; true)
cat $child.{bt,err}
- check_unsupported $child.err $child
+ check_native_unsupported $child.err $child
check_all $child.{bt,err} $child
}
@@ -140,6 +147,6 @@ check_native_core()
tempfiles $core{,.{bt,err}}
(set +ex; testrun ${abs_builddir}/backtrace -e ${abs_builddir}/$child --core=$core 1>$core.bt 2>$core.err; true)
cat $core.{bt,err}
- check_unsupported $core.err $child-$core
+ check_native_unsupported $core.err $child-$core
check_all $core.{bt,err} $child-$core
}
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 1a4709b9..331ba0f2 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -1,5 +1,5 @@
/* Test program for unwinding of frames.
- Copyright (C) 2013 Red Hat, Inc.
+ Copyright (C) 2013, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -98,7 +98,8 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
{
case 0:
if (! reduce_frameno && symname
- && strcmp (symname, "__kernel_vsyscall") == 0)
+ && (strcmp (symname, "__kernel_vsyscall") == 0
+ || strcmp (symname, "__libc_do_syscall") == 0))
reduce_frameno = true;
else
assert (symname && strcmp (symname, "raise") == 0);
@@ -147,6 +148,13 @@ frame_callback (Dwfl_Frame *state, void *frame_arg)
int *framenop = frame_arg;
Dwarf_Addr pc;
bool isactivation;
+
+ if (*framenop > 16)
+ {
+ error (0, 0, "Too many frames: %d\n", *framenop);
+ return DWARF_CB_ABORT;
+ }
+
if (! dwfl_frame_pc (state, &pc, &isactivation))
{
error (0, 0, "%s", dwfl_errmsg (-1));
@@ -459,6 +467,9 @@ main (int argc __attribute__ ((unused)), char **argv)
};
(void) argp_parse (&argp, argc, argv, 0, NULL, &dwfl);
assert (dwfl != NULL);
+ /* We want to make sure the dwfl was properly attached. */
+ if (dwfl_pid (dwfl) < 0)
+ error (2, 0, "dwfl_pid: %s", dwfl_errmsg (-1));
dump (dwfl);
dwfl_end (dwfl);
return 0;
diff --git a/tests/deleted-lib.c b/tests/deleted-lib.c
new file mode 100644
index 00000000..1ff411b7
--- /dev/null
+++ b/tests/deleted-lib.c
@@ -0,0 +1,27 @@
+/* Test program for opening already deleted running binaries.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+#include <unistd.h>
+
+void
+libfunc (void)
+{
+ sleep (60000);
+ /* Avoid tail call optimization for the sleep call. */
+ asm volatile ("");
+}
diff --git a/tests/deleted.c b/tests/deleted.c
new file mode 100644
index 00000000..32a310b6
--- /dev/null
+++ b/tests/deleted.c
@@ -0,0 +1,50 @@
+/* Test program for opening already deleted running binaries.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+#include <stdio.h>
+#include <error.h>
+#include <errno.h>
+
+extern void libfunc (void);
+
+int
+main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
+{
+ /* Set locale. */
+ (void) setlocale (LC_ALL, "");
+
+ pid_t pid = fork ();
+ assert (pid != -1);
+ if (pid == 0)
+ {
+ int err = close (0);
+ assert (!err);
+ err = close (1);
+ assert (!err);
+ err = close (2);
+ assert (!err);
+ libfunc ();
+ abort ();
+ }
+ printf ("%d\n", pid);
+ return EXIT_SUCCESS;
+}
diff --git a/tests/dwarf-getmacros.c b/tests/dwarf-getmacros.c
index 7972edc9..92e093ca 100644
--- a/tests/dwarf-getmacros.c
+++ b/tests/dwarf-getmacros.c
@@ -1,5 +1,5 @@
-/* Test program for dwfl_module_return_value_location.
- Copyright (C) 2009 Red Hat, Inc.
+/* Test program for dwarf_getmacros and related
+ Copyright (C) 2009, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -24,33 +24,121 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
+#include <assert.h>
+#include <inttypes.h>
+
+static void include (Dwarf *dbg, Dwarf_Off macoff, ptrdiff_t token);
+
+static int
+mac (Dwarf_Macro *macro, void *dbg)
+{
+ static int level = 0;
+
+ unsigned int opcode;
+ dwarf_macro_opcode (macro, &opcode);
+ switch (opcode)
+ {
+ case DW_MACRO_GNU_transparent_include:
+ {
+ Dwarf_Attribute at;
+ int r = dwarf_macro_param (macro, 0, &at);
+ assert (r == 0);
+
+ Dwarf_Word w;
+ r = dwarf_formudata (&at, &w);
+ assert (r == 0);
+
+ printf ("%*sinclude %#" PRIx64 "\n", level, "", w);
+ ++level;
+ include (dbg, w, DWARF_GETMACROS_START);
+ --level;
+ printf ("%*s/include\n", level, "");
+ break;
+ }
+
+ case DW_MACRO_GNU_start_file:
+ {
+ Dwarf_Files *files;
+ size_t nfiles;
+ if (dwarf_macro_getsrcfiles (dbg, macro, &files, &nfiles) < 0)
+ printf ("dwarf_macro_getsrcfiles: %s\n",
+ dwarf_errmsg (dwarf_errno ()));
+
+ Dwarf_Word w = 0;
+ dwarf_macro_param2 (macro, &w, NULL);
+
+ const char *name = dwarf_filesrc (files, (size_t) w, NULL, NULL);
+ printf ("%*sfile %s\n", level, "", name);
+ ++level;
+ break;
+ }
+
+ case DW_MACRO_GNU_end_file:
+ {
+ --level;
+ printf ("%*s/file\n", level, "");
+ break;
+ }
+
+ case DW_MACINFO_define:
+ case DW_MACRO_GNU_define_indirect:
+ {
+ const char *value;
+ dwarf_macro_param2 (macro, NULL, &value);
+ printf ("%*s%s\n", level, "", value);
+ break;
+ }
+
+ case DW_MACINFO_undef:
+ case DW_MACRO_GNU_undef_indirect:
+ break;
+
+ default:
+ {
+ size_t paramcnt;
+ dwarf_macro_getparamcnt (macro, &paramcnt);
+ printf ("%*sopcode %u with %zd arguments\n",
+ level, "", opcode, paramcnt);
+ break;
+ }
+ }
+
+ return DWARF_CB_ABORT;
+}
+
+static void
+include (Dwarf *dbg, Dwarf_Off macoff, ptrdiff_t token)
+{
+ while ((token = dwarf_getmacros_off (dbg, macoff, mac, dbg, token)) != 0)
+ if (token == -1)
+ {
+ puts (dwarf_errmsg (dwarf_errno ()));
+ break;
+ }
+}
int
-main (int argc __attribute__ ((unused)), char *argv[])
+main (int argc, char *argv[])
{
+ assert (argc >= 3);
const char *name = argv[1];
ptrdiff_t cuoff = strtol (argv[2], NULL, 0);
+ bool new_style = argc > 3;
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)
+
+ for (ptrdiff_t off = new_style ? DWARF_GETMACROS_START : 0;
+ (off = dwarf_getmacros (cudie, mac, dbg, off)); )
+ if (off == -1)
{
- const char *value;
- dwarf_macro_param2 (macro, NULL, &value);
- puts (value);
+ puts (dwarf_errmsg (dwarf_errno ()));
+ break;
}
- return DWARF_CB_ABORT;
- }
- ptrdiff_t off = 0;
- while ((off = dwarf_getmacros (cudie, mac, NULL, off)) > 0)
- ;
+ dwarf_end (dbg);
return 0;
}
diff --git a/tests/linkmap-cut-lib.so.bz2 b/tests/linkmap-cut-lib.so.bz2
new file mode 100644
index 00000000..a1bda5c0
--- /dev/null
+++ b/tests/linkmap-cut-lib.so.bz2
Binary files differ
diff --git a/tests/linkmap-cut.bz2 b/tests/linkmap-cut.bz2
new file mode 100644
index 00000000..f2ccd7ca
--- /dev/null
+++ b/tests/linkmap-cut.bz2
Binary files differ
diff --git a/tests/linkmap-cut.core.bz2 b/tests/linkmap-cut.core.bz2
new file mode 100644
index 00000000..b55b2f21
--- /dev/null
+++ b/tests/linkmap-cut.core.bz2
Binary files differ
diff --git a/tests/run-addr2line-i-lex-test.sh b/tests/run-addr2line-i-lex-test.sh
new file mode 100755
index 00000000..c391fd99
--- /dev/null
+++ b/tests/run-addr2line-i-lex-test.sh
@@ -0,0 +1,71 @@
+#! /bin/sh
+# Copyright (C) 2014 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# // g++ x.cpp -g -fPIC -olibx.so -shared -O3 -fvisibility=hidden
+#
+# void foobar()
+# {
+# __asm__ ( "nop" ::: );
+# }
+#
+# void foo()
+# {
+# {
+# void (*bar) () = foobar;
+# bar();
+# }
+# }
+
+testfiles testfile-lex-inlines
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000680 <<\EOF
+/tmp/x.cpp:5
+EOF
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000681 <<\EOF
+/tmp/x.cpp:5
+EOF
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000690 <<\EOF
+/tmp/x.cpp:5
+/tmp/x.cpp:12
+EOF
+
+testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-lex-inlines 0x0000000000000691 <<\EOF
+/tmp/x.cpp:5
+/tmp/x.cpp:12
+EOF
+
+# All together now (plus function names).
+testrun_compare ${abs_top_builddir}/src/addr2line -f -i -e testfile-lex-inlines 0x0000000000000680 0x0000000000000681 0x0000000000000690 0x0000000000000691 <<\EOF
+_Z6foobarv
+/tmp/x.cpp:5
+_Z6foobarv
+/tmp/x.cpp:5
+foobar inlined at /tmp/x.cpp:12 in _Z3foov
+/tmp/x.cpp:5
+_Z3foov
+/tmp/x.cpp:12
+foobar inlined at /tmp/x.cpp:12 in _Z3foov
+/tmp/x.cpp:5
+_Z3foov
+/tmp/x.cpp:12
+EOF
+
+exit 0
diff --git a/tests/run-addr2line-i-test.sh b/tests/run-addr2line-i-test.sh
index e98adda3..183916c7 100755
--- a/tests/run-addr2line-i-test.sh
+++ b/tests/run-addr2line-i-test.sh
@@ -103,7 +103,7 @@ testrun_compare ${abs_top_builddir}/src/addr2line -i -e testfile-inlines 0x00000
EOF
# All together now (plus function names).
-testrun_compare ${abs_top_builddir}/src/addr2line -f -i -e testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f1 0x00000000000005f2 <<\EOF
+testrun_compare ${abs_top_builddir}/src/addr2line -f -i -e testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f0 0x00000000000005f1 0x00000000000005f2 <<\EOF
foobar
/tmp/x.cpp:5
foobar
@@ -132,6 +132,8 @@ baz
/tmp/x.cpp:20
_Z3foov
/tmp/x.cpp:26
+_Z2fuv
+/tmp/x.cpp:31
fubar inlined at /tmp/x.cpp:32 in _Z2fuv
/tmp/x.cpp:10
_Z2fuv
diff --git a/tests/run-aggregate-size.sh b/tests/run-aggregate-size.sh
new file mode 100755
index 00000000..42b0742b
--- /dev/null
+++ b/tests/run-aggregate-size.sh
@@ -0,0 +1,105 @@
+#! /bin/sh
+# Copyright (C) 2014 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# char c;
+# int i;
+# long l;
+#
+# void *v;
+#
+# struct s
+# {
+# char *a;
+# int i;
+# } s;
+#
+# char ca[16];
+# int ia[32];
+# void *va[64];
+# struct s sa[8];
+
+# On x86_64 (LP64):
+# gcc -g -c -o testfile-sizes1.o sizes.c
+# clang -g -c -o testfile-sizes2.o sizes.c
+
+# const char c;
+# volatile int i;
+# const volatile long l;
+#
+# void * restrict v;
+#
+# struct s
+# {
+# const char *a;
+# volatile int i;
+# } s;
+#
+# const char ca[16];
+# volatile int ia[32];
+# const volatile void * const volatile restrict va[64];
+# struct s sa[8];
+#
+# typedef const int foo;
+# typedef volatile foo bar;
+# foo f;
+# bar b;
+#
+# gcc -std=c99 -g -c -o testfile-sizes3.o sizes.c
+
+testfiles testfile-sizes1.o testfile-sizes2.o testfile-sizes3.o
+
+testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes1.o <<\EOF
+c size 1
+i size 4
+l size 8
+v size 8
+s size 16
+ca size 16
+ia size 128
+va size 512
+sa size 128
+EOF
+
+testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes2.o <<\EOF
+c size 1
+i size 4
+l size 8
+v size 8
+s size 16
+ca size 16
+ia size 128
+va size 512
+sa size 128
+EOF
+
+testrun_compare ${abs_builddir}/aggregate_size -e testfile-sizes3.o <<\EOF
+c size 1
+i size 4
+l size 8
+v size 8
+s size 16
+ca size 16
+ia size 128
+va size 512
+sa size 128
+f size 4
+b size 4
+EOF
+
+exit 0
diff --git a/tests/run-backtrace-dwarf.sh b/tests/run-backtrace-dwarf.sh
index a133b32d..8834048a 100755
--- a/tests/run-backtrace-dwarf.sh
+++ b/tests/run-backtrace-dwarf.sh
@@ -26,5 +26,5 @@ unset VALGRIND_CMD
tempfiles dwarf.{bt,err}
(set +ex; testrun ${abs_builddir}/backtrace-dwarf 1>dwarf.bt 2>dwarf.err; true)
cat dwarf.{bt,err}
-check_unsupported dwarf.err dwarf
+check_native_unsupported dwarf.err dwarf
check_main dwarf.bt dwarf
diff --git a/tests/run-deleted.sh b/tests/run-deleted.sh
new file mode 100755
index 00000000..2b5a9a84
--- /dev/null
+++ b/tests/run-deleted.sh
@@ -0,0 +1,48 @@
+#! /bin/bash
+# Copyright (C) 2014 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/backtrace-subr.sh
+
+tempfiles deleted deleted-lib.so
+cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so .
+
+# We don't want to run the deleted process under valgrind then
+# stack will see the valgrind process backtrace.
+OLD_VALGRIND_CMD="$VALGRIND_CMD"
+unset VALGRIND_CMD
+
+pid=$(testrun ${abs_builddir}/deleted)
+sleep 1
+rm -f deleted deleted-lib.so
+tempfiles bt bt.err
+
+set VALGRIND_CMD="$OLD_VALGRIND_CMD"
+# It may have non-zero exit code with:
+# .../elfutils/src/stack: dwfl_thread_getframes tid 26376 at 0x4006c8 in .../elfutils/tests/deleted: no matching address range
+testrun ${abs_top_builddir}/src/stack -p $pid 1>bt 2>bt.err || true
+cat bt bt.err
+kill -9 $pid
+wait
+check_native_unsupported bt.err deleted
+# For PPC64 we need access to the OPD table which we get through the shdrs
+# (see backends/ppc64_init.c) but for the deleted-lib we only have phdrs.
+# So we don't have the name of the function. But since we should find
+# the EH_FRAME through phdrs just fine, we can unwind into main.
+if test "`uname -m`" != "ppc64"; then
+ grep -qw libfunc bt
+fi
+grep -qw main bt
diff --git a/tests/run-dwarf-getmacros.sh b/tests/run-dwarf-getmacros.sh
index ddb58e83..0a488fa3 100755
--- a/tests/run-dwarf-getmacros.sh
+++ b/tests/run-dwarf-getmacros.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2009 Red Hat, Inc.
+# Copyright (C) 2009, 2014 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -20,103 +20,294 @@
testfiles testfile51
testrun_compare ${abs_builddir}/dwarf-getmacros testfile51 0xb <<\EOF
+file /home/petr/proj/elfutils/pending/elfutils/tests/decom/x.c
+ __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
+/file
+EOF
+
+testrun_compare ${abs_builddir}/dwarf-getmacros testfile51 0x84 <<\EOF
+file /home/petr/proj/elfutils/pending/elfutils/tests/decom/y.c
+ __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
+/file
+EOF
+
+testfiles testfile-macros
+
+testrun_compare ${abs_builddir}/dwarf-getmacros testfile-macros 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
+__GNUC_MINOR__ 7
+__GNUC_PATCHLEVEL__ 0
+__VERSION__ "4.7.0 20120507 (Red Hat 4.7.0-5)"
+__GNUC_RH_RELEASE__ 5
+__ATOMIC_RELAXED 0
+__ATOMIC_SEQ_CST 5
+__ATOMIC_ACQUIRE 2
+__ATOMIC_RELEASE 3
+__ATOMIC_ACQ_REL 4
+__ATOMIC_CONSUME 1
+__FINITE_MATH_ONLY__ 0
_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
@@ -125,46 +316,49 @@ __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
+__CHAR_BIT__ 8
+__BIGGEST_ALIGNMENT__ 16
+__ORDER_LITTLE_ENDIAN__ 1234
+__ORDER_BIG_ENDIAN__ 4321
+__ORDER_PDP_ENDIAN__ 3412
+__BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+__FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
__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 ${abs_builddir}/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
+__CHAR16_TYPE__ short unsigned int
+__CHAR32_TYPE__ unsigned int
+__SIG_ATOMIC_TYPE__ int
+__INT8_TYPE__ signed char
+__INT16_TYPE__ short int
+__INT32_TYPE__ int
+__INT64_TYPE__ long int
+__UINT8_TYPE__ unsigned char
+__UINT16_TYPE__ short unsigned int
+__UINT32_TYPE__ unsigned int
+__UINT64_TYPE__ long unsigned int
+__INT_LEAST8_TYPE__ signed char
+__INT_LEAST16_TYPE__ short int
+__INT_LEAST32_TYPE__ int
+__INT_LEAST64_TYPE__ long int
+__UINT_LEAST8_TYPE__ unsigned char
+__UINT_LEAST16_TYPE__ short unsigned int
+__UINT_LEAST32_TYPE__ unsigned int
+__UINT_LEAST64_TYPE__ long unsigned int
+__INT_FAST8_TYPE__ signed char
+__INT_FAST16_TYPE__ long int
+__INT_FAST32_TYPE__ long int
+__INT_FAST64_TYPE__ long int
+__UINT_FAST8_TYPE__ unsigned char
+__UINT_FAST16_TYPE__ long unsigned int
+__UINT_FAST32_TYPE__ long unsigned int
+__UINT_FAST64_TYPE__ long unsigned int
+__INTPTR_TYPE__ long int
+__UINTPTR_TYPE__ long unsigned int
__GXX_ABI_VERSION 1002
__SCHAR_MAX__ 127
__SHRT_MAX__ 32767
@@ -172,8 +366,51 @@ __INT_MAX__ 2147483647
__LONG_MAX__ 9223372036854775807L
__LONG_LONG_MAX__ 9223372036854775807LL
__WCHAR_MAX__ 2147483647
-__CHAR_BIT__ 8
+__WCHAR_MIN__ (-__WCHAR_MAX__ - 1)
+__WINT_MAX__ 4294967295U
+__WINT_MIN__ 0U
+__PTRDIFF_MAX__ 9223372036854775807L
+__SIZE_MAX__ 18446744073709551615UL
__INTMAX_MAX__ 9223372036854775807L
+__INTMAX_C(c) c ## L
+__UINTMAX_MAX__ 18446744073709551615UL
+__UINTMAX_C(c) c ## UL
+__SIG_ATOMIC_MAX__ 2147483647
+__SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
+__INT8_MAX__ 127
+__INT16_MAX__ 32767
+__INT32_MAX__ 2147483647
+__INT64_MAX__ 9223372036854775807L
+__UINT8_MAX__ 255
+__UINT16_MAX__ 65535
+__UINT32_MAX__ 4294967295U
+__UINT64_MAX__ 18446744073709551615UL
+__INT_LEAST8_MAX__ 127
+__INT8_C(c) c
+__INT_LEAST16_MAX__ 32767
+__INT16_C(c) c
+__INT_LEAST32_MAX__ 2147483647
+__INT32_C(c) c
+__INT_LEAST64_MAX__ 9223372036854775807L
+__INT64_C(c) c ## L
+__UINT_LEAST8_MAX__ 255
+__UINT8_C(c) c
+__UINT_LEAST16_MAX__ 65535
+__UINT16_C(c) c
+__UINT_LEAST32_MAX__ 4294967295U
+__UINT32_C(c) c ## U
+__UINT_LEAST64_MAX__ 18446744073709551615UL
+__UINT64_C(c) c ## UL
+__INT_FAST8_MAX__ 127
+__INT_FAST16_MAX__ 9223372036854775807L
+__INT_FAST32_MAX__ 9223372036854775807L
+__INT_FAST64_MAX__ 9223372036854775807L
+__UINT_FAST8_MAX__ 255
+__UINT_FAST16_MAX__ 18446744073709551615UL
+__UINT_FAST32_MAX__ 18446744073709551615UL
+__UINT_FAST64_MAX__ 18446744073709551615UL
+__INTPTR_MAX__ 9223372036854775807L
+__UINTPTR_MAX__ 18446744073709551615UL
__FLT_EVAL_METHOD__ 0
__DEC_EVAL_METHOD__ 2
__FLT_RADIX__ 2
@@ -183,10 +420,11 @@ __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_DECIMAL_DIG__ 9
+__FLT_MAX__ 3.40282346638528859812e+38F
+__FLT_MIN__ 1.17549435082228750797e-38F
+__FLT_EPSILON__ 1.19209289550781250000e-7F
+__FLT_DENORM_MIN__ 1.40129846432481707092e-45F
__FLT_HAS_DENORM__ 1
__FLT_HAS_INFINITY__ 1
__FLT_HAS_QUIET_NAN__ 1
@@ -196,10 +434,11 @@ __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_DECIMAL_DIG__ 17
+__DBL_MAX__ ((double)1.79769313486231570815e+308L)
+__DBL_MIN__ ((double)2.22507385850720138309e-308L)
+__DBL_EPSILON__ ((double)2.22044604925031308085e-16L)
+__DBL_DENORM_MIN__ ((double)4.94065645841246544177e-324L)
__DBL_HAS_DENORM__ 1
__DBL_HAS_INFINITY__ 1
__DBL_HAS_QUIET_NAN__ 1
@@ -218,50 +457,51 @@ __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_EXP__ (-94)
+__DEC32_MAX_EXP__ 97
__DEC32_MIN__ 1E-95DF
__DEC32_MAX__ 9.999999E96DF
__DEC32_EPSILON__ 1E-6DF
-__DEC32_DEN__ 0.000001E-95DF
+__DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
__DEC64_MANT_DIG__ 16
-__DEC64_MIN_EXP__ (-383)
-__DEC64_MAX_EXP__ 384
+__DEC64_MIN_EXP__ (-382)
+__DEC64_MAX_EXP__ 385
__DEC64_MIN__ 1E-383DD
__DEC64_MAX__ 9.999999999999999E384DD
__DEC64_EPSILON__ 1E-15DD
-__DEC64_DEN__ 0.000000000000001E-383DD
+__DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
__DEC128_MANT_DIG__ 34
-__DEC128_MIN_EXP__ (-6143)
-__DEC128_MAX_EXP__ 6144
+__DEC128_MIN_EXP__ (-6142)
+__DEC128_MAX_EXP__ 6145
__DEC128_MIN__ 1E-6143DL
__DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
__DEC128_EPSILON__ 1E-33DL
-__DEC128_DEN__ 0.000000000000000000000000000000001E-6143DL
+__DEC128_SUBNORMAL_MIN__ 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
+__GCC_ATOMIC_BOOL_LOCK_FREE 2
+__GCC_ATOMIC_CHAR_LOCK_FREE 2
+__GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
+__GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
+__GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
+__GCC_ATOMIC_SHORT_LOCK_FREE 2
+__GCC_ATOMIC_INT_LOCK_FREE 2
+__GCC_ATOMIC_LONG_LOCK_FREE 2
+__GCC_ATOMIC_LLONG_LOCK_FREE 2
+__GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
+__GCC_ATOMIC_POINTER_LOCK_FREE 2
+__GCC_HAVE_DWARF2_CFI_ASM 1
+__PRAGMA_REDEFINE_EXTNAME 1
+__SIZEOF_INT128__ 16
__SIZEOF_WCHAR_T__ 4
__SIZEOF_WINT_T__ 4
__SIZEOF_PTRDIFF_T__ 8
-__SIZEOF_POINTER__ 8
__amd64 1
__amd64__ 1
__x86_64 1
@@ -282,7 +522,189 @@ __unix__ 1
unix 1
__ELF__ 1
__DECIMAL_BID_FORMAT__ 1
-macro2 ble
+file /home/mark/src/tests/macro.c
+ file /usr/include/string.h
+ _STRING_H 1
+ file /usr/include/features.h
+ include 0x5d8
+ _FEATURES_H 1
+ __KERNEL_STRICT_NAMES
+ __USE_ANSI 1
+ __GNUC_PREREQ(maj,min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+ _BSD_SOURCE 1
+ _SVID_SOURCE 1
+ _POSIX_SOURCE 1
+ _POSIX_C_SOURCE 200809L
+ __USE_POSIX_IMPLICITLY 1
+ __USE_POSIX 1
+ __USE_POSIX2 1
+ __USE_POSIX199309 1
+ __USE_POSIX199506 1
+ __USE_XOPEN2K 1
+ __USE_ISOC95 1
+ __USE_ISOC99 1
+ __USE_XOPEN2K8 1
+ _ATFILE_SOURCE 1
+ __USE_MISC 1
+ __USE_BSD 1
+ __USE_SVID 1
+ __USE_ATFILE 1
+ __USE_FORTIFY_LEVEL 0
+ /include
+ file /usr/include/stdc-predef.h
+ include 0x733
+ _STDC_PREDEF_H 1
+ __STDC_IEC_559__ 1
+ __STDC_IEC_559_COMPLEX__ 1
+ __STDC_ISO_10646__ 201103L
+ __STDC_NO_THREADS__ 1
+ /include
+ /file
+ include 0x755
+ __GNU_LIBRARY__ 6
+ __GLIBC__ 2
+ __GLIBC_MINOR__ 15
+ __GLIBC_PREREQ(maj,min) ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
+ __GLIBC_HAVE_LONG_LONG 1
+ /include
+ file /usr/include/sys/cdefs.h
+ include 0x783
+ _SYS_CDEFS_H 1
+ __LEAF , __leaf__
+ __LEAF_ATTR __attribute__ ((__leaf__))
+ __THROW __attribute__ ((__nothrow__ __LEAF))
+ __THROWNL __attribute__ ((__nothrow__))
+ __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
+ __P(args) args
+ __PMT(args) args
+ __CONCAT(x,y) x ## y
+ __STRING(x) #x
+ __ptr_t void *
+ __long_double_t long double
+ __BEGIN_DECLS
+ __END_DECLS
+ __BEGIN_NAMESPACE_STD
+ __END_NAMESPACE_STD
+ __USING_NAMESPACE_STD(name)
+ __BEGIN_NAMESPACE_C99
+ __END_NAMESPACE_C99
+ __USING_NAMESPACE_C99(name)
+ __bounded
+ __unbounded
+ __ptrvalue
+ __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
+ __bos0(ptr) __builtin_object_size (ptr, 0)
+ __fortify_function __extern_always_inline __attribute_artificial__
+ __warndecl(name,msg) extern void name (void) __attribute__((__warning__ (msg)))
+ __warnattr(msg) __attribute__((__warning__ (msg)))
+ __errordecl(name,msg) extern void name (void) __attribute__((__error__ (msg)))
+ __flexarr []
+ __REDIRECT(name,proto,alias) name proto __asm__ (__ASMNAME (#alias))
+ __REDIRECT_NTH(name,proto,alias) name proto __asm__ (__ASMNAME (#alias)) __THROW
+ __REDIRECT_NTHNL(name,proto,alias) name proto __asm__ (__ASMNAME (#alias)) __THROWNL
+ __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
+ __ASMNAME2(prefix,cname) __STRING (prefix) cname
+ __attribute_malloc__ __attribute__ ((__malloc__))
+ __attribute_pure__ __attribute__ ((__pure__))
+ __attribute_const__ __attribute__ ((__const__))
+ __attribute_used__ __attribute__ ((__used__))
+ __attribute_noinline__ __attribute__ ((__noinline__))
+ __attribute_deprecated__ __attribute__ ((__deprecated__))
+ __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
+ __attribute_format_strfmon__(a,b) __attribute__ ((__format__ (__strfmon__, a, b)))
+ __nonnull(params) __attribute__ ((__nonnull__ params))
+ __attribute_warn_unused_result__ __attribute__ ((__warn_unused_result__))
+ __wur
+ __always_inline __inline __attribute__ ((__always_inline__))
+ __attribute_artificial__ __attribute__ ((__artificial__))
+ __extern_inline extern __inline
+ __extern_always_inline extern __always_inline
+ __va_arg_pack() __builtin_va_arg_pack ()
+ __va_arg_pack_len() __builtin_va_arg_pack_len ()
+ __restrict_arr __restrict
+ __glibc_unlikely(cond) __builtin_expect((cond), 0)
+ /include
+ file /usr/include/bits/wordsize.h
+ include 0x8fa
+ __WORDSIZE 64
+ __WORDSIZE_TIME64_COMPAT32 1
+ __SYSCALL_WORDSIZE 64
+ /include
+ /file
+ include 0x910
+ __LDBL_REDIR1(name,proto,alias) name proto
+ __LDBL_REDIR(name,proto) name proto
+ __LDBL_REDIR1_NTH(name,proto,alias) name proto __THROW
+ __LDBL_REDIR_NTH(name,proto) name proto __THROW
+ __LDBL_REDIR_DECL(name)
+ __REDIRECT_LDBL(name,proto,alias) __REDIRECT (name, proto, alias)
+ __REDIRECT_NTH_LDBL(name,proto,alias) __REDIRECT_NTH (name, proto, alias)
+ /include
+ /file
+ file /usr/include/gnu/stubs.h
+ file /usr/include/gnu/stubs-64.h
+ include 0x945
+ __stub_bdflush
+ __stub_chflags
+ __stub_fattach
+ __stub_fchflags
+ __stub_fdetach
+ __stub_getmsg
+ __stub_gtty
+ __stub_lchmod
+ __stub_putmsg
+ __stub_revoke
+ __stub_setlogin
+ __stub_sigreturn
+ __stub_sstk
+ __stub_stty
+ /include
+ /file
+ /file
+ /file
+ include 0x99d
+ __need_size_t
+ __need_NULL
+ /include
+ file /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/stddef.h
+ include 0x9ad
+ __size_t__
+ __SIZE_T__
+ _SIZE_T
+ _SYS_SIZE_T_H
+ _T_SIZE_
+ _T_SIZE
+ __SIZE_T
+ _SIZE_T_
+ _BSD_SIZE_T_
+ _SIZE_T_DEFINED_
+ _SIZE_T_DEFINED
+ _BSD_SIZE_T_DEFINED_
+ _SIZE_T_DECLARED
+ ___int_size_t_h
+ _GCC_SIZE_T
+ _SIZET_
+ __size_t
+ NULL ((void *)0)
+ /include
+ /file
+ file /usr/include/xlocale.h
+ _XLOCALE_H 1
+ /file
+ /file
+ HELLO "world"
+/file
+EOF
+
+testfiles testfile-macros-0xff
+testrun_compare ${abs_builddir}/dwarf-getmacros testfile-macros-0xff 0xb <<\EOF
+invalid opcode
+EOF
+testrun_compare ${abs_builddir}/dwarf-getmacros testfile-macros-0xff 0xb '' <<\EOF
+opcode 255 with 0 arguments
+file /home/petr/proj/elfutils/master/elfutils/x.c
+ FOO 0
+/file
EOF
exit 0
diff --git a/tests/run-linkmap-cut.sh b/tests/run-linkmap-cut.sh
new file mode 100755
index 00000000..de2bc7cc
--- /dev/null
+++ b/tests/run-linkmap-cut.sh
@@ -0,0 +1,32 @@
+#! /bin/bash
+# Copyright (C) 2014 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# The core file has patched:
+# * _r_debug.r_map.l_next.l_next (vma 0x3fdf621718, offset 0x7718) = NULL,
+# therefore all libraries after the main executable and vDSO are removed.
+# * NT_FILE absolute filenames are relativized to: ./////basename
+
+testfiles linkmap-cut-lib.so linkmap-cut linkmap-cut.core
+tempfiles bt
+# It may have non-zero exit code with:
+# .../elfutils/src/stack: dwfl_thread_getframes tid 3130 at 0x3fdf821d64 in /usr/lib64/libc-2.18.so: no matching address range
+testrun ${abs_top_builddir}/src/stack --core=linkmap-cut.core -e linkmap-cut -m >bt || true
+cat bt
+grep -q '^#0 0x00007f08bc24d681 libfunc - .////////////////////////////////////linkmap-cut-lib\.so$' bt
+grep -q '^#1 0x00000000004006b4 main - linkmap-cut$' bt
diff --git a/tests/run-readelf-A.sh b/tests/run-readelf-A.sh
new file mode 100755
index 00000000..6ca9be89
--- /dev/null
+++ b/tests/run-readelf-A.sh
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 2014 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# See run-addrcfi.sh for testfilearm.
+
+# = testfileppc32attrs.s =
+# .gnu_attribute 8,1
+# .gnu_attribute 12,1
+#
+# gcc -m32 -c testfileppc32attrs.s
+
+testfiles testfilearm testfileppc32attrs.o
+
+testrun_compare ${abs_top_builddir}/src/readelf -A testfilearm <<\EOF
+
+Object attributes section [27] '.ARM.attributes' of 53 bytes at offset 0x718:
+ Owner Size
+ aeabi 52
+ File: 42
+ CPU_name: 7-A
+ CPU_arch: v7
+ CPU_arch_profile: Application
+ ARM_ISA_use: Yes
+ THUMB_ISA_use: Thumb-2
+ VFP_arch: VFPv3-D16
+ ABI_PCS_wchar_t: 4
+ ABI_FP_rounding: Needed
+ ABI_FP_denormal: Needed
+ ABI_FP_exceptions: Needed
+ ABI_FP_number_model: IEEE 754
+ ABI_align8_needed: Yes
+ ABI_align8_preserved: Yes, except leaf SP
+ ABI_enum_size: int
+ ABI_HardFP_use: SP and DP
+ ABI_VFP_args: VFP registers
+ CPU_unaligned_access: v6
+EOF
+
+testrun_compare ${abs_top_builddir}/src/readelf -A testfileppc32attrs.o <<\EOF
+
+Object attributes section [ 4] '.gnu.attributes' of 18 bytes at offset 0x34:
+ Owner Size
+ gnu 17
+ File: 9
+ GNU_Power_ABI_Vector: Generic
+ GNU_Power_ABI_Struct_Return: r3/r4
+EOF
+
+exit 0
diff --git a/tests/run-unstrip-n.sh b/tests/run-unstrip-n.sh
index 12c38229..37cbd607 100755
--- a/tests/run-unstrip-n.sh
+++ b/tests/run-unstrip-n.sh
@@ -67,7 +67,7 @@ remove_files="$remove_files $outfile2"
grep -v libc.so.6 $outfile | sort >$outfile2
diff -u $outfile2 - <<EOF
0x400000+0x202038 - test-core.exec - test-core.exec
-0x7f67f2aaf000+0x202000 - . - test-core-lib.so
+0x7f67f2aaf000+0x202000 - . - /home/jkratoch/redhat/elfutils-libregr/test-core-lib.so
0x7fff1596c000+0x1000 a9cf37f53897b5468ee018655760be61b8633d3c@0x7fff1596c340 . - linux-vdso.so.1
EOF
diff --git a/tests/testfile-lex-inlines.bz2 b/tests/testfile-lex-inlines.bz2
new file mode 100755
index 00000000..716e7927
--- /dev/null
+++ b/tests/testfile-lex-inlines.bz2
Binary files differ
diff --git a/tests/testfile-macros-0xff.bz2 b/tests/testfile-macros-0xff.bz2
new file mode 100755
index 00000000..a19662a3
--- /dev/null
+++ b/tests/testfile-macros-0xff.bz2
Binary files differ
diff --git a/tests/testfile-macros-0xff.s b/tests/testfile-macros-0xff.s
new file mode 100644
index 00000000..7fdd35c2
--- /dev/null
+++ b/tests/testfile-macros-0xff.s
@@ -0,0 +1,153 @@
+ .file "x.c"
+ .text
+.Ltext0:
+ .globl main
+ .type main, @function
+main:
+.LFB0:
+ .file 1 "x.c"
+ .loc 1 3 0
+ .cfi_startproc
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ .loc 1 3 0
+ movl $0, %eax
+ popq %rbp
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE0:
+ .size main, .-main
+.Letext0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .long 0x52
+ .value 0x4
+ .long .Ldebug_abbrev0
+ .byte 0x8
+ .uleb128 0x1
+ .long .LASF244
+ .byte 0x4
+ .string "x.c"
+ .long .LASF245
+ .quad .Ltext0
+ .quad .Letext0-.Ltext0
+ .long .Ldebug_line0
+ .long .Ldebug_macro0
+ .uleb128 0x2
+ .long .LASF246
+ .byte 0x1
+ .byte 0x3
+ .long 0x4e
+ .quad .LFB0
+ .quad .LFE0-.LFB0
+ .uleb128 0x1
+ .byte 0x9c
+ .uleb128 0x3
+ .byte 0x4
+ .byte 0x5
+ .string "int"
+ .byte 0
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1
+ .uleb128 0x11
+ .byte 0x1
+ .uleb128 0x25
+ .uleb128 0xe
+ .uleb128 0x13
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0x8
+ .uleb128 0x1b
+ .uleb128 0xe
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x7
+ .uleb128 0x10
+ .uleb128 0x17
+ .uleb128 0x2119
+ .uleb128 0x17
+ .byte 0
+ .byte 0
+ .uleb128 0x2
+ .uleb128 0x2e
+ .byte 0
+ .uleb128 0x3f
+ .uleb128 0x19
+ .uleb128 0x3
+ .uleb128 0xe
+ .uleb128 0x3a
+ .uleb128 0xb
+ .uleb128 0x3b
+ .uleb128 0xb
+ .uleb128 0x49
+ .uleb128 0x13
+ .uleb128 0x11
+ .uleb128 0x1
+ .uleb128 0x12
+ .uleb128 0x7
+ .uleb128 0x40
+ .uleb128 0x18
+ .uleb128 0x2117
+ .uleb128 0x19
+ .byte 0
+ .byte 0
+ .uleb128 0x3
+ .uleb128 0x24
+ .byte 0
+ .uleb128 0xb
+ .uleb128 0xb
+ .uleb128 0x3e
+ .uleb128 0xb
+ .uleb128 0x3
+ .uleb128 0x8
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,"",@progbits
+ .long 0x2c
+ .value 0x2
+ .long .Ldebug_info0
+ .byte 0x8
+ .byte 0
+ .value 0
+ .value 0
+ .quad .Ltext0
+ .quad .Letext0-.Ltext0
+ .quad 0
+ .quad 0
+ .section .debug_macro,"",@progbits
+.Ldebug_macro0:
+ .value 0x4
+ .byte 0x6
+ .long .Ldebug_line0
+ .byte 0x1
+ .byte 0xff
+ .uleb128 0
+ .byte 0xff
+ .byte 0x3
+ .uleb128 0
+ .uleb128 0x1
+ .byte 0x5
+ .uleb128 0x1
+ .long .LASF243
+ .byte 0x4
+ .byte 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF245:
+ .string "/home/petr/proj/elfutils/master/elfutils"
+.LASF244:
+ .string "GNU C++ 4.9.0 20140422 (Red Hat 4.9.0-1) -mtune=generic -march=x86-64 -g3"
+.LASF243:
+ .string "FOO 0"
+.LASF246:
+ .string "main"
+ .ident "GCC: (GNU) 4.9.0 20140422 (Red Hat 4.9.0-1)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/tests/testfile-sizes1.o.bz2 b/tests/testfile-sizes1.o.bz2
new file mode 100644
index 00000000..479ecb20
--- /dev/null
+++ b/tests/testfile-sizes1.o.bz2
Binary files differ
diff --git a/tests/testfile-sizes2.o.bz2 b/tests/testfile-sizes2.o.bz2
new file mode 100644
index 00000000..7bd7b47f
--- /dev/null
+++ b/tests/testfile-sizes2.o.bz2
Binary files differ
diff --git a/tests/testfile-sizes3.o.bz2 b/tests/testfile-sizes3.o.bz2
new file mode 100644
index 00000000..7fa6a8a5
--- /dev/null
+++ b/tests/testfile-sizes3.o.bz2
Binary files differ
diff --git a/tests/testfileppc32attrs.o.bz2 b/tests/testfileppc32attrs.o.bz2
new file mode 100644
index 00000000..c8d80a99
--- /dev/null
+++ b/tests/testfileppc32attrs.o.bz2
Binary files differ
diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
new file mode 100644
index 00000000..c1f8d89f
--- /dev/null
+++ b/tests/vdsosyms.c
@@ -0,0 +1,109 @@
+/* Test program for getting symbol table from vdso module.
+ Copyright (C) 2014 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+#include <assert.h>
+#include <errno.h>
+#include <error.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include ELFUTILS_HEADER(dwfl)
+
+#ifndef __linux__
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+ printf ("Getting the vdso is unsupported.\n");
+ return 77;
+}
+#else /* __linux__ */
+static int vdso_syms = 0;
+
+static int
+module_callback (Dwfl_Module *mod, void **userdata __attribute__((unused)),
+ const char *name, Dwarf_Addr start __attribute__((unused)),
+ void *arg __attribute__((unused)))
+{
+ /* We can only recognize the vdso by inspecting the "magic name". */
+ printf ("module name: %s\n", name);
+ if (strncmp ("[vdso: ", name, 7) == 0)
+ {
+ vdso_syms = dwfl_module_getsymtab (mod);
+ printf ("vdso syms: %d\n", vdso_syms);
+ if (vdso_syms < 0)
+ error (2, 0, "dwfl_module_getsymtab: %s", dwfl_errmsg (-1));
+
+ for (int i = 0; i < vdso_syms; i++)
+ {
+ GElf_Sym sym;
+ GElf_Addr addr;
+ const char *sname = dwfl_module_getsym_info (mod, i, &sym, &addr,
+ NULL, NULL, NULL);
+ assert (sname != NULL);
+ printf ("%d: '%s' %" PRIx64 " (%" PRIx64 ")\n",
+ i, sname, sym.st_value, addr);
+ }
+ }
+
+ return DWARF_CB_OK;
+}
+
+int
+main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
+{
+ 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));
+
+ /* Take our parent as "arbitrary" process to inspect. */
+ pid_t pid = getppid();
+
+ 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");
+
+ /* Also explicitly attach for older kernels (cannot read vdso otherwise). */
+ result = dwfl_linux_proc_attach (dwfl, pid, false);
+ if (result < 0)
+ error (2, 0, "dwfl_linux_proc_attach: %s", dwfl_errmsg (-1));
+ else if (result > 0)
+ error (2, result, "dwfl_linux_proc_attach");
+
+ if (dwfl_report_end (dwfl, NULL, NULL) != 0)
+ error (2, 0, "dwfl_report_end: %s", dwfl_errmsg (-1));
+
+ if (dwfl_getmodules (dwfl, module_callback, NULL, 0) != 0)
+ error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1));
+
+ /* No symbols is ok, then we haven't seen the vdso at all on this arch. */
+ return vdso_syms >= 0 ? 0 : -1;
+}
+
+#endif /* ! __linux__ */