-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDB Plugin Upgrade part2: memory leak detection and other memory tools #14851
Conversation
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very cool! I can't wait to try it! Thanks
Signed-off-by: anjiahao <[email protected]>
For coredump, gdb-stub, the thread command is natively supported. Signed-off-by: xuxingliang <[email protected]>
Display all memory nodes in a picture, which can be used to help analyze memory fragmentation Signed-off-by: yinshengkai <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
1. Avoid to_bytes by using memoryview directly. 2. No need to call gdb to cast to char *. 3. Cache the memory data without invoke gdb in every iteration. 4. Do code cleanup. memleak speed improved from 261.93 seconds to 29.9 seconds for x4b usecase. Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: yinshengkai <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Read the whole memory costs additional time. When the number memory nodes is small, test on qemu shows that read memory directly is faster. Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
"on" string is always in the word 'notification'. Should use "is on" instead. Signed-off-by: xuxingliang <[email protected]>
The macro could be eliminated by optimization. Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
1. Remove Nx prefix for nuttx unique commands. 2. Add docstring for most of the commands in order to show help message. 3. Add 'init_once' method for Memmap command. The prerequisite is checked the moment it's used. Signed-off-by: xuxingliang <[email protected]>
For the prebuilt arm-none-eabi-gdb, there's no python builtin module available. Signed-off-by: xuxingliang <[email protected]>
information prefer from gdb to python class Signed-off-by: buxiasen <[email protected]>
Signed-off-by: anjiahao <[email protected]>
Signed-off-by: anjiahao <[email protected]>
Signed-off-by: anjiahao <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: anjiahao <[email protected]>
Signed-off-by: anjiahao <[email protected]>
23eb8b2
to
428cffb
Compare
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
428cffb
to
2cd1a7d
Compare
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Signed-off-by: Neo Xu <[email protected]>
2cd1a7d
to
ca2392f
Compare
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
Note: Please adhere to Contributing Guidelines.
Summary
This PR is based on #14843 to minimize conflicts. I will rebase once that one is merged. The changes are from commit 679e38d.
In this PR, @anjiahao1 introduces a powerful tool to automatically detect memory leak based on offline core dump or online gdb connection. There are follow up commits that optimizes memleak detection speed.
The memfrag from @Gary-Hobson is used to calculate memory fragmentation rate, so we can have a relatively unified number to check the fragmentation rate.
The memmap from @Gary-Hobson can visually show the memory status.
This PR also includes miscellaneous bug fixes for utils module such as compatibility for older version of GDB etc.
Impact
New feature and bug fixes.
Testing
I tested on qemu arm64 with below additional configuration. Note that
-g3
is needed in order to parse the macro values which are needed by the tool.gdb-multiarch build/nuttx -ex "tar rem:1127" -ex "source nuttx/tools/gdb/__init__.py"
memleak
commandNote the leak is generated by example in hello_main.c: