Commit Graph

55 Commits

Author SHA1 Message Date
Ian Lance Taylor
ef6394205d libbacktrace: don't crash if ELF file has no sections
libbacktrace/
	* elf.c (elf_add): Bail early if there are no section headers at all.
2020-05-09 20:34:25 -07:00
Ian Lance Taylor
8600440e14 libbacktrace: don't free ELF strtab if error occurs after saving syminfo
* elf.c (elf_add): Don't free strtab if an error occurs after
	recording symbol information.
2020-05-09 16:12:48 -07:00
Ian Lance Taylor
31ae7b863a libbacktrace: sometimes read debug sections individually
libbacktrace/
	* elf.c (elf_add): If debug sections are very large or far apart,
	read them individually rather than as a single view.
2020-05-09 16:00:54 -07:00
Jakub Jelinek
8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Ian Lance Taylor
c926fd82bb libbacktrace: add DWARF 5 support
* dwarf.c (struct attr): Add val field.
	(enum attr_val_encoding): Add ATTR_VAL_ADDDRESS_INDEX,
	ATTR_VAL_STRING_INDEX, ATTR_VAL_RNGLISTS_INDEX.
	(struct line_header): Add addrsize field.
	(struct line_header_format): Define.
	(struct unit): Add str_offsets_base, addr_base, and rnglists_base
	fields.
	(read_uint24): New static function.
	(read_attribute): Add implicit_val parameter.  Replace dwarf_str
	and dwarf_str_size parameters with dwarf_sections parameter.  Add
	support for new DWARF 5 forms.  Change all callers.
	(resolve_string): New static function.
	(resolve_addr_index): Likewise.
	(read_abbrevs): Support DW_FORM_implicit_const.
	(struct pcrange): Add lowpc_is_addr_index, highpc_is_addr_Index,
	and ranges_is_index fields.
	(update_pcrange): Support DWARF 5 encodings.
	(add_high_low_range): New static function, split out of
	add_ranges.
	(add_ranges_from_ranges): Likewise.
	(add_ranges_from_rnglists): New static function.
	(add_ranges): Just call new helper functions.
	(find_address_ranges): Use resolve_string for strings, after
	reading all attributes.  Handle new DWARF 5 attributes.
	(build_address_map): Support DWARF 5 compilation units.
	(read_v2_paths): New static function, split out of
	read_line_header.
	(read_lnct): New static	function.
	(read_line_header_format_entries): Likewise.
	(read_line_header): Add ddata parameter.  Support DWARF 5 line
	headers.  Call new helper functions.  Change all callers.
	(read_line_program): Use addrsize from line program header.  Don't
	special case directory index 0 for DWARF 5.
	(read_referenced_name): Use resolve_string.
	(read_function_entry): Handle DWARF 5 encodings.  Use
	resolve_string.
	* internal.h (enum dwarf_section): Add DEBUG_ADDR,
	DEBUG_STR_OFFSETS, DEBUG_LINE_STR, DEBUG_RNGLISTS.
	* elf.c (dwarf_section_names): Add new section names.
	* pecoff.c (dwarf_section_names): Likewise.
	* xcoff.c (xcoff_add): Clear dwarf_sections before setting
	fields.
	* configure.ac: Define HAVE_DWARF5 automake conditional.
	* Makefile.am (dwarf5_SOURCES): New variable if HAVE_DWARF5.
	(dwarf5_CFLAGS, dwarf5_LDADD): Likewise.
	(dwarf5_alloc_SOURCES, dwarf5_alloc_CFLAGS): Likewise.
	(dwarf5_alloc_LDADD): Likewise.
	(BUILDTESTS): Add dwarf5 tests if HAVE_DWARF5.
	(CLEANFILES, clean-local): Define.

