Skip to content

Instantly share code, notes, and snippets.

@Benabik
Created October 16, 2011 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Benabik/1291423 to your computer and use it in GitHub Desktop.
Save Benabik/1291423 to your computer and use it in GitHub Desktop.
Disassembler-in-progress output. See https://github.com/parrot/PACT for source
Start/end sub markers in disassembly
Figure out what the debug segment actually means...
references:
src/debug.c:PBC_disassemble
frontend/pbc_dump.c:disas_dump
OpInfo PMC
OpLib PMC
$ winxed disasm.winxed temp.pbc
Core Version : 3.10.0
Bytecode Version: 12.0
UUID (type 0) :
Wordsize 8 Byteorder 0 Floattype 0
Segments:
Constants: CONSTANT_temp.pir
1 numeric constants:
0: 0
10 string constants:
0 (ascii): "temp.pir"
1 (ascii): "test"
2 (): ""
3 (ascii): "parrot"
4 (ascii): "/dev/random"
5 (ascii): "file"
6 (utf8): "Ub\x{eb}r-test\n"
7 (ascii): "line"
8 (ascii): "main"
9 (): ""
6 PMC constants:
0 (FixedIntegerArray): [ 0 ]
1 (Sub): test (PC 0 - 7)
2 (FixedIntegerArray): [ 16 ]
3 (FixedIntegerArray): [ 3 ]
4 (FixedIntegerArray): [ ]
5 (Sub): main (PC 7 - 32)
Debug: BYTECODE_temp.pir_DB
1 debug mappings:
0: temp.pir 0
Annotations: BYTECODE_temp.pir_ANN
2 annotations:
7 file: ascii:"/dev/random"
7 line: 1
Bytecode: BYTECODE_temp.pir
Oplibs:
core_ops 3.10.0
Opmap:
0: get_params_pc 1
1: set_returns_pc 1
2: returncc 0
3: set_s_p 2
4: print_n 1
5: set_args_pc 1
6: set_s_n 2
7: invokecc_p 1
8: get_results_pc 1
9: lt_i_ic_ic 3
10: exit_ic 1
Bytecode:
Subroutine: test (0 - 7)
0: get_params ($I0)
3: set_returns ($I0)
6: returncc
Subroutine: main (7 - 32)
7: set $S0, $P6
10: print $N0
12: set_args (1)
15: set $S0, $N1
18: invokecc $P0
20: get_results ($N0)
23: lt $I0, 0, 6
27: exit 1
29: set_returns ()
31: returncc
# Copyright (C) 2011 Parrot Foundation.
.sub 'test'
.param int n
.return (n)
.end
.sub 'main' :main
.annotate 'file', '/dev/random'
.annotate 'line', 1
$S1 = utf8:"Ubër-test\n"
print $S1
$N0 = 'test'(1)
if $N0 > 0 goto no_exit
exit 1
no_exit:
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment