Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
b232acd0
Commit
b232acd0
authored
Jul 05, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging mode for vm
parent
329887df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
vm.go
ethchain/vm.go
+14
-17
No files found.
ethchain/vm.go
View file @
b232acd0
...
...
@@ -24,14 +24,10 @@ var (
GasTx
=
big
.
NewInt
(
500
)
)
func
CalculateTxGas
(
initSize
*
big
.
Int
)
*
big
.
Int
{
totalGas
:=
new
(
big
.
Int
)
txTotalBytes
:=
new
(
big
.
Int
)
.
Set
(
initSize
)
txTotalBytes
.
Div
(
txTotalBytes
,
ethutil
.
Big32
)
totalGas
.
Add
(
totalGas
,
new
(
big
.
Int
)
.
Mul
(
txTotalBytes
,
GasSStore
))
return
totalGas
type
Debugger
interface
{
BreakHook
(
step
int
,
op
OpCode
,
mem
*
Memory
,
stack
*
Stack
,
stateObject
*
StateObject
)
bool
StepHook
(
step
int
,
op
OpCode
,
mem
*
Memory
,
stack
*
Stack
,
stateObject
*
StateObject
)
bool
BreakPoints
()
[]
int64
}
type
Vm
struct
{
...
...
@@ -53,14 +49,13 @@ type Vm struct {
err
error
// Debugging
Hook
DebugHook
Dbg
Debugger
BreakPoints
[]
int64
Stepping
bool
Fn
string
}
type
DebugHook
func
(
step
int
,
op
OpCode
,
mem
*
Memory
,
stack
*
Stack
,
stateObject
*
StateObject
)
bool
type
RuntimeVars
struct
{
Origin
[]
byte
Block
*
Block
...
...
@@ -754,12 +749,14 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
vm
.
Endl
()
if
vm
.
Hook
!=
nil
{
for
_
,
instrNo
:=
range
vm
.
BreakPoints
{
if
pc
.
Cmp
(
big
.
NewInt
(
instrNo
))
==
0
||
vm
.
Stepping
{
vm
.
Stepping
=
true
if
!
vm
.
Hook
(
prevStep
,
op
,
mem
,
stack
,
closure
.
Object
())
{
if
vm
.
Dbg
!=
nil
{
for
_
,
instrNo
:=
range
vm
.
Dbg
.
BreakPoints
()
{
if
pc
.
Cmp
(
big
.
NewInt
(
instrNo
))
==
0
{
if
!
vm
.
Dbg
.
BreakHook
(
prevStep
,
op
,
mem
,
stack
,
closure
.
Object
())
{
return
nil
,
nil
}
}
else
if
vm
.
Stepping
{
if
!
vm
.
Dbg
.
StepHook
(
prevStep
,
op
,
mem
,
stack
,
closure
.
Object
())
{
return
nil
,
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment