Skip to content

Conversation

@anjiahao1
Copy link
Contributor

Summary

  • Why change is necessary (fix, update, new feature)?
    These changes enhance gdbserver tool for improved debugging capabilities:

    • Fix unexpected thread values (fix)
    • Improve performance by using LIEF for symbol loading (update)
    • Add x86_64 architecture support (new feature)
    • Improve debugging with additional log information (update)
    • Fix compatibility with VSCode (fix)
  • What functional part of code is being changed?
    tools/gdbserver/gdbserver.py

  • How does the change exactly work (what will change and how)?

    • Fixed thread ID handling to ensure thread < 0 is set to 0
    • Replaced symbol loading mechanism to use LIEF inside pyelftools, significantly reducing load time for large ELF files
    • Added x86_64 architecture support to enable crash analysis for x86_64 targets
    • Added unpack_data logging for better debugging visibility
    • Fixed command parsing to work correctly with VSCode's debugger (c command should cut from [2:)
  • Related NuttX Issue reference if applicable.
    N/A

  • Related NuttX Apps Issue / Pull Request reference if applicable.
    N/A

Impact

  • Is new feature added? Is existing feature changed? YES

    • Added x86_64 architecture support
    • Improved symbol loading performance
    • Enhanced debugging capabilities with additional logging
  • Impact on user (will user need to adapt to change)? NO
    These are improvements to the gdbserver tool with backward compatibility maintained.

  • Impact on build (will build process change)? NO
    No changes to the build process.

  • Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO
    This is a host-side debugging tool enhancement.

  • Impact on documentation (is update required / provided)? NO
    Tool documentation update not required for these internal improvements.

  • Impact on security (any sort of implications)? NO

  • Impact on compatibility (backward/forward/interoperability)? YES
    Improved VSCode compatibility through command parsing fix.

  • Anything else to consider or add?
    The performance improvement is significant: symbol loading time reduced from 32s to 2s for a 273MB ELF file.

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host(s): Linux, x86_64
  • Target(s): N/A (host-side debugging tool)
  • Tested x86_64 symbol loading on a 273MB ELF file with significant performance improvement (32s → 2s)
  • Verified thread ID handling fix prevents unexpected values
  • Verified VSCode compatibility improvements

Testing logs after change:

Example test with 273MB ELF file:
Before: Symbol loading took 32 seconds
After:  Symbol loading took 2 seconds using LIEF

Thread ID handling:
Confirmed thread < 0 is properly set to 0

VSCode compatibility:
Confirmed c command parsing works correctly with VSCode debugger

PR verification Self-Check

  • This PR introduces only one functional change.
  • I have updated all required description fields above.
  • My PR adheres to Contributing Guidelines and Documentation (git commit title and message, coding standard, etc).
  • My PR is still work in progress (not ready for review).
  • My PR is ready for review and can be safely merged into a codebase.

anjiahao1 and others added 5 commits January 14, 2026 16:08
Fix unexpected thread values

Signed-off-by: anjiahao <[email protected]>
test:
an elf have 273MB, load symbol 32s to 2s

Signed-off-by: anjiahao <[email protected]>
Add x86_64 support, we can use it to analysis of x86_64 crashes

Signed-off-by: liwenxiang1 <[email protected]>
@anjiahao1 anjiahao1 requested a review from jerpelea as a code owner January 14, 2026 08:21
@github-actions github-actions bot added Area: Tooling Size: M The size of the change in this PR is medium labels Jan 14, 2026
@anjiahao1 anjiahao1 changed the title 20260114gdbserver improve gdbserver.py Jan 14, 2026
@xiaoxiang781216
Copy link
Contributor

please ignore the false spellcheck:

/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:36: lief ==> leaf, life
/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:38: lief ==> leaf, life
/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:38: lief ==> leaf, life
/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:332: lief ==> leaf, life
/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:334: lief ==> leaf, life
/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:346: lief ==> leaf, life
/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:538: lief ==> leaf, life
/home/runner/work/nuttx/nuttx/nuttx/tools/gdbserver.py:540: lief ==> leaf, life

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Tooling Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants