summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-17 01:37:23 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-17 01:37:23 +0100
commit366ead0dc70410a213eb5745dc869b8df0f036ed (patch)
treec858c5a3558ac4ea4a5881e8d86b065c36dcaccd
parent01c6bfb9994aeb811c7b3a2b2ec8ede30d041ef8 (diff)
downloadtoy-debugger-366ead0dc70410a213eb5745dc869b8df0f036ed.tar.gz
Store the current source filename and use it to pre-fill the breakpoint input buffer
-rw-r--r--tdbg.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tdbg.cpp b/tdbg.cpp
index 8db550e..c206018 100644
--- a/tdbg.cpp
+++ b/tdbg.cpp
@@ -619,6 +619,7 @@ int main(int argc, char** argv) {
bool running = true;
InputMode mode = INPUT_MODE_NORMAL;
std::string input_buffer;
+ std::string current_source_filename;
std::vector<std::string> log_buffer;
int log_scroll_offset = 0;
int locals_scroll_offset = 0;
@@ -652,8 +653,10 @@ int main(int argc, char** argv) {
std::string fullpath;
if (le.GetFileSpec().GetDirectory()) {
fullpath = std::string(le.GetFileSpec().GetDirectory()) + "/" + le.GetFileSpec().GetFilename();
+ current_source_filename = le.GetFileSpec().GetFilename();
} else {
fullpath = le.GetFileSpec().GetFilename();
+ current_source_filename = fullpath;
}
const std::vector<std::string>& lines = source_cache.get_lines(fullpath);
int total_lines = (int)lines.size();
@@ -701,7 +704,11 @@ int main(int argc, char** argv) {
}
} else if (ev.ch == 'b') {
mode = INPUT_MODE_BREAKPOINT;
- input_buffer.clear();
+ if (!current_source_filename.empty()) {
+ input_buffer = current_source_filename + ":";
+ } else {
+ input_buffer.clear();
+ }
} else if (ev.ch == 'p') {
mode = INPUT_MODE_VARIABLE;
input_buffer.clear();