|
|
| |
LMDBG-GREP(1) |
|
LMDBG-GREP(1) |
lmdbg-grep - output stacktraces that match the specified condition
lmdbg-grep [OPTIONS] <awk_expr> [files...]
lmdbg-grep takes output of lmdbg-stat or lmdbg-run as input
and outputs stacktraces that match the condition awk_expr. The
following special variables can be used in awk_exp expression :
- bytes
- the number of allocated bytes,
- allocs
- the number of calls of malloc, calloc, memalign, posix_memalign and
aligned_alloc functions,
- max
- the maximum number of bytes allocated per malloc, calloc, memalign,
posix_memalign and aligned_alloc functions,
- peak
- the peak number of allocated bytes,
- leaks
- the number of allocated but not freed bytes,
- address
- address returned by memory allocation function,
- source
- source code filename,
- funcname
- function name,
- addrline
- address in the stacktrace.
The following variables are numeric: bytes, allocs, max,
peak, leaks; others contain string values.
- -h
- Display the help message.
- -V
- Display the lmdbg version.
- -v
- Invert the sense of matching, select non-matching lines.
$ cat log
stacktrace peak: 120 max: 70 allocs: 3 leaks: 50
0xbbbe2bc3 lmdbg.c:101 log_stacktrace
0xbbbe3498 lmdbg.c:456 realloc
0x8049700 testme.c:902 func1
0x8048788 testme.c:9 main
0x80485b4
0x8048517
stacktrace peak: 100 max: 100 allocs: 1
0xbbbe2bc3 lmdbg.c:101 log_stacktrace
0xbbbe33bd lmdbg.c:431 malloc
0x8049654 testme.c:450 func2
0x8048757 testme.c:7 main
0x80485b4
0x8048517
$ lmdbg-grep 'leaks > 0' log
stacktrace peak: 120 max: 70 allocs: 3 leaks: 50
0xbbbe2bc3 lmdbg.c:101 log_stacktrace
0xbbbe3498 lmdbg.c:456 realloc
0x8049700 testme.c:902 func1
0x8048788 testme.c:9 main
0x80485b4
0x8048517
$ lmdbg-grep '!leaks' log
stacktrace peak: 100 max: 100 allocs: 1
0xbbbe2bc3 lmdbg.c:101 log_stacktrace
0xbbbe33bd lmdbg.c:431 malloc
0x8049654 testme.c:450 func2
0x8048757 testme.c:7 main
0x80485b4
0x8048517
$ lmdbg-grep 'addrline ~ /func2/' log
stacktrace peak: 100 max: 100 allocs: 1
0xbbbe2bc3 lmdbg.c:101 log_stacktrace
0xbbbe33bd lmdbg.c:431 malloc
0x8049654 testme.c:450 func2
0x8048757 testme.c:7 main
0x80485b4
0x8048517
$ lmdbg-grep 'allocs > 1000 || peak > 1000000' log
$
lmdbg(1), lmdbg-run(1), lmdbg-sym(1), lmdbg-stat(1),
lmdbg-sort(1), lmdbg-head(1), lmdbg-leaks(1),
lmdbg-sysleaks(1), lmdbg-strip(1), lmdbg-modules(1)
Aleksey Cheusov <vle@gmx.net>
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |