XuNeo opened a new pull request, #14912: URL: https://github.com/apache/nuttx/pull/14912
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary This PR mainly update the utils module and minor bug fixes. 1. Added `Backtrace` to better handle converting addresses to symbols. 2. Enhancement to `offset_of` and `container_of`, now support string as argumment 3. added helper `sizeof`, both str and gdb.Type are accepted. 4. Added enum function to map C enum to python Enum class ``` in C: enum color_e { RED = 1, GREEN = 2, }; in python: COLOR = utils.enum("enum color_e", "COLOR") print(COLOR.GREEN.value) # --> 2 RED = COLOR(1) ``` 6. Added `ArrayIterator` to access array elements 7. Added crash log parsing for `addr2line` command, now you can use `addr2line -f crash.log` or `addr2line -f crash.log -p 123 ` for specified PID. 8. Moved profiling commands to `profile.py` ## Impact No. ## Testing I tested addr2line on qemu arm64. ``` (gdb) addr2line -f crash.log Address Symbol Source Backtrace of 0 0x402cf900 <sched_backtrace+88> /home/neo/projects/nuttx/nuttx/sched/sched/sched_backtrace.c:106 0x402cd854 <sched_dumpstack+68> /home/neo/projects/nuttx/nuttx/libs/libc/sched/sched_dumpstack.c:71 0x402c0510 <dump_running_task+420> /home/neo/projects/nuttx/nuttx/sched/misc/assert.c:667 0x402c0978 <_assert+544> /home/neo/projects/nuttx/nuttx/sched/misc/assert.c:718 0x402b35bc <uart_check_special+132> /home/neo/projects/nuttx/nuttx/drivers/serial/serial.c:2272 0x402b39fc <uart_recvchars+520> /home/neo/projects/nuttx/nuttx/drivers/serial/serial_io.c:282 0x402b1978 <pl011_irq_handler+148> /home/neo/projects/nuttx/nuttx/drivers/serial/uart_pl011.c:838 0x402bfb70 <irq_dispatch+60> /home/neo/projects/nuttx/nuttx/sched/irq/irq_dispatch.c:145 0x402b14e0 <arm64_doirq+96> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_doirq.c:75 0x402b0908 <arm64_decodeirq+80> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_gicv3.c:808 0x402afd60 <arm64_irq_handler+32> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_vectors.S:227 0x402cbcc0 <up_idle+8> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_idle.c:63 0x402af6c4 <arm64_boot_primary_c_routine+16> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_boot.c:212 0x402cf900 <sched_backtrace+88> /home/neo/projects/nuttx/nuttx/sched/sched/sched_backtrace.c:106 0x402cd854 <sched_dumpstack+68> /home/neo/projects/nuttx/nuttx/libs/libc/sched/sched_dumpstack.c:71 0x402c0360 <dump_backtrace+32> /home/neo/projects/nuttx/nuttx/sched/misc/assert.c:452 0x402c11d4 <nxsched_foreach+160> /home/neo/projects/nuttx/nuttx/sched/sched/sched_foreach.c:69 0x402c0ad0 <_assert+888> /home/neo/projects/nuttx/nuttx/sched/misc/assert.c:790 0x402b35bc <uart_check_special+132> /home/neo/projects/nuttx/nuttx/drivers/serial/serial.c:2272 0x402b39fc <uart_recvchars+520> /home/neo/projects/nuttx/nuttx/drivers/serial/serial_io.c:282 0x402b1978 <pl011_irq_handler+148> /home/neo/projects/nuttx/nuttx/drivers/serial/uart_pl011.c:838 0x402bfb70 <irq_dispatch+60> /home/neo/projects/nuttx/nuttx/sched/irq/irq_dispatch.c:145 0x402b14e0 <arm64_doirq+96> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_doirq.c:75 0x402b0908 <arm64_decodeirq+80> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_gicv3.c:808 0x402afd60 <arm64_irq_handler+32> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_vectors.S:227 0x402cbcc0 <up_idle+8> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_idle.c:63 0x402af6c4 <arm64_boot_primary_c_routine+16> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_boot.c:212 Backtrace of 1 0x402cbcc0 <up_idle+8> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_idle.c:63 0x402cbcc0 <up_idle+8> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_idle.c:63 Backtrace of 2 0x402cbcc0 <up_idle+8> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_idle.c:63 Backtrace of 3 0x402cbcc0 <up_idle+8> /home/neo/projects/nuttx/nuttx/arch/arm64/src/common/arm64_idle.c:63 (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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
