Skip to content

Debug Watch List

Noah Krim requested to merge debug-watchlist into main

Among some fixes, this adds three main features to the VRV CLI prompt to support better debugging. Closes #51 (closed). Relates to #16.

The two smaller features are:

  • abi_register_names control setting which controls how the front-end displays registers in both print prompts as well as instruction formatting.
  • lookup_all_matching_defined_symbols() is a function that queries both the main and retired symbol tables for all defined symbols with the given name, with the global symbol appearing first in the list if it exists. This is used to safely query from the retired table while recognizing if a collision occurs, allowing the front end to handle it how it wishes. This partially addresses #16 by allowing users to refer to non-global symbols with unique names and, if there is a name collision, they can at least see the other potential addresses with the same symbol name.

Additionally, the break, delete, and print prompt commands were all cleaned up a bit with the help of two functions. convert_cmd_arg_symbol uses the new symbol lookup function to try to find and convert the top symbol match (prefers globals) to an integer token type so they can be used seamlessly alongside explicit address references. The incrementation logic for redo was also consolidated into another helper function, further simplifying these three commands.

Finally, the core feature of this MR is the watch command. This allows the user to request a register, csr, or memory line to be displayed after each execution command (full run-cycles, or single steps). Running it with the same argument removes it from the watch list, and wc or watchclear clears the entire list.

While most of the functionality is similar to print, it differs when using pc as the argument. watch pc prints the instruction at the current PC after execution finishes. This allows the user to see the upcoming instruction after each execution command. This can be used in conjunction with verbose messaging to see both the just-executed instruction as well as the upcoming instruction.

Merge request reports