Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- vm/bytecodes.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/vm/bytecodes.c b/vm/bytecodes.c index 8c6a5fa..4d78d38 100644 --- a/vm/bytecodes.c +++ b/vm/bytecodes.c @@ -207,20 +207,25 @@ void bytecode_disassemble(const unsigned char *code, unsigned long size) bytecode_for_each_insn(code, size, pc) { char *opc_name; int size; + int _pc; size = bc_insn_size(&code[pc]); printf(" [ %-3ld ] 0x%02x ", pc, code[pc]); - if (code[pc] == OPC_WIDE) - size--; - opc_name = bc_get_insn_name(&code[pc]); if (!opc_name) { printf("(string alloc failed)\n"); continue; } + _pc = pc; + + if (code[pc] == OPC_WIDE) { + _pc++; + size--; + } + if (size > 1) printf("%-14s", opc_name); else @@ -228,13 +233,13 @@ void bytecode_disassemble(const unsigned char *code, unsigned long size) free(opc_name); - if (bc_is_branch(code[pc])) { - printf(" %ld\n", bc_target_off(&code[pc]) + pc); + if (bc_is_branch(code[_pc])) { + printf(" %ld\n", bc_target_off(&code[_pc]) + _pc); continue; } for (int i = 1; i < size; i++) - printf(" 0x%02x", (unsigned int)code[pc + i]); + printf(" 0x%02x", (unsigned int)code[_pc + i]); printf("\n"); } -- 1.6.0.6 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel