A GDB Python script that analyzes and records C/C++ application's dynamic memory status. CMA has little effect on analyzed C/C++ application performance.
CMA supports X86_32 and X86_64.
How to use CMA?
CMA just can work with GDB 7.5 or newer version. You can use Get-GDB check the version of GDB in current system and get GDB 7.5 or newer version if need.
C/C++ application that want to analyzes should be built with GCC "-g" option to get the memory allocate and release code line infomation.
gcc -g xxx
g++ -g xxx
GDB control the C/C++ application that want to analyzes.
There are some ways:
Open GDB with a application. Don't need execute application because CMA script will auto do it if need.
gdb xxx
Attach a running application.
gdb -p pid
Or
gdb
attach pid
Start CMA script inside GDB.
It will let you input some options. Then, exencute application and analyzes its memory allocate and release.
source cma.py
When CMA script and application is running, you can use CTRL-C interrupt their execution. Then, you can let CMA script save record to a CSV file.
CSV file can be read by Openoffice or Excel.
[0] Record memory infomation to "/home/teawater/tmp/cma.csv".
[1] Continue.
[2] Quit.
Which operation?[0]
Memory infomation saved into "/home/teawater/tmp/cma.csv".
Continuing.