summaryrefslogtreecommitdiff
path: root/src/glibext/gbinarycursor.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-16 20:11:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-16 20:11:21 (GMT)
commitf6e56cebfa878dd32a2405fd0c916a40140a1ff0 (patch)
tree3e364d2e2b2de19b85ab6d14f856d4b8db11737a /src/glibext/gbinarycursor.c
parente0d03e3eddb9d240cc21ac1b7a7ade915fd17942 (diff)
Applied a new GUI update with the new loaded panels features.
Diffstat (limited to 'src/glibext/gbinarycursor.c')
-rw-r--r--src/glibext/gbinarycursor.c60
1 files changed, 56 insertions, 4 deletions
diff --git a/src/glibext/gbinarycursor.c b/src/glibext/gbinarycursor.c
index 0c2a197..ee9eb5f 100644
--- a/src/glibext/gbinarycursor.c
+++ b/src/glibext/gbinarycursor.c
@@ -24,6 +24,9 @@
#include "gbinarycursor.h"
+#include <assert.h>
+
+
#include "glinecursor-int.h"
@@ -66,12 +69,15 @@ static GLineCursor *g_binary_cursor_duplicate(const GBinaryCursor *);
/* Compare deux suivis d'emplacements. */
static int g_binary_cursor_compare(const GBinaryCursor *, const GBinaryCursor *);
-/* Détermine si un suivi d'emplacement est valide ou non. */
+/* Détermine si la position de suivi est pertinente ou non. */
static bool g_binary_cursor_is_valid(const GBinaryCursor *);
/* Construit une étiquette de représentation d'un suivi. */
static char *g_binary_cursor_build_label(const GBinaryCursor *);
+/* Affiche une position dans une barre de statut. */
+static void g_binary_cursor_show_status(const GBinaryCursor *, GtkStatusStack *, GLoadedContent *);
+
/* ---------------------- ENCADREMENT DES TRANSFERTS DE DONEES ---------------------- */
@@ -133,6 +139,7 @@ static void g_binary_cursor_class_init(GBinaryCursorClass *class)
line->compare = (compare_cursor_fc)g_binary_cursor_compare;
line->is_valid = (is_cursor_valid_fc)g_binary_cursor_is_valid;
line->build_label = (build_cursor_label_fc)g_binary_cursor_build_label;
+ line->show_status = (show_cursor_status_fc)g_binary_cursor_show_status;
line->serialize = (serialize_cursor_fc)g_binary_cursor_serialize;
line->unserialize = (unserialize_cursor_fc)g_binary_cursor_unserialize;
@@ -278,7 +285,7 @@ static int g_binary_cursor_compare(const GBinaryCursor *cursor, const GBinaryCur
* *
* Paramètres : cursor = suivi d'emplacement à consulter. *
* *
-* Description : Détermine si un suivi d'emplacement est valide ou non. *
+* Description : Détermine si la position de suivi est pertinente ou non. *
* *
* Retour : Bilan de validité. *
* *
@@ -325,6 +332,51 @@ static char *g_binary_cursor_build_label(const GBinaryCursor *cursor)
/******************************************************************************
* *
+* Paramètres : cursor = emplacement du curseur à afficher. *
+* stack = pile de statuts à mettre à jour. *
+* content = contenu contenant le curseur à représenter. *
+* *
+* Description : Affiche une position dans une barre de statut. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_binary_cursor_show_status(const GBinaryCursor *cursor, GtkStatusStack *stack, GLoadedContent *content)
+{
+ GLoadedBinary *binary; /* Binaire chargé et analysé */
+ GArchProcessor *proc; /* Architecture du binaire */
+ GArchInstruction *instr; /* Instruction présente */
+
+ if (g_binary_cursor_is_valid(cursor))
+ {
+ assert(G_IS_LOADED_BINARY(content));
+
+ binary = G_LOADED_BINARY(content);
+
+ proc = g_loaded_binary_get_processor(binary);
+
+ instr = _g_arch_processor_find_instr_by_address(proc, &cursor->addr, true);
+ assert(instr != NULL);
+
+ gtk_status_stack_update_current_instruction(stack, binary, instr);
+
+ g_object_unref(G_OBJECT(instr));
+
+ g_object_unref(G_OBJECT(proc));
+
+ }
+
+ else
+ gtk_status_stack_reset_current_instruction(stack);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : cursor = suivi de positions à mettre à jour. *
* addr = emplacement dans le binaire visé. *
* *
@@ -348,7 +400,7 @@ void g_binary_cursor_update(GBinaryCursor *cursor, const vmpa2t *addr)
* Paramètres : cursor = suivi de positions à consulter. *
* addr = emplacement dans le binaire visé. [OUT] *
* *
-* Description : Transmet la position suivi dans un panneau de chargement. *
+* Description : Transmet la position de suivi dans un panneau de chargement. *
* *
* Retour : - *
* *
@@ -356,7 +408,7 @@ void g_binary_cursor_update(GBinaryCursor *cursor, const vmpa2t *addr)
* *
******************************************************************************/
-void g_binary_cursor_get_info(GBinaryCursor *cursor, vmpa2t *addr)
+void g_binary_cursor_get_info(const GBinaryCursor *cursor, vmpa2t *addr)
{
copy_vmpa(addr, &cursor->addr);