From-SVN: r279380
2019-12-13 20:04:47 +00:00
Ian Lance Taylor
66ab583969 libbacktrace: simplify DWARF section handling
This is in preparation for adding DWARF 5 support.

	* internal.h (enum dwarf_section): Define.
	(struct dwarf_sections): Define.
	(backtrace_dwarf_add): Update declaration to replace specific
	section parameters with dwarf_sections parameter.
	* dwarf.c (struct dwarf_data): Replace specific section fields
	with dwarf_sections field.
	(read_attribute): Use dwarf_sections with altlink.
	(build_address_map): Replace specific section parameters with
	dwarf_sections parameter.  Change all callers.
	(read_line_info): Use dwarf_sections with ddata.
	(read_referenced_name): Likewise.
	(add_function_ranges): Likewise.
	(read_function_entry): Likewise.
	(read_function_info): Likewise.
	(build_dwarf_data): Replace specific section parameters with
	dwarf_sections parameter.  Change all callers.
	(backtrace_dwarf_add): Likewise.
	* elf.c (enum debug_section): Remove.
	(dwarf_section_names): Remove .zdebug names.
	(elf_add): Track zsections separately.  Build dwarf_sections.
	* pecoff.c (enum debug_section): Remove.
	(struct debug_section_info): Remove data field.
	(coff_add): Build dwarf_sections.
	* xcoff.c (enum dwarf_section): Remove.  Replace DWSECT_xxx
	references with DEBUG_xxx references.
	(xcoff_add): Build dwarf_sections.

From-SVN: r278984
2019-12-05 02:20:11 +00:00
Tom de Vries
3a3f5dd1af [libbacktrace] Fix .gnu_debugaltlink build-id check
The 'debugaltlink_name_len =+ 1' bug reported in PR89136 exposes the fact that
the build-id is not verified for the .gnu_debugaltlink.

Fix both problems.

2019-01-31  Tom de Vries  <tdevries@suse.de>

	PR libbacktrace/89136
	* elf.c (elf_add): Read build-id if with_buildid_data.  Fix
	'debugaltlink_name_len =+ 1'.

From-SVN: r268419
2019-01-31 12:17:32 +00:00
Tom de Vries
fddbc19325 [libbacktrace] Add test-cases exercising build-id and dwz
Add test-cases b2test_buildid and b3test_dwz_buildid.

The last one triggers the segfault fixed by "[backtrace] Avoid segfault"
( r268275 ).

2019-01-29  Tom de Vries  <tdevries@suse.de>

	* install-debuginfo-for-buildid.sh.in: New script.
	* Makefile.am (check_PROGRAMS): Add b2test and b3test.
	(TESTS): Add b2test_buildid and b3test_dwz_buildid.
	* Makefile.in: Regenerate.
	* configure.ac (HAVE_ELF): Set with AM_CONDITIONAL.
	(READELF): Set with AC_CHECK_PROG.
	(install-debuginfo-for-buildid.sh): Generate with AC_CONFIG_FILES.
	* configure: Regenerate.
	* elf.c (SYSTEM_BUILD_ID_DIR): Factor out of ...
	(elf_open_debugfile_by_buildid): ... here.

From-SVN: r268369
2019-01-29 16:25:46 +00:00
Nathan Sidwell
4bfcd13938 [backtrace] Avoid segfault
https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01521.html

	* elf.c (elf_add): Pass "" filename to recursive call with
	separated debug.

From-SVN: r268275
2019-01-25 17:16:53 +00:00
Tom de Vries
c75795fa1d [libbacktrace] Fix strrchr segfault
Currently, when running a libbacktrace testcase t with .gnu_debuglink to
t.debug, and t.debug having a .gnu_debugaltlink to t.alt.debug, a segfault
is triggered when calling strrchr with a NULL string from
elf_find_debugfile_by_debuglink.  The NULL string originates from the elf_add
called for the .gnu_debugaltlink, which uses NULL as filename argument.

Fix this by using "" as filename argument instead.

2019-01-25  Tom de Vries  <tdevries@suse.de>

	* elf.c (elf_add): When handling .gnu_debugaltlink, call elf_add with
	filename == "".
	* Makefile.am (TESTS): Add btest_dwz_gnudebuglink.
	* Makefile.in: Regenerate.

