I prefer libdisasm http://bastard.sourceforge.net/libdisasm.html,
but you can always call objdump -D.
From my jitter:
#ifdef HAVE_LIBDISASM
# define LINE_SIZE 255`
char line[LINE_SIZE];
int pos = 0;
int insnsize; /* size of instruction */
x86_insn_t insn; /* one instruction */
x86_init(opt_none, NULL, NULL);
while ( pos < size ) {
insnsize = x86_disasm(code, size, 0, pos, &insn);
if ( insnsize ) {
x86_format_insn(&insn, line, LINE_SIZE, att_syntax);
printf("(code+%3x): ", pos);
for ( i = 0; i < 10; i++ ) {
if ( i < insn.size ) printf(" %02x", insn.bytes[i]);
else printf(" ");
}
printf("%s\n", line);
pos += insnsize;
} else {
printf("Invalid instruction at 0x%x. size=0x%x\n", pos, size);
pos++;
}
}
x86_cleanup();
#else
fh = fopen("run-jit.bin", "w");
fwrite(code,size,1,fh);
fclose(fh);
system("objdump -D --target=binary --architecture i386"
#ifdef JIT_CPU_AMD64
":x86-64"
#endif
" run-jit.bin");
#endif