diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/analysis/binary-int.h | 2 | ||||
-rw-r--r-- | src/analysis/binary.c | 22 | ||||
-rw-r--r-- | src/analysis/binary.h | 17 | ||||
-rw-r--r-- | src/project.c | 8 | ||||
-rw-r--r-- | src/project.h | 12 |
6 files changed, 33 insertions, 37 deletions
@@ -1,5 +1,14 @@ 14-07-31 Cyrille Bagard <nocbos@gmail.com> + * src/analysis/binary.c: + * src/analysis/binary.h: + * src/analysis/binary-int.h: + * src/project.c: + * src/project.h: + Merge two equal binary views enumerations. + +14-07-31 Cyrille Bagard <nocbos@gmail.com> + * src/analysis/disass/fetch.c: Improve the way code is decoded by avoiding to propagate the base address everywhere. diff --git a/src/analysis/binary-int.h b/src/analysis/binary-int.h index 8aa2e83..6361a0c 100644 --- a/src/analysis/binary-int.h +++ b/src/analysis/binary-int.h @@ -75,7 +75,7 @@ struct _GLoadedBinary size_t decbuf_count; /* Taille des tableaux */ size_t defsrc; /* Fichier source principal */ - bool text_display[BDT_COUNT][2]; /* Position et code binaire #1 */ + bool text_display[BVW_COUNT][2]; /* Position et code binaire #1 */ bool lines_display; /* Affichage des lignes */ }; diff --git a/src/analysis/binary.c b/src/analysis/binary.c index a9379e9..83e81d8 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -143,10 +143,12 @@ 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[BDT_ASM][0] = true; - binary->text_display[BDT_ASM][1] = true; - binary->text_display[BDT_GRAPH][0] = false; - binary->text_display[BDT_GRAPH][1] = false; + 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->lines_display = true; @@ -1109,7 +1111,7 @@ GCodeBuffer *g_loaded_binary_get_disassembled_buffer(const GLoadedBinary *binary /****************************************************************************** * * * Paramètres : binary = élément binaire à consulter. * -* type = type de représentation visée. * +* view = type de représentation visée. * * * * Description : Indique si les adresses doivent apparaître dans le rendu. * * * @@ -1119,9 +1121,9 @@ GCodeBuffer *g_loaded_binary_get_disassembled_buffer(const GLoadedBinary *binary * * ******************************************************************************/ -bool *g_loaded_binary_display_addresses_in_text(GLoadedBinary *binary, BinaryDisplayType type) +bool *g_loaded_binary_display_addresses_in_text(GLoadedBinary *binary, BinaryView view) { - return &binary->text_display[type][0]; + return &binary->text_display[view][0]; } @@ -1129,7 +1131,7 @@ bool *g_loaded_binary_display_addresses_in_text(GLoadedBinary *binary, BinaryDis /****************************************************************************** * * * Paramètres : binary = élément binaire à consulter. * -* type = type de représentation visée. * +* view = type de représentation visée. * * * * Description : Indique si le code doit apparaître dans le rendu. * * * @@ -1139,9 +1141,9 @@ bool *g_loaded_binary_display_addresses_in_text(GLoadedBinary *binary, BinaryDis * * ******************************************************************************/ -bool *g_loaded_binary_display_code_in_text(GLoadedBinary *binary, BinaryDisplayType type) +bool *g_loaded_binary_display_code_in_text(GLoadedBinary *binary, BinaryView view) { - return &binary->text_display[type][1]; + return &binary->text_display[view][1]; } diff --git a/src/analysis/binary.h b/src/analysis/binary.h index f3e2d09..dbadd64 100644 --- a/src/analysis/binary.h +++ b/src/analysis/binary.h @@ -62,15 +62,16 @@ typedef enum _BinaryPartModel } BinaryPartModel; -/* Types de représentation */ -typedef enum _BinaryDisplayType +/* Type de représentations */ +typedef enum _BinaryView { - BDT_ASM, /* Rendu du code brut */ - BDT_GRAPH, /* Rendu avec graphiques */ + BVW_BLOCK, /* Version basique */ + BVW_GRAPH, /* Affichage en graphique */ + BVW_SOURCE, /* Code décompilé */ - BDT_COUNT + BVW_COUNT -} BinaryDisplayType; +} BinaryView; /* Indique le type défini pour une description de fichier binaire. */ @@ -138,10 +139,10 @@ GArchInstruction *g_loaded_binary_get_instructions(const GLoadedBinary *); 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 *, BinaryDisplayType); +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 *, BinaryDisplayType); +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); diff --git a/src/project.c b/src/project.c index faf232a..dc0c446 100644 --- a/src/project.c +++ b/src/project.c @@ -351,7 +351,6 @@ size_t g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *bina loaded_binary *loaded; /* Structure à renvoyer */ BinaryView i; /* Boucle de parcours */ GtkWidget *view; /* Affichage du binaire */ - BinaryDisplayType type; /* Options d'affichage */ GtkWidget *scroll; /* Surface d'exposition */ const char *name; /* Titre associé au binaire */ const char *lname; /* Description du binaire */ @@ -368,15 +367,12 @@ size_t g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *bina { case BVW_BLOCK: view = gtk_block_view_new(/*MRD_BLOCK*/); - type = BDT_ASM; break; case BVW_GRAPH: view = gtk_graph_view_new(); - type = BDT_GRAPH; break; case BVW_SOURCE: view = gtk_source_view_new(); - type = BDT_ASM; /* FIXME */ break; default: /* GCC ! */ break; @@ -387,8 +383,8 @@ size_t g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *bina loaded->views[i] = GTK_VIEW_PANEL(view); gtk_view_panel_attach_binary(loaded->views[i], binary, - g_loaded_binary_display_addresses_in_text(binary, type), - g_loaded_binary_display_code_in_text(binary, type)); + g_loaded_binary_display_addresses_in_text(binary, i), + g_loaded_binary_display_code_in_text(binary, i)); /* Intégration finale dans un support défilant */ diff --git a/src/project.h b/src/project.h index 63926b5..0f4a8f0 100644 --- a/src/project.h +++ b/src/project.h @@ -36,18 +36,6 @@ /* ------------------------- DEFINITION D'UN PROJET INTERNE ------------------------- */ -/* Type de représentations */ -typedef enum _BinaryView -{ - BVW_BLOCK, /* Version basique */ - BVW_GRAPH, /* Affichage en graphique */ - BVW_SOURCE, /* Code décompilé */ - - BVW_COUNT - -} BinaryView; - - #define G_TYPE_STUDY_PROJECT g_study_project_get_type() #define G_STUDY_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_study_project_get_type(), GStudyProject)) #define G_IS_STUDY_PROJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_study_project_get_type())) |