joelagnel / bpfd

BPFd (Deprecated, please see README.md) : Berkeley Packet Filter daemon (BPFd). Makes it possible to run BCC tools across systems.
Apache License 2.0
95 stars 23 forks source link

tools/stacksnoop compilation and runtime failures #32

Open jcanseco opened 6 years ago

jcanseco commented 6 years ago

Neither of the stacksnoop tools (stacksnoop.py and stacksnoop.lua) work.

stacksnoop.py submit_bio

Fails to compile when run with HiKey as remote:

/virtual/main.c:10:19: error: use of undeclared identifier '__START_KERNEL_map'
        if (ret < __START_KERNEL_map)
                  ^
/virtual/main.c:27:14: error: no member named 'ip' in 'struct pt_regs'
    if (ctx->ip)
        ~~~  ^
/virtual/main.c:28:45: error: no member named 'ip' in 'struct pt_regs'
        bpf_trace_printk("ip: %llx\n", ctx->ip);
                                       ~~~  ^
/virtual/main.c:29:15: error: no member named 'bp' in 'struct pt_regs'
    bp = ctx->bp;
         ~~~  ^
4 errors generated.
Traceback (most recent call last):
  File "./tools/old/stacksnoop.py", line 103, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 317, in __init__
    raise Exception("Failed to compile BPF module %s" % src_file)
Exception: Failed to compile BPF module 

Runtime error when run on ShellRemote OR when run on the Host (i.e. with no remotes set):

TIME(s)            STACK
Traceback (most recent call last):
  File "./tools/old/stacksnoop.py", line 121, in <module>
    (reg, addr) = msg.split(" ")
ValueError: too many values to unpack

I think the reason stacksnoop.py doesn't work with ShellRemote and Host is because this version of stacksnoop may just be too old and so its integration with BCC is outdated. However, the fact that running it on HiKey produces a different error might be a cause of concern.

stacksnoop.lua submit_bio

Fails to compile when run on either HiKey, ShellRemote, or Host:

[ERROR] bcc.lua:2251: bcc-lua: undefined symbol: bcc_symcache_new
stack traceback:
    [C]: in function '__index'
    bcc.lua:2251: in function 'SymbolCache'
    ./tools/stacksnoop.lua:53: in function <./tools/stacksnoop.lua:44>
    [C]: in function 'xpcall'
    bcc.lua:5894: in function <bcc.lua:5843>
    [C]: at 0x00844640