Skip to content

Commit

Permalink
fix: add heads machine string (gnolang#2037)
Browse files Browse the repository at this point in the history
Add headers to machine string
  • Loading branch information
petar-dambovaliev authored May 5, 2024
1 parent 88b9aa3 commit 555357e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gnovm/pkg/gnolang/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2047,14 +2047,20 @@ func (m *Machine) String() string {
builder.WriteString(fmt.Sprintf(" #%d %v\n", i, m.Values[i]))
}

builder.WriteString(`Exprs: `)

for i := len(m.Exprs) - 1; i >= 0; i-- {
builder.WriteString(fmt.Sprintf(" #%d %v\n", i, m.Exprs[i]))
}

builder.WriteString(`Stmts: `)

for i := len(m.Stmts) - 1; i >= 0; i-- {
builder.WriteString(fmt.Sprintf(" #%d %v\n", i, m.Stmts[i]))
}

builder.WriteString(`Blocks: `)

for b := m.LastBlock(); b != nil; {
gen := builder.Len()/3 + 1
gens := "@" // strings.Repeat("@", gen)
Expand Down Expand Up @@ -2090,6 +2096,8 @@ func (m *Machine) String() string {
}
}

builder.WriteString(`Blocks (other): `)

for i := len(m.Blocks) - 2; i >= 0; i-- {
b := m.Blocks[i]

Expand All @@ -2110,6 +2118,8 @@ func (m *Machine) String() string {
}
}

builder.WriteString(`Frames: `)

for i := len(m.Frames) - 1; i >= 0; i-- {
builder.WriteString(fmt.Sprintf(" #%d %s\n", i, m.Frames[i]))
}
Expand All @@ -2118,6 +2128,8 @@ func (m *Machine) String() string {
builder.WriteString(fmt.Sprintf(" Realm:\n %s\n", m.Realm.Path))
}

builder.WriteString(`Exceptions: `)

for _, ex := range m.Exceptions {
builder.WriteString(fmt.Sprintf(" %s\n", ex.Sprint(m)))
}
Expand Down

0 comments on commit 555357e

Please sign in to comment.