summaryrefslogtreecommitdiffstats
path: root/libdw/libdw_find_split_unit.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-17 19:23:46 +0200
committerMark Wielaard <[email protected]>2018-05-20 23:35:15 +0200
commit46d5523c94b5e9c830aeba9de863e1b65b08b1df (patch)
tree98344940b8f62388620aec92054ea59bd5e4841a /libdw/libdw_find_split_unit.c
parent3d4998a9edd9f88b46662b3584de89ecd8f2f4c8 (diff)
libdw: Cache ELF directory early. Explicitly set it in dwfl.
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]>
Diffstat (limited to 'libdw/libdw_find_split_unit.c')
-rw-r--r--libdw/libdw_find_split_unit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libdw/libdw_find_split_unit.c b/libdw/libdw_find_split_unit.c
index 0f74b39a..bd48b9e5 100644
--- a/libdw/libdw_find_split_unit.c
+++ b/libdw/libdw_find_split_unit.c
@@ -65,10 +65,10 @@ __libdw_find_split_unit (Dwarf_CU *cu)
{
const char *comp_dir = dwarf_formstring (&compdir);
const char *dwo_file = dwarf_formstring (&dwo_name);
- int fd = cu->dbg->elf->fildes;
- char *dwo_path = __libdw_filepath (fd, NULL, dwo_file);
+ const char *debugdir = cu->dbg->debugdir;
+ char *dwo_path = __libdw_filepath (debugdir, NULL, dwo_file);
if (dwo_path == NULL && comp_dir != NULL)
- dwo_path = __libdw_filepath (fd, comp_dir, dwo_file);
+ dwo_path = __libdw_filepath (debugdir, comp_dir, dwo_file);
if (dwo_path != NULL)
{
int split_fd = open (dwo_path, O_RDONLY);