This commit is contained in:
Rot127 2026-05-07 18:10:16 +02:00
parent cf0591a93d
commit 925918a6e3
No known key found for this signature in database
GPG key ID: 0E088203E6CF0BA5
4 changed files with 11 additions and 13 deletions

View file

@ -56,12 +56,9 @@ typedef struct {
RzGraph /*<RzInquiryBB *, RzInquiryBBCFGEdge *>*/ *graph;
} RzInquiryBBCFG;
RZ_IPI RZ_OWN RzInquiryBB *rz_inquiry_bb_new(ut64 addr, ut64 size);
RZ_IPI void rz_inquiry_bb_free(RZ_NULLABLE RZ_OWN RzInquiryBB *bb);
RZ_IPI RZ_OWN RzInquiryBBCFG *rz_inquiry_bb_cfg_new(RzGraphImplType impl_type);
RZ_IPI void rz_inquiry_bb_cfg_free(RZ_NULLABLE RZ_OWN RzInquiryBBCFG *bb_cfg);
RZ_IPI bool rz_inquiry_bb_cfg_add_basic_block(RzInquiryBBCFG *cfg, ut64 addr, ut64 size);
RZ_IPI bool rz_inquiry_bb_cfg_add_block(RzInquiryBBCFG *cfg, ut64 addr, ut64 size);
RZ_IPI bool rz_inquiry_bb_cfg_add_xrefs(RzInquiryBBCFG *cfg, const RzVector /*<RzAnalysisXRef>*/ *xrefs);
RZ_IPI bool rz_inquiry_bb_cfg_get_basic_block(const RzInquiryBBCFG *cfg, ut64 bb_addr, RZ_OUT RzInquiryBB *bb);

View file

@ -96,7 +96,7 @@ static void recurse_into_fcn_bbs(
rz_warn_if_reached();
goto err_return;
}
if (!rz_inquiry_bb_cfg_add_basic_block(fcn->bb_cfg, this_bb.addr, this_bb.size)) {
if (!rz_inquiry_bb_cfg_add_block(fcn->bb_cfg, this_bb.addr, this_bb.size)) {
rz_warn_if_reached();
goto err_return;
}
@ -107,7 +107,7 @@ static void recurse_into_fcn_bbs(
rz_warn_if_reached();
goto err_return;
}
if (!rz_inquiry_bb_cfg_add_basic_block(fcn->bb_cfg, from_bb.addr, from_bb.size)) {
if (!rz_inquiry_bb_cfg_add_block(fcn->bb_cfg, from_bb.addr, from_bb.size)) {
rz_warn_if_reached();
goto err_return;
}

View file

@ -143,7 +143,7 @@ RZ_API RZ_OWN RzIterator /*<RzGraphNode *>*/ *rz_inquiry_bb_cfg_get_incoming_edg
* \brief Does not update the BB if it is already present.
* Returns false if it already exists.
*/
RZ_IPI bool rz_inquiry_bb_cfg_add_basic_block(RzInquiryBBCFG *cfg, ut64 addr, ut64 size) {
RZ_IPI bool rz_inquiry_bb_cfg_add_block(RzInquiryBBCFG *cfg, ut64 addr, ut64 size) {
RzInquiryBB *bb = RZ_NEW(RzInquiryBB);
if (!bb) {
return false;
@ -214,9 +214,10 @@ static int cmp(const ut64 *a, const ut64 *b, void *user) {
}
/**
* \brief Reduces all basic blocks in the cfg to their minimum size.
* \brief Reduces all blocks in the cfg to their minimum size.
* Removing duplicates and overlapping basic blocks.
* This function makes each basic block just have a single entry point.
* This function makes each block just have a single entry point.
* This makes each block as "basic block" in the sense of One Entry/One Exit.
*/
RZ_IPI bool rz_inquiry_bb_cfg_reduce(RzInquiryBBCFG *cfg) {
// Index is end address of bb, values are starting address of bbs with that end address.

View file

@ -289,11 +289,11 @@ static bool get_branch_targets(RzCore *core, RzSetU *branch_targets) {
static bool log_control_flow(RzInquiry *inquiry, RzInterpreterCtrlFlow *cf) {
RZ_LOG_DEBUG("INQUIRY: Received control flow: 0x%" PFMT64x " size: %" PFMTSZu " (alt: 0x%" PFMT64x ")\n",
cf->target_addr, cf->target_block_size, cf->alt_target);
rz_inquiry_bb_cfg_add_basic_block(inquiry->bb_cfg, cf->actual_target, cf->target_block_size);
rz_inquiry_bb_cfg_add_block(inquiry->bb_cfg, cf->actual_target, cf->target_block_size);
if (cf->alt_target) {
// Add a dummy basic block at the address the call originally jumped to.
// This is the basic block for the imported function.
rz_inquiry_bb_cfg_add_basic_block(inquiry->bb_cfg, cf->target_addr, 1);
rz_inquiry_bb_cfg_add_block(inquiry->bb_cfg, cf->target_addr, 1);
}
// Add a simple control flow edge here.
// It gets later updated to another type if a reported xref has it.
@ -534,7 +534,7 @@ RZ_API bool rz_inquiry_interpreter(RzCore *core,
rz_warn_if_reached();
goto error_free;
}
size_t n_threads = 1;
size_t n_threads = 8;
iset_map = RZ_NEWS0(struct ituple, n_threads);
RzInterpreterYieldRBuf *yield_rbufs[RZ_INTERPRETER_YIELD_KIND_NUM] = { 0 };
@ -755,7 +755,7 @@ fatal_error:
char *bstr = rz_il_cache_block_str(block);
RZ_LOG_DEBUG("Inquiry: Add ILCache block: %s\n", bstr);
free(bstr);
rz_inquiry_bb_cfg_add_basic_block(core->inquiry->bb_cfg, block->addr, block->size);
rz_inquiry_bb_cfg_add_block(core->inquiry->bb_cfg, block->addr, block->size);
}
rz_iterator_free(iter);
if (!rz_inquiry_bb_cfg_add_xrefs(core->inquiry->bb_cfg, rz_il_cache_get_static_xrefs(il_cache))) {