From-SVN: r268269
2019-01-25 14:39:58 +00:00
Ian Lance Taylor
8b248c17bd re PR libbacktrace/88890 (libbacktrace on 32-bit system with _FILE_OFFSET_BITS == 64)
PR libbacktrace/88890
	* mmapio.c (backtrace_get_view): Change size parameter to
	uint64_t.  Check that value fits in size_t.
	* read.c (backtrace_get_view): Likewise.
	* internal.h (backtrace_get_view): Update declaration.
	* elf.c (elf_add): Pass shstrhdr->sh_size to backtrace_get_view.

From-SVN: r268082
2019-01-18 17:13:59 +00:00
Tom de Vries
9ad458d539 [libbacktrace] Add altlink field to struct dwarf_data
Add an altlink field to struct dwarf_data, and initialize it with the pointer
to the struct dwarf_data for the .gnu_debugaltlink.

2019-01-17  Tom de Vries  <tdevries@suse.de>

	* dwarf.c (struct dwarf_data): Add altlink field.
	(backtrace_dwarf_add): Add and handle fileline_altlink parameter.
	* elf.c	(elf_add): Add argument to backtrace_dwarf_add call.
	(phdr_callback, backtrace_initialize): Add argument to elf_add calls.
	* internal.h (backtrace_dwarf_add): Add fileline_altlink parameter.
	* pecoff.c (coff_add): Add argument to backtrace_dwarf_add call.
	* xcoff.c (xcoff_add): Same.

From-SVN: r267994
2019-01-17 00:07:43 +00:00
Tom de Vries
e6f00c83f4 [libbacktrace] Return struct dwarf_data pointer from elf_add
Allow the caller of elf_add access to the struct dwarf_data pointer
corresponding to the added elf.

2019-01-17  Tom de Vries  <tdevries@suse.de>

	* internal.h (backtrace_dwarf_add): Add fileline_entry parameter.
	* dwarf.c (backtrace_dwarf_add): Add and handle fileline_entry parameter.
	* elf.c	(elf_add): Add and handle fileline_entry parameter.  Add
	argument to backtrace_dwarf_add call.
	(phdr_callback, backtrace_initialize): Add argument to elf_add calls.
	* pecoff.c (coff_add): Add argument to backtrace_dwarf_add call.
	* xcoff.c (xcoff_add): Same.

From-SVN: r267993
2019-01-17 00:07:32 +00:00
Tom de Vries
a34c2a3d19 [libbacktrace] Read .gnu_debugaltlink
Read the elf file pointed at by the .gnu_debugaltlink section, and verify that
the build id matches.

2019-01-17  Tom de Vries  <tdevries@suse.de>

	* elf.c (elf_add): Add and handle with_buildid_data and
	with_buildid_size parameters.  Handle .gnu_debugaltlink section.
	(phdr_callback, backtrace_initialize): Add arguments to elf_add calls.

From-SVN: r267992
2019-01-17 00:07:21 +00:00
Jakub Jelinek
a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Denis Khalikov
1ac6620a52 re PR other/86198 (Libbacktrace does not properly work with ".note.gnu.build-id" section)
libbacktrace/

2018-06-21 Denis Khalikov <d.khalikov@partner.samsung.com>

	PR other/86198
	* elf.c (elf_add): Increase ".note.gnu.build-id" section size
	checking up to 36 bytes.

From-SVN: r261832
2018-06-21 08:42:53 +03:00
Jakub Jelinek
c5c4b2ae6e re PR other/85161 (Test case failures in libbacktrace on powerpc64 BE starting with r253456)
PR other/85161
	* elf.c (elf_zlib_fetch): Fix up predefined macro names in test for
	big endian, only use 32-bit loads if endianity macros are predefined
	and indicate big or little endian.

From-SVN: r259096
2018-04-04 19:18:14 +02:00
Jakub Jelinek
bcc23586c5 re PR other/82368 (with r253275 several new test cases in libbacktrace fail)
PR other/82368
	* elf.c (SHT_PROGBITS): Undefine and define.

From-SVN: r257685
2018-02-15 12:32:27 +01:00
Jakub Jelinek
da07141fd7 re PR other/82368 (with r253275 several new test cases in libbacktrace fail)
PR other/82368
	* elf.c (EM_PPC64, EF_PPC64_ABI): Undefine and define.
	(struct elf_ppc64_opd_data): New type.
	(elf_initialize_syminfo): Add opd argument, handle symbols
	pointing into the PowerPC64 ELFv1 .opd section.
	(elf_add): Read .opd section on PowerPC64 ELFv1, pass pointer
	to structure with .opd data to elf_initialize_syminfo.

