Implement frontend next command

This commit is contained in:
Derek Parker
2014-07-11 16:18:07 -05:00
parent eeb5757097
commit 6a82ebb25d

View File

@ -24,6 +24,7 @@ func DebugCommands() *Commands {
cmds := map[string]cmdfunc{ cmds := map[string]cmdfunc{
"exit": exitFunc, "exit": exitFunc,
"continue": cont, "continue": cont,
"next": next,
"break": breakpoint, "break": breakpoint,
"step": step, "step": step,
"clear": clear, "clear": clear,
@ -94,6 +95,23 @@ func step(p *proctl.DebuggedProcess, args ...string) error {
return nil return nil
} }
func next(p *proctl.DebuggedProcess, args ...string) error {
err := p.Next()
if err != nil {
return err
}
regs, err := p.Registers()
if err != nil {
return err
}
f, l, _ := p.GoSymTable.PCToLine(regs.PC())
fmt.Printf("Stopped at: %s:%d\n", f, l)
return nil
}
func clear(p *proctl.DebuggedProcess, args ...string) error { func clear(p *proctl.DebuggedProcess, args ...string) error {
fname := args[0] fname := args[0]
fn := p.GoSymTable.LookupFunc(fname) fn := p.GoSymTable.LookupFunc(fname)