Fix arguments alignment in PYC disassembler (#3569)

This commit is contained in:
Luca Borzacchiello 2023-06-11 12:38:28 +02:00 committed by GitHub
parent b52ebcc62f
commit d0426f9edd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 29 deletions

View file

@ -48,7 +48,7 @@ int rz_pyc_disasm(RzAsmOp *opstruct, const ut8 *code, RzList /*<pyc_code_object
}
const char *arg = parse_arg(&ops->opcodes[op], oparg, names, consts, varnames, freevars, cellvars, ops->opcode_arg_fmt);
if (arg != NULL) {
rz_strbuf_appendf(&opstruct->buf_asm, "%20s", arg);
rz_strbuf_setf(&opstruct->buf_asm, "%-22s%s", name, arg);
free((char *)arg);
}
} else if (ops->bits == 8) {

View file

@ -173,17 +173,17 @@ EXPECT=<<EOF
;-- entry0:
;-- section.module:
;-- <module>:
0x0000002e LOAD_CONST Multiline strings can be written
0x0000002e LOAD_CONST Multiline strings can be written
using three "s, and are often used
as documentation. ; [00] ---- section size 3248 named module
0x00000030 STORE_NAME __doc__
0x00000032 LOAD_CONST True
,=< 0x00000034 JUMP_IF_FALSE_OR_POP 10
| 0x00000036 LOAD_CONST False
0x00000030 STORE_NAME __doc__
0x00000032 LOAD_CONST True
,=< 0x00000034 JUMP_IF_FALSE_OR_POP 10
| 0x00000036 LOAD_CONST False
`-> 0x00000038 POP_TOP
0x0000003a LOAD_CONST False
,=< 0x0000003c JUMP_IF_TRUE_OR_POP 18
| 0x0000003e LOAD_CONST True
0x0000003a LOAD_CONST False
,=< 0x0000003c JUMP_IF_TRUE_OR_POP 18
| 0x0000003e LOAD_CONST True
`-> 0x00000040 POP_TOP
EOF
REGEXP_FILTER_ERR=<<EOF
@ -203,17 +203,17 @@ EXPECT=<<EOF
;-- entry0:
;-- section.module:
;-- <module>:
0x0000002a LOAD_CONST Multiline strings can be written
0x0000002a LOAD_CONST Multiline strings can be written
using three "s, and are often used
as documentation. ; [00] ---- section size 3218 named module
0x0000002c STORE_NAME __doc__
0x0000002e LOAD_CONST True
,=< 0x00000030 JUMP_IF_FALSE_OR_POP 10
| 0x00000032 LOAD_CONST False
0x0000002c STORE_NAME __doc__
0x0000002e LOAD_CONST True
,=< 0x00000030 JUMP_IF_FALSE_OR_POP 10
| 0x00000032 LOAD_CONST False
`-> 0x00000034 POP_TOP
0x00000036 LOAD_CONST False
,=< 0x00000038 JUMP_IF_TRUE_OR_POP 18
| 0x0000003a LOAD_CONST True
0x00000036 LOAD_CONST False
,=< 0x00000038 JUMP_IF_TRUE_OR_POP 18
| 0x0000003a LOAD_CONST True
`-> 0x0000003c POP_TOP
EOF
REGEXP_FILTER_ERR=<<EOF
@ -249,16 +249,16 @@ EXPECT=<<EOF
;-- entry0:
;-- section.module:
;-- <module>:
0x0000001e LOAD_CONSTCodeObject(hello_world) from hello.py ; [00] ---- section size 25 named module
0x0000001e LOAD_CONST CodeObject(hello_world) from hello.py ; [00] ---- section size 25 named module
0x00000021 MAKE_FUNCTION
0x00000024 STORE_NAME hello_world
0x00000027 LOAD_CONST 'world'
0x00000024 STORE_NAME hello_world
0x00000027 LOAD_CONST 'world'
0x0000002a PRINT_ITEM
0x0000002b PRINT_NEWLINE
0x0000002c LOAD_NAME hello_world
0x0000002f CALL_FUNCTION0 positional, 0 named
0x0000002c LOAD_NAME hello_world
0x0000002f CALL_FUNCTION 0 positional, 0 named
0x00000032 POP_TOP
0x00000033 LOAD_CONST None
0x00000033 LOAD_CONST None
EOF
REGEXP_FILTER_ERR=<<EOF
free_object\ \(0\)
@ -279,16 +279,16 @@ EXPECT=<<EOF
;-- section.module:
;-- <module>:
/ entry0();
| 0x0000001e LOAD_CONSTCodeObject(hello_world) from hello.py ; [00] ---- section size 25 named module
| 0x0000001e LOAD_CONST CodeObject(hello_world) from hello.py ; [00] ---- section size 25 named module
| 0x00000021 MAKE_FUNCTION
| 0x00000024 STORE_NAME hello_world
| 0x00000027 LOAD_CONST 'world'
| 0x00000024 STORE_NAME hello_world
| 0x00000027 LOAD_CONST 'world'
| 0x0000002a PRINT_ITEM
| 0x0000002b PRINT_NEWLINE
| 0x0000002c LOAD_NAME hello_world
| 0x0000002f CALL_FUNCTION0 positional, 0 named
| 0x0000002c LOAD_NAME hello_world
| 0x0000002f CALL_FUNCTION 0 positional, 0 named
| 0x00000032 POP_TOP
| 0x00000033 LOAD_CONST None
| 0x00000033 LOAD_CONST None
\ 0x00000036 RETURN_VALUE
EOF
REGEXP_FILTER_ERR=<<EOF