Commit 8ad1e8d0074a39fe6116a5343888dbb3e75c06d2
updated debuging interface
wanderer committed on 11/7/2016, 12:28:18 PMParent: 7465ee54b512e6772d88465794c551333e42ecfe
Files changed
debugInterface.js | changed |
debugInterface.js | ||
---|---|---|
@@ -5,17 +5,17 @@ | ||
5 | 5 | * This expose some functions that can help with debugging wast |
6 | 6 | */ |
7 | 7 | |
8 | 8 | module.exports = class DebugInterface { |
9 | - constructor (environment) { | |
10 | - this.environment = environment | |
9 | + constructor (kernel) { | |
10 | + this.kernel = kernel | |
11 | 11 | } |
12 | 12 | |
13 | - setModule (mod) { | |
14 | - this.module = mod | |
13 | + static get name () { | |
14 | + return 'debug' | |
15 | 15 | } |
16 | 16 | |
17 | - get exportTable () { | |
17 | + get exports () { | |
18 | 18 | return { |
19 | 19 | 'print': function (a) { |
20 | 20 | console.log(a) |
21 | 21 | }, |
@@ -31,9 +31,9 @@ | ||
31 | 31 | const opcode = opcodes(op) |
32 | 32 | if (opcode.number) { |
33 | 33 | opcode.name += opcode.number |
34 | 34 | } |
35 | - console.error(`op: ${opcode.name} gas: ${this.environment.gasLeft}`) | |
35 | + console.error(`op: ${opcode.name} gas: ${this.kernel.environment.gasLeft}`) | |
36 | 36 | console.log('-------------stack--------------') |
37 | 37 | for (let i = sp; i >= 0; i -= 32) { |
38 | 38 | console.log(`${(sp - i) / 32} ${this.getMemoryBuffer(i).reverse().toString('hex')}`) |
39 | 39 | } |
@@ -41,7 +41,7 @@ | ||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | getMemoryBuffer (offset) { |
45 | - return new Buffer(this.module.exports.memory.slice(offset, offset + 32)) | |
45 | + return new Buffer(this.kernel.memory.slice(offset, offset + 32)) | |
46 | 46 | } |
47 | 47 | } |
Built with git-ssb-web