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
16eaf2b1
Unverified
Commit
16eaf2b1
authored
Aug 01, 2018
by
Péter Szilágyi
Committed by
GitHub
Aug 01, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #17302 from karalabe/revert-evm-nil-panic
Revert "cmd/evm: change error msg output to stderr (#17118)"
parents
46d47215
83e2761c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
23 deletions
+22
-23
compiler.go
cmd/evm/compiler.go
+1
-1
disasm.go
cmd/evm/disasm.go
+1
-1
compiler.go
cmd/evm/internal/compiler/compiler.go
+2
-3
runner.go
cmd/evm/runner.go
+14
-14
staterunner.go
cmd/evm/staterunner.go
+4
-4
No files found.
cmd/evm/compiler.go
View file @
16eaf2b1
...
...
@@ -50,6 +50,6 @@ func compileCmd(ctx *cli.Context) error {
if
err
!=
nil
{
return
err
}
fmt
.
Fprintln
(
ctx
.
App
.
Writer
,
bin
)
fmt
.
Println
(
bin
)
return
nil
}
cmd/evm/disasm.go
View file @
16eaf2b1
...
...
@@ -45,6 +45,6 @@ func disasmCmd(ctx *cli.Context) error {
}
code
:=
strings
.
TrimSpace
(
string
(
in
[
:
]))
fmt
.
Fprintf
(
ctx
.
App
.
Writer
,
"%v
\n
"
,
code
)
fmt
.
Printf
(
"%v
\n
"
,
code
)
return
asm
.
PrintDisassembled
(
code
)
}
cmd/evm/internal/compiler/compiler.go
View file @
16eaf2b1
...
...
@@ -30,11 +30,10 @@ func Compile(fn string, src []byte, debug bool) (string, error) {
bin
,
compileErrors
:=
compiler
.
Compile
()
if
len
(
compileErrors
)
>
0
{
// report errors
errs
:=
""
for
_
,
err
:=
range
compileErrors
{
errs
+=
fmt
.
Sp
rintf
(
"%s:%v
\n
"
,
fn
,
err
)
fmt
.
P
rintf
(
"%s:%v
\n
"
,
fn
,
err
)
}
return
""
,
errors
.
New
(
errs
+
"compiling failed
\n
"
)
return
""
,
errors
.
New
(
"compiling failed
"
)
}
return
bin
,
nil
}
cmd/evm/runner.go
View file @
16eaf2b1
...
...
@@ -128,13 +128,13 @@ func runCmd(ctx *cli.Context) error {
if
ctx
.
GlobalString
(
CodeFileFlag
.
Name
)
==
"-"
{
//Try reading from stdin
if
hexcode
,
err
=
ioutil
.
ReadAll
(
os
.
Stdin
);
err
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWriter
,
"Could not load code from stdin: %v
\n
"
,
err
)
fmt
.
Printf
(
"Could not load code from stdin: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
}
else
{
// Codefile with hex assembly
if
hexcode
,
err
=
ioutil
.
ReadFile
(
ctx
.
GlobalString
(
CodeFileFlag
.
Name
));
err
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWriter
,
"Could not load code from file: %v
\n
"
,
err
)
fmt
.
Printf
(
"Could not load code from file: %v
\n
"
,
err
)
os
.
Exit
(
1
)
}
}
...
...
@@ -172,11 +172,11 @@ func runCmd(ctx *cli.Context) error {
if
cpuProfilePath
:=
ctx
.
GlobalString
(
CPUProfileFlag
.
Name
);
cpuProfilePath
!=
""
{
f
,
err
:=
os
.
Create
(
cpuProfilePath
)
if
err
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWriter
,
"could not create CPU profile: %v
\n
"
,
err
)
fmt
.
Println
(
"could not create CPU profile:
"
,
err
)
os
.
Exit
(
1
)
}
if
err
:=
pprof
.
StartCPUProfile
(
f
);
err
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWriter
,
"could not start CPU profile: %v
\n
"
,
err
)
fmt
.
Println
(
"could not start CPU profile:
"
,
err
)
os
.
Exit
(
1
)
}
defer
pprof
.
StopCPUProfile
()
...
...
@@ -200,17 +200,17 @@ func runCmd(ctx *cli.Context) error {
if
ctx
.
GlobalBool
(
DumpFlag
.
Name
)
{
statedb
.
IntermediateRoot
(
true
)
fmt
.
Fprintln
(
ctx
.
App
.
Writer
,
string
(
statedb
.
Dump
()))
fmt
.
Println
(
string
(
statedb
.
Dump
()))
}
if
memProfilePath
:=
ctx
.
GlobalString
(
MemProfileFlag
.
Name
);
memProfilePath
!=
""
{
f
,
err
:=
os
.
Create
(
memProfilePath
)
if
err
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWriter
,
"could not create memory profile: %v
\n
"
,
err
)
fmt
.
Println
(
"could not create memory profile:
"
,
err
)
os
.
Exit
(
1
)
}
if
err
:=
pprof
.
WriteHeapProfile
(
f
);
err
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWriter
,
"could not create memory profile: %v
\n
"
,
err
)
fmt
.
Println
(
"could not write memory profile:
"
,
err
)
os
.
Exit
(
1
)
}
f
.
Close
()
...
...
@@ -218,17 +218,17 @@ func runCmd(ctx *cli.Context) error {
if
ctx
.
GlobalBool
(
DebugFlag
.
Name
)
{
if
debugLogger
!=
nil
{
fmt
.
Fprintln
(
ctx
.
App
.
ErrWrite
r
,
"#### TRACE ####"
)
vm
.
WriteTrace
(
ctx
.
App
.
ErrWrite
r
,
debugLogger
.
StructLogs
())
fmt
.
Fprintln
(
os
.
Stder
r
,
"#### TRACE ####"
)
vm
.
WriteTrace
(
os
.
Stder
r
,
debugLogger
.
StructLogs
())
}
fmt
.
Fprintln
(
ctx
.
App
.
ErrWrite
r
,
"#### LOGS ####"
)
vm
.
WriteLogs
(
ctx
.
App
.
ErrWrite
r
,
statedb
.
Logs
())
fmt
.
Fprintln
(
os
.
Stder
r
,
"#### LOGS ####"
)
vm
.
WriteLogs
(
os
.
Stder
r
,
statedb
.
Logs
())
}
if
ctx
.
GlobalBool
(
StatDumpFlag
.
Name
)
{
var
mem
goruntime
.
MemStats
goruntime
.
ReadMemStats
(
&
mem
)
fmt
.
Fprintf
(
ctx
.
App
.
ErrWrite
r
,
`evm execution time: %v
fmt
.
Fprintf
(
os
.
Stder
r
,
`evm execution time: %v
heap objects: %d
allocations: %d
total allocations: %d
...
...
@@ -238,9 +238,9 @@ Gas used: %d
`
,
execTime
,
mem
.
HeapObjects
,
mem
.
Alloc
,
mem
.
TotalAlloc
,
mem
.
NumGC
,
initialGas
-
leftOverGas
)
}
if
tracer
==
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
Writer
,
"0x%x
\n
"
,
ret
)
fmt
.
Printf
(
"0x%x
\n
"
,
ret
)
if
err
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWriter
,
" error: %v
\n
"
,
err
)
fmt
.
Printf
(
" error: %v
\n
"
,
err
)
}
}
...
...
cmd/evm/staterunner.go
View file @
16eaf2b1
...
...
@@ -107,7 +107,7 @@ func stateTestCmd(ctx *cli.Context) error {
}
// print state root for evmlab tracing (already committed above, so no need to delete objects again
if
ctx
.
GlobalBool
(
MachineFlag
.
Name
)
&&
state
!=
nil
{
fmt
.
Fprintf
(
ctx
.
App
.
ErrWrite
r
,
"{
\"
stateRoot
\"
:
\"
%x
\"
}
\n
"
,
state
.
IntermediateRoot
(
false
))
fmt
.
Fprintf
(
os
.
Stder
r
,
"{
\"
stateRoot
\"
:
\"
%x
\"
}
\n
"
,
state
.
IntermediateRoot
(
false
))
}
results
=
append
(
results
,
*
result
)
...
...
@@ -115,13 +115,13 @@ func stateTestCmd(ctx *cli.Context) error {
// Print any structured logs collected
if
ctx
.
GlobalBool
(
DebugFlag
.
Name
)
{
if
debugger
!=
nil
{
fmt
.
Fprintln
(
ctx
.
App
.
ErrWrite
r
,
"#### TRACE ####"
)
vm
.
WriteTrace
(
ctx
.
App
.
ErrWrite
r
,
debugger
.
StructLogs
())
fmt
.
Fprintln
(
os
.
Stder
r
,
"#### TRACE ####"
)
vm
.
WriteTrace
(
os
.
Stder
r
,
debugger
.
StructLogs
())
}
}
}
}
out
,
_
:=
json
.
MarshalIndent
(
results
,
""
,
" "
)
fmt
.
Fprintln
(
ctx
.
App
.
Writer
,
string
(
out
))
fmt
.
Println
(
string
(
out
))
return
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