summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/links.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c
index 4d799fc..7cc3c27 100644
--- a/src/analysis/disass/links.c
+++ b/src/analysis/disass/links.c
@@ -50,12 +50,14 @@ void establish_links_between_lines(GArchInstruction *list, GBinRoutine **routine
vmpa_t addr; /* Adresse référencée */
InstructionLinkType type; /* Type de référence */
GArchInstruction *target; /* Ligne visée par la référence*/
+ GArchInstruction *prev; /* Instruction précédente */
for (i = 0; i < count; i++)
{
start = g_binary_routine_get_address(routines[i]);
end = start + g_binary_routine_get_size(routines[i]);
+ /* Définition de toutes les destinations */
for (iter = g_arch_instruction_find_by_address(list, start, true);
iter != NULL;
iter = g_arch_instruction_get_next_iter(list, iter, end))
@@ -104,10 +106,39 @@ void establish_links_between_lines(GArchInstruction *list, GBinRoutine **routine
break;
+ default:
+ /**
+ * Note pour GCC : à ce stade du désassemblage, ILT_CATCH_EXCEPTION
+ * ne peut être présente, car ne provenant que de greffons.
+ * Pour ILT_EXEC_FLOW, sa seule insertion est ici, plus bas.
+ */
+ break;
+
}
}
+ /* Rattachement de deux blocs selon le flux normal */
+
+ iter = g_arch_instruction_find_by_address(list, start, true);
+
+ for (iter = g_arch_instruction_get_next_iter(list, iter, end);
+ iter != NULL;
+ iter = g_arch_instruction_get_next_iter(list, iter, end))
+ {
+ if (!g_arch_instruction_has_sources(iter))
+ continue;
+
+ prev = g_arch_instruction_get_prev_iter(list, iter);
+
+ if (g_arch_instruction_is_return(prev))
+ continue;
+
+ if (!g_arch_instruction_has_destinations(prev))
+ g_arch_instruction_link_with(prev, iter, ILT_EXEC_FLOW);
+
+ }
+
gtk_extended_status_bar_update_activity(statusbar, id, (i + 1) * 1.0 / count);
}