Skip to content

Commit

Permalink
Add Symtab::addModule
Browse files Browse the repository at this point in the history
It's private, so can only be used by friends- specifically Object.
  • Loading branch information
hainest committed Nov 7, 2023
1 parent a357eab commit a9ae1a0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions symtabAPI/h/Symtab.h
Expand Up @@ -441,6 +441,7 @@ class SYMTAB_EXPORT Symtab : public LookupInterface,

private:
void createDefaultModule();
void addModule(Module *m);

//bool buildFunctionLists(std::vector <Symbol *> &raw_funcs);
//void enterFunctionInTables(Symbol *func, bool wasSymtab);
Expand Down
4 changes: 4 additions & 0 deletions symtabAPI/src/Object-elf.C
Expand Up @@ -3051,6 +3051,10 @@ ObjectType Object::objType() const {
return obj_type_;
}

void Object::addModule(SymtabAPI::Module* m) {
associated_symtab->addModule(m);
}

void Object::getModuleLanguageInfo(dyn_hash_map<string, supportedLanguages> *mod_langs) {
string working_module;
string mod_string;
Expand Down
4 changes: 2 additions & 2 deletions symtabAPI/src/Object-elf.h
Expand Up @@ -53,7 +53,7 @@
#include "headers.h"
#include "MappedFile.h"
#include "IntervalTree.h"

#include "Module.h"
#include <elf.h>
#include <libelf.h>
#include <string>
Expand Down Expand Up @@ -166,8 +166,8 @@ class Object : public AObject
bool hasDwarfInfo() const { return dwarvenDebugInfo; }
void getModuleLanguageInfo(dyn_hash_map<std::string, supportedLanguages> *mod_langs);
void parseFileLineInfo();

void parseTypeInfo();
void addModule(SymtabAPI::Module* m) override;

bool needs_function_binding() const { return (plt_addr_ > 0); }
bool get_func_binding_table(std::vector<relocationEntry> &fbt) const;
Expand Down
2 changes: 2 additions & 0 deletions symtabAPI/src/Object.h
Expand Up @@ -49,6 +49,7 @@

#include "Symbol.h"
#include "Symtab.h"
#include "Module.h"
#include "LineInformation.h"
#include "common/src/headers.h"
#include "common/src/MappedFile.h"
Expand Down Expand Up @@ -140,6 +141,7 @@ class AObject {
// Only implemented for ELF right now
SYMTAB_EXPORT virtual void getSegmentsSymReader(std::vector<SymSegment> &) {}
SYMTAB_EXPORT virtual void rebase(Offset) {}
virtual void addModule(SymtabAPI::Module *) {}
protected:
SYMTAB_EXPORT virtual ~AObject();
// explicitly protected
Expand Down
4 changes: 3 additions & 1 deletion symtabAPI/src/Symtab.C
Expand Up @@ -792,7 +792,9 @@ void Symtab::createDefaultModule() {
}
}


void Symtab::addModule(Module *m) {
impl->modules.insert(m);
}

Module *Symtab::getOrCreateModule(const std::string &modName,
const Offset modAddr)
Expand Down

0 comments on commit a9ae1a0

Please sign in to comment.