summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getalt.c
Commit message (Collapse)AuthorAgeFilesLines
* Make __libdw_debugdir and __libdw_filepath portableUlf Hermann2018-07-231-2/+2
| | | | | | | | Use generic IS_ABSOLUTE_FILE macro, and implement fd-to-filename for windows. Reading from /proc/self obviously is not porable. Change-Id: I805c5295871c13f4fa4b89eb89871fc100559318 Reviewed-by: Christian Kandeler <[email protected]>
* Add O_BINARY to new open() callsUlf Hermann2018-07-201-2/+2
| | | | | | | Windows needs that if you're not reading text. Change-Id: I923782f2c47ef16765f52d6a435f69cb33f50dfd Reviewed-by: Christian Kandeler <[email protected]>
* libdw: Make sure id_path can contain max number of build id bytes.Mark Wielaard2018-06-081-1/+1
| | | | | | | | | | | The MAX_BUILD_ID_BYTES is fairly large (64), while normally build-ids are only 20 bytes long. But if we would encounter a jumbo build-id we should have enough room to construct the full build-id path. We used to substract 2 bytes from the max, because 2 chars are used as subdir. But that should be 1 (2 hex chars is just one 8 bit byte). Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Cache ELF directory early. Explicitly set it in dwfl.Mark Wielaard2018-05-201-28/+16
| | | | | | | | | | | 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: Resolve alt file on first use.Mark Wielaard2018-01-251-2/+156
| | | | | | | | | | | | | | | | | | | | | 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: Add dwarf_getalt, dwarf_setaltFlorian Weimer2014-04-241-0/+42
Signed-off-by: Florian Weimer <[email protected]>