Skip to content

Commit

Permalink
pkg/terminal: Ignore existing breakpoints for continue until (go-delv…
Browse files Browse the repository at this point in the history
…e#2624)

Ignore existing breakpoints when using the continue command to continue
to a specific location such as `continue main.main`. The point of this
command is to continue to a specific location, so if there is already a
breakpoint set there there should be no error returned, just continue
until we hit the breakpoint already set in that location.
  • Loading branch information
derekparker authored Jul 28, 2021
1 parent 56731bd commit cb73ef8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/terminal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,9 @@ func (c *Commands) cont(t *Term, ctx callContext, args string) error {
if args != "" {
tmp, err := setBreakpoint(t, ctx, false, args)
if err != nil {
return err
if !strings.Contains(err.Error(), "Breakpoint exists") {
return err
}
}
defer func() {
for _, bp := range tmp {
Expand Down
12 changes: 12 additions & 0 deletions pkg/terminal/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,18 @@ func TestContinueUntil(t *testing.T) {
})
}

func TestContinueUntilExistingBreakpoint(t *testing.T) {
withTestTerminal("continuetestprog", t, func(term *FakeTerminal) {
term.MustExec("break main.main")
if runtime.GOARCH != "386" {
listIsAt(t, term, "continue main.main", 16, -1, -1)
} else {
listIsAt(t, term, "continue main.main", 17, -1, -1)
}
listIsAt(t, term, "continue main.sayhi", 12, -1, -1)
})
}

func TestPrintFormat(t *testing.T) {
withTestTerminal("testvariables2", t, func(term *FakeTerminal) {
term.MustExec("continue")
Expand Down

0 comments on commit cb73ef8

Please sign in to comment.