summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/project.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/analysis/project.c b/src/analysis/project.c
index 88e90ea..5c5c653 100644
--- a/src/analysis/project.c
+++ b/src/analysis/project.c
@@ -107,6 +107,9 @@ static void g_study_project_init(GStudyProject *);
/* Supprime de l'écran un projet en place. */
static void g_study_project_hide(const GStudyProject *);
+/* Assure un positionnement initial idéal. */
+static gboolean scroll_for_the_first_time(GtkWidget *, GdkEvent *, GLoadedBinary *);
+
/* ----------------------- VUES ET BASCULEMENT ENTRE LES VUES ----------------------- */
@@ -562,6 +565,39 @@ void g_study_project_add_loaded_binary(GLoadedBinary *binary, GStudyProject *pro
/******************************************************************************
* *
+* Paramètres : widget = composant d'affichage nouvellement porté à l'écran. *
+* event = informations liées à l'événement. *
+* binary = fichier binaire à associer au projet actuel. *
+* *
+* Description : Assure un positionnement initial idéal. *
+* *
+* Retour : FALSE. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static gboolean scroll_for_the_first_time(GtkWidget *widget, GdkEvent *event, GLoadedBinary *binary)
+{
+ GExeFormat *format; /* Format associé au binaire */
+ vmpa2t target; /* Position initiale à viser */
+
+ g_signal_handlers_disconnect_by_func(widget, G_CALLBACK(scroll_for_the_first_time), binary);
+
+ format = g_loaded_binary_get_format(binary);
+
+ if (g_exe_format_get_main_address(format, &target))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(widget), &target);
+
+ g_object_unref(G_OBJECT(format));
+
+ return FALSE;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : project = project à effacer de la mémoire. *
* binary = fichier binaire à associer au projet actuel. *
* *
@@ -596,34 +632,6 @@ void g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *binary
/* Premier affichage */
- gboolean scroll_for_the_first_time(GtkWidget *widget, GdkEvent *event, GLoadedBinary *binary)
- {
- GBinFormat *format; /* Format associé au binaire */
- GBinSymbol *symbol; /* Point d'entrée trouvé */
- const mrange_t *range; /* Emplacement de ce point */
-
- g_signal_handlers_disconnect_by_func(widget, G_CALLBACK(scroll_for_the_first_time), binary);
-
- format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
-
- /* TODO : se rabattre sur des symboles identifiés comme point d'entrée si on ne trouve pas les principaux ci dessous */
-
- if (g_binary_format_find_symbol_by_label(format, "main", &symbol)
- || g_binary_format_find_symbol_by_label(format, "_start", &symbol)
- || g_binary_format_find_symbol_by_label(format, "entry_point", &symbol))
- {
- range = g_binary_symbol_get_range(symbol);
-
- gtk_display_panel_request_move(GTK_DISPLAY_PANEL(widget), get_mrange_addr(range));
-
- }
-
- g_object_unref(G_OBJECT(format));
-
- return FALSE;
-
- }
-
panel = _setup_new_panel_item_for_binary(project, binary, BVW_BLOCK, &display);
g_mutex_unlock(&project->bin_mutex);