[PATCH] libdwfl: Arange CU cannot point to the EOF marker.
by Mark Wielaard
Don't assert, just report DWARF_E_INVALID_DWARF.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/cu.c | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 675c4e2..97ec954 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-07 Mark Wielaard <mjw(a)redhat.com>
+
+ * cu.c (arangecu): Return DWARF_E_INVALID_DWARF if arange cu is -1.
+
2015-05-05 Mark Wielaard <mjw(a)redhat.com>
* cu.c (intern_cu): Check cuoff points to a real Dwarf_Die before
diff --git a/libdwfl/cu.c b/libdwfl/cu.c
index dbbed85..ddd4913 100644
--- a/libdwfl/cu.c
+++ b/libdwfl/cu.c
@@ -294,7 +294,13 @@ arangecu (Dwfl_Module *mod, struct dwfl_arange *arange, struct dwfl_cu **cu)
Dwfl_Error result = intern_cu (mod, dwarange->offset, &arange->cu);
if (result != DWFL_E_NOERROR)
return result;
- assert (arange->cu != NULL && arange->cu != (void *) -1l);
+ assert (arange->cu != NULL);
+ if (arange->cu == (void *) -1l)
+ {
+ // An arange cannot point to the EOF marker.
+ arange->cu = NULL;
+ return (DWFL_E (LIBDW, DWARF_E_INVALID_DWARF));
+ }
less_lazy (mod); /* Each arange with null ->cu counts once. */
}
--
2.1.0
8 years, 11 months
[PATCH] libdwfl: Fix wrong type to make gcc -fsanitize=undefined happy.
by Mark Wielaard
gcc -fsanitize=undefined would warn about calling dwfl_error accessing
the error string array: elfutils/libdwfl/dwfl_error.c:156:60:
runtime error: index 385 out of bounds for type 'char [9]'
This is because it thought we went beyond error string zero "no error",
which is indeed 9 chars. "Correct" the type of the pointer to make
ubsan happy.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/dwfl_error.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index d4cd3f5..90c0a04 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2015-04-21 Mark Wielaard <mjw(a)redhat.com>
+
+ * dwfl_error.c (msgstr): Define as const char *.
+
2015-04-02 Mark Wielaard <mjw(a)redhat.com>
* segment.c (insert): Check correct number of lookup_elts.
diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
index d9ca9e7..c3648c0 100644
--- a/libdwfl/dwfl_error.c
+++ b/libdwfl/dwfl_error.c
@@ -65,7 +65,7 @@ static const struct msgtable
DWFL_ERRORS
#undef DWFL_ERROR
};
-#define msgstr (&msgtable.msg_NOERROR[0])
+#define msgstr ((const char *) &msgtable)
static const uint_fast16_t msgidx[] =
{
--
2.1.0
8 years, 11 months
[PATCH] libelf: Make sure version xlate dest buffer is fully defined.
by Mark Wielaard
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c16
contains an example of usage of undefined memory when version section
data needs to be translated, but the version xlate functions detect they
cannot fully transform the section data. To make sure the dest buffer
data is completely defined this patch makes sure all data is moved
from src to dest first. This is somewhat inefficient since normally
all data will be fully converted. But the translation functions have
no way to indicate only partial data was converted.
Reported-by: Alexander Cherepanov <cherepan(a)mccme.ru>
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libelf/ChangeLog | 5 +++++
libelf/version_xlate.h | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 2ca9509..adfccf1 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-03 Mark Wielaard <mjw(a)redhat.com>
+
+ * version_xlate.h (elf_cvt_Verdef): Use memmove to copy src to dest.
+ (elf_cvt_Verneed): Likewise.
+
2014-12-30 Mark Wielaard <mjw(a)redhat.com>
* elf_getphdrnum.c (__elf_getphdrnum_chk_rdlock): New function.
diff --git a/libelf/version_xlate.h b/libelf/version_xlate.h
index 16eaa19..9fe01c6 100644
--- a/libelf/version_xlate.h
+++ b/libelf/version_xlate.h
@@ -1,5 +1,5 @@
/* Conversion functions for versioning information.
- Copyright (C) 1998, 1999, 2000, 2002, 2003 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2015 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper(a)redhat.com>, 1998.
@@ -55,6 +55,11 @@ elf_cvt_Verdef (void *dest, const void *src, size_t len, int encode)
if (len == 0)
return;
+ /* Below we rely on the next field offsets to be correct, start by
+ copying over all data as is in case some data isn't translated.
+ We don't want to leave (undefined) garbage in the dest buffer. */
+ memmove (dest, src, len);
+
do
{
size_t aux_offset;
@@ -149,6 +154,11 @@ elf_cvt_Verneed (void *dest, const void *src, size_t len, int encode)
if (len == 0)
return;
+ /* Below we rely on the next field offsets to be correct, start by
+ copying over all data as is in case some data isn't translated.
+ We don't want to leave (undefined) garbage in the dest buffer. */
+ memmove (dest, src, len);
+
do
{
size_t aux_offset;
--
2.1.0
8 years, 11 months
[PATCH v2 0/2] Fixes for building with uClibc-based toolchain
by Max Filippov
Hi,
these two patches are updated (actually rewritten) according to feedback
for the v1 uClibc fixes series:
- futimes is unconditionally replaced with futimens;
- assert_perror is replaced with assert in tests.
Max Filippov (2):
Replace futimes with futimens.
Replace assert_perror with assert
src/ChangeLog | 8 ++++++++
src/ar.c | 8 ++++----
src/strip.c | 18 +++++++++---------
tests/ChangeLog | 8 ++++++++
tests/backtrace-child.c | 4 ++--
tests/backtrace-data.c | 22 +++++++++++-----------
tests/backtrace-dwarf.c | 4 ++--
tests/backtrace.c | 10 +++++-----
8 files changed, 49 insertions(+), 33 deletions(-)
--
1.8.1.4
8 years, 11 months
[PATCH] libdwfl: Sanity check cu offset before trying to intern.
by Mark Wielaard
We need to check the cuoff points to a real Dwarf_Die before trying to
intern the cu with tsearch. Otherwise bogus keys might end up in the
search tree with NULL cus. That will cause crashes in compare_cukey
during next insertion or deletion of cus.
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c30
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/cu.c | 15 ++++++---------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 6945eec..bce113e 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
2015-05-05 Mark Wielaard <mjw(a)redhat.com>
+ * cu.c (intern_cu): Check cuoff points to a real Dwarf_Die before
+ interning.
+
+2015-05-05 Mark Wielaard <mjw(a)redhat.com>
+
* dwfl_lineinfo.c (dwfl_lineinfo): Check info->file is valid.
2015-04-21 Mark Wielaard <mjw(a)redhat.com>
diff --git a/libdwfl/cu.c b/libdwfl/cu.c
index 3ac341e..dbbed85 100644
--- a/libdwfl/cu.c
+++ b/libdwfl/cu.c
@@ -171,6 +171,11 @@ compare_cukey (const void *a, const void *b)
static Dwfl_Error
intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result)
{
+ Dwarf_Die cudie;
+ Dwarf_Die *die = INTUSE(dwarf_offdie) (mod->dw, cuoff, &cudie);
+ if (die == NULL)
+ return DWFL_E_LIBDW;
+
struct Dwarf_CU dwkey;
struct dwfl_cu key;
key.die.cu = &dwkey;
@@ -203,15 +208,7 @@ intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result)
cu->mod = mod;
cu->next = NULL;
cu->lines = NULL;
-
- /* XXX use non-searching lookup */
- Dwarf_Die *die = INTUSE(dwarf_offdie) (mod->dw, cuoff, &cu->die);
- if (die == NULL)
- {
- free (cu);
- return DWFL_E_LIBDW;
- }
- assert (die == &cu->die);
+ cu->die = cudie;
struct dwfl_cu **newvec = realloc (mod->cu, ((mod->ncu + 1)
* sizeof (mod->cu[0])));
--
2.1.0
8 years, 11 months
[PATCH] configure: fix enable_demangler setting
by Max Filippov
Add missing comma to AS_IF, otherwise enable_demangler is always set to
'no'. Canonicalize tests.
Signed-off-by: Max Filippov <jcmvbkbc(a)gmail.com>
---
ChangeLog | 4 ++++
configure.ac | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1a11c6d..f727bf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-03 Max Filippov <jcmvbkbc(a)gmail.com>
+
+ * configure.ac (DEMANGLE): Fix enable_demangler setting.
+
2015-05-01 Mark Wielaard <mjw(a)redhat.com>
* configure.ac (DEMANGLE): Explicitly set enable_demangler.
diff --git a/configure.ac b/configure.ac
index 0ba3db3..7ba4d11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -234,8 +234,8 @@ AC_SUBST([zip_LIBS])
AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
-AM_CONDITIONAL(DEMANGLE, test "$ac_cv_lib_stdcpp___cxa_demangle" = yes)
-AS_IF([test "$ac_cv_lib_stdcpp___cxa_demangle" = yes]
+AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
+AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"],
[enable_demangler=yes],[enable_demangler=no])
AC_ARG_ENABLE([textrelcheck],
--
1.8.1.4
8 years, 11 months
Versioned symbols in elfutils and uClibc
by Max Filippov
Hello,
I've got a segfault in ltrace on uClibc-based system, caused by infinite
recursion in the dwfl_report_elf function [1]. This happens because there
is no symbol versioning support in uClibc and there are two versions of
that function, one of them calling the other. Does the below patch look
like a good solution to this?
[1] http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/113856
---8<---
From: Max Filippov <jcmvbkbc(a)gmail.com>
Subject: [PATCH] Allow disabling symbol versioning at configure time
Due to missing symbol versioning support in uClibc calls to versioned
functions that internally call different version of themselves results
in infinite recursion.
Introduce macro SYMBOL_VERSIONING and use it instead of plain SHARED to
decide whether symbol versioning is needed. Control this macro
definition with new configure option --disable-symbol-versioning.
Signed-off-by: Max Filippov <jcmvbkbc(a)gmail.com>
---
config/eu.am | 10 ++++++++--
configure.ac | 5 +++++
lib/eu-config.h | 6 +++---
libdwfl/core-file.c | 2 +-
libdwfl/dwfl_module_build_id.c | 2 +-
libdwfl/dwfl_report_elf.c | 2 +-
6 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/config/eu.am b/config/eu.am
index faf8add..6103a3e 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -38,16 +38,22 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
+DEFS.os = -DPIC -DSHARED
+if SYMBOL_VERSIONING
+DEFS.os += -DSYMBOL_VERSIONING
+else
+endif
+
%.os: %.c %.o
if AMDEP
- if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
+ if $(COMPILE.os) -c -o $@ -fpic $(DEFS.os) -MT $@ -MD -MP \
-MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
rm -f "$(DEPDIR)/$*.Tpo"; \
else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
fi
else
- $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $<
+ $(COMPILE.os) -c -o $@ -fpic $(DEFS.os) $<
endif
CLEANFILES = *.gcno *.gcda
diff --git a/configure.ac b/configure.ac
index ed2c964..e3226f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -241,6 +241,11 @@ AS_HELP_STRING([--disable-textrelcheck],
[Disable textrelcheck being a fatal error]))
AM_CONDITIONAL(FATAL_TEXTREL, [test "x$enable_textrelcheck" != "xno"])
+AC_ARG_ENABLE([symbol-versioning],
+AS_HELP_STRING([--disable-symbol-versioning],
+ [Disable symbol versioning in shared objects]))
+AM_CONDITIONAL(SYMBOL_VERSIONING, [test "x$enable_symbol_versioning" != "xno"])
+
dnl The directories with content.
dnl Documentation.
diff --git a/lib/eu-config.h b/lib/eu-config.h
index 3afff26..5bb21c1 100644
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -163,7 +163,7 @@ asm (".section predict_data, \"aw\"; .previous\n"
#define ELFUTILS_HEADER(name) <lib##name.h>
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
# define OLD_VERSION(name, version) \
asm (".globl _compat." #version "." #name "\n" \
"_compat." #version "." #name " = " #name "\n" \
@@ -181,8 +181,8 @@ asm (".section predict_data, \"aw\"; .previous\n"
# define OLD_VERSION(name, version) /* Nothing for static linking. */
# define NEW_VERSION(name, version) /* Nothing for static linking. */
# define COMPAT_VERSION_NEWPROTO(name, version, prefix) \
- error "should use #ifdef SHARED"
-# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SHARED"
+ error "should use #ifdef SYMBOL_VERSIONING"
+# define COMPAT_VERSION(name, version, prefix) error "should use #ifdef SYMBOL_VERSIONING"
#endif
diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
index 324e9d2..bbe0899 100644
--- a/libdwfl/core-file.c
+++ b/libdwfl/core-file.c
@@ -588,7 +588,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
INTDEF (dwfl_core_file_report)
NEW_VERSION (dwfl_core_file_report, ELFUTILS_0.158)
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
int _compat_without_executable_dwfl_core_file_report (Dwfl *dwfl, Elf *elf);
COMPAT_VERSION_NEWPROTO (dwfl_core_file_report, ELFUTILS_0.146,
without_executable)
diff --git a/libdwfl/dwfl_module_build_id.c b/libdwfl/dwfl_module_build_id.c
index 350bbf8..c9a42ca 100644
--- a/libdwfl/dwfl_module_build_id.c
+++ b/libdwfl/dwfl_module_build_id.c
@@ -101,7 +101,7 @@ dwfl_module_build_id (Dwfl_Module *mod,
INTDEF (dwfl_module_build_id)
NEW_VERSION (dwfl_module_build_id, ELFUTILS_0.138)
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
COMPAT_VERSION (dwfl_module_build_id, ELFUTILS_0.130, vaddr_at_end)
int
diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
index 3a4ae2e..624284c 100644
--- a/libdwfl/dwfl_report_elf.c
+++ b/libdwfl/dwfl_report_elf.c
@@ -321,7 +321,7 @@ dwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd,
INTDEF (dwfl_report_elf)
NEW_VERSION (dwfl_report_elf, ELFUTILS_0.156)
-#ifdef SHARED
+#ifdef SYMBOL_VERSIONING
Dwfl_Module *
_compat_without_add_p_vaddr_dwfl_report_elf (Dwfl *dwfl, const char *name,
const char *file_name, int fd,
--
1.8.1.4
8 years, 11 months
[COMMITTED] tests: Split run-stack tests to support missing demangler.
by Mark Wielaard
SKIP tests that need a demangler if it is not there.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
ChangeLog | 4 +++
configure.ac | 4 ++-
tests/ChangeLog | 8 +++++
tests/Makefile.am | 2 ++
tests/run-stack-d-test.sh | 14 ++++-----
...stack-i-test.sh => run-stack-demangled-test.sh} | 34 ++++++++++++++++++----
tests/run-stack-i-test.sh | 13 +++++----
7 files changed, 60 insertions(+), 19 deletions(-)
copy tests/{run-stack-i-test.sh => run-stack-demangled-test.sh} (68%)
diff --git a/ChangeLog b/ChangeLog
index dc20648..1a11c6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2015-05-01 Mark Wielaard <mjw(a)redhat.com>
+ * configure.ac (DEMANGLE): Explicitly set enable_demangler.
+
+2015-05-01 Mark Wielaard <mjw(a)redhat.com>
+
* configure.ac (debugpred): Use and set use_debugpred_val.
(textrelcheck): Explicitly set enable_textrelcheck to yes or no.
(symbol-versioning): Likewise for enable_symbol_versioning.
diff --git a/configure.ac b/configure.ac
index 876600d..0ba3db3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -235,6 +235,8 @@ AC_SUBST([zip_LIBS])
AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
AM_CONDITIONAL(DEMANGLE, test "$ac_cv_lib_stdcpp___cxa_demangle" = yes)
+AS_IF([test "$ac_cv_lib_stdcpp___cxa_demangle" = yes]
+ [enable_demangler=yes],[enable_demangler=no])
AC_ARG_ENABLE([textrelcheck],
AS_HELP_STRING([--disable-textrelcheck],
@@ -378,7 +380,7 @@ AC_MSG_NOTICE([
gzip support : ${with_zlib}
bzip2 support : ${with_bzlib}
lzma/xz support : ${with_lzma}
- libstdc++ demangle support : ${ac_cv_lib_stdcpp___cxa_demangle}
+ libstdc++ demangle support : ${enable_demangler}
File textrel check : ${enable_textrelcheck}
Symbol versioning : ${enable_symbol_versioning}
diff --git a/tests/ChangeLog b/tests/ChangeLog
index b686184..0556b1f 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,11 @@
+2015-05-01 Mark Wielaard <mjw(a)redhat.com>
+
+ * run-stack-d-test.sh: Use --raw and mangled output.
+ * run-stack-i-test.sh: Likewise.
+ * run-stack-demangled-test.sh: New test.
+ * Makefile.am (EXTRA_DIST): Add run-stack-demangled-test.sh.
+ (TESTS): Likewise.
+
2015-04-01 H.J. Lu <hjl.tools(a)gmail.com>
* Makefile.am (TESTS): Add run-strip-test10.sh.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 45bb74d..f94bd67 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -113,6 +113,7 @@ 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-stack-demangled-test.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 \
run-getsrc-die.sh run-strptr.sh newdata elfstrtab
@@ -282,6 +283,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
testfile-backtrace-demangle.cc \
testfile-backtrace-demangle.core.bz2 \
run-stack-d-test.sh run-stack-i-test.sh \
+ run-stack-demangled-test.sh \
testfiledwarfinlines.bz2 testfiledwarfinlines.core.bz2 \
run-readelf-zdebug.sh testfile-debug.bz2 testfile-zdebug.bz2 \
run-deleted.sh run-linkmap-cut.sh linkmap-cut-lib.so.bz2 \
diff --git a/tests/run-stack-d-test.sh b/tests/run-stack-d-test.sh
index 040c2fa..4198201 100755
--- a/tests/run-stack-d-test.sh
+++ b/tests/run-stack-d-test.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -68,21 +68,21 @@ else
STACKCMD=${abs_top_builddir}/src/stack
fi
-# Without -d the top function comes out as fu.
-testrun_compare ${abs_top_builddir}/src/stack -n 2 -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+# Without -d the top function comes out as fu. Use --raw to not demangle.
+testrun_compare ${abs_top_builddir}/src/stack -r -n 2 -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
PID 13654 - core
TID 13654:
-#0 0x00000000004006c8 fu(int)
+#0 0x00000000004006c8 _Z2fui
#1 0x00000000004004c5 main
$STACKCMD: tid 13654: shown max number of frames (2, use -n 0 for unlimited)
EOF
# But when asking for source we see it is actually on line 6.
-# (Which is in function fubar, not fu).
-testrun_compare ${abs_top_builddir}/src/stack -n 2 -s -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+# (Which is in function fubar, not fu). Use --raw to not demangle.
+testrun_compare ${abs_top_builddir}/src/stack -r -n 2 -s -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
PID 13654 - core
TID 13654:
-#0 0x00000000004006c8 fu(int)
+#0 0x00000000004006c8 _Z2fui
/home/mark/src/tests/dwarfinlines.cpp:6
#1 0x00000000004004c5 main
/home/mark/src/tests/dwarfinlines.cpp:39
diff --git a/tests/run-stack-i-test.sh b/tests/run-stack-demangled-test.sh
similarity index 68%
copy from tests/run-stack-i-test.sh
copy to tests/run-stack-demangled-test.sh
index 2d09ec0..0d9f8f3 100755
--- a/tests/run-stack-i-test.sh
+++ b/tests/run-stack-demangled-test.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -15,9 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+if test -n "$ELFUTILS_DISABLE_DEMANGLE"; then
+ exit 77
+fi
+
. $srcdir/test-subr.sh
-# See run-stack-d-test.sh for dwarfinlines.cpp source.
+# See run-stack-d-test.sh and run-stack-i-test.sh
+# Same tests, now with demangler support, no -r, and without -d.
+# Only change in output is an explit fu(int) instead of _Z2fui.
+
testfiles testfiledwarfinlines testfiledwarfinlines.core
# Depending on whether we are running make check or make installcheck
@@ -29,9 +36,26 @@ else
STACKCMD=${abs_top_builddir}/src/stack
fi
-# Compare with run-stack-d-test.sh to see the output without --inlines.
-# Only two call frames are visible (there is a jump from main to fu or
-# fubar).
+# Without -d the top function comes out as fu.
+testrun_compare ${abs_top_builddir}/src/stack -n 2 -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+PID 13654 - core
+TID 13654:
+#0 0x00000000004006c8 fu(int)
+#1 0x00000000004004c5 main
+$STACKCMD: tid 13654: shown max number of frames (2, use -n 0 for unlimited)
+EOF
+
+# But when asking for source we see it is actually on line 6.
+# (Which is in function fubar, not fu).
+testrun_compare ${abs_top_builddir}/src/stack -n 2 -s -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+PID 13654 - core
+TID 13654:
+#0 0x00000000004006c8 fu(int)
+ /home/mark/src/tests/dwarfinlines.cpp:6
+#1 0x00000000004004c5 main
+ /home/mark/src/tests/dwarfinlines.cpp:39
+$STACKCMD: tid 13654: shown max number of frames (2, use -n 0 for unlimited)
+EOF
# With --inlines we get all inlined calls. Note they share the same
# address.
diff --git a/tests/run-stack-i-test.sh b/tests/run-stack-i-test.sh
index 2d09ec0..ffab85f 100755
--- a/tests/run-stack-i-test.sh
+++ b/tests/run-stack-i-test.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2014 Red Hat, Inc.
+# Copyright (C) 2014, 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -31,25 +31,26 @@ fi
# Compare with run-stack-d-test.sh to see the output without --inlines.
# Only two call frames are visible (there is a jump from main to fu or
-# fubar).
+# fubar). Explicitly use --raw so demangler support being configured in
+# doesn't change the results.
# With --inlines we get all inlined calls. Note they share the same
# address.
-testrun_compare ${abs_top_builddir}/src/stack -n 6 -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+testrun_compare ${abs_top_builddir}/src/stack -r -n 6 -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
PID 13654 - core
TID 13654:
#0 0x00000000004006c8 fubar
#1 0x00000000004006c8 foobar
#2 0x00000000004006c8 bar
#3 0x00000000004006c8 foo
-#4 0x00000000004006c8 fu(int)
+#4 0x00000000004006c8 _Z2fui
#5 0x00000000004004c5 main
$STACKCMD: tid 13654: shown max number of frames (6, use -n 0 for unlimited)
EOF
# With --source we can also see where in the source the inlined frames
# where originally called from.
-testrun_compare ${abs_top_builddir}/src/stack -n 6 -s -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
+testrun_compare ${abs_top_builddir}/src/stack -r -n 6 -s -i -e testfiledwarfinlines --core testfiledwarfinlines.core<<EOF
PID 13654 - core
TID 13654:
#0 0x00000000004006c8 fubar
@@ -60,7 +61,7 @@ TID 13654:
/home/mark/src/tests/dwarfinlines.cpp:21
#3 0x00000000004006c8 foo
/home/mark/src/tests/dwarfinlines.cpp:27
-#4 0x00000000004006c8 fu(int)
+#4 0x00000000004006c8 _Z2fui
/home/mark/src/tests/dwarfinlines.cpp:33
#5 0x00000000004004c5 main
/home/mark/src/tests/dwarfinlines.cpp:39
--
1.8.3.1
8 years, 12 months
[COMMITTED] configure: print feature settings overview
by Mark Wielaard
elfutils can be configured in various ways. But we expect certain
settings for the features that we explicitly support. Print an
overview of all settings, plus their recommended setting, at the
end of the configure run.
=====================================================================
elfutils: 0.161 (eu_version: 161)
=====================================================================
Prefix : /opt/local/install/elfutils
Program prefix ("eu-" recommended) : eu-
Source code location : /home/mark/src/elfutils
Maintainer mode : yes
libebl modules subdirectory : elfutils
build arch : x86_64-unknown-linux-gnu
RECOMMENDED FEATURES (should all be yes)
gzip support : yes
bzip2 support : yes
lzma/xz support : yes
libstdc++ demangle support : yes
File textrel check : yes
Symbol versioning : yes
NOT RECOMMENDED FEATURES (should all be no)
Experimental thread safety : no
OTHER FEATURES
Deterministic archives by default : false
Native language support : yes
EXTRA TEST FEATURES (used with make check)
debug branch prediction : no
gprof support : no
gcov support : no
run all tests under valgrind : no
use rpath in tests : no
test biarch : yes
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
---
ChangeLog | 7 +++++++
configure.ac | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
m4/ChangeLog | 4 ++++
m4/zip.m4 | 2 ++
4 files changed, 57 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d45bf67..dc20648 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-01 Mark Wielaard <mjw(a)redhat.com>
+
+ * configure.ac (debugpred): Use and set use_debugpred_val.
+ (textrelcheck): Explicitly set enable_textrelcheck to yes or no.
+ (symbol-versioning): Likewise for enable_symbol_versioning.
+ AC_MSG_NOTICE overview of enabled/disabled features.
+
2015-04-23 Max Filippov <jcmvbkbc(a)gmail.com>
* configure.ac: Add --disable-symbol-versioning.
diff --git a/configure.ac b/configure.ac
index be01573..876600d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_INIT([elfutils],[0.161],[https://bugzilla.redhat.com/],[elfutils])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_FILES([config/Makefile])
-AC_COPYRIGHT([Copyright (C) 1996-2014 Red Hat, Inc.])
+AC_COPYRIGHT([Copyright (C) 1996-2015 Red Hat, Inc.])
AC_PREREQ(2.63) dnl Minimum Autoconf version required.
dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
@@ -170,10 +170,10 @@ AC_ARG_ENABLE([debugpred],
AS_HELP_STRING([--enable-debugpred],[build binaries with support to debug branch prediction]),
[use_debugpred=$enableval], [use_debugpred=no])
case $use_debugpred in
- yes) use_debugpred=1 ;;
- *) use_debugpred=0 ;;
+ yes) use_debugpred_val=1 ;;
+ *) use_debugpred_val=0 ;;
esac
-AC_SUBST([DEBUGPRED], $use_debugpred)
+AC_SUBST([DEBUGPRED], $use_debugpred_val)
dnl Enable gprof suport.
AC_ARG_ENABLE([gprof],
@@ -240,13 +240,16 @@ AC_ARG_ENABLE([textrelcheck],
AS_HELP_STRING([--disable-textrelcheck],
[Disable textrelcheck being a fatal error]))
AM_CONDITIONAL(FATAL_TEXTREL, [test "x$enable_textrelcheck" != "xno"])
+AS_IF([test "x$enable_textrelcheck" != "xno"],
+ [enable_textrelcheck=yes],[enable_textrelcheck=no])
AC_ARG_ENABLE([symbol-versioning],
AS_HELP_STRING([--disable-symbol-versioning],
[Disable symbol versioning in shared objects]))
AM_CONDITIONAL(SYMBOL_VERSIONING, [test "x$enable_symbol_versioning" != "xno"])
AS_IF([test "x$enable_symbol_versioning" = "xno"],
- [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.])])
+ [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.])
+ enable_symbol_versioning=no],[enable_symbol_versioning=yes])
dnl The directories with content.
@@ -358,3 +361,39 @@ CC_BIARCH="$CC $utrace_biarch"
AC_SUBST([CC_BIARCH])
AC_OUTPUT
+
+AC_MSG_NOTICE([
+=====================================================================
+ elfutils: ${PACKAGE_VERSION} (eu_version: ${eu_version})
+=====================================================================
+
+ Prefix : ${prefix}
+ Program prefix ("eu-" recommended) : ${program_prefix}
+ Source code location : ${srcdir}
+ Maintainer mode : ${enable_maintainer_mode}
+ libebl modules subdirectory : ${LIBEBL_SUBDIR}
+ build arch : ${ac_cv_build}
+
+ RECOMMENDED FEATURES (should all be yes)
+ gzip support : ${with_zlib}
+ bzip2 support : ${with_bzlib}
+ lzma/xz support : ${with_lzma}
+ libstdc++ demangle support : ${ac_cv_lib_stdcpp___cxa_demangle}
+ File textrel check : ${enable_textrelcheck}
+ Symbol versioning : ${enable_symbol_versioning}
+
+ NOT RECOMMENDED FEATURES (should all be no)
+ Experimental thread safety : ${use_locks}
+
+ OTHER FEATURES
+ Deterministic archives by default : ${default_ar_deterministic}
+ Native language support : ${USE_NLS}
+
+ EXTRA TEST FEATURES (used with make check)
+ debug branch prediction : ${use_debugpred}
+ gprof support : ${use_gprof}
+ gcov support : ${use_gcov}
+ run all tests under valgrind : ${use_valgrind}
+ use rpath in tests : ${tests_use_rpath}
+ test biarch : ${utrace_cv_cc_biarch}
+])
diff --git a/m4/ChangeLog b/m4/ChangeLog
index 163ee73..9ee06d7 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-01 Mark Wielaard <mjw(a)redhat.com>
+
+ * zip.m4: Explicitly set with_ to no, if not yes.
+
2014-07-14 Mark Wielaard <mjw(a)redhat.com>
* biarch.m4 (utrace_BIARCH): Set biarch-no for cross-compile using
diff --git a/m4/zip.m4 b/m4/zip.m4
index 8e4d545..ab6fd57 100644
--- a/m4/zip.m4
+++ b/m4/zip.m4
@@ -14,5 +14,7 @@ fi
AM_CONDITIONAL([$2], test $with_[$1] = yes)
if test $with_[$1] = yes; then
AC_DEFINE(USE_[$2])
+else
+ with_[$1]=no
fi
AH_TEMPLATE(USE_[$2], [Support $5 decompression via -l$3.])])
--
1.8.3.1
8 years, 12 months