-
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
Publish GDB Plugin as a standard python package #14904
Merged
xiaoxiang781216
merged 32 commits into
apache:master
from
XuNeo:gdb-plugin-misc-fix-rename
Nov 23, 2024
Merged
Publish GDB Plugin as a standard python package #14904
xiaoxiang781216
merged 32 commits into
apache:master
from
XuNeo:gdb-plugin-misc-fix-rename
Nov 23, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For LTO optimization, we may not be able to parse the macro value. Parse .debug_macro section from elf manually. Signed-off-by: xuxingliang <[email protected]>
ta_argv is removed, we use pointer to the TLS instead Signed-off-by: Gao Jiawei <[email protected]>
Signed-off-by: Gao Jiawei <[email protected]>
Signed-off-by: Gao Jiawei <[email protected]>
Signed-off-by: anjiahao <[email protected]>
(gdb) info threads Id Target Id Frame * 1.1 Thread 1 (Name: CPU0 IDLE, State: 3, Pri: 0, Stack: 41eccfec, Size: 3976) 0x402cd586 in up_idle () at chip/r528_idle.c:80 1.2 Thread 2 (Name: CPU1 IDLE, State: 4, Pri: 0, Stack: 4194bb78, Size: 3976) 0x402cd586 in up_idle () at chip/r528_idle.c:80 (gdb) info nxthreads Index Tid Pid Cpu Thread Info Frame 0 0 0 0 '\000' Thread 0x419633b8 (Name: CPU0 IDLE, State: Assigned, Priority: 0, Stack: 3976) 0x402cd586 up_idle() at chip/r528_idle.c:80 *1 1 1 1 '\001' Thread 0x41963498 (Name: CPU1 IDLE, State: Running, Priority: 0, Stack: 3976) 0x402cd586 up_idle() at chip/r528_idle.c:80 (gdb) Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: buxiasen <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Some version of gdb does not support subprocess Signed-off-by: xuxingliang <[email protected]>
Make sure elf exists before registering our commands. If no elf at the moment, register event to GDB to get notified when user adds the first object file. Signed-off-by: xuxingliang <[email protected]>
Prebuilt arm-none-eabi-gdb may have not socket module available. Signed-off-by: xuxingliang <[email protected]>
Usage: addr2line address1 address2 expression1 Example: addr2line 0x1234 0x5678 addr2line "0x1234 + pointer->abc" &var var->field function_name var addr2line $pc $r1 "$r2 + var" addr2line [24/08/29 20:51:02] [CPU1] [209] [ap] sched_dumpstack: backtrace| 0: 0x402cd484 0x4028357e Signed-off-by: xuxingliang <[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]>
Signed-off-by: anjiahao <[email protected]>
Signed-off-by: anjiahao <[email protected]>
After check version using inferior 2, need to switch back for normal operation Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
GDB uses remote-register to describe g/G packet. Whatever the target is, we can always find out the register offset in packet by `maint print remote-registers`. In NuttX, we follow the same standard to prepare the packet, in both coredump and GDB stub. For example, the CPSR for arm-v7a is at register number of 25, byte offset of 164. So we define the CPSR in g_reg_offs (164 /4 = 41)th elementent. If GDB stub supports qXfer feature, then GDB will ask stub for target descriptor, which is a standard xml file. If this file is provided, then the register order is also changed. It's also reflected in 'maint print remote-registers' output. JLink GDB server supports it for example. We always use manually added second inferiort to query the original remote register layout. So it can match with tcbinfo. Signed-off-by: xuxingliang <[email protected]>
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: xuxingliang <[email protected]>
Now the GDB tool can be built with python -m build . to generate a package. Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Run diagnostic related commands anytime to generate report. E.g `diag report -o systemreport.json` Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: rongyichang <[email protected]>
Signed-off-by: anjiahao <[email protected]>
Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: yangao1 <[email protected]>
Now the dmesg output log in correct time order, from oldest to latest. The NULL strings are also stripped, if the buffer is never get fully filled. Signed-off-by: xuxingliang <[email protected]>
a461f84
to
bea511e
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. |
anjiahao1
approved these changes
Nov 22, 2024
xiaoxiang781216
approved these changes
Nov 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: Tooling
Size: XL
The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: Please adhere to Contributing Guidelines.
Summary
In this PR, I have included several useful small tools.
deadlock
same as device side deadlock detection.addr2line
convert values to backtrace, similar to addr2line on hostprofile
this tools is used to profiler python commands, so we can improve the performance of the tools itself.diagnose
This tool automatically search available commands and generate a json report.dmesg
: show the RAM logSeveral 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
orsource nuttx/tools/gdb/gdbinit.py
which add nuttx/tools/gdb to path and import nuttxgdb.Impact
__init__.py
is replaced bygdbinit.py
.__init__.py
is used to mark a python packageTesting
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:
Run:
deadlock
use the same test case in #13899diag report
will generate a json of some of the command results .dmesg can be tested by generate some syslog on device by
echo 123 > /dev/ttyS1
and verify on gdb: