Skip to content

Implement GDB stub for remote debugging #45

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

Merged
merged 1 commit into from
Sep 1, 2022
Merged

Implement GDB stub for remote debugging #45

merged 1 commit into from
Sep 1, 2022

Conversation

RinHizakura
Copy link
Collaborator

This is an experimental solution that lets rv32emu support a small set of GDB Remote Serial Protocol packet with my mini-gdbstub library.

It is worth mentioning that mini-gdbstub is still a WIP and unstable library, so it doesn't support every type of packet of GDB remote serial protocol, and there might also have some bugs that must be refined in mini-gdbstub. I think we could still add mini-gdbstub on rv32emu first and report the bug to mini-gdbstub directly if we find any. Tell me if you have any better thoughts to integrate the GDB remote serial protocol support on rv32emu.

On the other hand, rv32emu itself also has to provide a better implementation of the gdbstub abstraction (For example, rv_set_bp should be able to set more than one breakpoint).

@RinHizakura
Copy link
Collaborator Author

An example to use the debug mode on rv32emu can be find in #22

@lgtm-com
Copy link

lgtm-com bot commented Aug 28, 2022

This pull request introduces 6 alerts when merging 168abb1 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve git commit message. See https://cbea.ms/git-commit/

@lgtm-com
Copy link

lgtm-com bot commented Aug 28, 2022

This pull request introduces 6 alerts when merging 35cddab into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Aug 28, 2022

This pull request introduces 6 alerts when merging ace1b8a into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@RinHizakura
Copy link
Collaborator Author

RinHizakura commented Aug 28, 2022

I think I may have to write down some examples to use the debug mode and also mention the limitation of this functionality in README.md? It's not suitable to cover them all under the commit message.

@lgtm-com
Copy link

lgtm-com bot commented Aug 28, 2022

This pull request introduces 6 alerts when merging e2cc3d5 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@jserv
Copy link
Contributor

jserv commented Aug 28, 2022

I think I may have to write down some examples to use the debug mode and also mention the limitation of this functionality in README.md? It's not suitable to cover them all under the commit message.

You should modify REAMD.md as well.

@lgtm-com
Copy link

lgtm-com bot commented Aug 29, 2022

This pull request introduces 6 alerts when merging 33317f2 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@jserv jserv changed the title Add debug mode using mini-gdbstub submodules Implement GDB stub for remote debugging Aug 29, 2022
@lgtm-com
Copy link

lgtm-com bot commented Aug 29, 2022

This pull request introduces 6 alerts when merging ab6e4a9 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Aug 31, 2022

This pull request introduces 6 alerts when merging ec4f468 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Aug 31, 2022

This pull request introduces 6 alerts when merging 2f60fef into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@jserv
Copy link
Contributor

jserv commented Aug 31, 2022

Attempt to provide (semi-)automated script/procedure for GDB remote connections as a test case, so that we can validate on demand.

You can prepare a GDB script file. Let's say "remote-commands.gdb" and run gdb with option -q -x remote-commands.gdb.

@lgtm-com
Copy link

lgtm-com bot commented Aug 31, 2022

This pull request introduces 6 alerts when merging 3e79f52 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@RinHizakura
Copy link
Collaborator Author

RinHizakura commented Aug 31, 2022

You can prepare a GDB script file. Let's say "remote-commands.gdb" and run gdb with option -q -x remote-commands.gdb.

A GDB script is added now to simply test some of the supported commands/commands sequences, which can be run by make gdb_test. I may have to fix it for better CI/CD, however.

@lgtm-com
Copy link

lgtm-com bot commented Aug 31, 2022

This pull request introduces 6 alerts when merging e8b3b0a into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Aug 31, 2022

This pull request introduces 6 alerts when merging d32c12a into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Aug 31, 2022

This pull request introduces 6 alerts when merging 1d10fa0 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

This patch provide an experimental solution that lets rv32emu support a small
set of GDB Remote Serial Protocol packet with the mini-gdbstub library. After
this patch, we could connect our emulator to GDB and interact with
some simple commands like printing current program counter(`print $pc`) or
unpausing the execution(`continue`).

It's worth mentioning that we only enable to use single breakpoint on
rv32emu under this patch. It will be improved in the future.

Close #22
@lgtm-com
Copy link

lgtm-com bot commented Aug 31, 2022

This pull request introduces 6 alerts when merging 7ed8da6 into 304f0af - view on LGTM.com

new alerts:

  • 6 for FIXME comment

@jserv jserv merged commit 1712435 into sysprog21:master Sep 1, 2022
@jserv
Copy link
Contributor

jserv commented Sep 1, 2022

Thank @RinHizakura for contributing! I amended the commit messages.

vestata pushed a commit to vestata/rv32emu that referenced this pull request Jan 24, 2025
With the help of the external mini-gdbstub library, rv32emu offers an
experimental way to support a limited number of GDB Remote Serial
Protocol (GDBRSP) packets. After applying this patch, we were able to
connect rv32emu to GDB and interact with it using basic commands
such as "print $pc" to dump the value of current program counter or
"continue" to resume program running.

It is important to note that this patch only permits the use of one
breakpoint. Future upgrades will be made.

Close sysprog21#22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants