Debug REPL - Hyp-ed/hyped-2024 GitHub Wiki

Debug REPL

The debug REPL is a tool we have written to simplify testing individual components (e.g. io protocols or sensors) as well as larger systems (e.g. the motor controllers or levitation). The active commands are defined in a TOML config file, an example (with all fields, although your config file does not need them all) is at config/debug.toml.

Building the REPL

Build with make -j hyped_debugger. The REPL is also build when running make -j.

Using the REPL

Run the REPL with ./hyped_debugger <config_file.toml>. This will give you a terminal that looks something like:

18:35:07.323 DEBUG[REPL] Adding command: help
18:35:07.323 DEBUG[REPL] Adding command: quit
18:35:07.324 DEBUG[REPL] Adding alias: example -> help
>>  example
18:35:10.821 DEBUG[REPL] help: Print this help message
18:35:10.821 DEBUG[REPL] quit: Quit the program
>> 

Enter commands as desired.

Commands

A command is defined in a .[ch]pp file pair in lib/debug/commands which has a

static core::Result addCommands(core::ILogger &logger,
                                  std::shared_ptr<Repl> repl,
                                  toml::v3::node_view<toml::v3::node> config);

method which adds a number of Command objects which is called from Repl::create(). See can_commands.cpp and .hpp for an example of adding commands.

Aliases

Aliases can be added to config.toml as follows:

[aliases]
"example" = "command"

Each command string must be a valid command.

⚠️ **GitHub.com Fallback** ⚠️