mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.debug] cmd/compile: rename dwarf.Var.Offset to StackOffset
After we track decomposition, offset could mean stack offset or offset in recomposed variable. Disambiguate. Change-Id: I4d810b8c0dcac7a4ec25ac1e52898f55477025df Reviewed-on: https://go-review.googlesource.com/50875 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
ee392ac10c
commit
045f605ea1
3 changed files with 14 additions and 14 deletions
|
|
@ -358,10 +358,10 @@ func debuginfo(fnsym *obj.LSym, curfn interface{}) []dwarf.Scope {
|
||||||
|
|
||||||
typename := dwarf.InfoPrefix + gotype.Name[len("type."):]
|
typename := dwarf.InfoPrefix + gotype.Name[len("type."):]
|
||||||
dwarfVars = append(dwarfVars, &dwarf.Var{
|
dwarfVars = append(dwarfVars, &dwarf.Var{
|
||||||
Name: n.Sym.Name,
|
Name: n.Sym.Name,
|
||||||
Abbrev: abbrev,
|
Abbrev: abbrev,
|
||||||
Offset: int32(offs),
|
StackOffset: int32(offs),
|
||||||
Type: Ctxt.Lookup(typename),
|
Type: Ctxt.Lookup(typename),
|
||||||
})
|
})
|
||||||
|
|
||||||
var scope ScopeID
|
var scope ScopeID
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ func (v varsByScopeAndOffset) Less(i, j int) bool {
|
||||||
if v.scopes[i] != v.scopes[j] {
|
if v.scopes[i] != v.scopes[j] {
|
||||||
return v.scopes[i] < v.scopes[j]
|
return v.scopes[i] < v.scopes[j]
|
||||||
}
|
}
|
||||||
return v.vars[i].Offset < v.vars[j].Offset
|
return v.vars[i].StackOffset < v.vars[j].StackOffset
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v varsByScopeAndOffset) Swap(i, j int) {
|
func (v varsByScopeAndOffset) Swap(i, j int) {
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,11 @@ type Sym interface {
|
||||||
|
|
||||||
// A Var represents a local variable or a function parameter.
|
// A Var represents a local variable or a function parameter.
|
||||||
type Var struct {
|
type Var struct {
|
||||||
Name string
|
Name string
|
||||||
Abbrev int // Either DW_ABRV_AUTO or DW_ABRV_PARAM
|
Abbrev int // Either DW_ABRV_AUTO or DW_ABRV_PARAM
|
||||||
Offset int32
|
StackOffset int32
|
||||||
Scope int32
|
Scope int32
|
||||||
Type Sym
|
Type Sym
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Scope represents a lexical scope. All variables declared within a
|
// A Scope represents a lexical scope. All variables declared within a
|
||||||
|
|
@ -749,9 +749,9 @@ func putvar(ctxt Context, s Sym, v *Var, encbuf []byte) {
|
||||||
Uleb128put(ctxt, s, int64(v.Abbrev))
|
Uleb128put(ctxt, s, int64(v.Abbrev))
|
||||||
putattr(ctxt, s, v.Abbrev, DW_FORM_string, DW_CLS_STRING, int64(len(n)), n)
|
putattr(ctxt, s, v.Abbrev, DW_FORM_string, DW_CLS_STRING, int64(len(n)), n)
|
||||||
loc := append(encbuf[:0], DW_OP_call_frame_cfa)
|
loc := append(encbuf[:0], DW_OP_call_frame_cfa)
|
||||||
if v.Offset != 0 {
|
if v.StackOffset != 0 {
|
||||||
loc = append(loc, DW_OP_consts)
|
loc = append(loc, DW_OP_consts)
|
||||||
loc = AppendSleb128(loc, int64(v.Offset))
|
loc = AppendSleb128(loc, int64(v.StackOffset))
|
||||||
loc = append(loc, DW_OP_plus)
|
loc = append(loc, DW_OP_plus)
|
||||||
}
|
}
|
||||||
putattr(ctxt, s, v.Abbrev, DW_FORM_block1, DW_CLS_BLOCK, int64(len(loc)), loc)
|
putattr(ctxt, s, v.Abbrev, DW_FORM_block1, DW_CLS_BLOCK, int64(len(loc)), loc)
|
||||||
|
|
@ -759,9 +759,9 @@ func putvar(ctxt Context, s Sym, v *Var, encbuf []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VarsByOffset attaches the methods of sort.Interface to []*Var,
|
// VarsByOffset attaches the methods of sort.Interface to []*Var,
|
||||||
// sorting in increasing Offset.
|
// sorting in increasing StackOffset.
|
||||||
type VarsByOffset []*Var
|
type VarsByOffset []*Var
|
||||||
|
|
||||||
func (s VarsByOffset) Len() int { return len(s) }
|
func (s VarsByOffset) Len() int { return len(s) }
|
||||||
func (s VarsByOffset) Less(i, j int) bool { return s[i].Offset < s[j].Offset }
|
func (s VarsByOffset) Less(i, j int) bool { return s[i].StackOffset < s[j].StackOffset }
|
||||||
func (s VarsByOffset) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
func (s VarsByOffset) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue