summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getmacros.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove old-style function definitions.Mark Wielaard2015-09-231-5/+2
| | | | | | | We already require -std=gnu99 and old-style function definitions might hide some compiler warnings. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Detect dwarf_formudata errors in dwarf_getmacros.Mark Wielaard2015-06-191-2/+4
| | | | | | dwarf_formudata can return an error for bad DWARF. Don't ignore it. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Don't overflow stack with user defined macro attributes array.Mark Wielaard2015-04-221-4/+26
| | | | | | | | | | | | In theory user defined debug macros can have an arbitrary number of arguments. Don't allocate them all on stack. If there are more than 8 (arbitrary number, but no sane macro should have more arguments), then dynamically allocate and free the attributes. Found by gcc -fsanitize=undefined. Which pointed out the nforms could be zero, creating an empty vla (which could cause undefined behavior). Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Add get_uleb128 and get_sleb128 bounds checking.Mark Wielaard2014-12-171-1/+4
| | | | | | | | | | | Both get_uleb128 and get_sleb128 now take an end pointer to prevent reading too much data. Adjust all callers to provide the end pointer. There are still two exceptions. "Raw" dwarf_getabbrevattr and read_encoded_valued don't have a end pointer associated yet. They will have to be provided in the future. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Make sure all attributes come with a (fake) CU for bound checks.Mark Wielaard2014-12-171-2/+3
| | | | | | | | | | All attributes now have a reference to a (fake) CU that has startp and endp set to the data section where the form data comes from. Use that for bounds checking in __libdw_form_val_len and dwarf_formblock to make sure data read doesn't overflow any data section. Remove libdwP.h cu_data and use cu startp and endp directly where appropriate. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Add overflow checking to __libdw_form_val_len.Mark Wielaard2014-12-111-2/+6
| | | | | | | | Pass endp as argument to __libdw_form_val_len and check we don't read beyond the end of expected data and don't return lengths that would overflow. Signed-off-by: Mark Wielaard <[email protected]>
* Change calling convention of dwarf_getmacros to allow opcode 0xffPetr Machata2014-12-101-69/+92
| | | | | | | | | We now require callers to pass DWARF_GETMACROS_START to start the iteration. 0 is still accepted, but signals to libdw that the iteration request comes from an old-style caller, and that opcode 0xff should be rejected when iterating .debug_macro, to avoid confusion. Signed-off-by: Petr Machata <[email protected]>
* Support .debug_macroPetr Machata2014-11-101-82/+455
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - This code is based on the following proposal: http://www.dwarfstd.org/ShowIssue.php?issue=110722.1 - dwarf_getmacros serves either of .debug_macinfo or .debug_macro transparently, but if the latter uses opcode 0xff, it bails out with an error. The reason is that in .debug_macro, 0xff is a custom code that can mean anything, while in .debug_macinfo there's fixed semantics associated with 0xff. - dwarf_getmacros_off is a new interface used for requesting iteration through transparently included units. - dwarf_macro_getparamcnt and dwarf_macro_param are new interfaces used for requesting number of parameters of an opcode and individual parameters. dwarf_macro_getsrcfiles is a new interface used for requesting a file part of .debug_line unit associated with macro unit that the opcode comes from. - The existing interfaces dwarf_macro_opcode, dwarf_macro_param1 and dwarf_macro_param2 remain operational for old- as well as new-style Dwarf macro sections, if applicable. - dwarf_getsrclines was made into a light wrapper around a worker function that loads line unit given its offset. The worker also caches loaded units in an offset-keyed search tree, so that we don't end up re-reading units even though they were read in a different domain (e.g. a macro unit request can prime cache for later CU lookup). dwarf_macro_getsrcfiles calls the worker function under covers. Signed-off-by: Petr Machata <[email protected]>
* Update name, license and contributor policy.Mark Wielaard2012-06-051-40/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change name from "Red Hat elfutils" to "elfutils". * Update license of standalone tools and test from GPLv2 to GPLv3+. * Change license of libraries from GPLv2+exception to GPLv2/LGPLv3+. * Add Developer Certificate of Origin based contributor policy. top-level: - COPYING: Upgraded from GPLv2 to GPLv3. - CONTRIBUTING, COPYING-GPLv2, COPYING-LGPLv3: New files. - NEWS: Added note about new contribution and license policy. - Makefile.am: Updated to GPLv3, added new files to EXTRA_DIST. - configure.ac: Update to GPLv3, changed AC_INIT name to 'elfutils'. backends, lib, libasm, libcpu, libdw, libdwfl, libebl, libelf: - All files updated to GPLv2/LGPLv3+. Except some very small files (<5 lines) which didn't have any headers at all before, the linker .maps files and the libcpu/defs files which only contain data and libelf/elf.h which comes from glibc and is under LGPLv2+. config: - elfutils.spec.in: Add new License: headers and new %doc files. - Update all license headers to GPLv2/LGPLv3+ for files used by libs. src, tests: - All files updated to GPLv3+. Except for the test bz2 data files, the linker maps and script files and some very small files (<5 lines) that don't have any headers. Signed-off-by: Richard Fontana <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* TypoRoland McGrath2009-05-071-1/+1
|
* Fix trivial regression in last commit.Roland McGrath2009-05-071-0/+3
|
* Slight optimization of dwarf_getmacros for loops.Roland McGrath2009-05-071-14/+20
|
* Fix dwarf_getmacros so that it passes newly-added testPetr Machata2009-05-071-10/+11
|
* Fix FSF address. No exception for libdwarf.Ulrich Drepper2006-04-041-1/+1
|
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2006-04-041-9/+45
| | | | | | 4f8fc821345feef58624f0aa5b470d4827577d8c) to branch 'com.redhat.elfutils' (head 76e26cb54695fd3b21ee8fb5be3036bd68200633)
* Adjust for monotone.Ulrich Drepper2005-07-261-0/+119