summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-09-10 22:36:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-09-11 00:04:06 (GMT)
commitdca1d8cefde54fa6f23c2963aef61d211fc1d7d0 (patch)
treee44894c936c4d55fed4cde1fc545a325f41154d8
parentb370370a9e35f9dd2357102b17338d3d93bb62aa (diff)
Fix the compilation when GTK support is enabled.
-rw-r--r--configure.ac2
-rw-r--r--plugins/pychrysalide/Makefile.am18
-rw-r--r--plugins/ropgadgets/select.c2
-rw-r--r--src/Makefile.am16
-rw-r--r--src/analysis/binary.c3
-rw-r--r--src/analysis/db/cdb.c1
-rw-r--r--src/glibext/gbinarycursor.c97
-rw-r--r--src/glibext/generators/hex.c1
-rw-r--r--src/glibext/widthtracker.h3
-rw-r--r--src/gtkext/gtkblockdisplay.c1
-rw-r--r--src/gtkext/gtkstatusstack.c60
-rw-r--r--src/gtkext/gtkstatusstack.h4
-rw-r--r--src/gtkext/hexdisplay.c1
-rw-r--r--src/gtkext/rendering.c1
-rw-r--r--src/gui/core/items.c1
-rw-r--r--src/gui/dialogs/about.c3
-rw-r--r--src/gui/dialogs/export_disass.c1
-rw-r--r--src/gui/dialogs/gotox.c1
-rw-r--r--src/gui/editor.c1
-rw-r--r--src/gui/panels/bintree.c1
-rw-r--r--src/gui/panels/bookmarks.c1
-rw-r--r--src/gui/panels/errors.c1
-rw-r--r--src/gui/panels/updating.h1
23 files changed, 148 insertions, 73 deletions
diff --git a/configure.ac b/configure.ac
index 3501617..65e1d37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -347,7 +347,7 @@ AC_SUBST(DESKTOP_DATADIR)
#--- Checks for GTK 3.0 / GObject 2.0
-R
+
AM_CONDITIONAL([BUILD_GTK_SUPPORT], [test "x$enable_gtk_support" = "xyes"])
if test "x$BUILD_GTK_SUPPORT_TRUE" = "x"; then
diff --git a/plugins/pychrysalide/Makefile.am b/plugins/pychrysalide/Makefile.am
index 7928595..4b6e551 100644
--- a/plugins/pychrysalide/Makefile.am
+++ b/plugins/pychrysalide/Makefile.am
@@ -8,24 +8,24 @@ libdir = $(pluginslibdir)
if BUILD_PYTHON_PACKAGE
- RUN_PATH = -Wl,-rpath,'$$ORIGIN/chrysalide-libs'
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/chrysalide-libs'
endif
if BUILD_GTK_SUPPORT
- GTKEXT_LIBADD = \
- gtkext/libpychrysagtkext.la
+GTKEXT_LIBADD = \
+ gtkext/libpychrysagtkext.la
- GTKEXT_SUBDIR = \
- gtkext
+GTKEXT_SUBDIR = \
+ gtkext
- GUI_LIBADD = \
- gui/libpychrysagui.la
+GUI_LIBADD = \
+ gui/libpychrysagui.la
- GUI_SUBDIR = \
- gui
+GUI_SUBDIR = \
+ gui
endif
diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c
index a45f043..c0cf08d 100644
--- a/plugins/ropgadgets/select.c
+++ b/plugins/ropgadgets/select.c
@@ -35,10 +35,12 @@
#include <i18n.h>
+#include <analysis/binary.h>
#include <analysis/contents/file.h>
#include <core/global.h>
#include <common/cpp.h>
#include <common/extstr.h>
+#include <core/columns.h>
#include <core/processors.h>
#include <format/known.h>
#include <gui/core/global.h>
diff --git a/src/Makefile.am b/src/Makefile.am
index 233fc10..4aed32e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,17 +24,17 @@ libchrysacore_la_SOURCES =
if BUILD_GTK_SUPPORT
- GTKEXT_LIBADD = \
- gtkext/libgtkext.la
+GTKEXT_LIBADD = \
+ gtkext/libgtkext.la
- GTKEXT_SUBDIR = \
- gtkext
+GTKEXT_SUBDIR = \
+ gtkext
- GUI_LIBADD = \
- gui/libgui.la
+GUI_LIBADD = \
+ gui/libgui.la
- GUI_SUBDIR = \
- gui
+GUI_SUBDIR = \
+ gui
endif
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 4309a4d..f8b17d2 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -52,8 +52,11 @@
#ifdef INCLUDE_GTK_SUPPORT
# include "../glibext/gloadedpanel.h"
# include "../gtkext/easygtk.h"
+# include "../gtkext/gtkblockdisplay.h"
# include "../gtkext/gtkdisplaypanel.h"
# include "../gtkext/gtkgraphdisplay.h"
+# include "../gtkext/gtkstatusstack.h"
+# include "../gtkext/hexdisplay.h"
#endif
diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c
index 1e8bfbb..6d4b84d 100644
--- a/src/analysis/db/cdb.c
+++ b/src/analysis/db/cdb.c
@@ -38,6 +38,7 @@
#include <sys/stat.h>
+#include <config.h>
#include <i18n.h>
diff --git a/src/glibext/gbinarycursor.c b/src/glibext/gbinarycursor.c
index 76975a7..d42b5a5 100644
--- a/src/glibext/gbinarycursor.c
+++ b/src/glibext/gbinarycursor.c
@@ -25,10 +25,15 @@
#include <assert.h>
+#include <malloc.h>
+
+
+#include <i18n.h>
#include "glinecursor-int.h"
#include "../analysis/binary.h"
+#include "../common/extstr.h"
@@ -77,6 +82,9 @@ 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 *);
+/* Extrait des détails complémentaires et actualise le statut. */
+static void prepare_and_show_status_from_binary_cursor(const mrange_t *, const char *, const GLoadedBinary *, GtkStatusStack *);
+
/* Affiche une position dans une barre de statut. */
static void g_binary_cursor_show_status(const GBinaryCursor *, GtkStatusStack *, GLoadedContent *);
@@ -334,6 +342,91 @@ static char *g_binary_cursor_build_label(const GBinaryCursor *cursor)
/******************************************************************************
* *
+* Paramètres : range = emplacement à mettre en valeur. *
+* encoding = encodage d'une éventuelle instruction ou NULL. *
+* binary = binaire chargé rassemblant l'ensemble des infos. *
+* stack = barre de statut à actualiser. *
+* *
+* Description : Extrait des détails complémentaires et actualise le statut. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void prepare_and_show_status_from_binary_cursor(const mrange_t *range, const char *encoding, const GLoadedBinary *binary, GtkStatusStack *stack)
+{
+ GExeFormat *format; /* Format de binaire à traiter */
+ const vmpa2t *addr; /* Localisation de départ */
+ GBinPortion *portions; /* Couche première de portions */
+ GBinPortion *portion; /* Zone mémoire d'appartenance */
+ const char *text; /* Texte au contenu à copier */
+ const char *segment; /* Désignation d'un segment */
+ GBinSymbol *symbol; /* Symbole présent à l'adresse */
+ phys_t diff; /* Décalage de l'adresse */
+ char *label; /* Description d'un symbole */
+ vmpa2t tmp; /* Zone de construction temp. */
+ VMPA_BUFFER(offset); /* Décalage physique */
+ char *sym_name; /* Position selon un symbole */
+
+ /* Préparations utiles */
+
+ format = g_loaded_binary_get_format(binary);
+
+ addr = get_mrange_addr(range);
+
+ /* Zone d'appartenance */
+
+ portions = g_exe_format_get_portions(format);
+
+ portion = g_binary_portion_find_at_addr(portions, addr);
+
+ text = g_binary_portion_get_desc(portion);
+
+ segment = (text != NULL ? text : _("Binary"));
+
+ g_object_unref(G_OBJECT(portion));
+
+ g_object_unref(G_OBJECT(portions));
+
+ /* Symbole concerné */
+
+ sym_name = NULL;
+
+ if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), addr, false, &symbol, &diff))
+ {
+ label = g_binary_symbol_get_label(symbol);
+
+ if (label != NULL)
+ {
+ sym_name = label;
+
+ sym_name = stradd(sym_name, "+");
+
+ init_vmpa(&tmp, diff, VMPA_NO_VIRTUAL);
+ vmpa2_phys_to_string(&tmp, MDS_UNDEFINED, offset, NULL);
+
+ sym_name = stradd(sym_name, offset);
+
+ }
+
+ g_object_unref(G_OBJECT(symbol));
+
+ }
+
+ /* Demande d'affichage final */
+
+ gtk_status_stack_update_current_location(stack, range, segment, sym_name, encoding);
+
+ if (sym_name != NULL)
+ free(sym_name);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : cursor = emplacement du curseur à afficher. *
* stack = pile de statuts à mettre à jour. *
* content = contenu contenant le curseur à représenter. *
@@ -365,7 +458,7 @@ static void g_binary_cursor_show_status(const GBinaryCursor *cursor, GtkStatusSt
{
init_mrange(&tmp, &cursor->addr, VMPA_NO_PHYSICAL);
- gtk_status_stack_update_current_location(stack, binary, &tmp, NULL);
+ prepare_and_show_status_from_binary_cursor(&tmp, NULL, binary, stack);
}
@@ -379,7 +472,7 @@ static void g_binary_cursor_show_status(const GBinaryCursor *cursor, GtkStatusSt
range = g_arch_instruction_get_range(instr);
encoding = g_arch_instruction_get_encoding(instr);
- gtk_status_stack_update_current_location(stack, binary, range, encoding);
+ prepare_and_show_status_from_binary_cursor(range, encoding, binary, stack);
g_object_unref(G_OBJECT(instr));
diff --git a/src/glibext/generators/hex.c b/src/glibext/generators/hex.c
index d9e5251..668ebae 100644
--- a/src/glibext/generators/hex.c
+++ b/src/glibext/generators/hex.c
@@ -32,6 +32,7 @@
#include "../gbinarycursor.h"
#include "../linegen-int.h"
#include "../linesegment.h"
+#include "../../core/columns.h"
#include "../../core/params.h"
#include "../../gtkext/hexdisplay.h"
diff --git a/src/glibext/widthtracker.h b/src/glibext/widthtracker.h
index 113cf8a..ce0aa93 100644
--- a/src/glibext/widthtracker.h
+++ b/src/glibext/widthtracker.h
@@ -51,6 +51,9 @@ typedef struct _line_width_summary
/* gbuffercache.h : Tampon pour gestion de lignes optimisée (instance) */
typedef struct _GBufferCache GBufferCache;
+/* ../gtkext/gtkstatusstack.h : Abstration d'une gestion de barre de statut (instance) */
+typedef struct _GtkStatusStack GtkStatusStack;
+
#define G_TYPE_WIDTH_TRACKER (g_width_tracker_get_type())
#define G_WIDTH_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_WIDTH_TRACKER, GWidthTracker))
diff --git a/src/gtkext/gtkblockdisplay.c b/src/gtkext/gtkblockdisplay.c
index 1810fc9..00da4cc 100644
--- a/src/gtkext/gtkblockdisplay.c
+++ b/src/gtkext/gtkblockdisplay.c
@@ -28,6 +28,7 @@
#include "../arch/instruction.h"
#include "../arch/operand.h"
#include "../analysis/loaded.h"
+#include "../core/columns.h"
#include "../glibext/gbinarycursor.h"
diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c
index 499ea88..fe4e4d5 100644
--- a/src/gtkext/gtkstatusstack.c
+++ b/src/gtkext/gtkstatusstack.c
@@ -34,7 +34,6 @@
#include "easygtk.h"
-#include "../common/extstr.h"
#include "../gui/agroup.h"
#include "../format/format.h"
@@ -503,8 +502,9 @@ 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. *
* range = emplacement à mettre en valeur. *
+* segment = zone de binaire d'appartenance. *
+* symbol = éventuelle position par rapport à un symbole. *
* encoding = encodage d'une éventuelle instruction ou NULL. *
* *
* Description : Actualise les informations liées une position d'assemblage. *
@@ -515,25 +515,14 @@ static void on_zoom_icon_press(GtkEntry *entry, GtkEntryIconPosition icon_pos, G
* *
******************************************************************************/
-void gtk_status_stack_update_current_location(GtkStatusStack *stack, const GLoadedBinary *binary, const mrange_t *range, const char *encoding)
+void gtk_status_stack_update_current_location(GtkStatusStack *stack, const mrange_t *range, const char *segment, const char *symbol, const char *encoding)
{
assembly_info *info; /* Informations à constituer */
- GExeFormat *format; /* Format de binaire à traiter */
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 */
- GBinSymbol *symbol; /* Symbole présent à l'adresse */
- phys_t diff; /* Décalage de l'adresse */
- char *label; /* Description d'un symbole */
- vmpa2t tmp; /* Zone de construction temp. */
- VMPA_BUFFER(offset); /* Décalage physique */
info = stack->asm_info;
- format = g_loaded_binary_get_format(binary);
-
/* Bascule vers une zone courante nouvelle ? */
addr = get_mrange_addr(range);
@@ -542,7 +531,7 @@ void gtk_status_stack_update_current_location(GtkStatusStack *stack, const GLoad
if (cmp_mrange(&info->current, range) == 0
&& info->size == size
&& info->encoding == encoding)
- goto gssuci_useless;
+ goto useless;
/* Réinitialisation */
@@ -552,20 +541,7 @@ void gtk_status_stack_update_current_location(GtkStatusStack *stack, const GLoad
/* Zone d'appartenance */
- portions = g_exe_format_get_portions(format);
-
- portion = g_binary_portion_find_at_addr(portions, addr);
-
- text = g_binary_portion_get_desc(portion);
-
- if (text != NULL)
- info->segment = strdup(text);
- else
- info->segment = strdup(_("Binary"));
-
- g_object_unref(G_OBJECT(portion));
-
- g_object_unref(G_OBJECT(portions));
+ info->segment = strdup(segment);
/* Adresses de base */
@@ -578,26 +554,8 @@ void gtk_status_stack_update_current_location(GtkStatusStack *stack, const GLoad
/* Symbole concerné */
- if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), addr, false, &symbol, &diff))
- {
- label = g_binary_symbol_get_label(symbol);
-
- if (label != NULL)
- {
- info->symbol = label;
-
- info->symbol = stradd(info->symbol, "+");
-
- init_vmpa(&tmp, diff, VMPA_NO_VIRTUAL);
- vmpa2_phys_to_string(&tmp, MDS_UNDEFINED, offset, NULL);
-
- info->symbol = stradd(info->symbol, offset);
-
- }
-
- g_object_unref(G_OBJECT(symbol));
-
- }
+ if (symbol != NULL)
+ info->symbol = strdup(symbol);
/* Nettoyage et conclusion */
@@ -605,9 +563,9 @@ void gtk_status_stack_update_current_location(GtkStatusStack *stack, const GLoad
gtk_status_stack_show_current_location(stack);
- gssuci_useless:
+ useless:
- g_object_unref(G_OBJECT(format));
+ ;
}
diff --git a/src/gtkext/gtkstatusstack.h b/src/gtkext/gtkstatusstack.h
index 91182a1..f419014 100644
--- a/src/gtkext/gtkstatusstack.h
+++ b/src/gtkext/gtkstatusstack.h
@@ -28,7 +28,7 @@
#include <gtk/gtk.h>
-#include "../analysis/binary.h"
+#include "../arch/vmpa.h"
@@ -62,7 +62,7 @@ GtkStatusStack *gtk_status_stack_new(void);
/* Actualise les informations liées une position d'assemblage. */
-void gtk_status_stack_update_current_location(GtkStatusStack *, const GLoadedBinary *, const mrange_t *, const char *);
+void gtk_status_stack_update_current_location(GtkStatusStack *, const mrange_t *, const char *, const char *, const char *);
/* Réinitialise les informations associées une position. */
void gtk_status_stack_reset_current_location(GtkStatusStack *);
diff --git a/src/gtkext/hexdisplay.c b/src/gtkext/hexdisplay.c
index f557513..32bd69b 100644
--- a/src/gtkext/hexdisplay.c
+++ b/src/gtkext/hexdisplay.c
@@ -25,6 +25,7 @@
#include "gtkbufferdisplay-int.h"
+#include "../core/columns.h"
#include "../core/params.h"
#include "../format/format.h"
#include "../glibext/generators/hex.h"
diff --git a/src/gtkext/rendering.c b/src/gtkext/rendering.c
index bb86791..8badf21 100644
--- a/src/gtkext/rendering.c
+++ b/src/gtkext/rendering.c
@@ -28,6 +28,7 @@
#include <malloc.h>
#include <stdio.h>
#include <string.h>
+#include <gtk/gtk.h>
#include "../common/extstr.h"
diff --git a/src/gui/core/items.c b/src/gui/core/items.c
index 6c57b7b..2b93dfd 100644
--- a/src/gui/core/items.c
+++ b/src/gui/core/items.c
@@ -30,6 +30,7 @@
#include "global.h"
+#include "../../analysis/binary.h"
#include "../../analysis/db/items/move.h"
diff --git a/src/gui/dialogs/about.c b/src/gui/dialogs/about.c
index dd2faa3..574c7f2 100644
--- a/src/gui/dialogs/about.c
+++ b/src/gui/dialogs/about.c
@@ -30,6 +30,9 @@
#include <gdk/gdkkeysyms.h>
+#include <config.h>
+
+
#include "../../gtkext/easygtk.h"
diff --git a/src/gui/dialogs/export_disass.c b/src/gui/dialogs/export_disass.c
index 12fc51f..911e345 100644
--- a/src/gui/dialogs/export_disass.c
+++ b/src/gui/dialogs/export_disass.c
@@ -36,6 +36,7 @@
#include "../core/global.h"
#include "../../common/extstr.h"
+#include "../../core/columns.h"
#include "../../core/global.h"
#include "../../core/logs.h"
#include "../../core/queue.h"
diff --git a/src/gui/dialogs/gotox.c b/src/gui/dialogs/gotox.c
index 2179960..9a8a1d2 100644
--- a/src/gui/dialogs/gotox.c
+++ b/src/gui/dialogs/gotox.c
@@ -31,6 +31,7 @@
#include <i18n.h>
+#include "../../core/columns.h"
#include "../../core/paths.h"
#include "../../format/format.h"
#include "../../format/symiter.h"
diff --git a/src/gui/editor.c b/src/gui/editor.c
index c46c137..f809848 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -45,6 +45,7 @@
#include "core/items.h"
#include "panels/view.h"
#include "tb/portions.h"
+#include "../analysis/binary.h"
#include "../common/extstr.h"
#include "../core/global.h"
#include "../core/logs.h"
diff --git a/src/gui/panels/bintree.c b/src/gui/panels/bintree.c
index c31bd88..e90179d 100644
--- a/src/gui/panels/bintree.c
+++ b/src/gui/panels/bintree.c
@@ -37,6 +37,7 @@
#include "../agroup.h"
#include "../panel-int.h"
#include "../core/global.h"
+#include "../../analysis/binary.h"
#include "../../core/queue.h"
#include "../../gtkext/easygtk.h"
#include "../../gtkext/gtkdisplaypanel.h"
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index 75d0a85..4601631 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -37,6 +37,7 @@
#include "../panel-int.h"
#include "../core/global.h"
+#include "../../analysis/binary.h"
#include "../../analysis/db/items/bookmark.h"
#include "../../core/params.h"
#include "../../core/paths.h"
diff --git a/src/gui/panels/errors.c b/src/gui/panels/errors.c
index 873c939..ef956d9 100644
--- a/src/gui/panels/errors.c
+++ b/src/gui/panels/errors.c
@@ -36,6 +36,7 @@
#include "updating-int.h"
#include "../panel-int.h"
#include "../core/global.h"
+#include "../../analysis/binary.h"
#include "../../core/global.h"
#include "../../core/paths.h"
#include "../../core/queue.h"
diff --git a/src/gui/panels/updating.h b/src/gui/panels/updating.h
index 2293a02..b30574d 100644
--- a/src/gui/panels/updating.h
+++ b/src/gui/panels/updating.h
@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
+#include "../../glibext/delayed.h"
#include "../../gtkext/gtkstatusstack.h"