diff options
Diffstat (limited to 'dwarf_wrappers.h')
-rw-r--r-- | dwarf_wrappers.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/dwarf_wrappers.h b/dwarf_wrappers.h index 1442a17c..54ab8fd4 100644 --- a/dwarf_wrappers.h +++ b/dwarf_wrappers.h @@ -8,10 +8,23 @@ #ifndef DWARF_WRAPPERS_H #define DWARF_WRAPPERS_H 1 + +#include "config.h" + +extern "C" { #include <elfutils/libdw.h> +#ifdef HAVE_ELFUTILS_VERSION_H +#include <elfutils/version.h> +#endif +} #include <string> +#if !defined(_ELFUTILS_PREREQ) +// make a dummy PREREQ check for elfutils < 0.138 +#define _ELFUTILS_PREREQ(major, minor) (0 >= 1) +#endif + // NB: "rc == 0" means OK in this case void dwfl_assert(const std::string& desc, int rc); @@ -89,7 +102,20 @@ public: } }; -const char *dwarf_diename_integrate (Dwarf_Die *die); + +#if !_ELFUTILS_PREREQ(0, 143) +// Elfutils prior to 0.143 didn't use attr_integrate when looking up the +// decl_file or decl_line, so the attributes would sometimes be missed. For +// those old versions, we define custom implementations to do the integration. + +const char *dwarf_decl_file_integrate (Dwarf_Die *die); +#define dwarf_decl_file dwarf_decl_file_integrate + +int dwarf_decl_line_integrate (Dwarf_Die *die, int *linep) + __nonnull_attribute__ (2); +#define dwarf_decl_line dwarf_decl_line_integrate + +#endif // !_ELFUTILS_PREREQ(0, 143) #endif |