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:
aarzilli
2017-11-21 09:50:14 +01:00
committed by Derek Parker
parent 926a6107ff
commit 1758f8523a
9 changed files with 100 additions and 13 deletions

View File

@ -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
}