From-SVN: r257658
2018-02-14 15:19:36 +01:00
Ian Lance Taylor
65d0b85990 elf.c (elf_add): Close descriptor if we use a debugfile.
* elf.c (elf_add): Close descriptor if we use a debugfile.
	* btest.c (check_open_files): New static function.
	(main): Call check_open_files.

From-SVN: r257275
2018-01-31 23:23:21 +00:00
Ian Lance Taylor
96f7c2a94a elf.c (elf_open_debugfile_by_debuglink): Don't check CRC if the desired CRC is zero.
* elf.c (elf_open_debugfile_by_debuglink): Don't check CRC if the
	desired CRC is zero.
	(elf_add): Don't clear *found_sym and *found_dwarf if debuginfo.

From-SVN: r257062
2018-01-25 18:14:04 +00:00
Ian Lance Taylor
566588f1a2 elf.c (codes): Fix size to be 288.
* elf.c (codes) [GENERATE_FIXED_HUFFMAN_TABLE]: Fix size to be
	288.
	(main) [GENERATE_FIXED_HUFFMAN_TABLE]: Pass 288 to
	elf_zlib_inflate_table.  Generate elf_zlib_default_dist_table.
	(elf_zlib_default_table): Update.
	(elf_zlib_default_dist_table): New static array.
	(elf_zlib_inflate): Use elf_zlib_default_dist_table for dist table
	for block type 1.
	* ztest.c (struct zlib_test): Add uncompressed_len.
	(tests): Initialize uncompressed_len field.  Add new test case.
	(test_samples): Use uncompressed_len field.

From-SVN: r256776
2018-01-17 01:39:05 +00:00
Jakub Jelinek
85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Ian Lance Taylor
a978e26b83 elf.c (elf_zlib_fetch): Change pval argument to uint64_t *.
* elf.c (elf_zlib_fetch): Change pval argument to uint64_t *.
	Read a four byte integer.
	(elf_zlib_inflate): Change val to uint64_t.  Align pin to a 32-bit
	boundary before ever calling elf_zlib_fetch.
	* ztest.c (test_large): Simplify print statements a bit.

From-SVN: r253456
2017-10-05 16:39:38 +00:00
Ian Lance Taylor
8da872d9ca re PR other/67165 (please enable libbacktrace to work with compressed debug sections)
PR other/67165
	* elf.c (__builtin_prefetch): Define if not __GNUC__.
	(unlikely): Define.
	(SHF_UNCOMPRESSED, ELFCOMPRESS_ZLIB): Define.
	(b_elf_chdr): Define type.
	(enum debug_section): Add ZDEBUG_xxx values.
	(debug_section_names): Add names for new sections.
	(struct debug_section_info): Add compressed field.
	(elf_zlib_failed, elf_zlib_fetch): New static functions.
	(HUFFMAN_TABLE_SIZE, HUFFMAN_VALUE_MASK): Define.
	(HUFFMAN_BITS_SHIFT, HUFFMAN_BITS_MASK): Define.
	(HUFFMAN_SECONDARY_SHIFT): Define.
	(ZDEBUG_TABLE_SIZE): Define.
	(ZDEBUG_TABLE_CODELEN_OFFSET, ZDEBUG_TABLE_WORK_OFFSET): Define.
	(final_next_secondary): New static variable if
	BACKTRACE_GENERATE_FIXED_HUFFMAN_TABLE.
	(elf_zlib_inflate_table): New static function.
	(BACKTRACE_GENERATE_FIXED_HUFFMAN_TABLE): If define, define main
	function to produce fixed Huffman table.
	(elf_zlib_default_table): New static variable.
	(elf_zlib_inflate): New static function.
	(elf_zlib_verify_checksum): Likewise.
	(elf_zlib_inflate_and_verify): Likewise.
	(elf_uncompress_zdebug): Likewise.
	(elf_uncompress_chdr): Likewise.
	(backtrace_uncompress_zdebug): New extern function.
	(elf_add): Look for .zdebug sections and SHF_COMPRESSED debug
	sections, and uncompress them.
	* internal.h (backtrace_compress_zdebug): Declare.
	* ztest.c: New file.
	* configure.ac: Check for -lz and check whether the linker
	supports --compress-debug-sections.
	* Makefile.am (ztest_SOURCES): New variable.
	(ztest_CFLAGS, ztest_LDADD): New variables.
	(check_PROGRAMS): Add ztest.
	(ctestg_SOURCES): New variable.
	(ctestg_CFLAGS, ctestg_LDFLAGS, ctestg_LDADD): New variables.
	(ctesta_SOURCES): New variable.
	(ctesta_CFLAGS, ctesta_LDFLAGS, ctesta_LDADD): New variables.
	(check_PROGRAMS): Add ctestg and ctesta.
	* configure, config.h.in, Makefile.in: Rebuild.

