Skip to content

Commit

Permalink
Ensure default module goes at the beginning of _mods so we can avoid …
Browse files Browse the repository at this point in the history
…lookup-by-name.
  • Loading branch information
wrwilliams committed Oct 19, 2016
1 parent 3469926 commit 2f4f810
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 34 deletions.
12 changes: 2 additions & 10 deletions symtabAPI/src/Symtab-lookup.C
Original file line number Diff line number Diff line change
Expand Up @@ -896,16 +896,8 @@ bool Symtab::getContainingInlinedFunction(Offset offset, FunctionBase* &func)
}

Module *Symtab::getDefaultModule() {
Module *mod = NULL;
// TODO: automatically pick the module that contains this address?
// For now, DEFAULT_MODULE or (if we have only one) that one.
if (_mods.size() == 1)
return _mods[0];
else {
if (!findModuleByName(mod, name()))
return NULL;
}
return mod;
if(_mods.empty()) createDefaultModule();
return _mods[0];
}

unsigned Function::getSize() const {
Expand Down
29 changes: 5 additions & 24 deletions symtabAPI/src/Symtab.C
Original file line number Diff line number Diff line change
Expand Up @@ -1125,25 +1125,11 @@ void Symtab::setModuleLanguages(dyn_hash_map<std::string, supportedLanguages> *m
}

void Symtab::createDefaultModule() {
Module *mod = NULL;
// if (1 || getObjectType() == obj_SharedLib) {
mod = new Module(lang_Unknown,
imageOffset_,
name(),
this);
// }
// else {
//mod = new Module(lang_Unknown,
// imageOffset_,
//#if defined(os_vxworks)
// VxWorks' kernel objects should
// have their own module.
// name(),
//#else
// "DEFAULT_MODULE",
//#endif
// this);
// }
assert(_mods.empty());
Module *mod = new Module(lang_Unknown,
imageOffset_,
name(),
this);
modsByFileName[mod->fileName()] = mod;
modsByFullName[mod->fullName()] = mod;
_mods.push_back(mod);
Expand Down Expand Up @@ -1535,11 +1521,6 @@ bool Symtab::extractInfo(Object *linkedFile)
return false;
}

// don't sort the symbols--preserve the original ordering
//sort(raw_syms.begin(),raw_syms.end(),symbol_compare);

createDefaultModule();

if (!fixSymModules(raw_syms))
{
serr = Syms_To_Functions;
Expand Down

0 comments on commit 2f4f810

Please sign in to comment.