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
c52ab932
Commit
c52ab932
authored
Mar 01, 2017
by
Valentin Wüstholz
Committed by
Jeffrey Wilcke
Mar 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/disasm, cmd/evm: integrate disasm tool into evm tool. (#3729)
parent
230cf2ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
disasm.go
cmd/evm/disasm.go
+23
-12
main.go
cmd/evm/main.go
+1
-0
No files found.
cmd/
disasm/main
.go
→
cmd/
evm/disasm
.go
View file @
c52ab932
// Copyright 201
5
The go-ethereum Authors
// Copyright 201
7
The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
...
...
@@ -14,29 +14,40 @@
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// disasm is a pretty-printer for EVM bytecode.
package
main
import
(
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/ethereum/go-ethereum/core/asm"
cli
"gopkg.in/urfave/cli.v1"
"strings"
)
func
main
()
{
in
,
err
:=
ioutil
.
ReadAll
(
os
.
Stdin
)
var
disasmCommand
=
cli
.
Command
{
Action
:
disasmCmd
,
Name
:
"disasm"
,
Usage
:
"disassembles evm binary"
,
ArgsUsage
:
"<file>"
,
}
func
disasmCmd
(
ctx
*
cli
.
Context
)
error
{
if
len
(
ctx
.
Args
()
.
First
())
==
0
{
return
errors
.
New
(
"filename required"
)
}
fn
:=
ctx
.
Args
()
.
First
()
in
,
err
:=
ioutil
.
ReadFile
(
fn
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
os
.
Exit
(
1
)
return
err
}
code
:=
strings
.
TrimSpace
(
string
(
in
[
:
]))
fmt
.
Printf
(
"%v
\n
"
,
code
)
err
=
asm
.
PrintDisassembled
(
code
)
if
err
!=
nil
{
fmt
.
Printf
(
"Error: %v
\n
"
,
err
)
return
if
err
=
asm
.
PrintDisassembled
(
code
);
err
!=
nil
{
return
err
}
return
nil
}
cmd/evm/main.go
View file @
c52ab932
...
...
@@ -101,6 +101,7 @@ func init() {
}
app
.
Commands
=
[]
cli
.
Command
{
compileCommand
,
disasmCommand
,
runCommand
,
}
}
...
...
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