diff --git a/src/rz-plugin/data.cpp b/src/rz-plugin/data.cpp index ea28555..8009b0d 100644 --- a/src/rz-plugin/data.cpp +++ b/src/rz-plugin/data.cpp @@ -20,7 +20,7 @@ using retdec::utils::io::Log; /** * Translation map between tokens representing calling convention type returned - * by Radare2 and CallingConventionID that is recognized by RetDec. + * by Rizin and CallingConventionID that is recognized by RetDec. */ std::map RizinDatabase::_rzrdcc = { {"arm32", CallingConventionID::CC_ARM}, @@ -49,7 +49,7 @@ RizinDatabase::RizinDatabase(RzCore &core): } /** - * @brief Fetches path of the binary file from Radare2. + * @brief Fetches path of the binary file from Rizin. */ std::string RizinDatabase::fetchFilePath() const { @@ -157,27 +157,27 @@ Function RizinDatabase::fetchSeekedFunction() const } /** - * @brief Fetches functions and global variables from Radare2. + * @brief Fetches functions and global variables from Rizin. */ -void RizinDatabase::fetchFunctionsAndGlobals(Config &rconfig) const +void RizinDatabase::fetchFunctionsAndGlobals(Config &rzconfig) const { auto list = rz_analysis_get_fcns(_rzcore.analysis); if (list != nullptr) { FunctionContainer functions; - for (RzListIter *it = list->head; it; it = it->n) { - auto fnc = reinterpret_cast(it->data); + for (RzListIter *it = list->head; it; it = rz_list_iter_get_next(it)) { + auto fnc = reinterpret_cast(rz_list_iter_get_data(it)); if (fnc == nullptr) continue; functions.insert(convertFunctionObject(*fnc)); } - rconfig.functions = functions; + rzconfig.functions = functions; } - fetchGlobals(rconfig); + fetchGlobals(rzconfig); } /** - * @brief Fetches global variables from the Radare2. + * @brief Fetches global variables from the Rizin. * * This method is intended only for internal usage. That is * why this method is private. To obtain functions and global @@ -185,12 +185,14 @@ void RizinDatabase::fetchFunctionsAndGlobals(Config &rconfig) const * method is available. * * Reason for this is that currently the global variables are - * not supported in Radare2 and fetching them requires sort + * not supported in Rizin and fetching them requires sort * of hack by looking into all available symbols and flags. * User may spacify symbol or provide flag on a specified address * and that could be treated as presence of global variable in * some cases. * + * TODO: Just use the proper rz_analysis_global_*() API + * * While browsing flags and symbols this method provides correction * of fetched functions as some of them might be dynamically linked. * This is another reason why this method is private and interface @@ -206,8 +208,8 @@ void RizinDatabase::fetchGlobals(Config &config) const GlobalVarContainer globals; FunctionContainer functions; - for (RzListIter *it = list->head; it; it = it->n) { - auto sym = reinterpret_cast(it->data); + for (RzListIter *it = list->head; it; it = rz_list_iter_get_next(it)) { + auto sym = reinterpret_cast(rz_list_iter_get_data(it)); if (sym == nullptr) continue; @@ -268,7 +270,7 @@ void RizinDatabase::fetchGlobals(Config &config) const } /** - * Converts function object from its representation in Radare2 into + * Converts function object from its representation in Rizin into * represnetation that is used in RetDec. */ Function RizinDatabase::convertFunctionObject(RzAnalysisFunction &rzfnc) const @@ -363,8 +365,8 @@ void RizinDatabase::fetchExtraArgsData(ObjectSequentialContainer &args, RzAnalys int nargs = rz_type_func_args_count(_rzcore.analysis->typedb, key); if (nargs) { RzList *list = rz_core_get_func_args(&_rzcore, rzfnc.name); - for (RzListIter *it = list->head; it; it = it->n) { - arg = reinterpret_cast(it->data); + for (RzListIter *it = list->head; it; it = rz_list_iter_get_next(it)) { + arg = reinterpret_cast(rz_list_iter_get_data(it)); Object var(arg->name, Storage::undefined()); var.setRealName(arg->name); var.type = Type(fu::convertTypeToLlvm(_rzcore.analysis->typedb, arg->orig_c_type)); @@ -376,7 +378,7 @@ void RizinDatabase::fetchExtraArgsData(ObjectSequentialContainer &args, RzAnalys } /** - * @brief Fetches the calling convention of the input function from Radare2. + * @brief Fetches the calling convention of the input function from Rizin. */ void RizinDatabase::fetchFunctionCallingconvention(Function &function, RzAnalysisFunction &rzfnc) const { @@ -391,7 +393,7 @@ void RizinDatabase::fetchFunctionCallingconvention(Function &function, RzAnalysi } /** - * @brief Fetches the return type of the input function from Radare2. + * @brief Fetches the return type of the input function from Rizin. */ void RizinDatabase::fetchFunctionReturnType(Function &function, RzAnalysisFunction &rzfnc) const {