proc: do not assign temporary breakpoint IDs (#2650)

Internal breakpoints do not need IDs and assigning them from a counter
separate from the user ID counter can be a cause of confusion.
If a user breakpoint is overlayed on top of a pre-existing internal
breakpoint the temporary ID will be surfaced as if it was a user ID,
possibly conflicting with another user ID.
If a temporary breakpoint is overlayed on top of a pre-existing user
breakpoint and the user breakpoint is first deleted and then
re-created, the user ID will be resurrected along with the breakpoint,
instead of allocating a fresh one.

This change removes internal breakpoint IDs entirely, only user
breakpoints receive an ID.
This commit is contained in:
Alessandro Arzilli
2021-09-29 12:01:37 +02:00
committed by GitHub
parent b8f8cd82a6
commit a97da22762
8 changed files with 78 additions and 60 deletions

View File

@ -251,7 +251,7 @@ func TestCheckpoints(t *testing.T) {
// Delete breakpoint, move back to checkpoint then next twice and check
// output of 'when' again
_, err = p.ClearBreakpoint(bp.Addr)
err = p.ClearBreakpoint(bp.Addr)
assertNoError(err, t, "ClearBreakpoint")
p.Restart(fmt.Sprintf("c%d", cpid))
g, _ = proc.FindGoroutine(p, 1)
@ -283,7 +283,7 @@ func TestIssue1376(t *testing.T) {
withTestRecording("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) {
bp := setFunctionBreakpoint(p, t, "main.main")
assertNoError(p.Continue(), t, "Continue (forward)")
_, err := p.ClearBreakpoint(bp.Addr)
err := p.ClearBreakpoint(bp.Addr)
assertNoError(err, t, "ClearBreakpoint")
assertNoError(p.ChangeDirection(proc.Backward), t, "Switching to backward direction")
assertNoError(p.Continue(), t, "Continue (backward)")