proc: when stepping set condition on thread ID if there is no curg (#3475)

If there is no current goroutine when 'next', 'step' or 'stepout' are
used set a condition that the thread ID should stay the same instead.
This makes stepping work for multithreaded C programs or Go programs
that have threads started by cgo code.

Fixes #3262
This commit is contained in:
Alessandro Arzilli
2023-08-21 21:30:56 +02:00
committed by GitHub
parent f0b534ddcc
commit 6a0423a1e9
9 changed files with 68 additions and 39 deletions

View File

@ -30,11 +30,17 @@ func Int(n int64) *ast.BasicLit {
}
// And returns an expression evaluating 'x && y'.
func And(x, y ast.Expr) *ast.BinaryExpr {
func And(x, y ast.Expr) ast.Expr {
if x == nil || y == nil {
return nil
}
return &ast.BinaryExpr{Op: token.LAND, X: x, Y: y}
}
// Or returns an expression evaluating 'x || y'.
func Or(x, y ast.Expr) *ast.BinaryExpr {
func Or(x, y ast.Expr) ast.Expr {
if x == nil || y == nil {
return nil
}
return &ast.BinaryExpr{Op: token.LOR, X: x, Y: y}
}