update test script

pull/5370/head
Iuri Matias 6 years ago
parent 693b411a5a
commit afe0e596ee
  1. 81
      remix-debug/test.js

@ -17,8 +17,8 @@ var compilation = {
compilation.lastCompilationResult = require('./compilation.json') compilation.lastCompilationResult = require('./compilation.json')
// connecting to a node // connecting to a node
// var Web3 = require('web3') var Web3 = require('web3')
// web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
// global.my_web3 = web3 // global.my_web3 = web3
// with vm // with vm
@ -40,7 +40,10 @@ contextManager.event.register('providerChanged', () => {
contextManager.initProviders() contextManager.initProviders()
contextManager.switchProvider('vm') contextManager.addProvider('myweb3', web3)
contextManager.switchProvider('myweb3')
//contextManager.switchProvider('vm')
_debugger.event.register('debuggerStatus', function (isActive) { _debugger.event.register('debuggerStatus', function (isActive) {
console.dir("debugger status") console.dir("debugger status")
@ -49,6 +52,18 @@ _debugger.event.register('debuggerStatus', function (isActive) {
_debugger.event.register('newSourceLocation', function (lineColumnPos, rawLocation) { _debugger.event.register('newSourceLocation', function (lineColumnPos, rawLocation) {
console.dir("newSourceLocation") console.dir("newSourceLocation")
if (!lineColumnPos || !lineColumnPos.start) return;
let line
//let line = compilation.lastCompilationResult.source.sources['browser/ballot.sol'].content.split("\n")[lineColumnPos.start.line].slice(lineColumnPos.start.column, lineColumnPos.start.column + lineColumnPos.end.column)
line = compilation.lastCompilationResult.source.sources['browser/ballot.sol'].content.split("\n")[lineColumnPos.start.line - 1]
console.dir(line)
line = compilation.lastCompilationResult.source.sources['browser/ballot.sol'].content.split("\n")[lineColumnPos.start.line]
console.dir(line)
console.dir("^^^^^^^^^^^^^^^ ")
line = compilation.lastCompilationResult.source.sources['browser/ballot.sol'].content.split("\n")[lineColumnPos.start.line + 1]
console.dir(line)
}); });
_debugger.event.register('debuggerUnloaded', function() { _debugger.event.register('debuggerUnloaded', function() {
@ -64,18 +79,54 @@ let blockNumber = null
let txNumber = null let txNumber = null
let tx = null let tx = null
// let code = compilation.lastCompilationResult.data.contracts['browser/ballot.sol'].Ballot.evm.bytecode.object let code = compilation.lastCompilationResult.data.contracts['browser/ballot.sol'].Ballot.evm.bytecode.object
// _web3.eth.sendTransaction({data: "0x" + code, from: _web3.eth.accounts[0], gas: 800000}, (err, txHash) => { _web3.eth.sendTransaction({data: "0x" + code, from: _web3.eth.accounts[0], gas: 800000}, (err, txHash) => {
// console.dir(err) //console.dir(err)
// console.dir(txHash) //console.dir(txHash)
//
// txNumber = txHash
// txNumber = txHash
// _debugger.debug(blockNumber, txNumber, tx, () => { global.mytx = txHash
// console.dir('debugger started')
// }) _debugger.event.register('newSourceLocation', (lineColumnPos, rawLocation) => {
// console.dir("************ new source location *********")
// }) console.dir(lineColumnPos)
console.dir(rawLocation)
})
_debugger.debug(blockNumber, txNumber, tx, () => {
_debugger.step_manager.event.register('stepChanged', (stepIndex) => {
console.dir("---------")
console.dir("stepChanged: " + stepIndex)
console.dir("---------")
})
_debugger.step_manager.event.register('traceLengthChanged', (traceLength) => {
console.dir("---------")
console.dir("traceLengthChanged: " + traceLength)
console.dir("---------")
});
_debugger.vmDebuggerLogic.event.register('codeManagerChanged', (code, address, index) => {
console.dir("---------")
console.dir("codeManagerChanged")
console.dir("address: " + address)
console.dir("asm code: " + code[index])
console.dir("---------")
});
_debugger.vmDebuggerLogic.event.register('traceManagerMemoryUpdate', (data) => {
console.dir("---------")
console.dir("traceManagerMemoryUpdate")
console.dir(data)
console.dir("---------")
});
console.dir('debugger started')
})
})
//_debugger.debug(blockNumber, txNumber, tx, () => { //_debugger.debug(blockNumber, txNumber, tx, () => {
// console.dir('debugger started') // console.dir('debugger started')

Loading…
Cancel
Save