proc,service: export declaration line of variables

Adds a field, DeclLine, to Variable containing the declaration line
number of the variable.
This commit is contained in:
aarzilli
2018-06-28 11:23:39 +02:00
committed by Derek Parker
parent 9a216211d3
commit 5cd86b1587
3 changed files with 5 additions and 0 deletions

View File

@ -103,6 +103,7 @@ type Variable struct {
Unreadable error Unreadable error
LocationExpr string // location expression LocationExpr string // location expression
DeclLine int64 // line number of this variable's declaration
} }
type LoadConfig struct { type LoadConfig struct {
@ -836,6 +837,7 @@ func (scope *EvalScope) extractVarInfoFromEntry(varEntry *dwarf.Entry) (*Variabl
v := scope.newVariable(n, uintptr(addr), t, mem) v := scope.newVariable(n, uintptr(addr), t, mem)
v.LocationExpr = descr v.LocationExpr = descr
v.DeclLine, _ = entry.Val(dwarf.AttrDeclLine).(int64)
if err != nil { if err != nil {
v.Unreadable = err v.Unreadable = err
} }

View File

@ -123,6 +123,7 @@ func ConvertVar(v *proc.Variable) *Variable {
Base: v.Base, Base: v.Base,
LocationExpr: v.LocationExpr, LocationExpr: v.LocationExpr,
DeclLine: v.DeclLine,
} }
r.Type = prettyTypeName(v.DwarfType) r.Type = prettyTypeName(v.DwarfType)

View File

@ -227,6 +227,8 @@ type Variable struct {
// LocationExpr describes the location expression of this variable's address // LocationExpr describes the location expression of this variable's address
LocationExpr string LocationExpr string
// DeclLine is the line number of this variable's declaration
DeclLine int64
} }
// LoadConfig describes how to load values from target's memory // LoadConfig describes how to load values from target's memory