Skip to content

Commit

Permalink
Merge pull request iovisor#3498 from davemarchevsky/davemarchevsky_ex…
Browse files Browse the repository at this point in the history
…e_syms

ProcSyms should treat the executable like any other mapped file when symbolizing
  • Loading branch information
davemarchevsky authored Jul 12, 2021
2 parents ad83318 + 649cb3e commit b21bd30
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
22 changes: 0 additions & 22 deletions src/cc/bcc_syms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,7 @@ ProcSyms::ProcSyms(int pid, struct bcc_symbol_option *option)
load_modules();
}

int ProcSyms::_add_load_sections(uint64_t v_addr, uint64_t mem_sz,
uint64_t file_offset, void *payload) {
auto module = static_cast<Module *>(payload);
module->ranges_.emplace_back(v_addr, v_addr + mem_sz, file_offset);
return 0;
}

void ProcSyms::load_exe() {
std::string exe = ebpf::get_pid_exe(pid_);
Module module(exe.c_str(), exe.c_str(), &symbol_option_);

if (module.type_ != ModuleType::EXEC)
return;


bcc_elf_foreach_load_section(exe.c_str(), &_add_load_sections, &module);

if (!module.ranges_.empty())
modules_.emplace_back(std::move(module));
}

void ProcSyms::load_modules() {
load_exe();
bcc_procutils_each_module(pid_, _add_module, this);
}

Expand Down
3 changes: 0 additions & 3 deletions src/cc/syms.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,7 @@ class ProcSyms : SymbolCache {
ProcStat procstat_;
bcc_symbol_option symbol_option_;

static int _add_load_sections(uint64_t v_addr, uint64_t mem_sz,
uint64_t file_offset, void *payload);
static int _add_module(mod_info *, int, void *);
void load_exe();
void load_modules();

public:
Expand Down

0 comments on commit b21bd30

Please sign in to comment.