-
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
nuttxgdb utils module update #14912
base: master
Are you sure you want to change the base?
nuttxgdb utils module update #14912
Conversation
Use the file hash instead to avoid file name conflicts Signed-off-by: xuxingliang <[email protected]>
Make sure file name is surrounded by \" Signed-off-by: xuxingliang <[email protected]>
Use json module to save macro info to json file and load directly. It can save 2seconds for x4b projects to load plugin Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: buxiasen <[email protected]>
After we introduced NxDQueue and NxSQueue, we're using them like `NxDQueue(g_active_connections, "struct socket_conn_s", "node")` and leads to `utils.container_of(ptr, str, str)`, so maybe we need to allow str input for `utils.container_of` Signed-off-by: Zhe Weng <[email protected]>
We're using `ptr.cast(get_long_type())` a week ago to get the pointer's value, it's alright, but `ptr.address` is not, the `ptr.address` will return **the address of the pointer**. These values are the address of first element in the queue: - `int(g_sigfreeaction["head"])` - `g_sigfreeaction["head"].cast(get_long_type())` - `g_sigfreeaction["head"].dereference().address` But: `int(g_sigfreeaction["head"].address)` is the address of the "head" member, which equals to the address of `g_sigfreeaction` It's happening in NxSQueue: g_sigfreeaction = gdb.parse_and_eval("g_sigfreeaction") print(["%x" % (node) for node in NxSQueue(g_sigfreeaction)]) print(["%x" % (node) for node in NxSQueue(g_sigfreeaction, "sigactq_t", "flink")]) Without this patch: ['f3c0aa10', 'f3c0aa2c', 'f3c0aa48'] ['55db90a0', 'f3c0aa10', 'f3c0aa2c'] With this patch: ['f3c0aa10', 'f3c0aa2c', 'f3c0aa48'] ['f3c0aa10', 'f3c0aa2c', 'f3c0aa48'] Signed-off-by: Zhe Weng <[email protected]>
Use array iterator where possible. Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: huangyin5 <[email protected]>
Now crash log can be directly pass to addr2line tool to get all backtraces. E.g. (gdb) addr2line -f crash.log -p 485 Address Symbol Source Backtrace of 485 0x402cc0ac <up_switch_context+84> /home/work/ssd1/workspace/MiRTOS-X4b-Stable-Build/nuttx/include/arch/syscall.h:179 0x40291276 <nxsig_timedwait+386> signal/sig_timedwait.c:365 0x4028fc7e <nxsig_nanosleep+106> signal/sig_nanosleep.c:141 0x4028fdba <clock_nanosleep+26> signal/sig_nanosleep.c:333 0x402c3736 <usleep+62> unistd/lib_usleep.c:108 0x415018c0 <cs2p2p_mSecSleep+24> Src/PPPP_Common.c:1139 0x414fabde <cs2p2p_Run_send_DRW+258> Src/PPPP_API.c:5577 0x414fac62 <cs2p2p_PPPP_thread_send_DRW+18> Src/PPPP_API.c:5616 0x40446f62 <pthread_startup+10> pthread/pthread_create.c:59 0x41094f4a <pthread_start+106> pthread/pthread_create.c:139 Signed-off-by: xuxingliang <[email protected]>
1. Support any type of value as pointer address in container_of 2. Support string as type in offset_of 3. Make sure type is a pointer in container_of, and not a pointer in offset_of Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: yangao1 <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Usage: (gdb) py NX_INITSTATE = utils.enum("enum nx_initstate_e") (gdb) py print(list(NX_INITSTATE)) [<NX_INITSTATE_E.POWERUP: 0>, <NX_INITSTATE_E.BOOT: 1>, <NX_INITSTATE_E.TASKLISTS: 2>, <NX_INITSTATE_E.MEMORY: 3>, <NX_INITSTATE_E.HARDWARE: 4>, <NX_INITSTATE_E.OSREADY: 5>, <NX_INITSTATE_E.IDLELOOP: 6>, <NX_INITSTATE_E.PANIC: 7>] (gdb) py print(NX_INITSTATE.POWERUP) NX_INITSTATE_E.POWERUP (gdb) py print(NX_INITSTATE.POWERUP.value) 0 (gdb) py print(NX_INITSTATE(1)) Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: Xu Xingliang <[email protected]>
Add simple time command to test time cost of a command. Usage: (gdb) time memleak ... (gdb) Time elapsed: 1.23456s Signed-off-by: xuxingliang <[email protected]>
GDB provides four “standard” register names sp, pc, fp and ps. Those can be used in most of the cases. See https://sourceware.org/gdb/current/onlinedocs/gdb.html/Registers.html Signed-off-by: xuxingliang <[email protected]>
Use a class Bactrace to support convert address to backtrace, format to string, accessing element and iterate though them. Adjust usage in fs and addr2line to make full use of it. Signed-off-by: xuxingliang <[email protected]>
GDB is slow to look up symbols, cache the result to speed up commands like memdump etc. Signed-off-by: xuxingliang <[email protected]>
Let GDB to read from ELF for readonly data. Disable this feature by nxgcore --no-trust-readonly. Signed-off-by: xuxingliang <[email protected]>
[Experimental Bot, please feedback here] This PR does not fully meet the NuttX requirements. While it provides a good overview of the changes, it lacks crucial details required for proper review and integration. Here's a breakdown of what's missing and how to improve it: Summary:
Impact:
Testing:
In short: This PR needs substantial revision before it can be considered for merging. Provide more detail and justification for each change, thoroughly assess the impact, and include comprehensive testing results for all modifications. Follow the template meticulously and address every point. |
6c9233c
to
41c88d9
Compare
Note: Please adhere to Contributing Guidelines.
Summary
This PR mainly update the utils module and minor bug fixes.
Backtrace
to better handle converting addresses to symbols.offset_of
andcontainer_of
, now support string as argummentsizeof
, both str and gdb.Type are accepted.ArrayIterator
to access array elementsaddr2line
command, now you can useaddr2line -f crash.log
oraddr2line -f crash.log -p 123
for specified PID.profile.py
Impact
No.
Testing
I tested addr2line on qemu arm64.