mirror of
https://github.com/go-delve/delve.git
synced 2025-11-01 20:20:40 +08:00
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:
committed by
GitHub
parent
b8f8cd82a6
commit
a97da22762
@ -21,7 +21,7 @@ import (
|
||||
func ConvertBreakpoint(bp *proc.Breakpoint) *Breakpoint {
|
||||
b := &Breakpoint{
|
||||
Name: bp.Name,
|
||||
ID: bp.LogicalID,
|
||||
ID: bp.LogicalID(),
|
||||
FunctionName: bp.FunctionName,
|
||||
File: bp.File,
|
||||
Line: bp.Line,
|
||||
@ -68,10 +68,10 @@ func ConvertBreakpoints(bps []*proc.Breakpoint) []*Breakpoint {
|
||||
r := make([]*Breakpoint, 0, len(bps))
|
||||
for _, bp := range bps {
|
||||
if len(r) > 0 {
|
||||
if r[len(r)-1].ID == bp.LogicalID {
|
||||
if r[len(r)-1].ID == bp.LogicalID() {
|
||||
r[len(r)-1].Addrs = append(r[len(r)-1].Addrs, bp.Addr)
|
||||
continue
|
||||
} else if r[len(r)-1].ID > bp.LogicalID {
|
||||
} else if r[len(r)-1].ID > bp.LogicalID() {
|
||||
panic("input not sorted")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user