diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-11-09 13:18:35 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-11-09 13:18:35 (GMT) |
commit | c301f7e77eaca632a491b5b4417c8e4b9dce2570 (patch) | |
tree | 501ccdd583e35ccad4f3a0592f2fb1b0870e0d5f /src/gtkext/gtkstatusstack.c | |
parent | 459b345d69532825f21bdcd3e4f92009b0a046dc (diff) |
Introduced the first features of a hexadecimal viewer.
Diffstat (limited to 'src/gtkext/gtkstatusstack.c')
-rw-r--r-- | src/gtkext/gtkstatusstack.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c index 45bd667..843d444 100644 --- a/src/gtkext/gtkstatusstack.c +++ b/src/gtkext/gtkstatusstack.c @@ -125,7 +125,7 @@ static void on_size_allocate_for_asm_status(GtkWidget *, GdkRectangle *, GObject static void on_zoom_icon_press(GtkEntry *, GtkEntryIconPosition, GdkEventButton *, GtkStatusStack *); /* S'assure de l'affichage à jour de la partie "assemblage". */ -static gboolean gtk_status_stack_show_current_instruction(GtkStatusStack *); +static gboolean gtk_status_stack_show_current_location(GtkStatusStack *); @@ -229,7 +229,7 @@ static void gtk_status_stack_init(GtkStatusStack *stack) gtk_widget_show(GTK_WIDGET(stack->main)); gtk_box_pack_start(GTK_BOX(stack), GTK_WIDGET(stack->main), TRUE, TRUE, 8); - stack->def_source = (GSourceFunc)gtk_status_stack_show_current_instruction; + stack->def_source = (GSourceFunc)gtk_status_stack_show_current_location; layer = build_assembly_status_stack(stack); gtk_stack_add_named(stack->main, layer, "asm_info"); @@ -247,7 +247,7 @@ static void gtk_status_stack_init(GtkStatusStack *stack) reset_progress_info(stack->prog_info); - gtk_status_stack_reset_current_instruction(stack); + gtk_status_stack_reset_current_location(stack); } @@ -498,9 +498,10 @@ static void on_zoom_icon_press(GtkEntry *entry, GtkEntryIconPosition icon_pos, G /****************************************************************************** * * -* Paramètres : stack = barre de statut à actualiser. * -* binary = binaire chargé rassemblant l'ensemble des infos. * -* instr = instruction désassemblée ciblée graphiquement. * +* Paramètres : stack = barre de statut à actualiser. * +* binary = binaire chargé rassemblant l'ensemble des infos. * +* range = emplacement à mettre en valeur. * +* encoding = encodage d'une éventuelle instruction ou NULL. * * * * Description : Actualise les informations liées une position d'assemblage. * * * @@ -510,12 +511,12 @@ static void on_zoom_icon_press(GtkEntry *entry, GtkEntryIconPosition icon_pos, G * * ******************************************************************************/ -void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GLoadedBinary *binary, const GArchInstruction *instr) +void gtk_status_stack_update_current_location(GtkStatusStack *stack, const GLoadedBinary *binary, const mrange_t *range, const char *encoding) { assembly_info *info; /* Informations à constituer */ GExeFormat *format; /* Format de binaire à traiter */ - const mrange_t *range; /* Emplacement d'instruction */ const vmpa2t *addr; /* Localisation de départ */ + phys_t size; /* Taille de l'emplacement */ GBinPortion *portions; /* Couche première de portions */ GBinPortion *portion; /* Zone mémoire d'appartenance */ const char *text; /* Texte au contenu à copier */ @@ -531,10 +532,12 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL /* Bascule vers une zone courante nouvelle ? */ - range = g_arch_instruction_get_range(instr); addr = get_mrange_addr(range); + size = get_mrange_length(range); - if (cmp_mrange(&info->current, range) == 0) + if (cmp_mrange(&info->current, range) == 0 + && info->size == size + && info->encoding == encoding) goto gssuci_useless; /* Réinitialisation */ @@ -566,9 +569,8 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL vmpa2_virt_to_string(addr, MDS_UNDEFINED, info->virt, NULL); - info->encoding = g_arch_instruction_get_encoding(instr); - - info->size = get_mrange_length(range); + info->encoding = encoding; + info->size = size; /* Symbole concerné */ @@ -597,7 +599,7 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL info->reset = false; - gtk_status_stack_show_current_instruction(stack); + gtk_status_stack_show_current_location(stack); gssuci_useless: @@ -618,7 +620,7 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL * * ******************************************************************************/ -void gtk_status_stack_reset_current_instruction(GtkStatusStack *stack) +void gtk_status_stack_reset_current_location(GtkStatusStack *stack) { assembly_info *info; /* Informations à constituer */ @@ -626,7 +628,7 @@ void gtk_status_stack_reset_current_instruction(GtkStatusStack *stack) reset_assembly_info(info); - gtk_status_stack_show_current_instruction(stack); + gtk_status_stack_show_current_location(stack); } @@ -643,7 +645,7 @@ void gtk_status_stack_reset_current_instruction(GtkStatusStack *stack) * * ******************************************************************************/ -static gboolean gtk_status_stack_show_current_instruction(GtkStatusStack *stack) +static gboolean gtk_status_stack_show_current_location(GtkStatusStack *stack) { GObject *ref; /* Espace de référencements */ assembly_info *info; /* Informations à consulter */ @@ -651,7 +653,7 @@ static gboolean gtk_status_stack_show_current_instruction(GtkStatusStack *stack) char raw_pos[6 + VMPA_MAX_LEN + 1]; /* Formatage final en direct */ char *content; /* Contenu dynamique */ - stack->def_source = (GSourceFunc)gtk_status_stack_show_current_instruction; + stack->def_source = (GSourceFunc)gtk_status_stack_show_current_location; gtk_stack_set_visible_child_name(stack->main, "asm_info"); @@ -697,7 +699,7 @@ static gboolean gtk_status_stack_show_current_instruction(GtkStatusStack *stack) /* Seconde partie : architecture */ - if (info->reset) + if (info->reset || info->encoding == NULL || info->size == VMPA_NO_PHYSICAL) { label = GTK_LABEL(g_object_get_data(ref, "arch")); gtk_label_set_text(label, NULL); |