lmdbg-sym - convert lmdbg-run addresses to source code positions.
lmdbg-sym [OPTIONS] [files...]
lmdbg-sym lmdbg-sym takes as input a log file generated by
lmdbg-run or other lmdbg-* programs and converts addresses to
source code positions and function names if it is possible. This is
accomplished with a help of external programs, gdb(1) or
addr2line(1). The result may look like the following
realloc ( 0xbb901800 , 777 ) --> 0xbb901c00
0xbbbe58e8
0xbbbe5a37
0x8048764 tests/test2.c:10 main
0x8048584
0x80484e7
Here lmdbg-sym found out that the address 0x8048764 corresponded to the
function main, in the source file tests/test2.c at the line
number 10. The address, the source file name and the function name are
separated by a TAB character. Several log files can be analysed with lmdbg-sym
as long as they refer to a single program.
- -h
- Display the help message.
- -V
- Display the lmdbg version.
- -g
- Use gdb(1) for resolving symbols. This is the default.
- -a
- Use addr2line(1) for resolving symbols.
- -P progname
- Specify the path to the program the log file of which is being analysed.
If not given, the program path is used that is found in the
logfile.
- -s library:flags
- Specify the library to open with dlopen(3) and flags, separated by a colon
character. Allowed flags are: RTLD_LAZY, RTLD_NOW and RTLD_GLOBAL . This
option can be used repeatedly.
- LMDBG_LIB
- Path to LD_PRELOAD'ed liblmdbg dynamic library. It defaults to
/usr/local/lib/liblmdbg.so
- LMDBG_GDB
- gdb(1) program to run, defaults to gdb.
$ cat -n testme.c
1 #include <stdlib.h>
2
3 int main ()
4 {
5 int i;
6 void *p1, *p2;
7 p1 = malloc (100);
8 for (i=0; i < 3; ++i){
9 p2 = realloc (NULL, 10+30*i);
10 }
11 free (p1);
12 free (p2);
13
14 return 0;
15 }
$ cc -O0 -g -o testme testme.c
$ lmdbg-run -T2 -B2 -f 'lmdbg-sym' -o log ./testme
$ cat log
info progname ./testme
malloc ( 100 ) --> 0xbb901080 num: 1
0x8048789 testme.c:7 main
realloc ( NULL , 10 ) --> 0xbb903040 num: 2
0x80487bb testme.c:9 main
realloc ( NULL , 40 ) --> 0xbb905070 num: 3
0x80487bb testme.c:9 main
realloc ( NULL , 70 ) --> 0xbb904060 num: 4
0x80487bb testme.c:9 main
free ( 0xbb901080 ) num: 5
0x80487d7 testme.c:12 main
free ( 0xbb904060 ) num: 6
0x80487e3 testme.c:14 main
$
lmdbg-sym -h
lmdbg-sym -V
lmdbg-run -o _log ./my_app &&
lmdbg-leaks _log > _log_leaks &&
lmdbg-sym -a ./my_app _log_leaks > _log_leaks2 &&
lmdbg-sysleaks -s _log_leaks2 > _log_final
lmdbg-run -p 'lmdbg-leaks | lmdbg-sym -p > _log' ./my_app <args>
lmdbg-sym -g -s /path/to/dll1.so RTLD_NOW -p < _log
lmdbg(1), lmdbg-run(1), lmdbg-stat(1),
lmdbg-sort(1), lmdbg-grep(1), lmdbg-head(1),
lmdbg-leaks(1), lmdbg-sysleaks(1), lmdbg-strip(1),
lmdbg-modules(1), gdb(1), addr2line(1)
Aleksey Cheusov <vle@gmx.net>