From bdeacabffb229002c9fead24e8707d56f0f1bb05 Mon Sep 17 00:00:00 2001 From: Giovanni <561184+wargio@users.noreply.github.com> Date: Sun, 8 May 2022 14:17:52 +0200 Subject: [PATCH] Replace afcf with C api. (#2940) --- src/core/Cutter.cpp | 11 ++++++++++- src/widgets/GraphWidget.cpp | 8 +++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index bd801a0e..8759c04c 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -1266,7 +1266,16 @@ RzAnalysisFunction *CutterCore::functionIn(ut64 addr) RzAnalysisFunction *CutterCore::functionAt(ut64 addr) { CORE_LOCK(); - return rz_analysis_get_function_at(core->analysis, addr); + RzAnalysisFunction *fcn = rz_analysis_get_function_at(core->analysis, addr); + if (fcn) { + return fcn; + } + RzList *list = rz_analysis_get_functions_in(core->analysis, addr); + if (rz_list_length(list) == 1) { + fcn = static_cast(rz_list_first(list)); + } + rz_list_free(list); + return fcn; } /** diff --git a/src/widgets/GraphWidget.cpp b/src/widgets/GraphWidget.cpp index 046babe0..f4b2b43e 100644 --- a/src/widgets/GraphWidget.cpp +++ b/src/widgets/GraphWidget.cpp @@ -84,11 +84,13 @@ QString GraphWidget::getWidgetType() void GraphWidget::prepareHeader() { - QString afcf = Core()->cmdRawAt("afcf", seekable->getOffset()).trimmed(); - if (afcf.isEmpty()) { + RzAnalysisFunction *f = Core()->functionAt(seekable->getOffset()); + char *str = f ? rz_analysis_function_get_signature(f) : nullptr; + if (!str) { header->hide(); return; } header->show(); - header->setText(afcf); + header->setText(str); + free(str); }