proc: skip autogenerated functions correctly (#2959)
Adjust heuristic used to skip autogenerated functions so that it works correctly with the new naming scheme in go1.18. Fixes #2948
This commit is contained in:
parent
a5532eb985
commit
3138157826
14
_fixtures/stepintobug.go
Normal file
14
_fixtures/stepintobug.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type T struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
t := T{}
|
||||||
|
f1 := t.m1
|
||||||
|
println(f1(1)) //break
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t T) m1(x int) int {
|
||||||
|
return x + 1
|
||||||
|
}
|
||||||
@ -5841,3 +5841,14 @@ func TestNilPtrDerefInBreakInstr(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestStepIntoAutogeneratedSkip(t *testing.T) {
|
||||||
|
// Tests that autogenerated functions are skipped with the new naming
|
||||||
|
// scheme for autogenerated functions (issue #2948).
|
||||||
|
withTestProcess("stepintobug", t, func(p *proc.Target, fixture protest.Fixture) {
|
||||||
|
setFileBreakpoint(p, t, fixture.Source, 9)
|
||||||
|
assertNoError(p.Continue(), t, "Continue()")
|
||||||
|
assertNoError(p.Step(), t, "Step")
|
||||||
|
assertLineNumber(p, t, 12, "After step")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -839,7 +839,7 @@ func skipAutogeneratedWrappersIn(p Process, startfn *Function, startpc uint64) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
tgtfn := tgtfns[0]
|
tgtfn := tgtfns[0]
|
||||||
if tgtfn.BaseName() != fn.BaseName() {
|
if strings.TrimSuffix(tgtfn.BaseName(), "-fm") != strings.TrimSuffix(fn.BaseName(), "-fm") {
|
||||||
return startfn, startpc
|
return startfn, startpc
|
||||||
}
|
}
|
||||||
fn = tgtfn
|
fn = tgtfn
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user