mirror of
https://github.com/radareorg/r2ghidra.git
synced 2026-11-07 06:25:57 -10:00
Fix build with radare2 ABI 168 basic block vectors
This commit is contained in:
1 parent
d6a283c5cf
commit
8e0b04edac
3 files changed
+18
-7
No files matched your search
@@ -132,10 +132,7 @@ static bool is_indirect_reg_call(RAnalOp *op) {
|
||||
static void walk_bb_regflow(RCore *core, RAnalFunction *fn,
|
||||
const std::unordered_map<ut64, ut64> &defs,
|
||||
const std::function<void(RAnalOp *, std::unordered_map<std::string, ut64> &)> &onOp) {
|
||||
RListIter *iter;
|
||||
void *pos;
|
||||
r_list_foreach (fn->bbs, iter, pos) {
|
||||
RAnalBlock *bb = reinterpret_cast<RAnalBlock *> (pos);
|
||||
r_anal_function_bbs_foreach_cpp (fn, [&](RAnalBlock *bb) {
|
||||
std::unordered_map<std::string, ut64> regs;
|
||||
for (int i = 0; i < bb->ninstr; i++) {
|
||||
ut64 at = r_anal_bb_opaddr_i (bb, i);
|
||||
@@ -156,7 +153,7 @@ static void walk_bb_regflow(RCore *core, RAnalFunction *fn,
|
||||
}
|
||||
r_anal_op_free (op);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void PcodeFixupPreprocessor::fixupSharedReturnJumpToRelocs(RAnalFunction *r2Func, Funcdata *ghFunc, RCore *core, R2Architecture &arch) {
|
||||
@@ -213,7 +210,7 @@ static bool has_data_xref_at(RCore *core, ut64 addr) {
|
||||
void PcodeFixupPreprocessor::fixupNoreturnCallsBeforeData(RAnalFunction *r2Func, Funcdata *ghFunc, RCore *core, R2Architecture &arch) {
|
||||
auto space = arch.getDefaultCodeSpace ();
|
||||
const ut64 fcnMax = r_anal_function_max_addr (r2Func);
|
||||
r_list_foreach_cpp<RAnalBlock> (r2Func->bbs, [&](RAnalBlock *bb) {
|
||||
r_anal_function_bbs_foreach_cpp (r2Func, [&](RAnalBlock *bb) {
|
||||
ut64 addr = bb->addr;
|
||||
const ut64 bbend = bb->addr + bb->size;
|
||||
while (addr < bbend) {
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#ifndef R2GHIDRA_R2UTILS_H
|
||||
#define R2GHIDRA_R2UTILS_H
|
||||
|
||||
#include <r_anal.h>
|
||||
#include <r_lib.h>
|
||||
|
||||
typedef struct r_list_t RList;
|
||||
typedef struct r_list_iter_t RListIter;
|
||||
|
||||
@@ -13,6 +16,17 @@ template<typename T, typename F> void r_list_foreach_cpp(RList *list, const F &c
|
||||
}
|
||||
}
|
||||
|
||||
template<typename F> void r_anal_function_bbs_foreach_cpp(RAnalFunction *function, const F &cb) {
|
||||
#if R2_ABIVERSION >= 168
|
||||
RAnalBlock **it;
|
||||
R_VEC_FOREACH (&function->bbs, it) {
|
||||
cb (*it);
|
||||
}
|
||||
#else
|
||||
r_list_foreach_cpp<RAnalBlock> (function->bbs, cb);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T, typename F> void r_interval_tree_foreach_cpp(RIntervalTree *tree, const F &cb) {
|
||||
RIntervalTreeIter it;
|
||||
for (it = r_rbtree_first (&(tree)->root->node); r_rbtree_iter_has (&it); r_rbtree_iter_next (&(it))) {
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ static void seedGlobalPointerRegister(R2Architecture &arch, RCore *core, RAnalFu
|
||||
}
|
||||
AddrSpace *space = arch.getDefaultCodeSpace ();
|
||||
ContextDatabase *cdb = arch.getContextDatabase ();
|
||||
r_list_foreach_cpp<RAnalBlock> (function->bbs, [&](RAnalBlock *bb) {
|
||||
r_anal_function_bbs_foreach_cpp (function, [&](RAnalBlock *bb) {
|
||||
TrackedSet &tset = cdb->createSet (Address (space, bb->addr), Address (space, bb->addr + bb->size));
|
||||
tset.push_back ({ reg, value });
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user