Skip to content

Commit

Permalink
Secondary fix for bad inline filenames
Browse files Browse the repository at this point in the history
Ensures that we're not doing bad partial initialization of string tables by being over-lazy
  • Loading branch information
wrwilliams committed Oct 31, 2016
1 parent 967ec2d commit ed78eda
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions symtabAPI/src/Module.C
Expand Up @@ -527,6 +527,8 @@ void Module::finalizeOneRange(Address ext_s, Address ext_e) const {

void Module::setDebugInfo(Module::DebugInfoT info) {
info_.push_back(info);
#if defined(cap_dwarf)
#endif
}

StringTablePtr & Module::getStrings() {
Expand Down
2 changes: 2 additions & 0 deletions symtabAPI/src/Object-elf.C
Expand Up @@ -2458,6 +2458,7 @@ bool Object::dwarf_parse_aranges(Dwarf_Debug dbg, std::set<Dwarf_Off>& dies_seen
Module* m = associated_symtab->getOrCreateModule(modname, actual_start);
m->addRange(actual_start, actual_end);
m->setDebugInfo(cu_die);
DwarfWalker::buildSrcFiles(dbg, cu_die, m->getStrings());
dies_seen.insert(cu_die_off);
dwarf_dealloc(dbg, ranges[i], DW_DLA_ARANGE);
}
Expand Down Expand Up @@ -2511,6 +2512,7 @@ bool Object::fix_global_symbol_modules_static_dwarf()
m->addRange(r->first, r->second);
}
m->setDebugInfo(cu_die);
DwarfWalker::buildSrcFiles(dbg, cu_die, m->getStrings());
dies_seen.insert(cu_die_off);

}
Expand Down
17 changes: 8 additions & 9 deletions symtabAPI/src/dwarfWalker.C
Expand Up @@ -226,8 +226,6 @@ bool DwarfWalker::parseModule(Dwarf_Bool is_info, Module *&fixUnknownMod) {
if (!fixUnknownMod)
fixUnknownMod = mod();

if (!buildSrcFiles(moduleDIE)) return false;


if (!parse_int(moduleDIE, true)) return false;

Expand All @@ -249,19 +247,20 @@ void DwarfParseActions::setModuleFromName(std::string moduleName)
}
}

bool DwarfWalker::buildSrcFiles(Dwarf_Die entry) {
bool DwarfWalker::buildSrcFiles(Dwarf_Debug dbg, Dwarf_Die entry, StringTablePtr srcFiles) {
Dwarf_Signed cnt = 0;
char** srcFileList;
DWARF_ERROR_RET(dwarf_srcfiles(entry, &srcFileList, &cnt, NULL));

if(!srcFiles()->empty()) return true; // already parsed, the module had better be right.
srcFiles()->push_back("Unknown file");
if(!srcFiles->empty()) {
return true;
} // already parsed, the module had better be right.
srcFiles->push_back("Unknown file");
for (unsigned i = 0; i < cnt; ++i) {
srcFiles()->push_back(srcFileList[i]);
dwarf_dealloc(dbg(), srcFileList[i], DW_DLA_STRING);
srcFiles->push_back(srcFileList[i]);
dwarf_dealloc(dbg, srcFileList[i], DW_DLA_STRING);
}
// cout << "Module " << mod()->fileName() << " srcfiles: " << endl << *srcFiles() << endl;
dwarf_dealloc(dbg(), srcFileList, DW_DLA_LIST);
dwarf_dealloc(dbg, srcFileList, DW_DLA_LIST);
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion symtabAPI/src/dwarfWalker.h
Expand Up @@ -239,10 +239,11 @@ namespace Dyninst {

// A printable ID for a particular entry
unsigned long id() { return (unsigned long) (offset() - compile_offset); }
public:
static bool buildSrcFiles(Dwarf_Debug dbg, Dwarf_Die entry, StringTablePtr strings);
private:

bool parseCallsite();
virtual bool buildSrcFiles(Dwarf_Die entry);
bool hasDeclaration(bool &decl);
bool findTag();
bool findOffset();
Expand Down

0 comments on commit ed78eda

Please sign in to comment.