Skip to content
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

Initial implementation of an interactive debugger, RDB #221

Draft
wants to merge 7 commits into
base: devel
Choose a base branch
from

Conversation

donofrio
Copy link
Collaborator

@donofrio donofrio commented Dec 9, 2023

This is a first cut at an interactive command line debugger for rev. Currently it has been tested with one core / one hart. Multicore will probably work... multihart is for sure broken.

To drop into debugging you set a param on RevCPU "breakAtCycle" : <cycle number> An example is the python config. Once in, you are greeted with a command prompt. h will get you help:

Supported commands:
        reg <hart> <num>  // Print Register value. num >= 32 will print all regs
        s <num>           // Step forward num cycles - default is one cycle
        pc <hart> <num>   // Execute until hart reaches pc == num. num must be in hex
        c                 // Continue (exit debugger)

Still in draft as there are some fundamental design choices worth considering before this goes further - for example, is RevCPU the right place for this class to live, or should it have some functionality buried in an individual RevProc as well, or should there be a debugger instance per Proc, rather than a single global debugger per RevCPU? Currently RDB is a friend of RevProc, so it can read / write any or all of it's internal state.

Some potential feature targets:

  • Break on a memory address touch
  • Read memory
  • Integration with Tracer output (auto print tracer output when you single step)
  • Call stack printout
  • Others?

@leekillough
Copy link
Collaborator

reg <hart> <num> // Print Register value. num >= 32 will print all regs

It would be more intuitive if simply omitting <num> printed all registers.

pc <hart> <num> // Execute until hart reaches pc == num. num must be in hex

It would be good if hex/decimal/octal were supported by reading 0x... as hex, 0... as octal, and 123... as decimal (strtol with a base of 0, or %i in scanf).

@kpgriesser
Copy link
Collaborator

I like the idea of enabling the tracer. In addition to enabling the tracer at the breakpoint we could capture a limited size trace buffer and dump it when we hit a breakpoint.

@jleidel
Copy link
Contributor

jleidel commented Jul 9, 2024

can we close this PR?

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.

4 participants