@@ -40,7 +40,6 @@ var logDwarf bool
40
40
41
41
// Sym represents a symbol.
42
42
type Sym interface {
43
- Length (dwarfContext interface {}) int64
44
43
}
45
44
46
45
// A Var represents a local variable or a function parameter.
@@ -189,6 +188,7 @@ type InlCall struct {
189
188
// A Context specifies how to add data to a Sym.
190
189
type Context interface {
191
190
PtrSize () int
191
+ Size (s Sym ) int64
192
192
AddInt (s Sym , size int , i int64 )
193
193
AddBytes (s Sym , b []byte )
194
194
AddAddress (s Sym , t interface {}, ofs int64 )
@@ -1322,7 +1322,7 @@ func putInlinedFunc(ctxt Context, s *FnState, callIdx int) error {
1322
1322
putattr (ctxt , s .Info , abbrev , DW_FORM_ref_addr , DW_CLS_REFERENCE , 0 , callee )
1323
1323
1324
1324
if abbrev == DW_ABRV_INLINED_SUBROUTINE_RANGES {
1325
- putattr (ctxt , s .Info , abbrev , DW_FORM_sec_offset , DW_CLS_PTR , s .Ranges . Length ( ctxt ), s .Ranges )
1325
+ putattr (ctxt , s .Info , abbrev , DW_FORM_sec_offset , DW_CLS_PTR , ctxt . Size ( s .Ranges ), s .Ranges )
1326
1326
s .PutRanges (ctxt , ic .Ranges )
1327
1327
} else {
1328
1328
st := ic .Ranges [0 ].Start
@@ -1535,7 +1535,7 @@ func putscope(ctxt Context, s *FnState, scopes []Scope, curscope int32, fnabbrev
1535
1535
putattr (ctxt , s .Info , DW_ABRV_LEXICAL_BLOCK_SIMPLE , DW_FORM_addr , DW_CLS_ADDRESS , scope .Ranges [0 ].End , s .StartPC )
1536
1536
} else {
1537
1537
Uleb128put (ctxt , s .Info , DW_ABRV_LEXICAL_BLOCK_RANGES )
1538
- putattr (ctxt , s .Info , DW_ABRV_LEXICAL_BLOCK_RANGES , DW_FORM_sec_offset , DW_CLS_PTR , s .Ranges . Length ( ctxt ), s .Ranges )
1538
+ putattr (ctxt , s .Info , DW_ABRV_LEXICAL_BLOCK_RANGES , DW_FORM_sec_offset , DW_CLS_PTR , ctxt . Size ( s .Ranges ), s .Ranges )
1539
1539
1540
1540
s .PutRanges (ctxt , scope .Ranges )
1541
1541
}
@@ -1684,7 +1684,7 @@ func putvar(ctxt Context, s *FnState, v *Var, absfn Sym, fnabbrev, inlIndex int,
1684
1684
}
1685
1685
1686
1686
if abbrevUsesLoclist (abbrev ) {
1687
- putattr (ctxt , s .Info , abbrev , DW_FORM_sec_offset , DW_CLS_PTR , s .Loc . Length ( ctxt ), s .Loc )
1687
+ putattr (ctxt , s .Info , abbrev , DW_FORM_sec_offset , DW_CLS_PTR , ctxt . Size ( s .Loc ), s .Loc )
1688
1688
v .PutLocationList (s .Loc , s .StartPC )
1689
1689
} else {
1690
1690
loc := encbuf [:0 ]
0 commit comments