summaryrefslogtreecommitdiff
path: root/src
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
parent5d94aa1a1e3af384307bb9d760410b61a33e7323 (diff)
Created an interface for jumping to addresses from operands.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/disass/links.c9
-rw-r--r--src/arch/Makefile.am2
-rw-r--r--src/arch/immediate.c71
-rw-r--r--src/arch/link.c22
-rw-r--r--src/arch/target.c89
-rw-r--r--src/arch/target.h3
-rw-r--r--src/arch/targetableop-int.h51
-rw-r--r--src/arch/targetableop.c85
-rw-r--r--src/arch/targetableop.h61
-rw-r--r--src/gui/menus/edition.c44
10 files changed, 380 insertions, 57 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);
diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am
index 8710b13..b600557 100644
--- a/src/arch/Makefile.am
+++ b/src/arch/Makefile.am
@@ -20,6 +20,8 @@ libarch_la_SOURCES = \
register.h register.c \
storage.h storage.c \
target.h target.c \
+ targetableop-int.h \
+ targetableop.h targetableop.c \
undefined.h undefined.c \
vmpa.h vmpa.c
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index 1c084ea..5519059 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -38,6 +38,7 @@
#include "operand-int.h"
+#include "targetableop-int.h"
#include "../common/asm.h"
#include "../common/extstr.h"
#include "../format/format.h"
@@ -86,6 +87,9 @@ static void g_imm_operand_class_init(GImmOperandClass *);
/* Initialise la classe des lignes de descriptions initiales. */
static void g_imm_operand_init(GImmOperand *);
+/* Procède à l'initialisation de l'interface de ciblage. */
+static void g_imm_operand_targetable_interface_init(GTargetableOperandInterface *);
+
/* Supprime toutes les références externes. */
static void g_imm_operand_dispose(GImmOperand *);
@@ -120,8 +124,17 @@ static bool g_imm_operand_serialize(const GImmOperand *, GAsmStorage *, packed_b
+/* ----------------------- INTERFACE DE CIBLAGE POUR OPERANDE ----------------------- */
+
+
+/* Obtient l'adresse de la cible visée par un opérande. */
+static bool g_imm_operand_get_addr(const GImmOperand *, const vmpa2t *, GBinFormat *, GArchProcessor *, vmpa2t *);
+
+
+
/* Indique le type défini pour un opérande de valeur numérique. */
-G_DEFINE_TYPE(GImmOperand, g_imm_operand, G_TYPE_ARCH_OPERAND);
+G_DEFINE_TYPE_WITH_CODE(GImmOperand, g_imm_operand, G_TYPE_ARCH_OPERAND,
+ G_IMPLEMENT_INTERFACE(G_TYPE_TARGETABLE_OPERAND, g_imm_operand_targetable_interface_init));
@@ -182,6 +195,25 @@ static void g_imm_operand_init(GImmOperand *operand)
/******************************************************************************
* *
+* Paramètres : iface = interface GLib à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'interface de ciblage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_imm_operand_targetable_interface_init(GTargetableOperandInterface *iface)
+{
+ iface->get_addr = (get_targetable_addr_fc)g_imm_operand_get_addr;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = instance d'objet GLib à traiter. *
* *
* Description : Supprime toutes les références externes. *
@@ -1464,3 +1496,40 @@ static bool g_imm_operand_serialize(const GImmOperand *operand, GAsmStorage *sto
return result;
}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* INTERFACE DE CIBLAGE POUR OPERANDE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = operande à consulter. *
+* src = localisation de l'instruction mère. *
+* format = format reconnu pour le binaire chargé. *
+* proc = architecture associée à ce même binaire. *
+* addr = localisation de la cible. [OUT] *
+* *
+* Description : Obtient l'adresse de la cible visée par un opérande. *
+* *
+* Retour : true si la cible est valide, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_imm_operand_get_addr(const GImmOperand *operand, const vmpa2t *src, GBinFormat *format, GArchProcessor *proc, vmpa2t *addr)
+{
+ bool result; /* Bilan à retourner */
+ virt_t virt; /* Adresse virtuelle */
+
+ result = g_imm_operand_to_virt_t(operand, &virt);
+
+ if (result)
+ result = g_exe_format_translate_address_into_vmpa(G_EXE_FORMAT(format), virt, addr);
+
+ return result;
+
+}
diff --git a/src/arch/link.c b/src/arch/link.c
index c11fe54..f09621e 100644
--- a/src/arch/link.c
+++ b/src/arch/link.c
@@ -27,7 +27,7 @@
#include <assert.h>
-#include "target.h"
+#include "targetableop.h"
@@ -99,11 +99,10 @@ void handle_jump_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcCon
void handle_branch_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GExeFormat *format, size_t index)
{
GArchOperand *op; /* Opérande numérique en place */
+ const mrange_t *range; /* Emplacement de l'instruction*/
bool defined; /* Adresse définie ? */
vmpa2t addr; /* Adresse de destination */
- virt_t virt; /* Adresse virtuelle */
GArchInstruction *target; /* Ligne visée par la référence*/
- const mrange_t *range; /* Emplacement d'instruction */
vmpa2t next; /* Position suivante */
g_arch_instruction_lock_operands(instr);
@@ -114,20 +113,17 @@ void handle_branch_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcC
g_arch_instruction_unlock_operands(instr);
- defined = false;
-
- if (G_IS_TARGET_OPERAND(op))
+ if (G_IS_TARGETABLE_OPERAND(op))
{
- g_target_operand_get_addr(G_TARGET_OPERAND(op), &addr);
- defined = true;
- }
+ range = g_arch_instruction_get_range(instr);
- else if (G_IS_IMM_OPERAND(op))
- {
- if (g_imm_operand_to_virt_t(G_IMM_OPERAND(op), &virt))
- defined = g_exe_format_translate_address_into_vmpa(format, virt, &addr);
+ defined = g_targetable_operand_get_addr(G_TARGETABLE_OPERAND(op), get_mrange_addr(range),
+ G_BIN_FORMAT(format), proc, &addr);
}
+ else
+ defined = false;
+
g_object_unref(G_OBJECT(op));
if (defined)
diff --git a/src/arch/target.c b/src/arch/target.c
index 97b2192..6872efe 100644
--- a/src/arch/target.c
+++ b/src/arch/target.c
@@ -33,6 +33,7 @@
#include "operand-int.h"
+#include "targetableop-int.h"
#include "../analysis/routine.h"
#include "../common/extstr.h"
#include "../format/format.h"
@@ -69,6 +70,9 @@ static void g_target_operand_class_init(GTargetOperandClass *);
/* Initialise la classe des opérandes ciblant des symboles. */
static void g_target_operand_init(GTargetOperand *);
+/* Procède à l'initialisation de l'interface de ciblage. */
+static void g_target_operand_targetable_interface_init(GTargetableOperandInterface *);
+
/* Supprime toutes les références externes. */
static void g_target_operand_dispose(GTargetOperand *);
@@ -97,8 +101,17 @@ static bool g_target_operand_serialize(const GTargetOperand *, GAsmStorage *, pa
+/* ----------------------- INTERFACE DE CIBLAGE POUR OPERANDE ----------------------- */
+
+
+/* Obtient l'adresse de la cible visée par un opérande. */
+static bool g_target_operand_get_addr(const GTargetOperand *, const vmpa2t *, GBinFormat *, GArchProcessor *, vmpa2t *);
+
+
+
/* Indique le type défini pour un opérande de valeur numérique. */
-G_DEFINE_TYPE(GTargetOperand, g_target_operand, G_TYPE_ARCH_OPERAND);
+G_DEFINE_TYPE_WITH_CODE(GTargetOperand, g_target_operand, G_TYPE_ARCH_OPERAND,
+ G_IMPLEMENT_INTERFACE(G_TYPE_TARGETABLE_OPERAND, g_target_operand_targetable_interface_init));
@@ -161,6 +174,25 @@ static void g_target_operand_init(GTargetOperand *operand)
/******************************************************************************
* *
+* Paramètres : iface = interface GLib à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'interface de ciblage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_target_operand_targetable_interface_init(GTargetableOperandInterface *iface)
+{
+ iface->get_addr = (get_targetable_addr_fc)g_target_operand_get_addr;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = instance d'objet GLib à traiter. *
* *
* Description : Supprime toutes les références externes. *
@@ -452,26 +484,6 @@ MemoryDataSize g_target_operand_get_size(const GTargetOperand *operand)
/******************************************************************************
* *
-* Paramètres : operand = structure dont le contenu est à consulter. *
-* addr = localisation à renseigner. [OUT] *
-* *
-* Description : Fournit l'adresse en mémoire de l'élément visé. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_target_operand_get_addr(const GTargetOperand *operand, vmpa2t *addr)
-{
- copy_vmpa(addr, &operand->addr);
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : operand = opérande dont le contenu est à raffiner. [OUT] *
* format = format du binaire d'origine à consulter. *
* strict = indique la perfection attendue de la résolution. *
@@ -659,3 +671,38 @@ static bool g_target_operand_serialize(const GTargetOperand *operand, GAsmStorag
return result;
}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* INTERFACE DE CIBLAGE POUR OPERANDE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = operande à consulter. *
+* src = localisation de l'instruction mère. *
+* format = format reconnu pour le binaire chargé. *
+* proc = architecture associée à ce même binaire. *
+* addr = localisation de la cible. [OUT] *
+* *
+* Description : Obtient l'adresse de la cible visée par un opérande. *
+* *
+* Retour : true si la cible est valide, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_target_operand_get_addr(const GTargetOperand *operand, const vmpa2t *src, GBinFormat *format, GArchProcessor *proc, vmpa2t *addr)
+{
+ bool result; /* Bilan à retourner */
+
+ result = true;
+
+ copy_vmpa(addr, &operand->addr);
+
+ return result;
+
+}
diff --git a/src/arch/target.h b/src/arch/target.h
index 3c68fda..f7a673c 100644
--- a/src/arch/target.h
+++ b/src/arch/target.h
@@ -59,9 +59,6 @@ GArchOperand *g_target_operand_new(MemoryDataSize, const vmpa2t *);
/* Renseigne la taille de la valeur indiquée à la construction. */
MemoryDataSize g_target_operand_get_size(const GTargetOperand *);
-/* Fournit l'adresse en mémoire de l'élément visé. */
-void g_target_operand_get_addr(const GTargetOperand *, vmpa2t *);
-
/* Tente une résolution de symbole. */
bool g_target_operand_resolve(GTargetOperand *, GBinFormat *, bool);
diff --git a/src/arch/targetableop-int.h b/src/arch/targetableop-int.h
new file mode 100644
index 0000000..9afce11
--- /dev/null
+++ b/src/arch/targetableop-int.h
@@ -0,0 +1,51 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * targetableop-int.h - définitions internes propres aux opérandes ciblant une portion de désassemblage
+ *
+ * Copyright (C) 2018 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GLIBEXT_TARGETABLEOP_INT_H
+#define _GLIBEXT_TARGETABLEOP_INT_H
+
+
+#include "targetableop.h"
+
+
+
+/* Obtient l'adresse de la cible visée par un opérande. */
+typedef bool (* get_targetable_addr_fc) (const GTargetableOperand *, const vmpa2t *, GBinFormat *, GArchProcessor *, vmpa2t *);
+
+
+/* Opérande ciblant une portion de désassemblage (interface) */
+struct _GTargetableOperandIface
+{
+ GTypeInterface base_iface; /* A laisser en premier */
+
+ get_targetable_addr_fc get_addr; /* Obtention de la cible */
+
+};
+
+
+/* Redéfinition */
+typedef GTargetableOperandIface GTargetableOperandInterface;
+
+
+
+#endif /* _GLIBEXT_TARGETABLEOP_INT_H */
diff --git a/src/arch/targetableop.c b/src/arch/targetableop.c
new file mode 100644
index 0000000..eab26a8
--- /dev/null
+++ b/src/arch/targetableop.c
@@ -0,0 +1,85 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * targetableop.c - opérandes ciblant une portion de désassemblage
+ *
+ * Copyright (C) 2018 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "targetableop.h"
+
+
+#include "targetableop-int.h"
+
+
+
+/* Procède à l'initialisation de l'interface de ciblage. */
+static void g_targetable_operand_default_init(GTargetableOperandInterface *);
+
+
+
+/* Détermine le type d'une interface pour le ciblage d'une portion de désassemblage. */
+G_DEFINE_INTERFACE(GTargetableOperand, g_targetable_operand, G_TYPE_OBJECT)
+
+
+/******************************************************************************
+* *
+* Paramètres : iface = interface GLib à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'interface de ciblage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_targetable_operand_default_init(GTargetableOperandInterface *iface)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = operande à consulter. *
+* src = localisation de l'instruction mère. *
+* format = format reconnu pour le binaire chargé. *
+* proc = architecture associée à ce même binaire. *
+* addr = localisation de la cible. [OUT] *
+* *
+* Description : Obtient l'adresse de la cible visée par un opérande. *
+* *
+* Retour : true si la cible est valide, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_targetable_operand_get_addr(const GTargetableOperand *operand, const vmpa2t *src, GBinFormat *format, GArchProcessor *proc, vmpa2t *addr)
+{
+ bool result; /* Bilan à retourner */
+ GTargetableOperandIface *iface; /* Interface utilisée */
+
+ iface = G_TARGETABLE_OPERAND_GET_IFACE(operand);
+
+ result = iface->get_addr(operand, src, format, proc, addr);
+
+ return result;
+
+}
diff --git a/src/arch/targetableop.h b/src/arch/targetableop.h
new file mode 100644
index 0000000..f6cc7bf
--- /dev/null
+++ b/src/arch/targetableop.h
@@ -0,0 +1,61 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * targetableop.h - prototypes pour les opérandes ciblant une portion de désassemblage
+ *
+ * Copyright (C) 2018 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GLIBEXT_TARGETABLEOP_H
+#define _GLIBEXT_TARGETABLEOP_H
+
+
+#include <glib-object.h>
+#include <stdbool.h>
+
+
+#include "vmpa.h"
+#include "../arch/processor.h"
+#include "../format/format.h"
+
+
+
+#define G_TYPE_TARGETABLE_OPERAND (g_targetable_operand_get_type())
+#define G_TARGETABLE_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_TARGETABLE_OPERAND, GTargetableOperand))
+#define G_TARGETABLE_OPERAND_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST((vtable), G_TYPE_TARGETABLE_OPERAND, GTargetableOperandIface))
+#define G_IS_TARGETABLE_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_TARGETABLE_OPERAND))
+#define G_IS_TARGETABLE_OPERAND_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), G_TYPE_TARGETABLE_OPERAND))
+#define G_TARGETABLE_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), G_TYPE_TARGETABLE_OPERAND, GTargetableOperandIface))
+
+
+/* Opérande ciblant une portion de désassemblage (coquille vide) */
+typedef struct _GTargetableOperand GTargetableOperand;
+
+/* Opérande ciblant une portion de désassemblage (interface) */
+typedef struct _GTargetableOperandIface GTargetableOperandIface;
+
+
+/* Détermine le type d'une interface pour le ciblage d'une portion de désassemblage. */
+GType g_targetable_operand_get_type(void) G_GNUC_CONST;
+
+/* Obtient l'adresse de la cible visée par un opérande. */
+bool g_targetable_operand_get_addr(const GTargetableOperand *, const vmpa2t *, GBinFormat *, GArchProcessor *, vmpa2t *);
+
+
+
+#endif /* _GLIBEXT_TARGETABLEOP_H */
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index 80c0796..04dd9df 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -37,7 +37,7 @@
#include "../dialogs/goto.h"
#include "../dialogs/gotox.h"
#include "../../analysis/db/items/switcher.h"
-#include "../../arch/target.h"
+#include "../../arch/targetableop.h"
#include "../../glibext/gbinarycursor.h"
#include "../../gtkext/easygtk.h"
#include "../../gtkext/gtkblockdisplay.h"
@@ -366,7 +366,7 @@ void update_access_for_cursor_in_menu_edition(GLoadedPanel *panel, const GLineCu
/* Bascule des opérandes numériques */
- access = (G_IS_IMM_OPERAND(creator));
+ access = G_IS_IMM_OPERAND(creator);
item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_hex"));
gtk_widget_set_sensitive(item, access);
@@ -385,7 +385,7 @@ void update_access_for_cursor_in_menu_edition(GLoadedPanel *panel, const GLineCu
/* Suivi de cibles */
- access = ((G_IS_TARGET_OPERAND(creator) || G_IS_IMM_OPERAND(creator)));
+ access = G_IS_TARGETABLE_OPERAND(creator);
item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_follow_ref"));
gtk_widget_set_sensitive(item, access);
@@ -538,9 +538,13 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
{
GLoadedPanel *panel; /* Afficheur effectif de code */
GObject *creator; /* Créateur à l'orgine du seg. */
+ GLoadedBinary *binary; /* Binaire en cours d'étude */
+ GBinFormat *format; /* Format binaire associé */
+ GArchProcessor *proc; /* Architecture associée */
+ GLineCursor *cursor; /* Curseur courant */
+ vmpa2t iaddr; /* Emplacement de l'instruction*/
bool defined; /* Adresse définie ? */
vmpa2t addr; /* Adresse de destination */
- virt_t virt; /* Adresse virtuelle */
panel = get_current_view();
assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
@@ -548,23 +552,29 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
assert(creator != NULL);
- defined = false;
-
- if (G_IS_TARGET_OPERAND(creator))
+ if (G_IS_TARGETABLE_OPERAND(creator))
{
- g_target_operand_get_addr(G_TARGET_OPERAND(creator), &addr);
- defined = true;
- }
+ binary = G_LOADED_BINARY(get_current_content());
+
+ format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
+ proc = g_loaded_binary_get_processor(binary);
+
+ cursor = g_loaded_panel_get_cursor(panel);
+ g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &iaddr);
+ g_object_unref(G_OBJECT(cursor));
+
+ defined = g_targetable_operand_get_addr(G_TARGETABLE_OPERAND(creator), &iaddr, format, proc, &addr);
+
+ g_object_unref(G_OBJECT(proc));
+ g_object_unref(G_OBJECT(format));
+
+ g_object_unref(G_OBJECT(binary));
- else if (G_IS_IMM_OPERAND(creator))
- {
- if (g_imm_operand_to_virt_t(G_IMM_OPERAND(creator), &virt))
- {
- init_vmpa(&addr, VMPA_NO_PHYSICAL, virt);
- defined = true;
- }
}
+ else
+ defined = false;
+
if (defined)
gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), &addr);