summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_end.c
Commit message (Collapse)AuthorAgeFilesLines
* libdw: Handle split Dwarf Dies in dwarf_die_addr_die.Mark Wielaard2018-05-311-0/+3
| | | | | | | | | | | | | | | | | | | dwarf_die_addr_die can be used to turn an Dwarf_Die addr back into a full Dwarf_Die, just given the original Dwarf debug handle. This now also works for Dwarf_Dies which originated from a split Dwarf. Whenever a split Dwarf_CU is found the Dwarf it originated from is registered with the Dwarf that the skeleton Dwarf_CU came from. All registered split Dwarfs are then searched by dwarf_die_addr_die if the addr didn't match the main Dwarf or the alt Dwarf. One limitation in this implementation is that only DIEs that come from the main .debug_info in the .dwo are supported. Theoretically there could also be DIEs in an .debug_type or from other/multiple (comdat) sections. New tests are added for dwarf-4, dwarf-5, split-dwarf-4, split-dwarf-5 and version 4 and 5 dwo files. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Handle .debug_loclists in dwarf_getlocation.Mark Wielaard2018-05-301-0/+5
| | | | | | | | | | | | | Handle all new DW_LLE opcodes in .debug_loclists in dwarf_getlocation. __libdw_read_begin_end_pair_inc now also handles a default location (which is simply the range [0,-1]). Since expression blocks can now also come from the .debug_loclists section add a new fake_loclists_cu necessary for checking bounds while parsing expression blocks. Adapt varlocs test to handle debug-only files. Test testfileranges5.debug and testfilesplitranges5.debug with it. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Support DW_OP_addrx/constx and split DWARF addrx/constx support.Mark Wielaard2018-05-251-1/+11
| | | | | | | | | | | | | | | | | | | DW_OP_addrx/constx and GNU DebugFission DW_OP_GNU_addr/const_index take as argument an index into the .debug_addr section for the associated CU. This index gets resolved through dwarf_getlocation_attr. A new fake addr CU is created per Dwarf for use with this new attribute. For split DWARF files, the IDX_debug_addr gets replaced with the skeleton section and the addr base is resolved immediately when constructing the split DWARF CU. Move __libdw_cu_addr_base to libdwP.h to share with eu-readelf. Also make it possible to resolve addrx[1234]/GNU_addr_index also as constant indexes to (also) show when displaying these attributes in eu-readelf. A new varlocs tests is added to test the resolving for both the DWARF4 and DWARF5 DW_OP variants. And now that addrx forms are resolved in split DWARF files add the new DIEs with "single ranges" (those DIEs that have a lowpc/highpc attribute pair) to run-all-dwarf-ranges.sh. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Cache ELF directory early. Explicitly set it in dwfl.Mark Wielaard2018-05-201-0/+3
| | | | | | | | | | | The logic that finds alt files and dwo files relies on having an open file descriptor. But after all needed ELF data has been read the underlying Elf file descriptor can be closed. libdwfl in particular closes file descriptor fairly aggressively. So capture the directory early on. And make dwfl set it if it has recorded it. Which it will do now before closing a file descriptor for the main Dwfl_Module file. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: dwarf_get_units find split units from .dwo.Mark Wielaard2018-05-191-0/+5
| | | | | | | | | | | | For a skeleton DIE dwarf_get_units should provide the split DIE as subdie. This implements that by trying to find the (named) .dwo file and finding the matching CU in it. The .dwo file is search relative to the current DWARF or using the comp_dir of the skeleton DIE. Also fixes a small issue with str_offsets_base_off which is tested in the new testcase (by getting the name of the split CU DIE). Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Resolve alt file on first use.Mark Wielaard2018-01-251-1/+9
| | | | | | | | | | | | | | | | | | | | | Add a new alt_fd field to the Dwarf struct. This tracks whether we tried to open the alt file ourselves. This is used in dwarf_getalt to see if we should try to find and open the alt file ourselves (if the user hasn't called dwarf_setalt yet). dwarf_formref_die and dwarf_formstring now call dwarf_getalt instead of accessing the alt_dwarf Dwarf field directly. For applications using libdwfl nothing changes (dwfl will find, set and clean up the alt file). For programs that set the alt file themselves already through other means, nothing changes. But for applications that don't create the Dwarf through libdwfl and don't set the alt file already libdw will now try to find and set it on first access. If found the application will now not get errors for missing alt files. Add a simple testcase based on the existing allfcts test which already tries to set the alt file, but is too simplistic to find it in some subdir (relative to the main debug file). Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Use elf_compress[_gnu] to uncompress debug section data.Mark Wielaard2016-01-061-20/+0
| | | | | | | | libdw used its own code for decompressing GNU style .zdebug sections. Using elf_compress and elf_compress_gnu instead makes it possible to transparently use either GNU style or ELF style compressed data. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Don't leak fake_loc_cu.Mark Wielaard2016-01-021-1/+5
| | | | | | | | The fake_loc_cu is used when synthesizing attributes for Dwarf_Ops that came from a location list entry in dwarf_getlocation_attr. Make sure we remove the loc cache stored in it when disposing of the fake_loc_cu. Signed-off-by: Mark Wielaard <[email protected]>
* Remove old-style function definitions.Mark Wielaard2015-09-231-2/+1
| | | | | | | We already require -std=gnu99 and old-style function definitions might hide some compiler warnings. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Make sure all attributes come with a (fake) CU for bound checks.Mark Wielaard2014-12-171-0/+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]>
* Support .debug_macroPetr Machata2014-11-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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]>
* libdwfl: Move dwz alt multi file searching to find_debuginfo callback.Mark Wielaard2014-05-021-5/+1
| | | | | | | | | | Don't hard code the Dwarf dwz alt multi file search but allow the user to override it through the standard Dwfl_Callbacks. Also move ownership completely to the user of dwarf_setalt by removing free_alt from Dwarf and adding alt, fd and elf fields to Dwfl_Module. Add a relative .dwz file test case. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Add support for DWZ multifile forms DW_FORM_GNU_ref_alt/strp_alt.Mark Wielaard2012-08-091-0/+4
| | | | | | | | | | | | | | | DWZ multifile forms http://www.dwarfstd.org/ShowIssue.php?issue=120604.1 DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt reference an alternative debuginfo file. dwarf_begin and dwarf_begin_elf will try to use this automatically. There are no user visible changes to the libdw interface. dwarf_formref_die, dwarf_formstring and dwarf_formudata can now return a Dwarf_Die which comes from a CU in the alternative Dwarf descriptor. __libdw_read_offset was adjusted to take an alternative Dwarf descriptor into account. Signed-off-by: Mark Wielaard <[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]>
* Support reading .zdebug_* DWARF sections compressed via zlib.Roland McGrath2011-02-231-1/+23
|
* Finish .debug_types support in libdw and readelf.Roland McGrath2010-06-201-0/+1
|
* Handle reading .debug_types section.Roland McGrath2010-06-161-1/+3
|
* CFI support: lookup by PC and translate into DWARF location per registerRoland McGrath2009-07-081-2/+6
|
* 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)
* libdw/Roland McGrath2005-08-091-0/+1
| | | | | | | | | | | | | | | | | | | | 2005-08-09 Roland McGrath <[email protected]> * dwarf_end.c: Add INTDEF. * dwarf_error.c (dwarf_errmsg): Likewise. * libdwP.h (dwarf_end, dwarf_errmsg): Add INTDECLs. libdwfl/ 2005-08-09 Roland McGrath <[email protected]> * libdwflP.h: Include ../libdw/libdwP.h for its INTDECLs. * cu.c: Use INTUSE on dwarf_* calls. * dwfl_error.c: Likewise. * dwfl_module.c: Likewise. * dwfl_module_getdwarf.c: Likewise. * dwfl_module_getsrc_file.c: Likewise. * lines.c: Likewise.
* Adjust for monotone.Ulrich Drepper2005-07-261-0/+75