summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/goto.c42
-rw-r--r--src/gui/menus/edition.c6
2 files changed, 42 insertions, 6 deletions
diff --git a/src/gui/dialogs/goto.c b/src/gui/dialogs/goto.c
index 1fe2bbd..1cb365f 100644
--- a/src/gui/dialogs/goto.c
+++ b/src/gui/dialogs/goto.c
@@ -30,6 +30,8 @@
#include <i18n.h>
+#include "../core/global.h"
+#include "../../analysis/binary.h"
#include "../../gtkext/easygtk.h"
@@ -150,6 +152,12 @@ GtkWidget *create_goto_dialog(GtkWindow *parent)
GtkWidget *entry; /* Zone de saisie principale */
GtkWidget *hbox; /* Support à construire #2 */
GtkWidget *radio; /* Définition de localisation */
+ GLoadedBinary *binary; /* Binaire en cours d'édition */
+ vmpa2t *old_gotos; /* Liste de destinations */
+ size_t count; /* Taille de cette liste */
+ size_t i; /* Boucle de parcours */
+ bool is_virt; /* Détermination de l'utile */
+ VMPA_BUFFER(loc); /* Version humaintement lisible*/
result = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(result), _("Go to address"));
@@ -181,11 +189,6 @@ GtkWidget *create_goto_dialog(GtkWindow *parent)
g_signal_connect(G_OBJECT(entry), "activate",
G_CALLBACK(validate_addresses), GTK_DIALOG(result));
-
- /* TODO */
- //gtk_combo_box_append_text(combobox, "test");
-
-
/* Propriétés de la localisation */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -207,9 +210,36 @@ GtkWidget *create_goto_dialog(GtkWindow *parent)
gtk_dialog_add_button(GTK_DIALOG(result), _("_Ok"), GTK_RESPONSE_OK);
gtk_entry_set_text(GTK_ENTRY(entry), "0x");
- gtk_widget_grab_focus (entry);
+ gtk_widget_grab_focus(entry);
gtk_editable_set_position(GTK_EDITABLE(entry), -1);
+ /* Restaurationd d'anciennes destinations */
+
+ binary = G_LOADED_BINARY(get_current_content());
+ old_gotos = g_loaded_binary_get_old_gotos(binary, &count);
+ g_object_unref(G_OBJECT(binary));
+
+ if (old_gotos != NULL)
+ {
+ for (i = 0; i < count; i++)
+ {
+ is_virt = has_virt_addr(&old_gotos[i]);
+
+ if (is_virt)
+ vmpa2_virt_to_string(&old_gotos[i], MDS_UNDEFINED, loc, NULL);
+ else
+ vmpa2_phys_to_string(&old_gotos[i], MDS_UNDEFINED, loc, NULL);
+
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), loc);
+
+ }
+
+ free(old_gotos);
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0);
+
+ }
+
return result;
}
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index b1ac0ad..be045b5 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -36,6 +36,7 @@
#include "../dialogs/bookmark.h"
#include "../dialogs/goto.h"
#include "../dialogs/gotox.h"
+#include "../../analysis/binary.h"
#include "../../analysis/db/items/switcher.h"
#include "../../arch/targetableop.h"
#include "../../glibext/gbinarycursor.h"
@@ -422,6 +423,7 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
GtkWidget *dialog; /* Boîte de dialogue à montrer */
vmpa2t *addr; /* Adresse de destination */
GLoadedPanel *panel; /* Afficheur effectif de code */
+ GLoadedBinary *binary; /* Binaire en cours d'édition */
ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
dialog = create_goto_dialog(GTK_WINDOW(ref));
@@ -433,6 +435,10 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
panel = get_current_view();
assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
+ binary = G_LOADED_BINARY(g_loaded_panel_get_content(panel));
+ g_loaded_binary_remember_new_goto(binary, addr);
+ g_object_unref(G_OBJECT(binary));
+
gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
g_object_unref(G_OBJECT(panel));