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
c9517024
Commit
c9517024
authored
Jul 17, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
parents
fc8bd722
7d64b589
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
167 additions
and
87 deletions
+167
-87
debugger.qml
ethereal/assets/debugger/debugger.qml
+5
-3
webapp.qml
ethereal/assets/qml/webapp.qml
+1
-2
debugger.go
ethereal/debugger.go
+11
-2
flags.go
ethereal/flags.go
+1
-1
html_container.go
ethereal/html_container.go
+4
-3
cmd.go
ethereum/cmd.go
+3
-2
flags.go
ethereum/flags.go
+4
-0
main.go
ethereum/main.go
+9
-0
javascript_runtime.go
ethereum/repl/javascript_runtime.go
+1
-1
js_lib.go
ethereum/repl/js_lib.go
+1
-1
repl.go
ethereum/repl/repl.go
+83
-0
repl_darwin.go
ethereum/repl/repl_darwin.go
+1
-1
repl_linux.go
ethereum/repl/repl_linux.go
+0
-0
repl_windows.go
ethereum/repl/repl_windows.go
+1
-1
types.go
ethereum/repl/types.go
+12
-70
cmd.go
utils/cmd.go
+30
-0
No files found.
ethereal/assets/debugger/debugger.qml
View file @
c9517024
...
...
@@ -19,7 +19,7 @@ ApplicationWindow {
property
alias
dataText
:
rawDataField
.
text
onClosing
:
{
compileTimer
.
stop
()
//
compileTimer.stop()
}
MenuBar
{
...
...
@@ -86,7 +86,7 @@ ApplicationWindow {
TableView
{
id
:
asmTableView
width
:
200
TableViewColumn
{
role
:
"value"
;
title
:
""
;
width
:
200
}
TableViewColumn
{
role
:
"value"
;
title
:
""
;
width
:
asmTableView
.
width
-
2
}
model
:
asmModel
}
...
...
@@ -112,13 +112,15 @@ ApplicationWindow {
anchors.right
:
settings
.
left
focus
:
true
/*
Timer {
id: compileTimer
interval: 500 ; running: true ; repeat: true
onTriggered: {
dbg
.
compile
(
codeEditor
.
text
)
dbg.
autoComp
(codeEditor.text)
}
}
*/
}
Column
{
...
...
ethereal/assets/qml/webapp.qml
View file @
c9517024
...
...
@@ -191,6 +191,7 @@ ApplicationWindow {
inspector
.
visible
=
false
}
else
{
inspector
.
visible
=
true
inspector
.
url
=
webview
.
experimental
.
remoteInspectorUrl
}
}
onDoubleClicked
:
{
...
...
@@ -224,7 +225,6 @@ ApplicationWindow {
WebView
{
id
:
inspector
visible
:
false
url
:
webview
.
experimental
.
remoteInspectorUrl
anchors
{
left
:
root
.
left
right
:
root
.
right
...
...
@@ -238,7 +238,6 @@ ApplicationWindow {
name
:
"inspectorShown"
PropertyChanges
{
target
:
inspector
url
:
webview
.
experimental
.
remoteInspectorUrl
}
}
]
...
...
ethereal/debugger.go
View file @
c9517024
...
...
@@ -74,6 +74,13 @@ func (self *DebuggerWindow) Compile(code string) {
}
}
// Used by QML
func
(
self
*
DebuggerWindow
)
AutoComp
(
code
string
)
{
if
self
.
Db
.
done
{
self
.
Compile
(
code
)
}
}
func
(
self
*
DebuggerWindow
)
ClearLog
()
{
self
.
win
.
Root
()
.
Call
(
"clearLog"
)
}
...
...
@@ -110,8 +117,6 @@ func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, data
return
}
self
.
SetAsm
(
script
)
var
(
gas
=
ethutil
.
Big
(
gasStr
)
gasPrice
=
ethutil
.
Big
(
gasPriceStr
)
...
...
@@ -257,6 +262,10 @@ func (self *Debugger) StepHook(pc int, op ethchain.OpCode, mem *ethchain.Memory,
return
self
.
halting
(
pc
,
op
,
mem
,
stack
,
stateObject
)
}
func
(
self
*
Debugger
)
SetCode
(
byteCode
[]
byte
)
{
self
.
main
.
SetAsm
(
byteCode
)
}
func
(
self
*
Debugger
)
BreakPoints
()
[]
int64
{
return
self
.
breakPoints
}
...
...
ethereal/flags.go
View file @
c9517024
...
...
@@ -36,6 +36,7 @@ var LogLevel int
// flags specific to gui client
var
AssetPath
string
//TODO: If we re-use the one defined in cmd.go the binary osx image crashes. If somebody finds out why we can dry this up.
func
defaultAssetPath
()
string
{
var
assetPath
string
// If the current working directory is the go-ethereum dir
...
...
@@ -60,7 +61,6 @@ func defaultAssetPath() string {
}
return
assetPath
}
func
defaultDataDir
()
string
{
usr
,
_
:=
user
.
Current
()
return
path
.
Join
(
usr
.
HomeDir
,
".ethereal"
)
...
...
ethereal/html_container.go
View file @
c9517024
...
...
@@ -8,7 +8,6 @@ import (
"github.com/go-qml/qml"
"github.com/howeyc/fsnotify"
"io/ioutil"
"log"
"net/url"
"os"
"path"
...
...
@@ -59,7 +58,7 @@ func (app *HtmlApplication) RootFolder() string {
if
err
!=
nil
{
return
""
}
return
path
.
Dir
(
folder
.
RequestURI
(
))
return
path
.
Dir
(
ethutil
.
WindonizePath
(
folder
.
RequestURI
()
))
}
func
(
app
*
HtmlApplication
)
RecursiveFolders
()
[]
os
.
FileInfo
{
files
,
_
:=
ioutil
.
ReadDir
(
app
.
RootFolder
())
...
...
@@ -77,11 +76,13 @@ func (app *HtmlApplication) NewWatcher(quitChan chan bool) {
app
.
watcher
,
err
=
fsnotify
.
NewWatcher
()
if
err
!=
nil
{
logger
.
Infoln
(
"Could not create new auto-reload watcher:"
,
err
)
return
}
err
=
app
.
watcher
.
Watch
(
app
.
RootFolder
())
if
err
!=
nil
{
log
.
Fatal
(
err
)
logger
.
Infoln
(
"Could not start auto-reload watcher:"
,
err
)
return
}
for
_
,
folder
:=
range
app
.
RecursiveFolders
()
{
fullPath
:=
app
.
RootFolder
()
+
"/"
+
folder
.
Name
()
...
...
ethereum/cmd.go
View file @
c9517024
...
...
@@ -2,13 +2,14 @@ package main
import
(
"github.com/ethereum/eth-go"
"github.com/ethereum/go-ethereum/ethereum/repl"
"github.com/ethereum/go-ethereum/utils"
"io/ioutil"
"os"
)
func
InitJsConsole
(
ethereum
*
eth
.
Ethereum
)
{
repl
:=
NewJSRepl
(
ethereum
)
repl
:=
ethrepl
.
NewJSRepl
(
ethereum
)
go
repl
.
Start
()
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
repl
.
Stop
()
...
...
@@ -24,7 +25,7 @@ func ExecJsFile(ethereum *eth.Ethereum, InputFile string) {
if
err
!=
nil
{
logger
.
Fatalln
(
err
)
}
re
:=
NewJSRE
(
ethereum
)
re
:=
ethrepl
.
NewJSRE
(
ethereum
)
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
re
.
Stop
()
})
...
...
ethereum/flags.go
View file @
c9517024
...
...
@@ -11,6 +11,8 @@ import (
var
Identifier
string
var
KeyRing
string
var
DiffTool
bool
var
DiffType
string
var
KeyStore
string
var
StartRpc
bool
var
RpcPort
int
...
...
@@ -66,6 +68,8 @@ func Init() {
flag
.
StringVar
(
&
ConfigFile
,
"conf"
,
defaultConfigFile
,
"config file"
)
flag
.
StringVar
(
&
DebugFile
,
"debug"
,
""
,
"debug file (no debugging if not set)"
)
flag
.
IntVar
(
&
LogLevel
,
"loglevel"
,
int
(
ethlog
.
InfoLevel
),
"loglevel: 0-5: silent,error,warn,info,debug,debug detail)"
)
flag
.
BoolVar
(
&
DiffTool
,
"difftool"
,
false
,
"creates output for diff'ing. Sets LogLevel=0"
)
flag
.
StringVar
(
&
DiffType
,
"diff"
,
"all"
,
"sets the level of diff output [vm, all]. Has no effect if difftool=false"
)
flag
.
BoolVar
(
&
StartMining
,
"mine"
,
false
,
"start dagger mining"
)
flag
.
BoolVar
(
&
StartJsConsole
,
"js"
,
false
,
"launches javascript console"
)
...
...
ethereum/main.go
View file @
c9517024
...
...
@@ -2,6 +2,7 @@ package main
import
(
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/utils"
"runtime"
)
...
...
@@ -20,7 +21,15 @@ func main() {
// precedence: code-internal flag default < config file < environment variables < command line
Init
()
// parsing command line
// If the difftool option is selected ignore all other log output
if
DiffTool
{
LogLevel
=
0
}
utils
.
InitConfig
(
ConfigFile
,
Datadir
,
"ETH"
)
ethutil
.
Config
.
Diff
=
DiffTool
ethutil
.
Config
.
DiffType
=
DiffType
utils
.
InitDataDir
(
Datadir
)
...
...
ethereum/javascript_runtime.go
→
ethereum/
repl/
javascript_runtime.go
View file @
c9517024
package
main
package
ethrepl
import
(
"fmt"
...
...
ethereum/js_lib.go
→
ethereum/
repl/
js_lib.go
View file @
c9517024
package
main
package
ethrepl
const
jsLib
=
`
function pp(object) {
...
...
ethereum/repl/repl.go
0 → 100644
View file @
c9517024
package
ethrepl
import
(
"bufio"
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"io"
"os"
"path"
)
var
logger
=
ethlog
.
NewLogger
(
"REPL"
)
type
Repl
interface
{
Start
()
Stop
()
}
type
JSRepl
struct
{
re
*
JSRE
prompt
string
history
*
os
.
File
running
bool
}
func
NewJSRepl
(
ethereum
*
eth
.
Ethereum
)
*
JSRepl
{
hist
,
err
:=
os
.
OpenFile
(
path
.
Join
(
ethutil
.
Config
.
ExecPath
,
"history"
),
os
.
O_RDWR
|
os
.
O_CREATE
,
os
.
ModePerm
)
if
err
!=
nil
{
panic
(
err
)
}
return
&
JSRepl
{
re
:
NewJSRE
(
ethereum
),
prompt
:
"> "
,
history
:
hist
}
}
func
(
self
*
JSRepl
)
Start
()
{
if
!
self
.
running
{
self
.
running
=
true
logger
.
Infoln
(
"init JS Console"
)
reader
:=
bufio
.
NewReader
(
self
.
history
)
for
{
line
,
err
:=
reader
.
ReadString
(
'\n'
)
if
err
!=
nil
&&
err
==
io
.
EOF
{
break
}
else
if
err
!=
nil
{
fmt
.
Println
(
"error reading history"
,
err
)
break
}
addHistory
(
line
[
:
len
(
line
)
-
1
])
}
self
.
read
()
}
}
func
(
self
*
JSRepl
)
Stop
()
{
if
self
.
running
{
self
.
running
=
false
self
.
re
.
Stop
()
logger
.
Infoln
(
"exit JS Console"
)
self
.
history
.
Close
()
}
}
func
(
self
*
JSRepl
)
parseInput
(
code
string
)
{
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
fmt
.
Println
(
"[native] error"
,
r
)
}
}()
value
,
err
:=
self
.
re
.
Run
(
code
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
self
.
PrintValue
(
value
)
}
ethereum/repl_darwin.go
→
ethereum/repl
/repl
_darwin.go
View file @
c9517024
package
main
package
ethrepl
// #cgo darwin CFLAGS: -I/usr/local/opt/readline/include
// #cgo darwin LDFLAGS: -L/usr/local/opt/readline/lib
...
...
ethereum/repl_linux.go
→
ethereum/repl
/repl
_linux.go
View file @
c9517024
File moved
ethereum/repl_windows.go
→
ethereum/repl
/repl
_windows.go
View file @
c9517024
package
main
package
ethrepl
import
(
"bufio"
...
...
ethereum/repl.go
→
ethereum/repl
/types
.go
View file @
c9517024
package
main
package
ethrepl
import
(
"bufio"
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"github.com/obscuren/otto"
"io"
"os"
"path"
)
type
Repl
interface
{
Start
()
Stop
()
}
type
JSRepl
struct
{
re
*
JSRE
prompt
string
history
*
os
.
File
running
bool
}
func
NewJSRepl
(
ethereum
*
eth
.
Ethereum
)
*
JSRepl
{
hist
,
err
:=
os
.
OpenFile
(
path
.
Join
(
ethutil
.
Config
.
ExecPath
,
"history"
),
os
.
O_RDWR
|
os
.
O_CREATE
,
os
.
ModePerm
)
if
err
!=
nil
{
panic
(
err
)
}
return
&
JSRepl
{
re
:
NewJSRE
(
ethereum
),
prompt
:
"> "
,
history
:
hist
}
}
func
(
self
*
JSRepl
)
Start
()
{
if
!
self
.
running
{
self
.
running
=
true
logger
.
Infoln
(
"init JS Console"
)
reader
:=
bufio
.
NewReader
(
self
.
history
)
for
{
line
,
err
:=
reader
.
ReadString
(
'\n'
)
if
err
!=
nil
&&
err
==
io
.
EOF
{
break
}
else
if
err
!=
nil
{
fmt
.
Println
(
"error reading history"
,
err
)
break
}
addHistory
(
line
[
:
len
(
line
)
-
1
])
}
self
.
read
()
}
}
func
(
self
*
JSRepl
)
Stop
()
{
if
self
.
running
{
self
.
running
=
false
self
.
re
.
Stop
()
logger
.
Infoln
(
"exit JS Console"
)
self
.
history
.
Close
()
}
type
JSStateObject
struct
{
*
ethpub
.
PStateObject
eth
*
JSEthereum
}
func
(
self
*
JSRepl
)
parseInput
(
code
string
)
{
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
fmt
.
Println
(
"[native] error"
,
r
)
}
}()
func
(
self
*
JSStateObject
)
EachStorage
(
call
otto
.
FunctionCall
)
otto
.
Value
{
cb
:=
call
.
Argument
(
0
)
self
.
PStateObject
.
EachStorage
(
func
(
key
string
,
value
*
ethutil
.
Value
)
{
value
.
Decode
()
value
,
err
:=
self
.
re
.
Run
(
code
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
cb
.
Call
(
self
.
eth
.
toVal
(
self
),
self
.
eth
.
toVal
(
key
),
self
.
eth
.
toVal
(
ethutil
.
Bytes2Hex
(
value
.
Bytes
())))
})
self
.
PrintValue
(
value
)
return
otto
.
UndefinedValue
(
)
}
// The JSEthereum object attempts to wrap the PEthereum object and returns
...
...
@@ -110,7 +52,7 @@ func (self *JSEthereum) GetKey() otto.Value {
}
func
(
self
*
JSEthereum
)
GetStateObject
(
addr
string
)
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetStateObject
(
addr
)
)
return
self
.
toVal
(
&
JSStateObject
{
self
.
PEthereum
.
GetStateObject
(
addr
),
self
}
)
}
func
(
self
*
JSEthereum
)
GetStateKeyVals
(
addr
string
)
otto
.
Value
{
...
...
utils/cmd.go
View file @
c9517024
package
utils
import
(
"bitbucket.org/kardianos/osext"
"fmt"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethcrypto"
...
...
@@ -16,6 +17,8 @@ import (
"os"
"os/signal"
"path"
"path/filepath"
"runtime"
"time"
)
...
...
@@ -164,7 +167,34 @@ func NewKeyManager(KeyStore string, Datadir string, db ethutil.Database) *ethcry
return
keyManager
}
func
DefaultAssetPath
()
string
{
var
assetPath
string
// If the current working directory is the go-ethereum dir
// assume a debug build and use the source directory as
// asset directory.
pwd
,
_
:=
os
.
Getwd
()
if
pwd
==
path
.
Join
(
os
.
Getenv
(
"GOPATH"
),
"src"
,
"github.com"
,
"ethereum"
,
"go-ethereum"
,
"ethereal"
)
{
assetPath
=
path
.
Join
(
pwd
,
"assets"
)
}
else
{
switch
runtime
.
GOOS
{
case
"darwin"
:
// Get Binary Directory
exedir
,
_
:=
osext
.
ExecutableFolder
()
assetPath
=
filepath
.
Join
(
exedir
,
"../Resources"
)
case
"linux"
:
assetPath
=
"/usr/share/ethereal"
case
"windows"
:
assetPath
=
"./assets"
default
:
assetPath
=
"."
}
}
return
assetPath
}
func
KeyTasks
(
keyManager
*
ethcrypto
.
KeyManager
,
KeyRing
string
,
GenAddr
bool
,
SecretFile
string
,
ExportDir
string
,
NonInteractive
bool
)
{
ethcrypto
.
InitWords
(
DefaultAssetPath
())
// Init mnemonic word list
var
err
error
switch
{
case
GenAddr
:
...
...
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