summaryrefslogtreecommitdiffstats
path: root/libdwfl/libdwflP.h
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-10-21 23:41:32 +0200
committerMark Wielaard <[email protected]>2018-11-09 18:11:48 +0100
commitecbe3120cddb1b9597a19a68c4265e4f2c530444 (patch)
tree40f6549cda3aa5bff3df983f15ac88d0da597b72 /libdwfl/libdwflP.h
parent4b0342b85b5b1a3d3636e06e3b5320954828dfb1 (diff)
libdwelf: New function dwelf_elf_begin.
This introduces a new function dwelf_elf_begin which creates a (read-only) ELF handle from a possibly compressed file handle or a file that start with a linux kernel header. This can be used in eu-readelf to (re)open a (pure) ELF. eu-readelf uses libdwfl to relocate addresses in the original file in case it is ET_REL. But to show the "raw" data it might need to (re)open the file. Which could fail if the file was compressed. And produced an obscure error message: "cannot create EBL handle". This rewrites __libdw_open_file a little so that the given file handle will never be closed (whether on success or failure) and introduces a new internal function __libdw_open_elf that dwelf_elf_begin wraps. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdwfl/libdwflP.h')
-rw-r--r--libdwfl/libdwflP.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index 31e6e190..941a8b66 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -626,6 +626,10 @@ extern Dwfl_Error __libdw_open_file (int *fdp, Elf **elfp,
bool close_on_fail, bool archive_ok)
internal_function;
+/* Same as __libdw_open_file, but never closes the given file
+ descriptor and ELF_K_AR is always an acceptable type. */
+extern Dwfl_Error __libdw_open_elf (int fd, Elf **elfp) internal_function;
+
/* Fetch PT_DYNAMIC P_VADDR from ELF and store it to *VADDRP. Return success.
*VADDRP is not modified if the function fails. */
extern bool __libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)