
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.
19 lines
379 B
Go
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)
|
|
}
|
|
}
|