From 6d47fa4336a994c4239e796cbcc31ecccd0119b7 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 15 Mar 2021 02:02:15 +0100 Subject: [PATCH] af-*: Remove function flags too ##anal (#18466) Co-authored-by: Khairul Azhar Kasmiran --- libr/core/cmd_anal.c | 6 ++--- test/db/anal/x86_64 | 59 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index 3f61a8ed67..e08daa0d1c 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -3355,11 +3355,11 @@ static int cmd_anal_fcn(RCore *core, const char *input) { r_core_anal_undefine (core, core->offset); } else if (!strcmp (input + 2, "*")) { RAnalFunction *f; - RListIter *iter; - r_list_foreach (core->anal->fcns, iter, f) { + RListIter *iter, *iter2; + r_list_foreach_safe (core->anal->fcns, iter, iter2, f) { r_anal_del_jmprefs (core->anal, f); + r_core_anal_undefine (core, f->addr); } - r_list_purge (core->anal->fcns); } else { ut64 addr = input[2] ? r_num_math (core->num, input + 2) diff --git a/test/db/anal/x86_64 b/test/db/anal/x86_64 index d2156cddfb..950256ac11 100644 --- a/test/db/anal/x86_64 +++ b/test/db/anal/x86_64 @@ -4038,3 +4038,62 @@ EXPECT=< # fcn.00000003 (); + ----. +| | +|.-------------------------------------. .-----------------------. +|| 0x0 | | 0x3 | +|| ; CODE XREF from fcn.00000003 @ 0x5 | | 9: fcn.00000003 (); | +|| mov eax, 0x1000c121 | | add byte [rax], dl | +|| 9: fcn.00000003 (); | `-----------------------' +|| add byte [rax], dl | v +|`-------------------------------------' | +| v | +| | | +| '----------------------------. | +| .--------------' +| | | +| .--------------------. +| | 0x5 | +| | jmp 0 | +| `--------------------' +| v +| | +`-----------------------------' + +address size nbbs edges cc cost min bound range max bound calls locals args xref frame name +================== ==== ===== ===== ===== ==== ================== ===== ================== ===== ====== ==== ==== ===== ==== +0x0000000000000003 9 3 3 0 4 0x0000000000000000 7 0x0000000000000007 0 0 0 0 0 fcn.00000003 +EOF +RUN