Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/cc/api/BPF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ StatusTuple BPF::attach_uprobe(const std::string& binary_path,

std::string module;
uint64_t offset;
TRY2(check_binary_symbol(binary_path, symbol, symbol_addr, module, offset,
TRY2(check_binary_symbol(binary_path, symbol, symbol_addr, module, offset, pid,
symbol_offset));

std::string probe_event = get_uprobe_event(module, offset, attach_type, pid);
Expand All @@ -281,7 +281,7 @@ StatusTuple BPF::attach_uprobe(const std::string& binary_path,
TRY2(load_func(probe_func, BPF_PROG_TYPE_KPROBE, probe_fd));

int res_fd = bpf_attach_uprobe(probe_fd, attach_type, probe_event.c_str(),
binary_path.c_str(), offset, pid,
module.c_str(), offset, pid,
ref_ctr_offset);

if (res_fd < 0) {
Expand Down Expand Up @@ -513,7 +513,7 @@ StatusTuple BPF::detach_uprobe(const std::string& binary_path,
uint64_t symbol_offset) {
std::string module;
uint64_t offset;
TRY2(check_binary_symbol(binary_path, symbol, symbol_addr, module, offset,
TRY2(check_binary_symbol(binary_path, symbol, symbol_addr, module, offset, pid,
symbol_offset));

std::string event = get_uprobe_event(module, offset, attach_type, pid);
Expand Down Expand Up @@ -762,11 +762,11 @@ StatusTuple BPF::check_binary_symbol(const std::string& binary_path,
const std::string& symbol,
uint64_t symbol_addr,
std::string& module_res,
uint64_t& offset_res,
uint64_t& offset_res, pid_t pid,
uint64_t symbol_offset) {
bcc_symbol output;
int res = bcc_resolve_symname(binary_path.c_str(), symbol.c_str(),
symbol_addr, -1, nullptr, &output);
symbol_addr, pid, nullptr, &output);
if (res < 0)
return StatusTuple(
-1, "Unable to find offset for binary %s symbol %s address %lx",
Expand All @@ -776,7 +776,7 @@ StatusTuple BPF::check_binary_symbol(const std::string& binary_path,
module_res = output.module;
::free(const_cast<char*>(output.module));
} else {
module_res = "";
module_res = binary_path;
}
offset_res = output.offset + symbol_offset;
return StatusTuple::OK();
Expand Down
2 changes: 1 addition & 1 deletion src/cc/api/BPF.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class BPF {
StatusTuple check_binary_symbol(const std::string& binary_path,
const std::string& symbol,
uint64_t symbol_addr, std::string& module_res,
uint64_t& offset_res,
uint64_t& offset_res,pid_t pid,
uint64_t symbol_offset = 0);

void init_fail_reset();
Expand Down
Loading