diff options
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r-- | dwflpp.cxx | 41 |
1 files changed, 18 insertions, 23 deletions
@@ -41,9 +41,6 @@ extern "C" { #include <fcntl.h> #include <elfutils/libdwfl.h> #include <elfutils/libdw.h> -#ifdef HAVE_ELFUTILS_VERSION_H -#include <elfutils/version.h> -#endif #include <dwarf.h> #include <elf.h> #include <obstack.h> @@ -981,11 +978,11 @@ dwflpp::iterate_over_labels (Dwarf_Die *begin_die, && function_name_matches_pattern (name, sym))) { const char *file = dwarf_decl_file (&die); + // Get the line number for this label - Dwarf_Attribute attr; - dwarf_attr (&die,DW_AT_decl_line, &attr); - Dwarf_Sword dline; - dwarf_formsdata (&attr, &dline); + int dline; + dwarf_decl_line (&die, &dline); + Dwarf_Addr stmt_addr; if (dwarf_lowpc (&die, &stmt_addr) != 0) { @@ -996,7 +993,7 @@ dwflpp::iterate_over_labels (Dwarf_Die *begin_die, size_t nlines = 0; // Get the line for this label Dwarf_Line **aline; - dwarf_getsrc_file (module_dwarf, file, (int)dline, 0, &aline, &nlines); + dwarf_getsrc_file (module_dwarf, file, dline, 0, &aline, &nlines); // Get the address for (size_t i = 0; i < nlines; i++) { @@ -1012,7 +1009,7 @@ dwflpp::iterate_over_labels (Dwarf_Die *begin_die, if (nscopes > 1) { callback(function_name.c_str(), file, - (int)dline, &scopes[1], stmt_addr, q); + dline, &scopes[1], stmt_addr, q); add_label_name(q, name); } } @@ -1561,7 +1558,7 @@ dwflpp::print_members(Dwarf_Die *vardie, ostream &o) if (typetag != DW_TAG_structure_type && typetag != DW_TAG_union_type) { o << " Error: " - << (dwarf_diename_integrate (vardie) ?: "<anonymous>") + << (dwarf_diename (vardie) ?: "<anonymous>") << " isn't a struct/union"; return; } @@ -1573,14 +1570,14 @@ dwflpp::print_members(Dwarf_Die *vardie, ostream &o) { case 1: // No children. o << ((typetag == DW_TAG_union_type) ? " union " : " struct ") - << (dwarf_diename_integrate (die) ?: "<anonymous>") + << (dwarf_diename (die) ?: "<anonymous>") << " is empty"; break; case -1: // Error. default: // Shouldn't happen. o << ((typetag == DW_TAG_union_type) ? " union " : " struct ") - << (dwarf_diename_integrate (die) ?: "<anonymous>") + << (dwarf_diename (die) ?: "<anonymous>") << ": " << dwarf_errmsg (-1); break; @@ -1591,7 +1588,7 @@ dwflpp::print_members(Dwarf_Die *vardie, ostream &o) // Output each sibling's name to 'o'. while (dwarf_tag (die) == DW_TAG_member) { - const char *member = dwarf_diename_integrate (die) ; + const char *member = dwarf_diename (die) ; if ( member != NULL ) o << " " << member; @@ -1641,7 +1638,7 @@ dwflpp::find_struct_member(const target_symbol::component& c, case -1: /* Error. */ default: /* Shouldn't happen */ throw semantic_error (string (dwarf_tag(&die) == DW_TAG_union_type ? "union" : "struct") - + string (dwarf_diename_integrate (&die) ?: "<anonymous>") + + string (dwarf_diename (&die) ?: "<anonymous>") + string (dwarf_errmsg (-1)), c.tok); } @@ -1651,7 +1648,7 @@ dwflpp::find_struct_member(const target_symbol::component& c, if (dwarf_tag(&die) != DW_TAG_member) continue; - const char *name = dwarf_diename_integrate(&die); + const char *name = dwarf_diename(&die); if (name == NULL) { // need to recurse for anonymous structs/unions @@ -1774,7 +1771,7 @@ dwflpp::translate_components(struct obstack *pool, Dwarf_Die *tmpdie = dwflpp::declaration_resolve(dwarf_diename(die)); if (tmpdie == NULL) throw semantic_error ("unresolved struct " - + string (dwarf_diename_integrate (die) ?: "<anonymous>"), + + string (dwarf_diename (die) ?: "<anonymous>"), c.tok); *die_mem = *tmpdie; } @@ -1790,7 +1787,7 @@ dwflpp::translate_components(struct obstack *pool, alternatives = " (alternatives:" + members.str(); throw semantic_error("unable to find member '" + c.member + "' for struct " - + string(dwarf_diename_integrate(die) ?: "<unknown>") + + string(dwarf_diename(die) ?: "<unknown>") + alternatives, c.tok); } @@ -1806,14 +1803,14 @@ dwflpp::translate_components(struct obstack *pool, throw semantic_error ("invalid access '" + lex_cast<string>(c) + "' vs. enum type " - + string(dwarf_diename_integrate (die) ?: "<anonymous type>"), + + string(dwarf_diename (die) ?: "<anonymous type>"), c.tok); break; case DW_TAG_base_type: throw semantic_error ("invalid access '" + lex_cast<string>(c) + "' vs. base type " - + string(dwarf_diename_integrate (die) ?: "<anonymous type>"), + + string(dwarf_diename (die) ?: "<anonymous type>"), c.tok); break; case -1: @@ -1822,7 +1819,7 @@ dwflpp::translate_components(struct obstack *pool, break; default: - throw semantic_error (string(dwarf_diename_integrate (die) ?: "<anonymous type>") + throw semantic_error (string(dwarf_diename (die) ?: "<anonymous type>") + ": unexpected type tag " + lex_cast<string>(dwarf_tag (die)), c.tok); @@ -2593,9 +2590,8 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) clog << "get_cfa_ops @0x" << hex << pc << dec << ", module_start @0x" << hex << module_start << dec << endl; -#ifdef _ELFUTILS_PREREQ #if _ELFUTILS_PREREQ(0,142) - // Try debug_frame first, then fall back on eh_frame. + // Try debug_frame first, then fall back on eh_frame. size_t cfa_nops; Dwarf_Addr bias; Dwarf_CFI *cfi = dwfl_module_dwarf_cfi (module, &bias); @@ -2630,7 +2626,6 @@ dwflpp::get_cfa_ops (Dwarf_Addr pc) } #endif -#endif if (sess.verbose > 2) clog << (cfa_ops == NULL ? "not " : " ") << "found cfa" << endl; |