diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/editor.c | 2 | ||||
-rw-r--r-- | src/gui/status.c | 163 |
2 files changed, 10 insertions, 155 deletions
diff --git a/src/gui/editor.c b/src/gui/editor.c index 1742596..bc4f144 100644 --- a/src/gui/editor.c +++ b/src/gui/editor.c @@ -177,7 +177,7 @@ GtkWidget *create_editor(void) - vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); gtk_widget_show(vbox1); gtk_container_add(GTK_CONTAINER(result), vbox1); diff --git a/src/gui/status.c b/src/gui/status.c index 41cad1a..f466193 100644 --- a/src/gui/status.c +++ b/src/gui/status.c @@ -36,7 +36,7 @@ #include "../common/extstr.h" #include "../gtkext/gtkbufferview.h" #include "../gtkext/gtkblockview.h" -#include "../gtkext/gtkextstatusbar.h" +#include "../gtkext/gtkstatusstack.h" @@ -136,7 +136,7 @@ static void g_status_info_init(GStatusInfo *bar) item->name = "status"; - item->widget = gtk_extended_status_bar_new(); + item->widget = gtk_status_stack_new(); gtk_widget_show(item->widget); } @@ -271,89 +271,12 @@ static void track_caret_address_on_buffer_views(GtkBufferView *view, const vmpa2 { GEditorItem *item; /* Autre version de l'élément */ GLoadedBinary *binary; /* Binaire courant */ - GExeFormat *format; /* Format du fichier binaire */ - GArchProcessor *proc; /* Architecture du binaire */ - MemoryDataSize msize; /* Taille par défaut */ - char *msg; /* Message à transmettre */ - VMPA_BUFFER(conv); /* Zone de conversion */ - - vmpa_t rel; /* Adresse relative à un symb. */ - const char *label; /* Désignation d'un symbole */ item = G_EDITOR_ITEM(info); binary = g_editor_item_get_current_binary(item); - proc = g_loaded_binary_get_processor(binary); - msize = g_arch_processor_get_memory_size(proc); - g_object_unref(G_OBJECT(proc)); - - /* Réinitiation seule si il n'y a plus d'adresse... */ - - if (addr == NULL) - { - if (info->msg_id > 0) - gtk_extended_status_bar_remove(GTK_EXT_STATUS_BAR(item->widget), info->msg_id); - - return; - - } - - /* Adresse brute */ - - msize = g_arch_processor_get_memory_size(proc); - - msg = strdup(_("Location phys:")); - - vmpa2_phys_to_string(addr, msize, conv, NULL); - msg = stradd(msg, conv); - - msg = stradd(msg, " virt:"); - - vmpa2_virt_to_string(addr, msize, conv, NULL); - msg = stradd(msg, conv); - - - -#if 0 - - /* Relation avec les symboles */ - - binary = G_LOADED_BINARY(g_object_get_data(item->ref, "current_binary")); - format = g_loaded_binary_get_format(binary); - - rel = addr; - - if (g_binary_format_resolve_relative_routine(G_BIN_FORMAT(format), &label, &rel)) - { - msg = stradd(msg, _(" at ")); - msg = stradd(msg, label); - msg = stradd(msg, _("+")); - - snprintf(tmp, VMPA_MAX_SIZE, VMPA_FMT, rel); - msg = stradd(msg, tmp); - - } - -#endif - - - /* Impression */ - - if (info->msg_id > 0) - gtk_extended_status_bar_remove(GTK_EXT_STATUS_BAR(item->widget), info->msg_id); - - info->msg_id = gtk_extended_status_bar_push(GTK_EXT_STATUS_BAR(item->widget), msg, FALSE); - - - printf("---- moved to 0x%08llx\n", addr); - - printf(" MSG '%s'\n", msg); - - //update_menu_project_for_project(bar->project, project, bar); - - - free(msg); + focus_address_in_status_info(info, binary, addr); } @@ -374,85 +297,17 @@ static void track_caret_address_on_buffer_views(GtkBufferView *view, const vmpa2 static void focus_address_in_status_info(GStatusInfo *info, GLoadedBinary *binary, const vmpa2t *addr) { - GExeFormat *format; /* Format associé au binaire */ GArchProcessor *proc; /* Architecture du binaire */ - MemoryDataSize msize; /* Taille du bus d'adresses */ - char *msg; /* Message à transmettre */ - VMPA_BUFFER(tmp); /* Traduction d'adresses */ - GBinSymbol *symbol; /* Symbole présent à l'adresse */ - phys_t diff; /* Décallage de l'adresse */ - const char *label; /* Description d'un symbole */ - GBinPortion *portions; /* Portions binaires existantes*/ - GBinPortion *portion; /* Zone mémoire d'appartenance */ - size_t len; /* Caractère à faire basculer */ - - format = g_loaded_binary_get_format(binary); + GArchInstruction *instr; /* Instruction présente */ + GEditorItem *item; /* Autre version de l'élément */ proc = g_loaded_binary_get_processor(binary); - msize = g_arch_processor_get_memory_size(proc); - g_object_unref(G_OBJECT(proc)); - - msg = strdup(_("Localisation:")); - - /* Adresses de base */ - - msg = stradd(msg, " phys:"); - vmpa2_phys_to_string(addr, msize, tmp, NULL); - msg = stradd(msg, tmp); - - msg = stradd(msg, " virt:"); - vmpa2_virt_to_string(addr, msize, tmp, NULL); - msg = stradd(msg, tmp); - - /* Symbole présent ? */ - - if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), addr, &symbol, &diff)) - { - label = g_binary_symbol_get_label(symbol); - - if (label != NULL) - { - msg = stradd(msg, _(" at ")); - msg = stradd(msg, label); - msg = stradd(msg, _("+")); - snprintf(tmp, VMPA_MAX_SIZE, "0x%x", diff); - msg = stradd(msg, tmp); + instr = g_arch_processor_find_instr_by_address(proc, addr); - } - - g_object_unref(G_OBJECT(symbol)); - - } - - /* Zone d'appartenance */ - - portions = g_exe_format_get_portions(format); - - portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { }); - - label = g_binary_portion_get_desc(portion); - - msg = stradd(msg, _(" (")); - - /** - * Pas très propre : on bascule de majuscule en minuscule ici... - * FIXME ? - */ - - len = strlen(msg); - msg = stradd(msg, label); - msg[len] = tolower(msg[len]); - - msg = stradd(msg, _(")")); - - /* Impression */ - - if (info->msg_id > 0) - gtk_extended_status_bar_remove(GTK_EXT_STATUS_BAR(G_EDITOR_ITEM(info)->widget), info->msg_id); - - info->msg_id = gtk_extended_status_bar_push(GTK_EXT_STATUS_BAR(G_EDITOR_ITEM(info)->widget), msg, FALSE); + item = G_EDITOR_ITEM(info); + gtk_status_stack_update_current_instruction(GTK_STATUS_STACK(item->widget), binary, instr); - free(msg); + g_object_unref(G_OBJECT(proc)); } |