summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-16 13:25:40 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-16 13:25:40 +0100
commitd8028e0f3ea12f1cca9dc84eda3767c26d0a3731 (patch)
tree3057d1ade1c8dec18434a523c87984d61758748c /README.md
parent4537fa8fa96915b7b907579bcb2b3f84b2322160 (diff)
downloadtoy-debugger-d8028e0f3ea12f1cca9dc84eda3767c26d0a3731.tar.gz
Merged TUI into main
Diffstat (limited to 'README.md')
-rw-r--r--README.md70
1 files changed, 61 insertions, 9 deletions
diff --git a/README.md b/README.md
index 8cfbcc9..fcd8ff6 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,10 @@
This project demonstrates how to use the LLDB C++ API to build a very basic
debugger.
+> [!IMPORTANT]
+> This is a work in progress and is not a production-ready debugger. I wrote
+> this to learn how to use the LLDB C++ API.
+
https://github.com/user-attachments/assets/677f69fd-c5fe-402c-9342-3304547b29aa
## Requirements
@@ -12,15 +16,63 @@ sudo xbps-install -S lldb21-devel clang llvm llvm-devel
```
After you clone the repository build the debugger and a sample program with
-`make`.
+`make all -B`.
+
+## How to use
+
+Run the debugger with: `./tdbg <target_executable>`
+
+### 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 |
+| `q` | **Quit** debugger |
+
+### Input Mode
+
+When adding breakpoints or printing variables:
+- `Enter`: Confirm input
+- `Esc`: Cancel and return to normal mode
+
+### Tips & Troubleshooting
+
+- **Logs**: The debugger redirects `stderr` to `tdbg.log`. Check this file if
+ something isn't working as expected.
+- **Missing Source**: If the debugger enters a function without source (like a
+ library call), it will fallback to disassembly. Use `n` (Step Over) or `o`
+ (Step Out) to get back to your code.
+
+### Type mappings
+
+| Type | Mapping |
+| :------------ | :------------------------ |
+| Pointer | `p` |
+| Reference | `&` |
+| Array | `a` |
+| Integer (int) | `i` |
+| Char | `c` |
+| Float | `f` |
+| Double | `d` |
+| Bool | `b` |
+| Long | `l` |
+| Short | `s` |
+| Struct | `s` |
+| Class | `c` |
+| Void | `v` |
+| Default | First letter of type name |
+
+> [!NOTE]
+> Some symbols are shared (e.g., `s` for both Short and Struct, `c` for both
+> Char and Class).
-Then run the debugger with example program with `./tdbg example`.
+## Acknowledgment
-## Available commands
+- https://github.com/termbox/termbox2
-- `c` - Continue execution until the next breakpoint or stop
-- `s` - Step into the next instruction/function
-- `n` - Step over the next instruction/function
-- `bt` - Print a backtrace (call stack) of the current thread
-- `v` - Print local variables in the current stack frame
-- `q` - Kill the debugged process and exit