On Sun, Nov 17, 2013 at 5:16 AM, Azat Khuzhin <a3at.mail@xxxxxxxxx> wrote: > Examples: > ./ktap -F ./ktap # print symbols > ./ktap -M ./ktap # print sdt markers > > Don't available without libelf. > > Signed-off-by: Azat Khuzhin <a3at.mail@xxxxxxxxx> > --- > v2: make it more pretty > > userspace/main.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/userspace/main.c b/userspace/main.c > index 658c608..4761a1b 100644 > --- a/userspace/main.c > +++ b/userspace/main.c > @@ -39,6 +39,7 @@ > #include "../interpreter/kp_obj.h" > #include "../interpreter/kp_str.h" > #include "../interpreter/kp_tab.h" > +#include "symbol.h" > > > /*******************************************************************/ > @@ -348,6 +349,10 @@ static void usage(const char *msg_fmt, ...) > " -v : enable verbose mode\n" > " -s : simple event tracing\n" > " -b : list byte codes\n" > +#ifndef NO_LIBELF > +" -F : list available functions from DSO\n" > +" -M : list available sdt notes from DSO\n" > +#endif > " file : program read from script file\n" > " -- cmd [args] : workload to tracing\n"); > > @@ -465,6 +470,14 @@ static const char *script_file; > static int script_args_start; > static int script_args_end; > > +#ifndef NO_LIBELF > +static int print_symbol(const char *name, vaddr_t addr, void *arg) > +{ > + printf("%s (0x%lx)\n", name, addr); > + return 0; > +} > +#endif It should better to output the result like this: #./ktap -F /lib64/libc.so.6 probe:/lib64/libc.so.6:symbol1 probe:/lib64/libc.so.6:symbol2 probe:/lib64/libc.so.6:symbol3 ... #./ktap -M /lib64/libc.so.6 sdt:/lib64/libc.so.6:set_jmp sdt:/lib64/libc.so.6:long_jmp sdt:/lib64/libc.so.6:lll_futex_wake ... I think this can indicate user how to trace those symbols and sdt notes in direct way, perhaps user can copy-paste it in simple enough way. (In similar way, we also need to output all tracepoints in future, that's not urgent now) Jovi.