summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-19 19:00:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-19 19:00:34 (GMT)
commita4f40b1971fe208bd9c25adebaeff5614aee87ee (patch)
tree376d1832e345b0bf451cd8d06b97e0c2cd37fa86 /src/analysis
parent5d94aa1a1e3af384307bb9d760410b61a33e7323 (diff)
Created an interface for jumping to addresses from operands.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/disass/links.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c
index 0207d6b..ffdee36 100644
--- a/src/analysis/disass/links.c
+++ b/src/analysis/disass/links.c
@@ -30,6 +30,7 @@
#include "../../arch/instruction.h"
#include "../../arch/raw.h"
#include "../../arch/target.h"
+#include "../../arch/targetableop.h"
@@ -262,6 +263,7 @@ void establish_links_for_instruction(GArchInstruction *instr, GBinFormat *format
size_t count; /* Nombre d'opérandes présents */
size_t i; /* Boucle de parcours */
GArchOperand *op; /* Opérande numérique en place */
+ const mrange_t *range; /* Emplacement de l'instruction*/
vmpa2t addr; /* Localisation plus complète */
GArchInstruction *target; /* Instruction visée au final */
@@ -280,9 +282,12 @@ void establish_links_for_instruction(GArchInstruction *instr, GBinFormat *format
convert_immediate_into_target(instr, i, format);
op = _g_arch_instruction_get_operand(instr, i);
- if (!G_IS_TARGET_OPERAND(op)) goto next_op;
+ if (!G_IS_TARGETABLE_OPERAND(op)) goto next_op;
- g_target_operand_get_addr(G_TARGET_OPERAND(op), &addr);
+ range = g_arch_instruction_get_range(instr);
+
+ if (!g_targetable_operand_get_addr(G_TARGETABLE_OPERAND(op), get_mrange_addr(range), format, proc, &addr))
+ goto next_op;
target = g_arch_processor_find_instr_by_address(proc, &addr);