• Andrew Birchall's avatar
    Add user space stack traces to offcputime · 1f202e7b
    Andrew Birchall authored
    Summary:
    * generalize `KernelSymbolCache` into `SymbolCache` which supports user/kernel space symbols
    * create `BPF.sym()` for resolving user/kernel space symbols
    * `_ksym_cache` => `_sym_caches` and create `BPF._sym_cache()` to leverage the symbol caches
    * update `tools/offcputime.py` to print user space stack traces
    
    Test Plan:
    ```
    dev[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -U -k -f 1
    ERROR: Displaying user stacks for kernel threads doesn't make sense.
    devbig680[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -K -f 1 | grep python2 | head -n 1
    python2.7;system_call_fastpath;sys_futex;do_futex;futex_wait;futex_wait_queue_me;schedule 19
    dev[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -U -f 1 | grep python2 | head -n 1
    python2.7;clone;start_thread;t_bootstrap;PyEval_CallObjectWithKeywords;PyObject_Call;instancemethod_call;PyObject_Call;function_call;PyEval_EvalCodeEx;PyEval_EvalFrameEx;PyObject_Call;function_call;PyEval_EvalCodeEx;PyEval_EvalFrameEx;time_sleep;PyEval_RestoreThread 5
    devbig680[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -f 1 | grep python2 | head -n 1
    python2.7;system_call_fastpath;sys_futex;do_futex;futex_wait;futex_wait_queue_me;schedule;[unknown];__libc_start_main;Py_Main;RunModule;PyObject_Call;function_call;PyEval_EvalCodeEx;PyEval_EvalFrameEx;PyEval_EvalFrameEx;PyEval_EvalCodeEx;PyEval_EvalFrameEx;lock_PyThread_acquire_lock;PyEval_RestoreThread 39
    ```
    1f202e7b
helpers.h 16 KB