Hide meaningless AnalOp fields in ao/aoj ##anal

This commit is contained in:
pancake 2023-03-23 12:06:23 +01:00 committed by GitHub
parent 9608c125ec
commit b601497c3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 15 additions and 69 deletions

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2010-2022 - pancake, nibble */
/* radare - LGPL - Copyright 2010-2023 - pancake, nibble */
#include <r_anal.h>
#include <r_util.h>

View File

@ -2414,7 +2414,9 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
pj_ks (pj, "esil", jesil);
}
pj_kb (pj, "sign", op.sign);
pj_kn (pj, "prefix", op.prefix);
if (op.prefix > 0) {
pj_kn (pj, "prefix", op.prefix);
}
pj_ki (pj, "id", op.id);
if (op.vliw > 0) {
pj_ki (pj, "id", op.vliw);
@ -2457,8 +2459,10 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
if (op.ireg) {
pj_ks (pj, "ireg", op.ireg);
}
pj_ki (pj, "scale", op.scale);
if (op.refptr != -1) {
if (op.scale > 0) {
pj_ki (pj, "scale", op.scale);
}
if (op.refptr != -1 && op.refptr > 0) {
pj_ki (pj, "refptr", op.refptr);
}
pj_ki (pj, "cycles", op.cycles);
@ -2579,7 +2583,9 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
printline ("ophint", "%s\n", hint->opcode);
}
}
printline ("prefix", "%u\n", op.prefix);
if (op.prefix > 0) {
printline ("prefix", "%u\n", op.prefix);
}
printline ("id", "%d\n", op.id);
if (op.vliw > 0) {
printline ("id", "%d\n", op.vliw);
@ -2606,7 +2612,7 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
if (op.disp && op.disp != UT64_MAX) {
printline ("disp", "0x%08" PFMT64x "\n", op.disp);
}
if (op.refptr != -1) {
if (op.refptr != -1 && op.refptr > 0) {
printline ("refptr", "%d\n", op.refptr);
}
printline ("size", "%d\n", size);
@ -2629,7 +2635,7 @@ static void core_anal_bytes(RCore *core, const ut8 *buf, int len, int nops, int
if (op.ireg) {
printline ("ireg", "%s\n", op.ireg);
}
if (op.scale) {
if (op.scale > 0) {
printline ("scale", "%d\n", op.scale);
}
if (hint && hint->esil) {

View File

@ -900,10 +900,8 @@ disasm: push {r3, lr}
pseudo: push (r3, lr)
mnemonic: push
mask: ffffffff
prefix: 0
id: 128
bytes: 08402de9
refptr: 0
size: 4
sign: false
type: push
@ -921,10 +919,8 @@ pseudo: r7 = sp + 0
mnemonic: add
description: add two values
mask: ffff
prefix: 0
id: 2
bytes: 00af
refptr: 0
size: 2
sign: false
type: add

View File

@ -97,10 +97,8 @@ pseudo: irg x8, sp, x8
mnemonic: irg
description: insert random tag
mask: ffffffff
prefix: 0
id: 429
bytes: e813c89a
refptr: 0
size: 4
sign: false
type: mov
@ -115,10 +113,8 @@ pseudo: addg x9, x8, 0x20, 0
mnemonic: addg
description: add with tag
mask: ffffffff
prefix: 0
id: 7
bytes: 09018291
refptr: 0
size: 4
sign: false
type: add
@ -148,10 +144,8 @@ pseudo: addg x12, x8, 0x200, 2
mnemonic: addg
description: add with tag
mask: ffffffff
prefix: 0
id: 7
bytes: 91a0090c
refptr: 0
size: 4
sign: false
type: add
@ -167,10 +161,8 @@ pseudo: addg x9, x8, 0x20, 0
mnemonic: addg
description: add with tag
mask: ffffffff
prefix: 0
id: 7
bytes: 91820109
refptr: 0
size: 4
sign: false
type: add
@ -186,10 +178,8 @@ pseudo: irg x8, sp, x8
mnemonic: irg
description: insert random tag
mask: ffffffff
prefix: 0
id: 429
bytes: 9ac813e8
refptr: 0
size: 4
sign: false
type: mov

View File

@ -16,11 +16,9 @@ pseudo: r0 += 0x1
mnemonic: add
description: add src to dst (32-bit)
mask: ffffffffffffffff
prefix: 0
id: 1
bytes: 0400000001000000
val: 0x00000001
refptr: 0
size: 8
sign: false
type: add

View File

@ -15,10 +15,8 @@ pseudo: add64 r0, r1
mnemonic: add64
description: add src to dst (64-bit)
mask: ffffffffffffffff
prefix: 0
id: 14
bytes: 0f10000000000000
refptr: 0
size: 8
sign: false
type: add
@ -45,11 +43,9 @@ pseudo: add64 r0, 0x1
mnemonic: add64
description: add src to dst (64-bit)
mask: ffffffffffffffff
prefix: 0
id: 14
bytes: 0700000001000000
val: 0x00000001
refptr: 0
size: 8
sign: false
type: add
@ -76,11 +72,9 @@ pseudo: r0 += 0x1
mnemonic: add
description: add src to dst (32-bit)
mask: ffffffffffffffff
prefix: 0
id: 1
bytes: 0400000001000000
val: 0x00000001
refptr: 0
size: 8
sign: false
type: add
@ -107,10 +101,8 @@ pseudo: stxw [r2+0x10], r9
mnemonic: stxw
description: store word from register
mask: ffffffffffffffff
prefix: 0
id: 45
bytes: 6392100000000000
refptr: 0
size: 8
sign: false
type: store

View File

@ -33,10 +33,8 @@ pseudo: jump
mnemonic: jump
description: perform unconditional jump
mask: ff
prefix: 0
id: 86
bytes: 56
refptr: 0
size: 1
sign: false
type: jmp

View File

@ -422,7 +422,6 @@ EXPECT=<<EOF
"mask": "ffffffff",
"esil": "r1,-16,r1,+,=[4],-16,r1,+=",
"sign": false,
"prefix": 0,
"id": 1072,
"opex": {
"operands": [
@ -442,8 +441,6 @@ EXPECT=<<EOF
"size": 4,
"type": "store",
"esilcost": 12,
"scale": 0,
"refptr": 0,
"cycles": 0,
"failcycles": 0,
"delay": 0,

View File

@ -146,7 +146,6 @@ EXPECT=<<EOF
"mnemonic": "la",
"mask": "ffffffff",
"sign": false,
"prefix": 0,
"id": 0,
"opex": {
"operands": [
@ -166,8 +165,6 @@ EXPECT=<<EOF
"size": 4,
"type": "mov",
"esilcost": 0,
"scale": 0,
"refptr": 0,
"cycles": 0,
"failcycles": 0,
"delay": 0,

View File

@ -16,7 +16,6 @@ EXPECT=<<EOF
"mask": "ff000000",
"jump": 134632,
"sign": false,
"prefix": 0,
"id": 17,
"opex": {
"operands": [
@ -31,8 +30,6 @@ EXPECT=<<EOF
"size": 4,
"type": "jmp",
"esilcost": 0,
"scale": 0,
"refptr": 0,
"cycles": 0,
"failcycles": 0,
"delay": 0,

View File

@ -56,7 +56,6 @@ EXPECT=<<EOF
"mask": "ff",
"esil": "2,sp,-=,eflags,sp,=[2]",
"sign": false,
"prefix": 0,
"id": 612,
"opex": {
"operands": [
@ -73,8 +72,6 @@ EXPECT=<<EOF
"size": 1,
"type": "upush",
"esilcost": 0,
"scale": 0,
"refptr": 0,
"cycles": 2,
"failcycles": 0,
"delay": 0,

View File

@ -3125,7 +3125,6 @@ EXPECT=<<EOF
"mask": "ffff",
"esil": "eax,eax,^=,$z,zf,:=,$p,pf,:=,31,$s,sf,:=,0,cf,:=,0,of,:=",
"sign": false,
"prefix": 0,
"id": 1503,
"opex": {
"operands": [
@ -3149,8 +3148,6 @@ EXPECT=<<EOF
"size": 2,
"type": "xor",
"esilcost": 0,
"scale": 0,
"refptr": 0,
"cycles": 1,
"failcycles": 0,
"delay": 0,
@ -3180,7 +3177,6 @@ EXPECT=<<EOF
"mask": "ffff",
"esil": "4,esp,-=,eflags,esp,=[4]",
"sign": false,
"prefix": 0,
"id": 612,
"opex": {
"operands": [
@ -3197,8 +3193,6 @@ EXPECT=<<EOF
"size": 2,
"type": "upush",
"esilcost": 12,
"scale": 0,
"refptr": 0,
"cycles": 2,
"failcycles": 0,
"delay": 0,
@ -3423,7 +3417,7 @@ ao 1
p8 1
EOF
EXPECT=<<EOF
18
16
address: 0x0
opcode: nop
esilcost: 0
@ -3432,10 +3426,8 @@ pseudo: no
mnemonic: nop
description: no operation
mask: ff
prefix: 0
id: 510
bytes: 90
refptr: 0
size: 1
sign: false
type: nop

View File

@ -1297,7 +1297,7 @@ ahe test
ao~esil
EOF
EXPECT=<<EOF
18
17
esilcost: 0
esil: test
EOF
@ -2446,7 +2446,6 @@ EXPECT=<<EOF
"mask": "ffff",
"esil": "8,rsp,-=,eflags,rsp,=[8]",
"sign": false,
"prefix": 0,
"id": 612,
"opex": {
"operands": [
@ -2463,8 +2462,6 @@ EXPECT=<<EOF
"size": 2,
"type": "upush",
"esilcost": 24,
"scale": 0,
"refptr": 0,
"cycles": 2,
"failcycles": 0,
"delay": 0,
@ -3232,10 +3229,8 @@ pseudo: push (rbp)
mnemonic: push
description: push word, doubleword or quadword onto the stack
mask: ff
prefix: 0
id: 609
bytes: 55
refptr: 0
size: 1
sign: false
type: rpush

View File

@ -261,7 +261,6 @@ pseudo: dword [rbp - 0xc] = 0
mnemonic: mov
description: moves data from src to dst
mask: ffffffffffffff
prefix: 0
id: 460
bytes: c745f400000000
val: 0x00000000
@ -286,7 +285,6 @@ stackptr: 8
"mask": "ffffffffffffff",
"esil": "0,0xc,rbp,-,=[4]",
"sign": false,
"prefix": 0,
"id": 460,
"opex": {
"operands": [
@ -315,7 +313,6 @@ stackptr: 8
"size": 7,
"type": "mov",
"esilcost": 12,
"scale": 0,
"refptr": 4,
"cycles": 1,
"failcycles": 0,
@ -346,15 +343,12 @@ EXPECT=<<EOF
"mnemonic": "adc",
"mask": "ffff",
"sign": false,
"prefix": 0,
"id": 0,
"addr": 0,
"bytes": "ceed",
"size": 2,
"type": "unk",
"esilcost": 0,
"scale": 0,
"refptr": 0,
"cycles": 0,
"failcycles": 0,
"delay": 0,
@ -403,15 +397,12 @@ EXPECT=<<EOF
"mask": "ffff",
"esil": "0xed,a,+=,C,NUM,7,$c,C,:=,3,$c,H,:=,a,+=,7,$c,C,|,C,:=,3,$c,H,|=,a,a,=,$z,Z,:=,0,N,:=",
"sign": false,
"prefix": 0,
"id": 0,
"addr": 0,
"bytes": "ceed",
"size": 2,
"type": "add",
"esilcost": 0,
"scale": 0,
"refptr": 0,
"cycles": 8,
"failcycles": 0,
"delay": 0,