Skip to content

Commit

Permalink
ltrace: example to trace dlopen-ed libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
johannst committed Nov 9, 2024
1 parent cec6cc3 commit 3d599bc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/trace_profile/ltrace.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ltrace [opts] [prg]
-o <file> ... log output into <file>
-l <filter> . show who calls into lib matched by <filter>
-C .......... demangle
-x <filter> . which symbol table entry points to trace
(can be of form sym_pattern@lib_pattern)
```

# Example
Expand All @@ -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*'
```

0 comments on commit 3d599bc

Please sign in to comment.