mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-05 04:50:43 +00:00
Initialize udis86 library once (faster disasm)
This commit is contained in:
parent
31ba2e8e16
commit
43647b909c
@ -45,10 +45,15 @@ static int modify(RAsm *a, ut8 *buf, int field, ut64 val) {
|
||||
|
||||
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
int opsize;
|
||||
static ud_t d;
|
||||
ud_init (&d);
|
||||
ud_set_syntax (&d, (a->syntax==R_ASM_SYNTAX_ATT)?
|
||||
UD_SYN_ATT: UD_SYN_INTEL);
|
||||
static ud_t d = {0};
|
||||
static int osyntax = 0;
|
||||
if (!d.dis_mode)
|
||||
ud_init (&d);
|
||||
if (osyntax != a->syntax) {
|
||||
ud_set_syntax (&d, (a->syntax==R_ASM_SYNTAX_ATT)?
|
||||
UD_SYN_ATT: UD_SYN_INTEL);
|
||||
osyntax = a->syntax;
|
||||
}
|
||||
ud_set_input_buffer (&d, (uint8_t*) buf, len);
|
||||
ud_set_pc (&d, a->pc);
|
||||
ud_set_mode (&d, a->bits);
|
||||
|
Loading…
x
Reference in New Issue
Block a user