summaryrefslogtreecommitdiff
path: root/src/gui/menus
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/menus')
-rw-r--r--src/gui/menus/edition.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index 9e4077d..c524891 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -219,41 +219,45 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, GMenuBar *bar)
{
ImmOperandDisplay display; /* Type de basculement */
+ GEditorItem *editem; /* Autre version de la barre */
GtkViewPanel *vpanel; /* Afficheur effectif de code */
GBufferLine *line; /* Ligne de position courante */
GBufferSegment *segment; /* Segment actif s'il existe */
GObject *creator; /* Créateur à l'orgine du seg. */
- virt_t virt; /* Adresse virtuelle */
- vmpa2t addr; /* Adresse de destination */
+ GDbSwitcher *switcher; /* Bascule à mettre en place */
+ const mrange_t *range; /* Emplacement de la ligne */
+ GLoadedBinary *binary; /* Binaire en cours d'étude */
+ GArchProcessor *proc; /* Propriétaire d'instructions */
+ GArchInstruction *instr; /* Instruction liée à la ligne */
display = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_switch"));
- vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+ editem = G_EDITOR_ITEM(bar);
+
+ vpanel = g_editor_item_get_current_view(editem);
if (gtk_view_panel_get_position(vpanel, &line, &segment))
{
- if (segment != NULL)
- creator = g_buffer_segment_get_creator(segment);
- else
- creator = NULL;
-
- if (creator != NULL)
- {
- assert(G_IS_TARGET_OPERAND(creator));
-
-
-
+ creator = g_buffer_segment_get_creator(segment);
+ assert(G_IS_IMM_OPERAND(creator));
+ range = g_buffer_line_get_range(line);
+ binary = g_editor_item_get_current_binary(editem);
+ proc = g_loaded_binary_get_processor(binary);
+ instr = g_arch_processor_find_instr_by_address(proc, get_mrange_addr(range));
+ assert(instr != NULL);
+ switcher = g_db_switcher_new(instr, G_IMM_OPERAND(creator), display);
+ g_loaded_binary_add_to_collection(binary, DBF_DISPLAY_SWITCHERS, G_DB_ITEM(switcher));
- g_object_unref(creator);
+ g_object_unref(G_OBJECT(proc));
- }
+ g_object_unref(creator);
- if (segment != NULL) g_object_unref(G_OBJECT(segment));
+ g_object_unref(G_OBJECT(segment));
g_object_unref(G_OBJECT(line));
}