StdVm by default

This commit is contained in:
obscuren 2015-01-20 15:49:12 +01:00
parent 375cc67ba6
commit 9845029a75
6 changed files with 14 additions and 8 deletions

View File

@ -19,7 +19,7 @@ ApplicationWindow {
property alias dataText: rawDataField.text property alias dataText: rawDataField.text
onClosing: { onClosing: {
dbg.Stop() //dbg.Stop()
} }
menuBar: MenuBar { menuBar: MenuBar {
@ -353,6 +353,7 @@ ApplicationWindow {
ComboBox { ComboBox {
visible: false
id: snippets id: snippets
anchors.right: parent.right anchors.right: parent.right
model: ListModel { model: ListModel {

View File

@ -267,6 +267,9 @@ type storeVal struct {
Key, Value string Key, Value string
} }
func (self *Debugger) Step(evm vm.VirtualMachine, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, context *vm.Context) {
}
func (self *Debugger) BreakHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool { func (self *Debugger) BreakHook(pc int, op vm.OpCode, mem *vm.Memory, stack *vm.Stack, stateObject *state.StateObject) bool {
self.main.Logln("break on instr:", pc) self.main.Logln("break on instr:", pc)

View File

@ -212,16 +212,16 @@ func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
dbWindow := NewDebuggerWindow(self) dbWindow := NewDebuggerWindow(self)
object := self.eth.ChainManager().State().GetStateObject(ethutil.Hex2Bytes(contractHash)) object := self.eth.ChainManager().State().GetStateObject(ethutil.Hex2Bytes(contractHash))
if len(object.Code) > 0 { if len(object.Code) > 0 {
dbWindow.SetCode("0x" + ethutil.Bytes2Hex(object.Code)) dbWindow.SetCode(ethutil.Bytes2Hex(object.Code))
} }
dbWindow.SetData("0x" + data) dbWindow.SetData(data)
dbWindow.Show() dbWindow.Show()
} }
func (self *UiLib) StartDbWithCode(code string) { func (self *UiLib) StartDbWithCode(code string) {
dbWindow := NewDebuggerWindow(self) dbWindow := NewDebuggerWindow(self)
dbWindow.SetCode("0x" + code) dbWindow.SetCode(code)
dbWindow.Show() dbWindow.Show()
} }

View File

@ -33,7 +33,7 @@ func (self *Execution) Call(codeAddr []byte, caller vm.ContextRef) ([]byte, erro
func (self *Execution) exec(code, contextAddr []byte, caller vm.ContextRef) (ret []byte, err error) { func (self *Execution) exec(code, contextAddr []byte, caller vm.ContextRef) (ret []byte, err error) {
env := self.env env := self.env
evm := vm.New(env, vm.StdVmTy) evm := vm.New(env)
if env.Depth() == vm.MaxCallDepth { if env.Depth() == vm.MaxCallDepth {
caller.ReturnGas(self.Gas, self.price) caller.ReturnGas(self.Gas, self.price)

View File

@ -17,7 +17,6 @@ type Vm struct {
err error err error
// Debugging
Dbg Debugger Dbg Debugger
BreakPoints []int64 BreakPoints []int64
@ -27,7 +26,7 @@ type Vm struct {
Recoverable bool Recoverable bool
} }
func NewVm(env Environment) *Vm { func New(env Environment) *Vm {
lt := LogTyPretty lt := LogTyPretty
if ethutil.Config.Diff { if ethutil.Config.Diff {
lt = LogTyDiff lt = LogTyDiff
@ -111,6 +110,9 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
op = context.GetOp(pc) op = context.GetOp(pc)
self.Printf("(pc) %-3d -o- %-14s (m) %-4d (s) %-4d ", pc, op.String(), mem.Len(), stack.Len()) self.Printf("(pc) %-3d -o- %-14s (m) %-4d (s) %-4d ", pc, op.String(), mem.Len(), stack.Len())
if self.Dbg != nil {
//self.Dbg.Step(self, op, mem, stack, context)
}
newMemSize, gas := self.calculateGasAndSize(context, caller, op, statedb, mem, stack) newMemSize, gas := self.calculateGasAndSize(context, caller, op, statedb, mem, stack)

View File

@ -8,7 +8,7 @@ type JitVm struct {
} }
func NewJitVm(env Environment) *JitVm { func NewJitVm(env Environment) *JitVm {
backupVm := NewVm(env) backupVm := New(env)
return &JitVm{env: env, backup: backupVm} return &JitVm{env: env, backup: backupVm}
} }