From 7028e3113db4dd3d276e236b64aebd58169efe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sat, 16 Dec 2017 17:30:38 +0100 Subject: [PATCH] Add r_core_prevop_addr_force() with fallback --- libr/core/visual.c | 10 ++++++++++ libr/include/r_core.h | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libr/core/visual.c b/libr/core/visual.c index e084c0948e..3c95cee93c 100644 --- a/libr/core/visual.c +++ b/libr/core/visual.c @@ -765,6 +765,16 @@ R_API bool r_core_prevop_addr(RCore *core, ut64 start_addr, int numinstrs, ut64 return false; } +// Like r_core_prevop_addr(), but also uses fallback from prevop_addr() if +// no anal info is available. +R_API ut64 r_core_prevop_addr_force(RCore *core, ut64 start_addr, int numinstrs) { + int i; + for (i = 0; i < numinstrs; ++i) { + start_addr = prevop_addr (core, start_addr); + } + return start_addr; +} + static void reset_print_cur(RPrint *p) { p->cur = 0; p->ocur = -1; diff --git a/libr/include/r_core.h b/libr/include/r_core.h index 2942927000..64c16e71e5 100644 --- a/libr/include/r_core.h +++ b/libr/include/r_core.h @@ -251,7 +251,8 @@ R_API int r_core_is_valid_offset (RCore *core, ut64 offset); R_API int r_core_shift_block(RCore *core, ut64 addr, ut64 b_size, st64 dist); R_API void r_core_visual_prompt_input (RCore *core); R_API int r_core_visual_refs(RCore *core, bool xref); -R_API bool r_core_prevop_addr (RCore* core, ut64 start_addr, int numinstrs, ut64* prev_addr); +R_API bool r_core_prevop_addr(RCore* core, ut64 start_addr, int numinstrs, ut64* prev_addr); +R_API ut64 r_core_prevop_addr_force(RCore *core, ut64 start_addr, int numinstrs); R_API bool r_core_visual_hudstuff(RCore *core); R_API int r_core_visual_classes(RCore *core); R_API int r_core_visual_types(RCore *core);