delve/pkg/dwarf/op/op_test.go
aarzilli f4e2000fc8 proc: refactor stack.go to use DWARF registers
Instead of only tracking a few cherrypicked registers in stack.go track
all DWARF registers.

This is needed for cgo code and for the locationlists emitted by go in
1.10:
* The debug_frame sections emitted by C compilers can not be used
  without tracking all registers
* the loclists emitted by go1.10 need all registers of a frame to be
  interpreted.
2017-11-17 10:17:24 -08:00

19 lines
379 B
Go

package op
import "testing"
func TestExecuteStackProgram(t *testing.T) {
var (
instructions = []byte{DW_OP_consts, 0x1c, DW_OP_consts, 0x1c, DW_OP_plus}
expected = int64(56)
)
actual, err := ExecuteStackProgram(DwarfRegisters{}, instructions)
if err != nil {
t.Fatal(err)
}
if actual != expected {
t.Fatalf("actual %d != expected %d", actual, expected)
}
}