![]() |
![]()
| ![]() |
![]()
NAMElmdbg-run - runs a program and traces the malloc/realloc/free calls SYNOPSISlmdbg-run [OPTIONS] <progname> [args...] DESCRIPTIONlmdbg-run lmdbg-run runs an external command progname args and creates a log file where all invocations of malloc, calloc, realloc, memalign, posix_memalign, aligned_alloc and free are registered accompanied by the following information: full stacktrace (addresses), input argument(s) (requested size and/or address), result value (returned address, if any) and ordinal number of function invocation. Also, some special information is output about the program being run. Before being saved to the log file, stacktrace info can be filtered through a custom command. OPTIONS
EXAMPLEThe output of lmdbg-run may look like the following
This output means that realloc function was given the pointer 0xbb901800 and 777 bytes were requested. As a result realloc returned the address 0xbb901c00. Addresses 0xbbbe58e8, 0xbbbe5a37 etc. are a part of the stacktrace. EXAMPLE$ cat test2.c #include <stdlib.h> int main () { EXAMPLElmdbg-run -o log ./my_app && ENVIRONMENT
NOTESFull stacktrace allows analysing an application on per-module basis. It helps determine what libraries and/or components require more memory than others and why. See lmdbg-stat and lmdbg-sort. BUGSThe current implementation of lmdbg-run relies on several GCC's extensions, namely, __builtin_return_address, __builtin_frame_address, __attribute__((constructor)) and __attribute__((destructor)). In my knowledge, Besides GCC these extensions are also supported by Intel C compiler and Clang. If you know a solution that works for other compilers let me now ;-) SEE ALSOlmdbg(1), lmdbg-sym(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) AUTHORAleksey Cheusov <vle@gmx.net>
|