Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc: skip trapthread for harcoded breakpoints after manual stop #3582

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkg/proc/target_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ func (grp *TargetGroup) Continue() error {
dbp.StopReason = StopWatchpoint
}
return conditionErrors(grp)
case stopReason == StopLaunched:
return nil
default:
// not a manual stop, not on runtime.Breakpoint, not on a breakpoint, just repeat
}
Expand Down Expand Up @@ -1342,6 +1344,9 @@ func (t *Target) handleHardcodedBreakpoints(grp *TargetGroup, trapthread Thread,
if (thread.ThreadID() != trapthread.ThreadID()) && !thread.SoftExc() {
continue
}
if (thread.ThreadID() == trapthread.ThreadID()) && grp.cctx.GetManualStopRequested() {
continue
}

loc, err := thread.Location()
if err != nil || loc.Fn == nil {
Expand Down Expand Up @@ -1371,7 +1376,11 @@ func (t *Target) handleHardcodedBreakpoints(grp *TargetGroup, trapthread Thread,
}
setHardcodedBreakpoint(thread, loc)
case g == nil || t.fncallForG[g.ID] == nil:
if isHardcodedBreakpoint(thread, loc.PC) > 0 {
// Check that PC is inside a function (not the entry point) and the
// preceding instruction is a hardcoded breakpoint.
// We explicitly check for entry points of functions because the space
// between functions is usually filled with hardcoded breakpoints.
if (loc.Fn == nil || loc.Fn.Entry != loc.PC) && isHardcodedBreakpoint(thread, loc.PC) > 0 {
stepOverBreak(thread, loc.PC)
setHardcodedBreakpoint(thread, loc)
}
Expand Down