From-SVN: r253275
2017-09-29 00:30:35 +00:00
Ian Lance Taylor
8c2ea6b20a re PR sanitizer/77631 (no symbols in backtrace shown by ASan when debug info is split)
PR sanitizer/77631
	* configure.ac: Check for lstat and readlink.
	* elf.c (lstat, readlink): Provide dummy versions if real versions
	are not available.
	* configure, config.h.in: Rebuild.

From-SVN: r253095
2017-09-22 13:38:10 +00:00
Ian Lance Taylor
f0de45420d re PR go/82284 (go -version segfaults on big endian architectures)
PR go/82284
	* elf.c (backtrace_initialize): Set pd.exe_filename.

From-SVN: r253078
2017-09-21 18:44:39 +00:00
Ian Lance Taylor
9283471ba0 re PR sanitizer/77631 (no symbols in backtrace shown by ASan when debug info is split)
PR sanitizer/77631
	Support for external debug info.
	* elf.c: Include <errno.h>, <sys/stat.h>, <unistd.h>.
	(S_ISLNK): Define if not defined.
	(xstrnlen): Define if strnlen is not available.
	(b_elf_note): Define type.
	(NT_GNU_BUILD_ID): Define macro.
	(elf_crc32, elf_crc32_file): New static functions.
	(elf_is_symlink, elf_readlink): New static functions.
	(elf_open_debugfile_by_buildid): New static function.
	(elf_try_debugfile): New static function.
	(elf_find_debugfile_by_debuglink): New static function.
	(elf_open_debugfile_by_debuglink): New static function.
	(elf_add): Add filename and debuginfo parameters.  Adjust all
	callers.  Look for external debug info notes, and try to fetch
	debug info from external file.
	(struct phdr_data): Add exe_filename field.
	(phdr_callback): Pass filename to elf_add.
	(backtrace_initialize): Add filename parameter.
	* internal.h (backtrace_initialize): Add filename parameter.
	* fileline.c (fileline_initialize): Pass filename to
	backtrace_initialize.
	* pecoff.c (fileline_initialize): Add unused filename parameter.
	* unknown.c (fileline_initialize): Likewise.
	* xcoff.c (fileline_initialize): Likewise.
	* configure.ac: Check for objcopy --add-gnu-debuglink.
	* Makefile.am (dtest): New test target.
	* configure, Makefile.in: Rebuild.

Co-Authored-By: Denis Khalikov <d.khalikov@partner.samsung.com>

From-SVN: r253032
2017-09-20 21:09:37 +00:00
Tony Reix
7e2a8417f7 configure.ac: Check for XCOFF32/XCOFF64.
* configure.ac: Check for XCOFF32/XCOFF64.  Check for loadquery.
	* filetype.awk: Separate AIX XCOFF32 and XCOFF64.
	* xcoff.c: Add support for AIX XCOFF32 and XCOFF64 formats.
	* configure, config.h.in: Regenerate.

