Skip to content

Commit 61ddeb0

Browse files
committed
Suspend the breakpoint if file is not found
1 parent c4ab92e commit 61ddeb0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/proc/bininfo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,10 @@ func (err *ErrCouldNotFindLine) Error() string {
930930
return fmt.Sprintf("could not find file %s", err.filename)
931931
}
932932

933+
func (err *ErrCouldNotFindLine) IsFileFound() bool {
934+
return err.fileFound
935+
}
936+
933937
// AllPCsForFileLines returns a map providing all PC addresses for filename and each line in linenos
934938
func (bi *BinaryInfo) AllPCsForFileLines(filename string, linenos []int) map[int][]uint64 {
935939
r := make(map[int][]uint64)

service/dap/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,9 @@ func (s *Session) setBreakpoints(prefix string, totalBps int, metadataFunc func(
15101510
if err == nil {
15111511
// Create new breakpoints.
15121512
got, err = s.debugger.CreateBreakpoint(bp, "", nil, false)
1513+
if createBpError, isCouldNotFindLine := err.(*proc.ErrCouldNotFindLine); isCouldNotFindLine && !createBpError.IsFileFound() {
1514+
got, err = s.debugger.CreateBreakpoint(bp, "", nil, true)
1515+
}
15131516
}
15141517
}
15151518
}

0 commit comments

Comments
 (0)