summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-02-19 18:34:33 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-02-19 18:34:33 (GMT)
commitd992b4ae5a35954d4fda460735f6dc861ae7bd26 (patch)
treee37e3f43cbdd2daf5751512e9197f88ec8081957 /src/analysis
parent8ff2fec3c71e156391304361631e0a306a4a9afd (diff)
Ensured all natural links are well created.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/disass/links.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c
index 26788db..4eba0d7 100644
--- a/src/analysis/disass/links.c
+++ b/src/analysis/disass/links.c
@@ -58,8 +58,7 @@ void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev)
bool has_src; /* Présence de sources ? */
const instr_link_t *other; /* Instruction diverse liée */
size_t i; /* Boucle de parcours */
- bool no_natural; /* Aucun lien naturel présent */
- bool no_need; /* Pas de besoin pour ce lien */
+ bool need; /* Besoin exprimé pour ce lien */
/**
* Si rien ne vient séparer les deux instructions,
@@ -108,29 +107,26 @@ void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev)
count = g_arch_instruction_count_destinations(prev);
- no_natural = true;
- no_need = (count > 0);
+ need = true;
- for (i = 0; i < count && no_natural; i++)
+ for (i = 0; i < count && need; i++)
{
other = g_arch_instruction_get_destination(prev, i);
switch (other->type)
{
case ILT_EXEC_FLOW:
- no_natural = false;
+ need = false;
+ break;
+
+ case ILT_JUMP:
+ case ILT_CASE_JUMP:
+ need = false;
break;
case ILT_JUMP_IF_TRUE:
case ILT_JUMP_IF_FALSE:
- if (other->linked != instr)
- no_need = false;
- else
- {
- no_need = true;
- unref_instr_link(other);
- goto check_done;
- }
+ need = (other->linked != instr);
break;
default:
@@ -142,11 +138,9 @@ void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev)
}
- check_done:
-
g_arch_instruction_unlock_dest(prev);
- if (no_natural && !no_need)
+ if (need)
{
/* Vérification de la cohérence de l'ensemble */
#ifndef NDEBUG