From: Petr Machata Date: Tue, 28 Apr 2009 16:38:27 +0000 (+0200) Subject: Add length read hooks X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b130453eb16a8cf042915e312cc5f189b8b92c01;p=thirdparty%2Felfutils.git Add length read hooks --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 55c87014d..ff33e7ede 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,9 @@ +2009-04-28 Petr Machata + + * libdwP.h (__libdw_read_length_inc, __libdw_read_length): + New internal functions. + * dwarf_readhooks.c: Implement the above. + 2009-04-23 Petr Machata * dwarf_formaddr.c (dwarf_formaddr): Call __libdw_read_* instead diff --git a/libdw/libdwP.h b/libdw/libdwP.h index 416769115..4a1e4b2bf 100644 --- a/libdw/libdwP.h +++ b/libdw/libdwP.h @@ -448,6 +448,11 @@ int __libdw_relocate_offset (Dwarf *dbg, int width, Dwarf_Off *val) internal_function; +int __libdw_relocate_length (Dwarf *dbg, + int sec_index, uintptr_t addr, + int width, Dwarf_Addr *val) + internal_function; + #define READ_AND_RELOCATE(RELOC_HOOK) \ { \ int status; \ @@ -488,6 +493,14 @@ __libdw_read_offset_inc (Dwarf *dbg, READ_AND_RELOCATE (__libdw_relocate_offset) } +static inline int +__libdw_read_length_inc (Dwarf *dbg, + int sec_index, unsigned char **addr, + int width, Dwarf_Addr *ret) +{ + READ_AND_RELOCATE (__libdw_relocate_length) +} + #undef READ_AND_RELOCATE static inline int @@ -508,6 +521,15 @@ __libdw_read_offset (Dwarf *dbg, width, ret); } +static inline int +__libdw_read_length (Dwarf *dbg, + int sec_index, const unsigned char *addr, + int width, Dwarf_Word *ret) +{ + return __libdw_read_length_inc (dbg, sec_index, (unsigned char **)&addr, + width, ret); +} + #define ADDR_ESCAPE(width) \ (width == 8 ? (Elf64_Addr)-1 : (Elf64_Addr)(Elf32_Addr)-1) diff --git a/libdw/libdw_readhooks.c b/libdw/libdw_readhooks.c index 404f12aa7..93c986429 100644 --- a/libdw/libdw_readhooks.c +++ b/libdw/libdw_readhooks.c @@ -72,3 +72,13 @@ __libdw_relocate_offset (Dwarf *dbg __attribute__ ((unused)), { return 0; } + +internal_function int +__libdw_relocate_length (Dwarf *dbg __attribute__ ((unused)), + int sec_index __attribute__ ((unused)), + uintptr_t addr __attribute__ ((unused)), + int width __attribute__ ((unused)), + Dwarf_Addr *val __attribute__ ((unused))) +{ + return 0; +}