feat(debug): headless script mode with timeout watchdog

This commit is contained in:
2026-08-29 14:16:04 +02:00
parent e44162a749
commit cb398d9498
2 changed files with 40 additions and 6 deletions
+5 -4
View File
@@ -8,7 +8,7 @@ package debug
import (
"bufio"
"fmt"
"os"
"io"
"sort"
"strconv"
"strings"
@@ -26,14 +26,15 @@ type SourceLine struct {
Line int
}
// REPL runs the interactive debugger loop.
func REPL(s *Session, bm *Breakpoints, codeBase uint64, funcOffset, funcSize, argsSize int, labels []Label, lines []SourceLine) {
// REPL runs the interactive debugger loop, reading commands from in (pass
// os.Stdin interactively, or a bytes.Reader/script file for headless runs).
func REPL(s *Session, bm *Breakpoints, codeBase uint64, funcOffset, funcSize, argsSize int, labels []Label, lines []SourceLine, in io.Reader) {
entryAddr := codeBase + uint64(funcOffset)
fmt.Printf("stopped at function entry: %#x (%d bytes)\n", entryAddr, funcSize)
fmt.Println("commands: break <label|addr> | step [n] | continue | disas [n] | regs | where | x <addr> [len] | w <addr> <val...> | labels | quit")
scanner := bufio.NewScanner(os.Stdin)
scanner := bufio.NewScanner(in)
for {
fmt.Print("(gasm) ")