Skip to content

Commit

Permalink
Fixed TestUprobes.test_simple_library() in test_uprobes.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Przybylski committed Feb 9, 2017
1 parent 70e2034 commit 7fb7bfa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lua/bcc/bpf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ end
function Bpf:attach_uprobe(args)
Bpf.check_probe_quota(1)

local path, addr = Sym.check_path_symbol(args.name, args.sym, args.addr)
local path, addr = Sym.check_path_symbol(args.name, args.sym, args.addr, args.pid)
local fn = self:load_func(args.fn_name, 'BPF_PROG_TYPE_KPROBE')
local ptype = args.retprobe and "r" or "p"
local ev_name = string.format("%s_%s_0x%p", ptype, path:gsub("[^%a%d]", "_"), addr)
Expand Down
4 changes: 2 additions & 2 deletions src/lua/bcc/sym.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ local function create_cache(pid)
}
end

local function check_path_symbol(module, symname, addr)
local function check_path_symbol(module, symname, addr, pid)
local sym = SYM()
local module_path
if libbcc.bcc_resolve_symname(module, symname, addr or 0x0, 0, sym) < 0 then
if libbcc.bcc_resolve_symname(module, symname, addr or 0x0, pid or 0, sym) < 0 then
if sym[0].module == nil then
error("could not find library '%s' in the library path" % module)
else
Expand Down
4 changes: 2 additions & 2 deletions tests/lua/test_uprobes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ int count(struct pt_regs *ctx) {
local text = text:gsub("PID", tostring(pid))

local b = BPF:new{text=text}
b:attach_uprobe{name="c", sym="malloc_stats", fn_name="count"}
b:attach_uprobe{name="c", sym="malloc_stats", fn_name="count", retprobe=true}
b:attach_uprobe{name="c", sym="malloc_stats", fn_name="count", pid=pid}
b:attach_uprobe{name="c", sym="malloc_stats", fn_name="count", pid=pid, retprobe=true}

assert_equals(BPF.num_open_uprobes(), 2)

Expand Down

0 comments on commit 7fb7bfa

Please sign in to comment.