summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/menus/edition.c44
1 files changed, 27 insertions, 17 deletions
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);