diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-17 02:46:10 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-17 02:46:10 +0100 |
| commit | a4c2b6e89103670cbf748760345ba45453666a17 (patch) | |
| tree | 9e840dfc397a0be227976fa2d3bf552895b9a9b0 | |
| parent | 6965762e2f3eda25b080c484bfed2191a6b5f059 (diff) | |
| download | toy-debugger-a4c2b6e89103670cbf748760345ba45453666a17.tar.gz | |
Add help command-line option
| -rw-r--r-- | README.md | 29 | ||||
| -rw-r--r-- | tdbg.cpp | 8 |
2 files changed, 24 insertions, 13 deletions
@@ -50,19 +50,22 @@ Example with auto run: ### Interactive Commands -| Key | Action | -| :-- | :---------------------------------------------------------------- | -| `r` | **Run** the program (auto-breaks on `main` if no breakpoints set) | -| `b` | Add a **breakpoint** (enter name/file:line) | -| `p` | **Print** variable value | -| `n` | **Step over** | -| `s` | **Step into** | -| `o` | **Step out** | -| `c` | **Continue** execution | -| `w` | **Watch** expression | -| `q` | **Quit** debugger | -| `>` | **Reduces sidebar width** | -| `<` | **Increases sidebar width** | +| Key | Action | +| :----------- | :---------------------------------------------------------------- | +| `r` | **Run** the program (auto-breaks on `main` if no breakpoints set) | +| `b` | Add a **breakpoint** (enter name/file:line) | +| `p` | **Print** variable value | +| `n` | **Step over** | +| `s` | **Step into** | +| `o` | **Step out** | +| `c` | **Continue** execution | +| `w` | **Watch** expression | +| `h` | **Toggle help view** | +| `Ctrl+Left` | **Increases sidebar width** | +| `Ctrl+Right` | **Reduces sidebar width** | +| `Ctrl+Up` | **Increases log height** | +| `Ctrl+Down` | **Reduces log height** | +| `q` | **Quit** debugger | ### Input Mode @@ -771,6 +771,14 @@ int main(int argc, char** argv) { startup_breakpoints.push_back(argv[++i]); } else if (arg == "-run") { auto_run = true; + } else if (arg == "-h" || arg == "--help") { + std::cout << "Usage: " << argv[0] << " [options] <target_executable> [-- arg1 arg2 ...]\n\n" + << "Options:\n" + << " -e KEY=VALUE Set environment variable\n" + << " -b BREAKPOINT Set startup breakpoint (name or file:line)\n" + << " -run Automatically run the target on startup\n" + << " -h, --help Show this help message\n"; + return 0; } else if (arg == "--") { for (int j = i + 1; j < argc; ++j) { debuggee_args.push_back(argv[j]); |
