summaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-04-13 16:34:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-04-13 16:34:34 (GMT)
commit6906aa19b7ac4c14615c30d15bfb26b0b86557d5 (patch)
treef0fb0b6ea116e4ec87f33b3b4198f6dc4c88766c /src/debug
parentacc7b5f33e93bae3bf43e8f029976b7f74260b52 (diff)
Simplified the way links between instructions are handled.
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/debugger.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/debug/debugger.c b/src/debug/debugger.c
index 0dfe315..85ca241 100644
--- a/src/debug/debugger.c
+++ b/src/debug/debugger.c
@@ -1037,9 +1037,9 @@ virt_t *g_binary_debugger_get_next_pcs(GBinaryDebugger *debugger, virt_t pc, boo
instr_iter_t *iter; /* Parcours local d'adresses */
GArchInstruction *instr; /* Instruction correspondante */
virt_t ret; /* Adresse de retour d'appel */
- instr_link_t *dests; /* Instr. visées par une autre */
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 mrange_t *range; /* Emplacement d'instruction */
result = NULL;
@@ -1071,12 +1071,15 @@ virt_t *g_binary_debugger_get_next_pcs(GBinaryDebugger *debugger, virt_t pc, boo
/* Sinon on se penche sur ses destinations */
else
{
- g_arch_instruction_rlock_dest(instr);
+ g_arch_instruction_lock_dest(instr);
- dcount = g_arch_instruction_get_destinations(instr, &dests);
+ dcount = g_arch_instruction_count_destinations(instr);
for (i = 0; i < dcount; i++)
- switch (dests[i].type)
+ {
+ dest = g_arch_instruction_get_destination(instr, i);
+
+ switch (dest->type)
{
case ILT_EXEC_FLOW:
case ILT_JUMP:
@@ -1088,7 +1091,7 @@ virt_t *g_binary_debugger_get_next_pcs(GBinaryDebugger *debugger, virt_t pc, boo
(*count)++;
result = (virt_t *)realloc(result, *count * sizeof(virt_t));
- range = g_arch_instruction_get_range(dests[i].linked);
+ range = g_arch_instruction_get_range(dest->linked);
result[*count - 1] = get_virt_addr(get_mrange_addr(range));
break;
@@ -1100,7 +1103,7 @@ virt_t *g_binary_debugger_get_next_pcs(GBinaryDebugger *debugger, virt_t pc, boo
(*count)++;
result = (virt_t *)realloc(result, *count * sizeof(virt_t));
- range = g_arch_instruction_get_range(dests[i].linked);
+ range = g_arch_instruction_get_range(dest->linked);
result[*count - 1] = get_virt_addr(get_mrange_addr(range));
@@ -1113,7 +1116,9 @@ virt_t *g_binary_debugger_get_next_pcs(GBinaryDebugger *debugger, virt_t pc, boo
}
- g_arch_instruction_runlock_dest(instr);
+ }
+
+ g_arch_instruction_unlock_dest(instr);
/* Si tout ça ne donne rien, on se rabat sur l'instruction suivante par défaut */
if (*count == 0)