summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-03-08 19:27:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-03-08 19:27:15 (GMT)
commitfaa334f84ea2ddac65358dde0f05c074747f4e39 (patch)
tree6f61aa3513c3abb2cd34788af9c7c44cce561a55 /src
parent404c117efa179e61bdae6679b12c1cef1c9c2489 (diff)
Fixed conditions for adding missing natural execution flow links.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/disass/links.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c
index 295b4b6..cf33677 100644
--- a/src/analysis/disass/links.c
+++ b/src/analysis/disass/links.c
@@ -54,11 +54,11 @@ static void convert_immediate_into_target(GArchInstruction *, size_t, GBinFormat
void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev)
{
bool has_src; /* Présence de sources ? */
- bool no_natural; /* Aucun lien naturel présent */
- bool no_need; /* Pas de besoin pour ce lien */
instr_link_t *others; /* Instructions diverses liées */
size_t count; /* Nbre de sources affichées */
size_t i; /* Boucle de parcours */
+ bool no_natural; /* Aucun lien naturel présent */
+ bool no_need; /* Pas de besoin pour ce lien */
/**
* Si rien ne vient séparer les deux instructions,
@@ -66,7 +66,15 @@ void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev)
*/
g_arch_instruction_rlock_src(instr);
- has_src = g_arch_instruction_has_sources(instr);
+
+ count = g_arch_instruction_get_sources(instr, &others);
+
+ has_src = false;
+
+ for (i = 0; i < count && !has_src; i++)
+ if (others[i].type != ILT_REF)
+ has_src = true;
+
g_arch_instruction_runlock_src(instr);
if (!has_src)
@@ -88,12 +96,13 @@ void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev)
* déjà en place.
*/
- no_natural = true;
- no_need = true;
-
g_arch_instruction_rlock_dest(prev);
+
count = g_arch_instruction_get_destinations(prev, &others);
+ no_natural = true;
+ no_need = (count > 0);
+
for (i = 0; i < count && no_natural; i++)
switch (others[i].type)
{