Add help command-line option

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)
-rw-r--r-- README.md 29
-rw-r--r-- tdbg.cpp 8
2 files changed, 24 insertions, 13 deletions
diff --git a/README.md b/README.md
...
50
  
50
  
51
### Interactive Commands
51
### Interactive Commands
52
  
52
  
53
| Key | Action                                                            |
53
| Key          | Action                                                            |
54
| :-- | :---------------------------------------------------------------- |
54
| :----------- | :---------------------------------------------------------------- |
55
| `r` | **Run** the program (auto-breaks on `main` if no breakpoints set) |
55
| `r`          | **Run** the program (auto-breaks on `main` if no breakpoints set) |
56
| `b` | Add a **breakpoint** (enter name/file:line)                       |
56
| `b`          | Add a **breakpoint** (enter name/file:line)                       |
57
| `p` | **Print** variable value                                          |
57
| `p`          | **Print** variable value                                          |
58
| `n` | **Step over**                                                     |
58
| `n`          | **Step over**                                                     |
59
| `s` | **Step into**                                                     |
59
| `s`          | **Step into**                                                     |
60
| `o` | **Step out**                                                      |
60
| `o`          | **Step out**                                                      |
61
| `c` | **Continue** execution                                            |
61
| `c`          | **Continue** execution                                            |
62
| `w` | **Watch** expression                                              |
62
| `w`          | **Watch** expression                                              |
63
| `q` | **Quit** debugger                                                 |
63
| `h`          | **Toggle help view**                                              |
64
| `>` | **Reduces sidebar width**                                         |
64
| `Ctrl+Left`  | **Increases sidebar width**                                       |
65
| `<` | **Increases sidebar width**                                       |
65
| `Ctrl+Right` | **Reduces sidebar width**                                         |
  
66
| `Ctrl+Up`    | **Increases log height**                                          |
  
67
| `Ctrl+Down`  | **Reduces log height**                                            |
  
68
| `q`          | **Quit** debugger                                                 |
66
  
69
  
67
### Input Mode
70
### Input Mode
68
  
71
  
...
diff --git a/tdbg.cpp b/tdbg.cpp
...
771
			startup_breakpoints.push_back(argv[++i]);
771
			startup_breakpoints.push_back(argv[++i]);
772
		} else if (arg == "-run") {
772
		} else if (arg == "-run") {
773
			auto_run = true;
773
			auto_run = true;
  
774
		} else if (arg == "-h" || arg == "--help") {
  
775
			std::cout << "Usage: " << argv[0] << " [options] <target_executable> [-- arg1 arg2 ...]\n\n"
  
776
					  << "Options:\n"
  
777
					  << "  -e KEY=VALUE      Set environment variable\n"
  
778
					  << "  -b BREAKPOINT     Set startup breakpoint (name or file:line)\n"
  
779
					  << "  -run              Automatically run the target on startup\n"
  
780
					  << "  -h, --help        Show this help message\n";
  
781
			return 0;
774
		} else if (arg == "--") {
782
		} else if (arg == "--") {
775
			for (int j = i + 1; j < argc; ++j) {
783
			for (int j = i + 1; j < argc; ++j) {
776
				debuggee_args.push_back(argv[j]);
784
				debuggee_args.push_back(argv[j]);
...