From-SVN: r250590
2017-07-26 21:43:28 +00:00
Ian Lance Taylor
d1609a2326 elf.c (backtrace_initialize): Always set *fileline_fn.
* elf.c (backtrace_initialize): Always set *fileline_fn.
	* ttest.c: New file.
	* btest.c: Move support functions into testlib.c.  Change calls to
	check to pass file name.
	* testlib.c: New file, copied from (part of) btest.c.
	* testlib.h: New file, declarations for testlib.c.
	* edtest.c: Use testlib.h and testlib.c.
	* configure.ac: Test for -pthread, set HAVE_PTHREAD conditional.
	* Makefile.am (btest_SOURCES): Add testlib.c.
	(edtest_SOURCES): Likewise.
	(CHECK_PROGRAMS): Add ttest if HAVE_PTHREAD.
	(ttest_SOURCES, ttest_CFLAGS, ttest_LDADD): Define.
	* configure, Makefile.in: Rebuild.

From-SVN: r249111
2017-06-12 03:25:04 +00:00
Jakub Jelinek
cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Carlos Liam
84ebf639b8 * all: Remove meaningless trailing whitespace.
From-SVN: r240084
2016-09-11 13:44:07 +00:00
Uros Bizjak
28644f75a9 re PR target/71161 (Lots of ASAN and libgo runtime FAILs after r236090)
PR target/71161
	* elf.c (phdr_callback) [__i386__]: Add
	__attribute__((__force_align_arg_pointer__)).

From-SVN: r236397
2016-05-18 16:40:54 +02:00
Max Ostapenko
26ac52dba5 elf.c (backtrace_initialize): Properly initialize elf_fileline_fn to avoid possible crash.
libbacktrace/

2016-03-02  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>

	* elf.c (backtrace_initialize): Properly initialize elf_fileline_fn to
	avoid possible crash.
	(elf_add): Don't set *fileline_fn to elf_nodebug value in case of
	missing debug info anymore.

From-SVN: r233911
2016-03-02 18:32:55 +02:00
Jakub Jelinek
818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
John David Anglin
2f401a8f18 PR 68115/libfortran
PR 68115/libfortran
	* configure.ac: Set libbacktrace_cv_sys_sync to no on hppa*-*-hpux*.
	* configure: Regenerate.
	* elf.c (backtrace_initialize): Cast __sync_bool_compare_and_swap call
	to void.

From-SVN: r231485
2015-12-10 01:08:13 +00:00
Jakub Jelinek
5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Ian Lance Taylor
c5604b48f9 sort.c: New file.
* sort.c: New file.
	* stest.c: New file.
	* internal.h (backtrace_qsort): Declare.
	* dwarf.c (read_abbrevs): Call backtrace_qsort instead of qsort.
	(read_line_info, read_function_entry): Likewise.
	(read_function_info, build_dwarf_data): Likewise.
	* elf.c (elf_initialize_syminfo): Likewise.
	* Makefile.am (libbacktrace_la_SOURCES): Add sort.c.
	(stest_SOURCES, stest_LDADD): Define.
	(check_PROGRAMS): Add stest.

From-SVN: r208392
2014-03-07 05:07:56 +00:00
Richard Sandiford
afeba5cb1d Update copyright years in libbacktrace/
From-SVN: r206292
2014-01-02 22:24:37 +00:00
Jakub Jelinek
0284b52ec9 elf.c (ET_DYN): Undefine and define again.
* elf.c (ET_DYN): Undefine and define again.
	(elf_add): Add exe argument, if true and ehdr.e_type is ET_DYN,
	return early -1 without closing the descriptor.
	(struct phdr_data): Add exe_descriptor.
	(phdr_callback): If pd->exe_descriptor is not -1, for very first
	call if dlpi_name is NULL just call elf_add with the exe_descriptor,
	otherwise backtrace_close the exe_descriptor if not -1.  Adjust
	call to elf_add.
	(backtrace_initialize): Adjust call to elf_add.  If it returns
	-1, set pd.exe_descriptor to descriptor, otherwise set it to -1.

