Skip to content
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

nuttxgdb memory commands performance optimization #14916

Merged
merged 10 commits into from
Nov 24, 2024

Commits on Nov 24, 2024

  1. gdb: optimize memory commands

    Tested on a complex project, results are promising.
    
    Command                 Time cost(s)           Time saving(s)   Peformance Boost
                            Before      After
    memleak                 39.494172   22.366415   17.127757       1.8
    memdump                 41.872441   26.458386   15.414055       1.6
    memdump -a 0x1234       28.116294   1.114119    27.002175       25.2
    memdump --no-backtrace    N/A       1.114119
    memmap                  7.973809    6.836468    1.137341        1.2
    
    Signed-off-by: Xu Xingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    d02367a View commit details
    Browse the repository at this point in the history
  2. gdb/mm: move memleak to standalone file

    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    c46f85b View commit details
    Browse the repository at this point in the history
  3. gdb/memdump: show prev and next node in address finding mode

    This will make it easier to debug memory corruption when agacent node is corrupted.
    
    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    9e4ed65 View commit details
    Browse the repository at this point in the history
  4. mm: dump node overheadp during memdump

    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    dd79ab0 View commit details
    Browse the repository at this point in the history
  5. gdb/memdump: reorganize the memdump parameters

    Make the dump_nodes etc more common to use.
    
    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    da12df4 View commit details
    Browse the repository at this point in the history
  6. gdb/memdump: add option to parse memdump log from device

    igned-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    3d70372 View commit details
    Browse the repository at this point in the history
  7. gdb/memdump: add option to exclude nodes from specific PID

    This is useful to exclude memory nodes for mempool.
    
    E.g.
    
    (gdb) mm dump --nob --top 5 --sort size --nop --no-pid -1
      Pool          CNT          PID         Size  Overhead          Seqno            Address Backtrace
         H            1            0     16777264        44             13         0x41a79010
         H            2          160      1536048        44     1129827490         0x41d6aad0
         H            1        45374      1536176        44     1129829080         0x45ef1010
         H            3          141       408440        44         145817         0x43905bf0
         H            7          158       131120        44          32955         0x4308d090
    Total 14 blks, 23528696 bytes
    (gdb) mm dump --nob --top 5 --sort size --nop
      Pool          CNT          PID         Size  Overhead          Seqno            Address Backtrace
         H            1            0     16777264        44             13         0x41a79010
    *    H            6           -1      1048640        44         116954         0x436a0fd0
    *    H            5           -1      1048640        44         146821         0x43b24fd0
    *    H            3           -1      1048640        44          66161         0x4335bfd0
    *    H            3           -1      1048640        44         156337         0x43d3ffd0
    Total 18 blks, 16777264 bytes
    
    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    303b802 View commit details
    Browse the repository at this point in the history
  8. gdb/mm: fix memdump when mempool backtrace is disabled

    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    10f74df View commit details
    Browse the repository at this point in the history
  9. gdb/mm: fix prev free judging and region search

    1. The prev free flag should use field size instead of preceding to compare.
    2. If not prev-free, then prevnode should be None.
    3. Cast type to mm_freenode_s in order to access flink, blink when node is free.
    4. Heap itself is also included in first region.
    
    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    bda5254 View commit details
    Browse the repository at this point in the history
  10. tools/gdb: avoid direct access to tcb['name']

    It could be disabled at compile time. Use utils.get_task_name to handle it
    
    Signed-off-by: xuxingliang <[email protected]>
    XuNeo committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    c3b9054 View commit details
    Browse the repository at this point in the history