From 3d599bcbf6771def1076c3e9561bc748956dfc94 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Sat, 9 Nov 2024 11:41:49 +0100 Subject: ltrace: example to trace dlopen-ed libraries --- src/trace_profile/ltrace.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/trace_profile/ltrace.md b/src/trace_profile/ltrace.md index cfa3fae..12bd4b3 100644 --- a/src/trace_profile/ltrace.md +++ b/src/trace_profile/ltrace.md @@ -7,6 +7,8 @@ ltrace [opts] [prg] -o ... log output into -l . show who calls into lib matched by -C .......... demangle + -x . which symbol table entry points to trace + (can be of form sym_pattern@lib_pattern) ``` # Example @@ -15,3 +17,17 @@ List which program/libs call into `libstdc++`: ```bash ltrace -l '*libstdc++*' -C -o ltrace.log ./main ``` + +Trace symbols from `dlopen(3)`ed libraries. +```bash +# Assume libfoo.so would be dynamically loaded via dlopen. +ltrace -x '@libfoo.so' + +# Trace all dlopened symbols. +ltrace -x '*' +# Trace all symbols from dlopened libraries which name match the +# pattern "liby*". +ltrace -x '@liby*' +# Trace symbol "foo" from all dlopened libraries matching the pattern. +ltrace -x 'foo@liby*' +``` \ No newline at end of file -- cgit v1.2.3