XuNeo opened a new pull request, #14904: URL: https://github.com/apache/nuttx/pull/14904
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary In this PR, I have included several useful small tools. 1. `deadlock` same as device side deadlock detection. 2. `addr2line` convert values to backtrace, similar to addr2line on host 3. `profile` this tools is used to profiler python commands, so we can improve the performance of the tools itself. 4. `diagnose` This tool automatically search available commands and generate a json report. 5. `dmesg`: show the RAM log Several minor bug fixes are also included here to minimize merge confections. From this PR on, the nuttxgdb tool can be published as a standard python package. We can now use `py import nuttxgdb` or `source nuttx/tools/gdb/gdbinit.py` which add nuttx/tools/gdb to path and import nuttxgdb. ## Impact `__init__.py` is replaced by `gdbinit.py`. `__init__.py` is used to mark a python package ## Testing *Update this section with details on how did you verify the change, what Host was used for build (OS, CPU, compiler, ..), what Target was used for verification (arch, board:config, ..), etc. Providing build and runtime logs from before and after change is highly appreciated.* Tested on qemu: `lm3s6965-ek:qemu-flat` Config: ```patch +CONFIG_DEBUG_SYMBOLS_LEVEL="-g3" +CONFIG_RAMLOG=y +CONFIG_RAMLOG_SYSLOG=y +CONFIG_SYSLOG_DEVPATH="/dev/ttyS1" +CONFIG_SYSLOG_MAX_CHANNELS=2 ``` Run: ``` qemu-system-arm -semihosting \ -M lm3s6965evb \ -device loader,file=nuttx.bin,addr=0x00000000 \ -netdev user,id=user0 \ -nic user,id=user1 \ -serial mon:stdio -nographic -s ``` `deadlock` use the same test case in https://github.com/apache/nuttx/pull/13899 ``` (gdb) deadlock Thread 6 "" has deadlocked! holders: 6->7->8->9 (gdb) ``` `diag report` will generate a json of some of the command results . ``` (gdb) diag report Run command: Memleak Run command: DeadLock Run command: Dmesg Write report to /home/neo/projects/nuttx/nuttx/nuttx.diagnostics.json (gdb) shell cat /home/neo/projects/nuttx/nuttx/nuttx.diagnostics.json [ { "title": "Memory Leak Report", "command": "memleak", "details": "Need to set CONFIG_MM_BACKTRACE to 8 or 16 better.\n" }, { "title": "Deadlock Report", "summary": "1 deadlocks", "command": "deadlock", "deadlocks": { "6": [ "7", "8", "9" ] } }, { "title": "RAM log", "summary": "Buffer not available", "result": "info", "command": "dmesg", "message": "" } ](gdb) ``` dmesg can be tested by generate some syslog on device by `echo 123 > /dev/ttyS1` and verify on gdb: ``` (gdb) dmesg 123 (gdb) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org