terminal: fixed typo. (#694)
* terminal: fixed typo. * debugger: bugfix: when restaring use new process to FindFileLocation
This commit is contained in:
parent
f4aaffbbf3
commit
464d6c2783
@ -133,7 +133,7 @@ func (d *Debugger) Restart() ([]api.DiscardedBreakpoint, error) {
|
||||
continue
|
||||
}
|
||||
if len(oldBp.File) > 0 {
|
||||
oldBp.Addr, err = d.process.FindFileLocation(oldBp.File, oldBp.Line)
|
||||
oldBp.Addr, err = p.FindFileLocation(oldBp.File, oldBp.Line)
|
||||
if err != nil {
|
||||
discarded = append(discarded, api.DiscardedBreakpoint{oldBp, err})
|
||||
continue
|
||||
|
@ -1193,3 +1193,26 @@ func TestClientServer_FpRegisters(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestClientServer_RestartBreakpointPosition(t *testing.T) {
|
||||
withTestClient2("locationsprog2", t, func(c service.Client) {
|
||||
bpBefore, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.afunction", Line: -1, Tracepoint: true, Name: "this"})
|
||||
addrBefore := bpBefore.Addr
|
||||
t.Logf("%x\n", bpBefore.Addr)
|
||||
assertNoError(err, t, "CreateBreakpoint")
|
||||
_, err = c.Halt()
|
||||
assertNoError(err, t, "Halt")
|
||||
_, err = c.Restart()
|
||||
assertNoError(err, t, "Restart")
|
||||
bps, err := c.ListBreakpoints()
|
||||
assertNoError(err, t, "ListBreakpoints")
|
||||
for _, bp := range bps {
|
||||
if bp.Name == bpBefore.Name {
|
||||
if bp.Addr != addrBefore {
|
||||
t.Fatalf("Address changed after restart: %x %x", bp.Addr, addrBefore)
|
||||
}
|
||||
t.Logf("%x %x\n", bp.Addr, addrBefore)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ func restart(t *Term, ctx callContext, args string) error {
|
||||
}
|
||||
fmt.Println("Process restarted with PID", t.client.ProcessPid())
|
||||
for i := range discarded {
|
||||
fmt.Println("Discarded %s at %s: %v\n", formatBreakpointName(discarded[i].Breakpoint, false), formatBreakpointLocation(discarded[i].Breakpoint), discarded[i].Reason)
|
||||
fmt.Printf("Discarded %s at %s: %v\n", formatBreakpointName(discarded[i].Breakpoint, false), formatBreakpointLocation(discarded[i].Breakpoint), discarded[i].Reason)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user