summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-10-21 23:11:30 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-10-21 23:11:30 (GMT)
commit085fef16a819cb321fd38e7e0926d3cca863777a (patch)
treef2f24c6205134338999760f1a4a427b0c6c8be27 /src/analysis
parentec6aa436f4a1ae486feb7a88b2b8e793b59674d4 (diff)
Cleaned, fixed and improved the rules for the display of view columns.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@416 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary-int.h3
-rw-r--r--src/analysis/binary.c86
-rw-r--r--src/analysis/binary.h12
3 files changed, 62 insertions, 39 deletions
diff --git a/src/analysis/binary-int.h b/src/analysis/binary-int.h
index 28d4594..fa06a25 100644
--- a/src/analysis/binary-int.h
+++ b/src/analysis/binary-int.h
@@ -77,7 +77,7 @@ struct _GLoadedBinary
size_t decbuf_count; /* Taille des tableaux */
size_t defsrc; /* Fichier source principal */
- bool text_display[BVW_COUNT][2]; /* Position et code binaire #1 */
+ bool col_display[BVW_COUNT][BLC_DISPLAY];/* Position et code binaire */
bool lines_display; /* Affichage des lignes */
};
@@ -90,6 +90,7 @@ struct _GLoadedBinaryClass
/* Signaux */
void (* disassembly_done) (GLoadedBinary *);
+ void (* display_changed) (GLoadedBinary *, BinaryView, BufferLineColumn);
};
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 18dca8c..6c8bcba 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -41,6 +41,7 @@
#include "../common/extstr.h"
#include "../common/cpp.h"
#include "../core/params.h"
+#include "../glibext/chrysamarshal.h"
@@ -117,6 +118,14 @@ static void g_loaded_binary_class_init(GLoadedBinaryClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ g_signal_new("display-changed",
+ G_TYPE_LOADED_BINARY,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(GLoadedBinaryClass, display_changed),
+ NULL, NULL,
+ g_cclosure_user_marshal_VOID__ENUM_ENUM,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
+
}
@@ -144,12 +153,15 @@ static void g_loaded_binary_init(GLoadedBinary *binary)
binary->storages[DBF_SEGMENTS_DISPLAY] = DBS_ALL_LOCAL;
binary->storages[DBF_BOOKMARKS] = DBS_ALL_LOCAL;
- binary->text_display[BVW_BLOCK][0] = true;
- binary->text_display[BVW_BLOCK][1] = true;
- binary->text_display[BVW_BLOCK][2] = true;
- binary->text_display[BVW_GRAPH][0] = false;
- binary->text_display[BVW_GRAPH][1] = false;
- binary->text_display[BVW_GRAPH][2] = false;
+ binary->col_display[BVW_BLOCK][BLC_PHYSICAL] = true;
+ binary->col_display[BVW_BLOCK][BLC_VIRTUAL] = true;
+ binary->col_display[BVW_BLOCK][BLC_BINARY] = true;
+ binary->col_display[BVW_GRAPH][BLC_PHYSICAL] = false;
+ binary->col_display[BVW_GRAPH][BLC_VIRTUAL] = false;
+ binary->col_display[BVW_GRAPH][BLC_BINARY] = false;
+ binary->col_display[BVW_SOURCE][BLC_PHYSICAL] = false;
+ binary->col_display[BVW_SOURCE][BLC_VIRTUAL] = false;
+ binary->col_display[BVW_SOURCE][BLC_BINARY] = false;
binary->lines_display = true;
@@ -1305,39 +1317,60 @@ GCodeBuffer *g_loaded_binary_get_disassembled_buffer(const GLoadedBinary *binary
/******************************************************************************
* *
* Paramètres : binary = élément binaire à consulter. *
-* view = type de représentation visée. *
+* index = indice du fichier à retrouver. *
* *
-* Description : Indique si les adresses doivent apparaître dans le rendu. *
+* Description : Fournit le tampon associé au contenu d'un fichier source. *
* *
-* Retour : Consigne d'affichage. [OUT] *
+* Retour : Tampon mis en place ou NULL si aucun (!). *
* *
* Remarques : - *
* *
******************************************************************************/
-bool *g_loaded_binary_display_addresses_in_text(GLoadedBinary *binary, BinaryView view)
+GCodeBuffer *g_loaded_binary_get_decompiled_buffer(const GLoadedBinary *binary, size_t index)
{
- return &binary->text_display[view][0];
+ GCodeBuffer *result; /* Tampon à retourner */
+
+ if (binary->decbuf_count == 0)
+ result = NULL;
+
+ else if (index >= binary->decbuf_count)
+ result = binary->dec_buffers[binary->defsrc];
+
+ else
+ result = binary->dec_buffers[index];
+
+ return result;
}
/******************************************************************************
* *
-* Paramètres : binary = élément binaire à consulter. *
+* Paramètres : binary = élément binaire à mettre à jour. *
* view = type de représentation visée. *
+* col = indice de colonne dont l'affichage est à modifier. *
+* state = nouvel état de l'affichage. *
* *
-* Description : Indique si le code doit apparaître dans le rendu. *
+* Description : Définit si une colonne donnée doit apparaître dans le rendu. *
* *
-* Retour : Consigne d'affichage. [OUT] *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-bool *g_loaded_binary_display_code_in_text(GLoadedBinary *binary, BinaryView view)
+void g_loaded_binary_set_column_display(GLoadedBinary *binary, BinaryView view, BufferLineColumn col, bool state)
{
- return &binary->text_display[view][1];
+ bool old; /* Ancien état à remplacer */
+
+ old = binary->col_display[view][col];
+
+ if (state != old)
+ {
+ binary->col_display[view][col] = state;
+ g_signal_emit_by_name(binary, "display-changed", view, col);
+ }
}
@@ -1345,30 +1378,19 @@ bool *g_loaded_binary_display_code_in_text(GLoadedBinary *binary, BinaryView vie
/******************************************************************************
* *
* Paramètres : binary = élément binaire à consulter. *
-* index = indice du fichier à retrouver. *
+* view = type de représentation visée. *
* *
-* Description : Fournit le tampon associé au contenu d'un fichier source. *
+* Description : Indique quelles colonnes doivent apparaître dans le rendu. *
* *
-* Retour : Tampon mis en place ou NULL si aucun (!). *
+* Retour : Consigne d'affichage. [OUT] *
* *
* Remarques : - *
* *
******************************************************************************/
-GCodeBuffer *g_loaded_binary_get_decompiled_buffer(const GLoadedBinary *binary, size_t index)
+const bool *g_loaded_binary_get_column_display(GLoadedBinary *binary, BinaryView view)
{
- GCodeBuffer *result; /* Tampon à retourner */
-
- if (binary->decbuf_count == 0)
- result = NULL;
-
- else if (index >= binary->decbuf_count)
- result = binary->dec_buffers[binary->defsrc];
-
- else
- result = binary->dec_buffers[index];
-
- return result;
+ return binary->col_display[view];
}
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 17da200..8574f28 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -169,15 +169,15 @@ GArchInstruction *g_loaded_binary_get_instructions(const GLoadedBinary *);
/* Fournit le tampon associé au contenu assembleur d'un binaire. */
GCodeBuffer *g_loaded_binary_get_disassembled_buffer(const GLoadedBinary *);
-/* Indique si les adresses doivent apparaître dans le rendu. */
-bool *g_loaded_binary_display_addresses_in_text(GLoadedBinary *, BinaryView);
-
-/* Indique si le code doit apparaître dans le rendu. */
-bool *g_loaded_binary_display_code_in_text(GLoadedBinary *, BinaryView);
-
/* Fournit le tampon associé au contenu d'un fichier source. */
GCodeBuffer *g_loaded_binary_get_decompiled_buffer(const GLoadedBinary *, size_t);
+/* Définit si une colonne donnée doit apparaître dans le rendu. */
+void g_loaded_binary_set_column_display(GLoadedBinary *, BinaryView, BufferLineColumn, bool);
+
+/* Indique quelles colonnes doivent apparaître dans le rendu. */
+const bool *g_loaded_binary_get_column_display(GLoadedBinary *, BinaryView);
+
/* Indique si les lignes doivent apparaître dans le rendu. */
bool *g_loaded_binary_display_decomp_lines(GLoadedBinary *);