|
17 | 17 | get_instructions_bytes, |
18 | 18 | get_opcode, |
19 | 19 | ) |
| 20 | +from xdis.instruction import Instruction |
20 | 21 | from xdis.std import distb |
21 | 22 | from xdis.version_info import PYTHON_VERSION_TRIPLE |
22 | 23 |
|
@@ -368,11 +369,17 @@ def null_print(x): |
368 | 369 | hasattr(opc, "opcode_extended_fmt") |
369 | 370 | and opc.opname[op] in opc.opcode_extended_fmt |
370 | 371 | ): |
371 | | - result= opc.opcode_extended_fmt[opc.opname[op]]( |
| 372 | + tos_str, start_offset = opc.opcode_extended_fmt[opc.opname[op]]( |
372 | 373 | opc, list(reversed(instructions)) |
373 | 374 | ) |
374 | | - if result is not None: |
375 | | - argrepr = result[0] |
| 375 | + if start_offset is not None: |
| 376 | + argrepr = tos_str |
| 377 | + new_instruction = list(instructions[-1]) |
| 378 | + new_instruction[-2] = tos_str |
| 379 | + new_instruction[-1] = start_offset |
| 380 | + del instructions[-1] |
| 381 | + instructions.append(Instruction(*new_instruction)) |
| 382 | + |
376 | 383 | pass |
377 | 384 | elif asm_format in ("extended", "extended-bytes"): |
378 | 385 | # Note: instr.arg is also None |
@@ -432,7 +439,8 @@ def section(msg_str): |
432 | 439 | # dis(msg, msg_nocr, errmsg, section, curframe, |
433 | 440 | # start_offset=10, end_offset=20, highlight='dark') |
434 | 441 | print("-" * 40) |
435 | | - for asm_format in ("extended", "bytes", "extended-bytes", "std"): |
| 442 | + # for asm_format in ("std", "extended", "bytes", "extended-bytes"): |
| 443 | + for asm_format in ("extended", "bytes", "extended-bytes"): |
436 | 444 | print("Format is", asm_format) |
437 | 445 | dis(msg, msg_nocr, section, errmsg, disassemble, asm_format=asm_format) |
438 | 446 | print("=" * 30) |
|
0 commit comments