diff options
Diffstat (limited to 'src/analysis/disass/rank.c')
-rw-r--r-- | src/analysis/disass/rank.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/analysis/disass/rank.c b/src/analysis/disass/rank.c index c31fd58..6e737a5 100644 --- a/src/analysis/disass/rank.c +++ b/src/analysis/disass/rank.c @@ -63,7 +63,7 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns GArchInstruction *last; /* Dernière instruction du bloc*/ size_t dcount; /* Nombre de liens de dest. */ size_t i; /* Boucle de parcours */ - instr_link_t *dest; /* Instr. visée par une autre */ + const instr_link_t *dest; /* Instr. visée par une autre */ const mrange_t *range; /* Emplacement d'une cible */ GFlowBlock *target; /* Bloc ciblé par un lien */ unsigned int rank; /* Rang à constituer */ @@ -167,6 +167,8 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns } + unref_instr_link(dest); + if (target != NULL) { rank = MAX(next, g_flow_block_get_rank(target)); @@ -308,7 +310,7 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block) GArchInstruction *last; /* Dernière instruction du bloc*/ size_t dcount; /* Nombre de liens de dest. */ size_t i; /* Boucle de parcours */ - instr_link_t *dest; /* Instr. visée par une autre */ + const instr_link_t *dest; /* Instr. visée par une autre */ InstructionLinkType type; /* Raccourci pour confort */ GBasicBlock *target; /* Bloc ciblé par un lien */ unsigned int rank; /* Rang à constituer */ @@ -327,7 +329,7 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block) type = dest->type; /* La boucle de remontée n'abaisse pas les rangs */ - if (type == ILT_LOOP) continue; + if (type == ILT_LOOP) goto next_dest; /** * On se doit de suivre le même cheminement que celui emprunté lors @@ -339,7 +341,7 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block) && type != ILT_CASE_JUMP && type != ILT_JUMP_IF_TRUE && type != ILT_JUMP_IF_FALSE) - continue; + goto next_dest; target = g_block_list_find_by_starting_instr(list, dest->linked); @@ -368,6 +370,10 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block) } + next_dest: + + unref_instr_link(dest); + } g_arch_instruction_unlock_dest(last); |