bongtrop/hbctool

Show jump offsets and object keys & values in disassembly

vs49688 opened this issue · 1 comments

As it stands, it's difficult to (a) determine the object keys/values used in New*WithBuffer instructions, and (b) determine the exact location of a jump.

It would be great if this information could be displayed in the disassembly output (see below for examples).

I've done a proof-of-concept here, but it's very dodgy.

Function offsets:

0000: Function<Ie>9746(3 params, 16 registers, 2 symbols):
0000: 	CreateEnvironment   	Reg8:0
0002: 	LoadParam           	Reg8:3, UInt8:1
0005: 	LoadConstUInt8      	Reg8:7, UInt8:1
0008: 	LoadConstUndefined  	Reg8:6
0010: 	LoadConstUndefined  	Reg8:4
0012: 	GetArgumentsLength  	Reg8:5, Reg8:4
0015: 	LoadConstUInt8      	Reg8:2, UInt8:2
0018: 	Mov                 	Reg8:1, Reg8:7
0021: 	JNotGreater         	Addr8:19, Reg8:5, Reg8:2
0021:	; Oper[1]; Offset(40)

0025: 	GetArgumentsPropByVal	Reg8:5, Reg8:2, Reg8:4
0029: 	Mov                 	Reg8:1, Reg8:7
0032: 	JStrictEqual        	Addr8:8, Reg8:6, Reg8:5
0032:	; Oper[1]; Offset(40)

0036: 	GetArgumentsPropByVal	Reg8:1, Reg8:2, Reg8:4
0040: 	LoadParam           	Reg8:2, UInt8:2
0043: 	StoreToEnvironment  	Reg8:0, UInt8:1, Reg8:2
...

Object keys & values:

...
0085: 	Call4               	Reg8:9, Reg8:14, Reg8:15, Reg8:5, Reg8:9, Reg8:13
0092: 	NewObjectWithBuffer 	Reg8:9, UInt16:11, UInt16:11, UInt16:33863, UInt16:288
0092:	; Oper[3]: ObjectKey(33863, String(12426)) 'updateId'
0092:	; Oper[3]: ObjectKey(33863, String(25017)) 'releaseChannel'
0092:	; Oper[4]: ObjectVal(288, Boolean(True))
0092:	; Oper[4]: ObjectVal(288, Boolean(True))
...

Ho nice idea! Could you please create the merge request?