diff options
author | Ian Lance Taylor <iant@google.com> | 2012-10-09 18:20:45 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-10-09 18:20:45 +0000 |
commit | e561a9920cce1e638826a53599eb55ec44ce54c2 (patch) | |
tree | cf3815f8c8b0babee15a42892364a912abc14de3 /libbacktrace/configure | |
parent | 1a61077e0ef68c9c4453f86c408a302518dd8075 (diff) | |
download | gcc-e561a9920cce1e638826a53599eb55ec44ce54c2.tar.gz |
Add support for tracing through shared libraries.
* configure.ac: Check for link.h and dl_iterate_phdr.
* elf.c: #include <link.h> if system has dl_iterate_phdr. #undef
ELF macros before #defining them.
(dl_phdr_info, dl_iterate_phdr): Define if system does not have
dl_iterate_phdr.
(struct elf_syminfo_data): Add next field.
(elf_initialize_syminfo): Initialize next field.
(elf_add_syminfo_data): New static function.
(elf_add): New static function, broken out of
backtrace_initialize. Call backtrace_dwarf_add instead of
backtrace_dwarf_initialize.
(struct phdr_data): Define.
(phdr_callback): New static function.
(backtrace_initialize): Call elf_add.
* dwarf.c (struct dwarf_data): Add next and base_address fields.
(add_unit_addr): Add base_address parameter. Change all callers.
(add_unit_ranges, build_address_map): Likewise.
(add_line): Add ddata parameter. Change all callers.
(read_line_program, add_function_range): Likewise.
(dwarf_lookup_pc): New static function, broken out of
dwarf_fileline.
(dwarf_fileline): Call dwarf_lookup_pc.
(build_dwarf_data): New static function.
(backtrace_dwarf_add): New function.
(backtrace_dwarf_initialize): Remove.
* internal.h (backtrace_dwarf_initialize): Don't declare.
(backtrace_dwarf_add): Declare.
* configure, config.h.in: Rebuild.
From-SVN: r192267
Diffstat (limited to 'libbacktrace/configure')
-rwxr-xr-x | libbacktrace/configure | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/libbacktrace/configure b/libbacktrace/configure index 8e2ea413cba..8d34856e693 100755 --- a/libbacktrace/configure +++ b/libbacktrace/configure @@ -12182,6 +12182,53 @@ if test "$ALLOC_FILE" = "alloc.lo"; then fi +# Check for dl_iterate_phdr. +for ac_header in link.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "link.h" "ac_cv_header_link_h" "$ac_includes_default" +if test "x$ac_cv_header_link_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LINK_H 1 +_ACEOF + +fi + +done + +if test "$ac_cv_header_link_h" = "no"; then + have_dl_iterate_phdr=no +else + if test -n "${with_target_subdir}"; then + # When built as a GCC target library, we can't do a link test. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <link.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "dl_iterate_phdr" >/dev/null 2>&1; then : + have_dl_iterate_phdr=yes +else + have_dl_iterate_phdr=no +fi +rm -f conftest* + + else + ac_fn_c_check_func "$LINENO" "dl_iterate_phdr" "ac_cv_func_dl_iterate_phdr" +if test "x$ac_cv_func_dl_iterate_phdr" = x""yes; then : + have_dl_iterate_phdr=yes +else + have_dl_iterate_phdr=no +fi + + fi +fi +if test "$have_dl_iterate_phdr" = "yes"; then + +$as_echo "#define HAVE_DL_ITERATE_PHDR 1" >>confdefs.h + +fi + # Check for the fcntl function. if test -n "${with_target_subdir}"; then case "${host}" in |