diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-02-02 22:08:53 +0100 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-02-02 22:09:41 +0100 |
commit | 9f222971e304d4ec03a3af9015744530f2c8793d (patch) | |
tree | 1fe4c789bc2371cf4a65e21278d4eacd1d573617 /src/lundump.js | |
parent | 626fa17826d854fb93c576dde3f48bc344fd41a2 (diff) | |
download | fengari-9f222971e304d4ec03a3af9015744530f2c8793d.tar.gz fengari-9f222971e304d4ec03a3af9015744530f2c8793d.tar.bz2 fengari-9f222971e304d4ec03a3af9015744530f2c8793d.zip |
readDebug
Diffstat (limited to 'src/lundump.js')
-rw-r--r-- | src/lundump.js | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/lundump.js b/src/lundump.js index bab34fe..46a9d70 100644 --- a/src/lundump.js +++ b/src/lundump.js @@ -190,6 +190,36 @@ class BytecodeParser { } } + readDebug(f) { + let n = this.readInt(); + for (let i = 0; i < n; i++) + f.lineinfo[i] = this.readInt(); + + n = this.readInt(); + for (let i = 0; i < n; i++) { + f.locvars[i] = { + varname: this.readString(), + startpc: this.readInt(), + endpc: this.readInt() + } + + console.log(` + f.locvars[${i}].varname = ${f.locvars[i].varname} + f.locvars[${i}].startpc = ${f.locvars[i].startpc} + f.locvars[${i}].endpc = ${f.locvars[i].endpc} + `); + } + + n = this.readInt(); + for (let i = 0; i < n; i++) { + f.upvalues[i].name = this.readString(); + + console.log(` + f.upvalues[${i}].name = ${f.upvalues[i].name} + `); + } + } + readFunction(f, psource) { f.source = this.readString(); if (f.source === null || f.source === undefined || f.source.length === 0) /* no source in dump? */ @@ -213,7 +243,7 @@ class BytecodeParser { this.readConstants(f); this.readUpvalues(f); this.readProtos(f); - // this.readDebug(f); + this.readDebug(f); } checkHeader() { @@ -260,7 +290,7 @@ class BytecodeParser { this.readFunction(cl.p); - // assert(cl.nupvalues === cl.p.upvalues.length); + assert(cl.nupvalues === cl.p.upvalues.length); return cl; } |