@tact-lang/opcode
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -8,2 +8,13 @@ # Changelog | ||
## [0.0.3] - 2023-03-24 | ||
## Added | ||
- Handling debug opcodes | ||
## Changed | ||
- Change unknown function name prefix | ||
## Fixed | ||
- Missigng IFJMPREF processing in decompileAll | ||
## [0.0.2] - 2023-03-24 | ||
@@ -10,0 +21,0 @@ |
@@ -363,20 +363,8 @@ import { Cell } from 'ton-core'; | ||
} | { | ||
code: 'DUMPSTKTOP'; | ||
code: 'DEBUG'; | ||
args: [number]; | ||
} | { | ||
code: 'DUMP'; | ||
args: [number]; | ||
} | { | ||
code: 'PRINT'; | ||
args: [number]; | ||
} | { | ||
code: 'DUMPTOSFMT'; | ||
args: [number]; | ||
} | { | ||
code: 'LOGSTR'; | ||
code: 'DEBUGSTR'; | ||
args: [string]; | ||
} | { | ||
code: 'PRINTSTR'; | ||
args: [string]; | ||
} | { | ||
code: 'SETCP'; | ||
@@ -1345,24 +1333,4 @@ args: [number]; | ||
} | { | ||
code: 'DUMPSTK'; | ||
} | { | ||
code: 'HEXDUMP'; | ||
} | { | ||
code: 'HEXPRINT'; | ||
} | { | ||
code: 'BINDUMP'; | ||
} | { | ||
code: 'BINPRINT'; | ||
} | { | ||
code: 'STRDUMP'; | ||
} | { | ||
code: 'STRPRINT'; | ||
} | { | ||
code: 'DEBUGOFF'; | ||
} | { | ||
code: 'DEBUGON'; | ||
} | { | ||
code: 'LOGFLUSH'; | ||
} | { | ||
code: 'SETCPX'; | ||
}; | ||
export type OpCode = OpCodeWithArgs | OpCodeNoArgs; |
@@ -1151,11 +1151,11 @@ "use strict"; | ||
CP0Auto.insertHex('fb07', 16, { code: 'CHANGELIB' }); | ||
// CP0Auto.insertHex('fe', 8, (slice) => { | ||
// let nn = slice.loadUint(8); | ||
// if ((nn & 0xf0) == 0xf0) { | ||
// let n = nn & 0x0f; | ||
// let str = slice.readBuffer(n + 1).toString('utf-8'); | ||
// return { code: 'LOGSTR', args: [str] }; | ||
// } | ||
// return { code: 'DEBUG', args: [nn] }; | ||
// }); | ||
CP0Auto.insertHex('fe', 8, (slice) => { | ||
let nn = slice.loadUint(8); | ||
if ((nn & 0xf0) == 0xf0) { | ||
let n = nn & 0x0f; | ||
let str = slice.loadBuffer(n + 1).toString('utf-8'); | ||
return { code: 'DEBUGSTR', args: [str] }; | ||
} | ||
return { code: 'DEBUG', args: [nn] }; | ||
}); | ||
CP0Auto.insertHex('ff', 8, (slice) => { | ||
@@ -1162,0 +1162,0 @@ let nn = slice.loadInt(8); |
@@ -75,4 +75,14 @@ "use strict"; | ||
} | ||
// Debug | ||
if (op.code === 'DEBUG') { | ||
if (op.args[0] === 0x00) { | ||
return 'DUMPSTK'; | ||
} | ||
if (op.args[0] === 0x14) { | ||
return 'STRDUMP'; | ||
} | ||
return `${op.args[0]} DEBUG`; | ||
} | ||
return `${op.args.join(' ')} ${op.code}`; | ||
} | ||
exports.opcodeToString = opcodeToString; |
@@ -35,3 +35,3 @@ "use strict"; | ||
// Add name to a map and assign name | ||
let name = '#unknown_' + (unknownIndex++); | ||
let name = '?fun_' + (unknownIndex++); | ||
callRefs.set(k, name); | ||
@@ -51,3 +51,3 @@ // Render cell | ||
for (let [key, value] of dict) { | ||
let name = knownMethods_1.knownMethods[key] || '#unknown_' + (unknownIndex++); | ||
let name = knownMethods_1.knownMethods[key] || '?fun_' + (unknownIndex++); | ||
let w = new Writer_1.Writer(); | ||
@@ -92,2 +92,3 @@ decompileCell({ | ||
|| op.op.code === 'CALLREF' | ||
|| op.op.code === 'IFJMPREF' | ||
|| op.op.code === 'IFREF' | ||
@@ -94,0 +95,0 @@ || op.op.code === 'IFREFELSEREF') { |
{ | ||
"name": "@tact-lang/opcode", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/tact-lang/ton-opcode.git", |
@@ -124,8 +124,4 @@ import { Cell } from 'ton-core'; | ||
| { code: 'SETGLOB', args: [number] } | ||
| { code: 'DUMPSTKTOP', args: [number] } | ||
| { code: 'DUMP', args: [number] } | ||
| { code: 'PRINT', args: [number] } | ||
| { code: 'DUMPTOSFMT', args: [number] } | ||
| { code: 'LOGSTR', args: [string] } | ||
| { code: 'PRINTSTR', args: [string] } | ||
| { code: 'DEBUG', args: [number] } | ||
| { code: 'DEBUGSTR', args: [string] } | ||
| { code: 'SETCP', args: [number] }; | ||
@@ -617,14 +613,4 @@ | ||
| { code: 'CHANGELIB' } | ||
| { code: 'DUMPSTK' } | ||
| { code: 'HEXDUMP' } | ||
| { code: 'HEXPRINT' } | ||
| { code: 'BINDUMP' } | ||
| { code: 'BINPRINT' } | ||
| { code: 'STRDUMP' } | ||
| { code: 'STRPRINT' } | ||
| { code: 'DEBUGOFF' } | ||
| { code: 'DEBUGON' } | ||
| { code: 'LOGFLUSH' } | ||
| { code: 'SETCPX' }; | ||
export type OpCode = OpCodeWithArgs | OpCodeNoArgs; |
@@ -1160,13 +1160,11 @@ import { beginCell, Slice } from 'ton-core'; | ||
CP0Auto.insertHex('fb07', 16, { code: 'CHANGELIB' }); | ||
// CP0Auto.insertHex('fe', 8, (slice) => { | ||
// let nn = slice.loadUint(8); | ||
// if ((nn & 0xf0) == 0xf0) { | ||
// let n = nn & 0x0f; | ||
// let str = slice.readBuffer(n + 1).toString('utf-8'); | ||
// return { code: 'LOGSTR', args: [str] }; | ||
// } | ||
// return { code: 'DEBUG', args: [nn] }; | ||
// }); | ||
CP0Auto.insertHex('fe', 8, (slice) => { | ||
let nn = slice.loadUint(8); | ||
if ((nn & 0xf0) == 0xf0) { | ||
let n = nn & 0x0f; | ||
let str = slice.loadBuffer(n + 1).toString('utf-8'); | ||
return { code: 'DEBUGSTR', args: [str] }; | ||
} | ||
return { code: 'DEBUG', args: [nn] }; | ||
}); | ||
CP0Auto.insertHex('ff', 8, (slice) => { | ||
@@ -1173,0 +1171,0 @@ let nn = slice.loadInt(8); |
@@ -77,3 +77,14 @@ import { isOpCodeWithArgs, OpCode } from "./opcodes.gen"; | ||
// Debug | ||
if (op.code === 'DEBUG') { | ||
if (op.args[0] === 0x00) { | ||
return 'DUMPSTK'; | ||
} | ||
if (op.args[0] === 0x14) { | ||
return 'STRDUMP'; | ||
} | ||
return `${op.args[0]} DEBUG`; | ||
} | ||
return `${op.args.join(' ')} ${op.code}`; | ||
} |
@@ -44,3 +44,3 @@ import { Cell, Dictionary, DictionaryValue } from "ton-core"; | ||
// Add name to a map and assign name | ||
let name = '#unknown_' + (unknownIndex++); | ||
let name = '?fun_' + (unknownIndex++); | ||
callRefs.set(k, name); | ||
@@ -61,3 +61,3 @@ | ||
for (let [key, value] of dict) { | ||
let name = knownMethods[key] || '#unknown_' + (unknownIndex++); | ||
let name = knownMethods[key] || '?fun_' + (unknownIndex++); | ||
let w = new Writer(); | ||
@@ -106,2 +106,3 @@ decompileCell({ | ||
|| op.op.code === 'CALLREF' | ||
|| op.op.code === 'IFJMPREF' | ||
|| op.op.code === 'IFREF' | ||
@@ -108,0 +109,0 @@ || op.op.code === 'IFREFELSEREF') { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5345387
5709