Replace afcf with C api. (#2940)

This commit is contained in:
Giovanni 2022-05-08 14:17:52 +02:00 committed by Anton Kochkov
parent e022e44474
commit 6345604172
2 changed files with 15 additions and 4 deletions

View File

@ -1266,7 +1266,16 @@ RzAnalysisFunction *CutterCore::functionIn(ut64 addr)
RzAnalysisFunction *CutterCore::functionAt(ut64 addr) RzAnalysisFunction *CutterCore::functionAt(ut64 addr)
{ {
CORE_LOCK(); 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<RzAnalysisFunction *>(rz_list_first(list));
}
rz_list_free(list);
return fcn;
} }
/** /**

View File

@ -84,11 +84,13 @@ QString GraphWidget::getWidgetType()
void GraphWidget::prepareHeader() void GraphWidget::prepareHeader()
{ {
QString afcf = Core()->cmdRawAt("afcf", seekable->getOffset()).trimmed(); RzAnalysisFunction *f = Core()->functionAt(seekable->getOffset());
if (afcf.isEmpty()) { char *str = f ? rz_analysis_function_get_signature(f) : nullptr;
if (!str) {
header->hide(); header->hide();
return; return;
} }
header->show(); header->show();
header->setText(afcf); header->setText(str);
free(str);
} }