mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-07 22:36:52 +00:00
Fix ret op type for RISC-V (#16954)
This commit is contained in:
parent
3bea2cf5ed
commit
91255a4ccc
@ -538,8 +538,10 @@ static int riscv_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int le
|
||||
op->type = R_ANAL_OP_TYPE_JMP;
|
||||
} else if (is_any ("j", "jump")) {
|
||||
op->type = R_ANAL_OP_TYPE_JMP;
|
||||
} else if (is_any ("jalr", "ret")) { // ?
|
||||
op->type = R_ANAL_OP_TYPE_UCALL;
|
||||
} else if (is_any ("jalr")) {
|
||||
// decide whether it's ret or call
|
||||
int rd = (word >> OP_SH_RD) & OP_MASK_RD;
|
||||
op->type = (rd == 0) ? R_ANAL_OP_TYPE_RET: R_ANAL_OP_TYPE_UCALL;
|
||||
} else if (is_any ("ret")) {
|
||||
op->type = R_ANAL_OP_TYPE_RET;
|
||||
} else if (is_any ("beqz", "beq", "blez", "bgez", "ble",
|
||||
|
10
test/db/anal/riscv
Normal file
10
test/db/anal/riscv
Normal file
@ -0,0 +1,10 @@
|
||||
NAME=ret
|
||||
FILE=bins/elf/analysis/guess-number-riscv64
|
||||
CMDS=<<EOF
|
||||
af @ sym._printf_r
|
||||
afl~_printf_r
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
0x00010330 1 68 sym._printf_r
|
||||
EOF
|
||||
RUN
|
Loading…
x
Reference in New Issue
Block a user