From a4c2b6e89103670cbf748760345ba45453666a17 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 17 Jan 2026 02:46:10 +0100 Subject: Add help command-line option --- README.md | 29 ++++++++++++++++------------- tdbg.cpp | 8 ++++++++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 53d6285..5c84500 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/tdbg.cpp b/tdbg.cpp index 3daede1..b078f0a 100644 --- a/tdbg.cpp +++ b/tdbg.cpp @@ -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] [-- 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]); -- cgit v1.2.3