diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/db/items/comment.c | 19 | ||||
-rw-r--r-- | src/analysis/routine.c | 16 |
2 files changed, 29 insertions, 6 deletions
diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c index 394abe2..57bb017 100644 --- a/src/analysis/db/items/comment.c +++ b/src/analysis/db/items/comment.c @@ -628,6 +628,7 @@ static bool g_db_comment_run(GDbComment *comment, GLoadedBinary *binary, bool ap { bool result; /* Bilan à faire remonter */ GBufferCache *cache; /* Ensemble de lignes à traiter*/ + GLineCursor *cursor; /* Emplacement dans un tampon */ size_t index; /* Point d'insertion */ GArchProcessor *proc; /* Propriétaire d'instructions */ GArchInstruction *instr; /* Instruction à traiter */ @@ -641,7 +642,12 @@ static bool g_db_comment_run(GDbComment *comment, GLoadedBinary *binary, bool ap cache = g_loaded_binary_get_disassembled_cache(binary); - index = g_buffer_cache_find_index_by_addr(cache, &comment->addr, true); + cursor = g_binary_cursor_new(); + g_binary_cursor_update(G_BINARY_CURSOR(cursor), &comment->addr); + + index = g_buffer_cache_find_index_by_cursor(cache, cursor, true); + + g_object_unref(G_OBJECT(cursor)); index = g_buffer_cache_look_for_flag(cache, index, BLF_HAS_CODE); @@ -696,15 +702,20 @@ static bool g_db_comment_run(GDbComment *comment, GLoadedBinary *binary, bool ap range = g_arch_instruction_get_range(source->linked); + cursor = g_binary_cursor_new(); + g_binary_cursor_update(G_BINARY_CURSOR(cursor), get_mrange_addr(range)); + + linked = g_buffer_cache_find_index_by_cursor(cache, cursor, true); + assert(linked != g_buffer_cache_count_lines(cache)); + + g_object_unref(G_OBJECT(cursor)); + /** * On recherche ici une ligne potentiellement BLF_HAS_CODE ou BLF_IS_LABEL. * Comme on ne peut pas traiter les deux cas, on prend la première qui vient * avec BLF_NONE. */ - linked = g_buffer_cache_find_index_by_addr(cache, get_mrange_addr(range), true); - assert(linked != g_buffer_cache_count_lines(cache)); - linked = g_buffer_cache_look_for_flag(cache, linked, BLF_HAS_CODE | BLF_IS_LABEL); RUN_INLINED_COMMENT(linked, comment, comment->old_inlined[i]); diff --git a/src/analysis/routine.c b/src/analysis/routine.c index 19782c7..cc1e337 100644 --- a/src/analysis/routine.c +++ b/src/analysis/routine.c @@ -38,6 +38,7 @@ #include "../common/extstr.h" #include "../core/params.h" #include "../format/symbol-int.h" +#include "../glibext/gbinarycursor.h" @@ -1011,6 +1012,7 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi size_t i; /* Boucle de parcours */ instr_link_t *dest; /* Instr. visée par une autre */ const mrange_t *irange; /* Emplacement d'instruction */ + GLineCursor *cursor; /* Emplacement dans un tampon */ size_t index; /* Indice de ligne à traiter */ GBufferLine *line; /* Ligne présente à l'adresse */ char *info; /* Ligne d'information créée */ @@ -1082,7 +1084,12 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi irange = g_arch_instruction_get_range(instr); - index = g_buffer_cache_find_index_by_addr(cache, get_mrange_addr(irange), true); + cursor = g_binary_cursor_new(); + g_binary_cursor_update(G_BINARY_CURSOR(cursor), get_mrange_addr(irange)); + + index = g_buffer_cache_find_index_by_cursor(cache, cursor, true); + + g_object_unref(G_OBJECT(cursor)); index = g_buffer_cache_look_for_flag(cache, index, BLF_HAS_CODE); @@ -1133,7 +1140,12 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi irange = g_arch_instruction_get_range(dest->linked); - index = g_buffer_cache_find_index_by_addr(cache, get_mrange_addr(irange), true); + cursor = g_binary_cursor_new(); + g_binary_cursor_update(G_BINARY_CURSOR(cursor), get_mrange_addr(irange)); + + index = g_buffer_cache_find_index_by_cursor(cache, cursor, true); + + g_object_unref(G_OBJECT(cursor)); index = g_buffer_cache_look_for_flag(cache, index, BLF_HAS_CODE); |