feat(debug): headless script mode with timeout watchdog
This commit is contained in:
+5
-4
@@ -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) ")
|
||||
|
||||
Reference in New Issue
Block a user