mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-10 05:53:46 +00:00
core/vm: add labels to vm trace sections
This commit is contained in:
parent
e9c9e69560
commit
1ff140ba91
1 changed files with 16 additions and 9 deletions
|
|
@ -196,20 +196,27 @@ func (l *StructLogger) StructLogs() []StructLog {
|
||||||
// WriteTrace writes a formatted trace to the given writer
|
// WriteTrace writes a formatted trace to the given writer
|
||||||
func WriteTrace(writer io.Writer, logs []StructLog) {
|
func WriteTrace(writer io.Writer, logs []StructLog) {
|
||||||
for _, log := range logs {
|
for _, log := range logs {
|
||||||
fmt.Fprintf(writer, "%-10spc=%08d gas=%v cost=%v", log.Op, log.Pc, log.Gas, log.GasCost)
|
fmt.Fprintf(writer, "%-16spc=%08d gas=%v cost=%v", log.Op, log.Pc, log.Gas, log.GasCost)
|
||||||
if log.Err != nil {
|
if log.Err != nil {
|
||||||
fmt.Fprintf(writer, " ERROR: %v", log.Err)
|
fmt.Fprintf(writer, " ERROR: %v", log.Err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(writer, "\n")
|
fmt.Fprintln(writer)
|
||||||
|
|
||||||
for i := len(log.Stack) - 1; i >= 0; i-- {
|
if len(log.Stack) > 0 {
|
||||||
fmt.Fprintf(writer, "%08d %x\n", len(log.Stack)-i-1, math.PaddedBigBytes(log.Stack[i], 32))
|
fmt.Fprintln(writer, "Stack:")
|
||||||
|
for i := len(log.Stack) - 1; i >= 0; i-- {
|
||||||
|
fmt.Fprintf(writer, "%08d %x\n", len(log.Stack)-i-1, math.PaddedBigBytes(log.Stack[i], 32))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if len(log.Memory) > 0 {
|
||||||
fmt.Fprint(writer, hex.Dump(log.Memory))
|
fmt.Fprintln(writer, "Memory:")
|
||||||
|
fmt.Fprint(writer, hex.Dump(log.Memory))
|
||||||
for h, item := range log.Storage {
|
}
|
||||||
fmt.Fprintf(writer, "%x: %x\n", h, item)
|
if len(log.Storage) > 0 {
|
||||||
|
fmt.Fprintln(writer, "Storage:")
|
||||||
|
for h, item := range log.Storage {
|
||||||
|
fmt.Fprintf(writer, "%x: %x\n", h, item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.Fprintln(writer)
|
fmt.Fprintln(writer)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue