From 5cd86b1587342727befb3b4991a655b7491b552c Mon Sep 17 00:00:00 2001 From: aarzilli Date: Thu, 28 Jun 2018 11:23:39 +0200 Subject: [PATCH] proc,service: export declaration line of variables Adds a field, DeclLine, to Variable containing the declaration line number of the variable. --- pkg/proc/variables.go | 2 ++ service/api/conversions.go | 1 + service/api/types.go | 2 ++ 3 files changed, 5 insertions(+) diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index 22849531..0e8d6917 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -103,6 +103,7 @@ type Variable struct { Unreadable error LocationExpr string // location expression + DeclLine int64 // line number of this variable's declaration } type LoadConfig struct { @@ -836,6 +837,7 @@ func (scope *EvalScope) extractVarInfoFromEntry(varEntry *dwarf.Entry) (*Variabl v := scope.newVariable(n, uintptr(addr), t, mem) v.LocationExpr = descr + v.DeclLine, _ = entry.Val(dwarf.AttrDeclLine).(int64) if err != nil { v.Unreadable = err } diff --git a/service/api/conversions.go b/service/api/conversions.go index 49472f67..59394ef8 100644 --- a/service/api/conversions.go +++ b/service/api/conversions.go @@ -123,6 +123,7 @@ func ConvertVar(v *proc.Variable) *Variable { Base: v.Base, LocationExpr: v.LocationExpr, + DeclLine: v.DeclLine, } r.Type = prettyTypeName(v.DwarfType) diff --git a/service/api/types.go b/service/api/types.go index 02af8a70..c1968bc3 100644 --- a/service/api/types.go +++ b/service/api/types.go @@ -227,6 +227,8 @@ type Variable struct { // LocationExpr describes the location expression of this variable's address LocationExpr string + // DeclLine is the line number of this variable's declaration + DeclLine int64 } // LoadConfig describes how to load values from target's memory -- GitLab