From-SVN: r205748
2013-12-06 15:48:17 +01:00
Jakub Jelinek
1f96a712d1 backtrace.h (backtrace_syminfo_callback): Add symsize argument.
* backtrace.h (backtrace_syminfo_callback): Add symsize argument.
	* elf.c (elf_syminfo): Pass 0 or sym->size to the callback as
	last argument.
	* btest.c (struct symdata): Add size field.
	(callback_three): Add symsize argument.  Copy it to the data->size
	field.
	(f23): Set symdata.size to 0.
	(test5): Likewise.  If sizeof (int) > 1, lookup address of
	((uintptr_t) &global) + 1.  Verify symdata.val and symdata.size
	values.

From-SVN: r205028
2013-11-19 15:46:03 +01:00
Ian Lance Taylor
49579c7e20 configure.ac: Check for support of __atomic extensions.
* configure.ac: Check for support of __atomic extensions.
	* internal.h: Declare or #define atomic functions for use in
	backtrace code.
	* atomic.c: New file.
	* dwarf.c (dwarf_lookup_pc): Use atomic functions.
	(dwarf_fileline, backtrace_dwarf_add): Likewise.
	* elf.c (elf_add_syminfo_data, elf_syminfo): Likewise.
	(backtrace_initialize): Likewise.
	* fileline.c (fileline_initialize): Likewise.
	* Makefile.am (libbacktrace_la_SOURCES): Add atomic.c.
	* configure, config.h.in, Makefile.in: Rebuild.

From-SVN: r204994
2013-11-19 01:09:47 +00:00
Jakub Jelinek
f18578157d elf.c (SHN_UNDEF): Define.
* elf.c (SHN_UNDEF): Define.
	(elf_initialize_syminfo): Add base_address argument.  Ignore symbols
	with st_shndx == SHN_UNDEF.  Add base_address to address fields.
	(elf_add): Adjust caller.

From-SVN: r204975
2013-11-18 18:15:07 +01:00
Jakub Jelinek
582f5a2df8 * elf.c (phdr_callback): Process info->dlpi_addr == 0 normally.
From-SVN: r204971
2013-11-18 17:30:44 +01:00
Ian Lance Taylor
cfa658e4f8 backtrace.h (backtrace_syminfo): Update comment and parameter name to take any address, not just a PC value.
* backtrace.h (backtrace_syminfo): Update comment and parameter
	name to take any address, not just a PC value.
	* elf.c (STT_OBJECT): Define.
	(elf_nosyms): Rename parameter pc to addr.
	(elf_symbol_search): Rename local variable pc to addr.
	(elf_initialize_syminfo): Add STT_OBJECT symbols to elf_symbols.
	(elf_syminfo): Rename parameter pc to addr.
	* btest.c (global): New global variable.
	(test5): New test.
	(main): Call test5.

From-SVN: r204904
2013-11-16 18:20:33 +00:00
Ian Lance Taylor
6c084a5b37 elf.c (elf_add): Don't get the wrong offsets if a debug section is missing.
* elf.c (elf_add): Don't get the wrong offsets if a debug section
	is missing.

From-SVN: r203810
2013-10-18 04:24:48 +00:00
Alexander Monakov
78625ce608 elf.c (elf_syminfo): Loop over the elf_syminfo_data chain.
* elf.c (elf_syminfo): Loop over the elf_syminfo_data chain.

From-SVN: r201159
2013-07-23 13:17:10 +04:00
Alexander Monakov
0153887c3d elf.c (backtrace_initialize): Pass elf_fileline_fn to dl_iterate_phdr callbacks.
* elf.c (backtrace_initialize): Pass elf_fileline_fn to
	dl_iterate_phdr callbacks.

From-SVN: r201158
2013-07-23 13:12:00 +04:00
Richard Sandiford
f8a7e1a44d Update copyright years in libbacktrace.
From-SVN: r195165
2013-01-14 18:17:30 +00:00
Ian Lance Taylor
73f4149137 re PR other/55087 (bogus "linux-vdso.so.1: No such file or directory" caused by libbacktrace)
PR other/55087
	* posix.c (backtrace_open): Add does_not_exist parameter.
	* elf.c (phdr_callback): Do not warn if shared library could not
	be opened.
	* fileline.c (fileline_initialize): Update calls to
	backtrace_open.
	* internal.h (backtrace_open): Update declaration.

From-SVN: r192861
2012-10-26 20:08:29 +00:00