mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 04:36:29 +08:00
debugger/locations: prioritize exact matches of function names (#651)
If the location specification matches the name of a function exactly return that function as a match event if the expression matches other functions as well. Without this some functions, like math/rand.Intn are unmatchable.
This commit is contained in:
committed by
Derek Parker
parent
f6e8fb37a4
commit
6e882c50fa
@ -666,6 +666,18 @@ func TestClientServer_FindLocationsAddr(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestClientServer_FindLocationsExactMatch(t *testing.T) {
|
||||
// if an expression matches multiple functions but one of them is an exact
|
||||
// match it should be used anyway.
|
||||
// In this example "math/rand.Intn" would normally match "math/rand.Intn"
|
||||
// and "math/rand.(*Rand).Intn" but since the first match is exact it
|
||||
// should be prioritized.
|
||||
withTestClient2("locationsprog3", t, func(c service.Client) {
|
||||
<-c.Continue()
|
||||
findLocationHelper(t, c, "math/rand.Intn", false, 1, 0)
|
||||
})
|
||||
}
|
||||
|
||||
func TestClientServer_EvalVariable(t *testing.T) {
|
||||
withTestClient2("testvariables", t, func(c service.Client) {
|
||||
state := <-c.Continue()
|
||||
|
||||
Reference in New Issue
Block a user