mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 01:27:16 +08:00
proc: save location expr and decl line for escaped variables (#1553)
Copy the location expression and declaration line of escaped variables when auto-dereferencing them.
This commit is contained in:
committed by
Derek Parker
parent
c30a333f7b
commit
04834a781a
@ -2287,12 +2287,16 @@ func (scope *EvalScope) Locals() ([]*Variable, error) {
|
||||
|
||||
for i, v := range vars {
|
||||
if name := v.Name; len(name) > 1 && name[0] == '&' {
|
||||
locationExpr := v.LocationExpr
|
||||
declLine := v.DeclLine
|
||||
v = v.maybeDereference()
|
||||
if v.Addr == 0 {
|
||||
v.Unreadable = fmt.Errorf("no address for escaped variable")
|
||||
}
|
||||
v.Name = name[1:]
|
||||
v.Flags |= VariableEscaped
|
||||
v.LocationExpr = locationExpr + " (escaped)"
|
||||
v.DeclLine = declLine
|
||||
vars[i] = v
|
||||
}
|
||||
if hasScopes {
|
||||
|
||||
Reference in New Issue
Block a user