summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-17 02:46:10 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-17 02:46:10 +0100
commita4c2b6e89103670cbf748760345ba45453666a17 (patch)
tree9e840dfc397a0be227976fa2d3bf552895b9a9b0
parent6965762e2f3eda25b080c484bfed2191a6b5f059 (diff)
downloadtoy-debugger-a4c2b6e89103670cbf748760345ba45453666a17.tar.gz
Add help command-line option
-rw-r--r--README.md29
-rw-r--r--tdbg.cpp8
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] <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]);