mirror of
https://github.com/go-delve/delve.git
synced 2025-11-03 05:47:34 +08:00
pkg/terminal: print DWARF location expression with whatis
Adds a configuration option (show-location-expr) that when activated will cause the whatis command to also print the DWARF location expression for a variable.
This commit is contained in:
@ -95,6 +95,8 @@ type Variable struct {
|
||||
|
||||
loaded bool
|
||||
Unreadable error
|
||||
|
||||
LocationExpr string // location expression
|
||||
}
|
||||
|
||||
type LoadConfig struct {
|
||||
@ -777,7 +779,7 @@ func (scope *EvalScope) extractVarInfoFromEntry(entry *dwarf.Entry) (*Variable,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
addr, pieces, err := scope.BinInfo.Location(entry, dwarf.AttrLocation, scope.PC, scope.Regs)
|
||||
addr, pieces, descr, err := scope.BinInfo.Location(entry, dwarf.AttrLocation, scope.PC, scope.Regs)
|
||||
mem := scope.Mem
|
||||
if pieces != nil {
|
||||
addr = fakeAddress
|
||||
@ -785,6 +787,7 @@ func (scope *EvalScope) extractVarInfoFromEntry(entry *dwarf.Entry) (*Variable,
|
||||
}
|
||||
|
||||
v := scope.newVariable(n, uintptr(addr), t, mem)
|
||||
v.LocationExpr = descr
|
||||
if err != nil {
|
||||
v.Unreadable = err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user