Commit Graph

17 Commits

Author SHA1 Message Date
Ian Lance Taylor
8c05bcb94f libbacktrace: update copyright years 2024-07-11 18:14:01 -07:00
Ian Lance Taylor
f69acdfbd6 libbacktrace: remove trailing whitespace
* dwarf.c: Remove trailing whitespace.
	* macho.c: Likewise.

Fixes #124
2024-07-11 15:30:09 -07:00
Ian Lance Taylor
afe2967c77 libbacktrace: change PC variables from uint64_t to uintptr_t
Change variables holding PC values from uint64_t to uintptr_t.
	Patch by Björn Schäpers.
	* dwarf.c (struct function_addrs): Change low and high fields to
	uintptr_t.
	(struct unit_addrs): Likewise.
	(resolve_addr_index): Change address parameter to uintptr_t*.
	(add_unit_addr): Change lowpc and highpc parameters to uintptr_t.
	(add_function_range): Likewise.
	(struct pcrange): Change lowpc and highpc fields to uintptr_t.
	(add_low_high_range): Change add_range lowpc and highpc parameters
	to uintptr_t.
	(add_ranges_from_ranges): Likewise.
	(add_ranges_from_rnglists): Likewise.
	(add_low_high_range): Chnage lowpc and highpc variables to
	uintpr_t.
	(add_ranges_from_rnglists): Change some local variables to
	uintptr_t.
	(add_ranges_from_ranges): Change base parameter to uintptr_t.
	(add_ranges_from_rnglists): Likewise.
	(read_function_entry): Likewise.
	(resolve_addr_index): Add explicit casts to uintptr_t.
	(update_pcrange): Likewise.
	(add_ranges_from_ranges): Likewise.
	(add_ranges_from_rnglists): Likewise.
	(read_function_entry): Likewise.
2023-01-20 14:25:38 -08:00
Ian Lance Taylor
2446c66076 libbacktrace: gather address ranges from skeleton units
* dwarf.c (find_address_ranges): Handle skeleton units.
	(read_function_entry): Likewise.
2022-02-17 08:27:13 -08:00
Ian Lance Taylor
509f74a2fb libbacktrace: initialize DWARF 5 fields of unit
When I added the fields in 2019-12-13 I forgot to initialize them.

	* dwarf.c (build_address_map): Initialize DWARF 5 fields of unit.
2022-02-16 11:42:40 -08:00
Ian Lance Taylor
4f57c99971 libbacktrace: don't special case file 0
It's no longer necessary as file 0 is now set up in all cases.

	* dwarf.c (read_line_program): Don't special case file 0.
	(read_function_entry): Likewise.

Fixes #69
2021-03-02 18:17:36 -08:00
Ian Lance Taylor
59473f7906 libbacktrace: pass -1 to error callback for unrecognized DWARF
PR libbacktrace/98818
	* dwarf.c (dwarf_buf_error): Add errnum parameter.  Change all
	callers.
	* backtrace.h: Update backtrace_error_callback comment.
2021-03-02 13:49:18 -08:00
Ian Lance Taylor
096650403a libbacktrace: use correct directory/filename for DWARF 5
PR debug/98716
	* dwarf.c (read_v2_paths): Allocate zero entry for dirs and
	filenames.
	(read_line_program): Remove parameter u, change caller.  Don't
	subtract one from dirs and filenames index.
	(read_function_entry): Don't subtract one from filenames index.
2021-01-18 14:57:11 -08:00
Jakub Jelinek
5496ee0a1a Update copyright years. 2021-01-18 14:56:19 -08:00
Ian Lance Taylor
1da441c1b0 libbacktrace: correct buffer overflow tests
* dwarf.c (resolve_string): Use > rather than >= to check whether
	string index extends past buffer.
	(resolve_addr_index): Similarly for address index.
2020-12-04 11:19:55 -08:00
Ian Lance Taylor
95e8e96c86 libbacktrace: handle pc == low correctly
* dwarf.c (report_inlined_functions): Handle PC == -1 and PC ==
	p->low.
	(dwarf_lookup_pc): Likewise.
2020-09-27 17:30:21 -07:00
Ian Lance Taylor
430dc8b6fe libbacktrace: avoid ambiguous binary search
Searching for a range match can cause the search order to not match
the sort order, which can cause libbacktrace to miss matching entries.
Allocate an extra entry at the end of function_addrs and unit_addrs vectors,
so that we can safely compare to the next entry when searching.
Adjust the matching code accordingly.

Fixes #44

	* dwarf.c (function_addrs_search): Compare against the next entry
	low address, not the high address.
	(unit_addrs_search): Likewise.
	(build_address_map): Add a trailing unit_addrs.
	(read_function_entry): Add a trailing function_addrs.
	(read_function_info): Likewise.
	(report_inlined_functions): Search backward for function_addrs
	match.
	(dwarf_lookup_pc): Search backward for unit_addrs and
	function_addrs matches.
2020-09-27 17:17:59 -07:00
Ian Lance Taylor
bd02146d90 Update copyright years. 2020-02-18 18:46:13 -08:00
Ian Lance Taylor
559ab7cab4 libbacktrace: update to current version from GCC trunk
This adds DWARF 5 support as well as an enhanced testsuite.

Patch assembled by Than McIntosh.
2019-12-23 18:55:51 -08:00
Than McIntosh
17f687d2b9 Update from gcc trunk version of libbacktrace at svn rev 256427. (#8)
Includes (among other things) support for compressed debug sections,
a variety of bugfixes, and expanded test coverage.
2018-01-12 10:26:02 -08:00
Ian Lance Taylor
ba79a27ee9 all: remove meaningless trailing whitespace 2016-09-11 06:45:37 -07:00
Ian Lance Taylor
84241313f2 libbacktrace: initial commit
This is a standalone version of the libbacktrace library that I
originally wrote for GCC.  This is a copy of libbacktrace from GCC
trunk, with all dependencies incorporated here.
2016-09-10 07:59:09 -07:00