summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-08-09 18:12:27 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-08-09 18:12:27 (GMT)
commit5cd25c4adfe0426520a51a76de3f77c77cfa4b8e (patch)
tree396514971fb78e81b7bb55c9cd3331d87b45ca9a /src/analysis
parentd02deb2425d6559c357bdd00e1c0fb05f35d5fc9 (diff)
Reorganized the way formats are handled (Java and PE got disabled, Dwarf is empty).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@105 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c19
-rw-r--r--src/analysis/binary.h4
-rw-r--r--src/analysis/delayed.c15
-rw-r--r--src/analysis/delayed.h2
-rw-r--r--src/analysis/line_code.c3
-rw-r--r--src/analysis/roptions.c6
-rw-r--r--src/analysis/roptions.h6
7 files changed, 29 insertions, 26 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 9351c48..38d3d19 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -41,6 +41,7 @@
#include "line_prologue.h"
#include "prototype.h"
#include "../common/extstr.h"
+#include "../format/format.h"
#include "../panel/log.h"
#include "../plugins/pglist.h"
@@ -67,7 +68,7 @@ struct _GOpenidaBinary
off_t bin_length; /* Taille des données brutes */
bin_t *bin_data; /* Données binaires brutes */
- exe_format *format; /* Format du binaire */
+ GExeFormat *format; /* Format du binaire */
GArchProcessor *proc; /* Architecture du binaire */
GRenderingLine *lines; /* Lignes de rendu en place */
@@ -174,10 +175,10 @@ GOpenidaBinary *g_openida_binary_new_from_file(const char *filename)
result->bin_data = map_binary_file(filename, &result->bin_length);
if (result->bin_data == NULL) goto lbf_error;
- result->format = load_new_exe_format(result->bin_data, result->bin_length);
+ result->format = G_EXE_FORMAT(load_new_format(FMT_EXEC, result->bin_data, result->bin_length));
if (result->format == NULL) goto lbf_error;
- switch (get_exe_target_machine(result->format))
+ switch (g_exe_format_get_target_machine(result->format))
{
case FTM_JVM:
log_simple_message(LMT_INFO, _("Detected architecture: Java Virtual Machine"));
@@ -312,14 +313,13 @@ bool g_openida_binary_save(const GOpenidaBinary *binary, xmlDocPtr xdoc, xmlXPat
void g_openida_binary_analyse(GOpenidaBinary *binary)
{
GDelayedManager *manager; /* Gestionnaire de différés */
- bin_part **parts; /* Parties d'élément binaire */
+ GBinPart **parts; /* Parties d'élément binaire */
size_t parts_count; /* Nombre de ces parties */
manager = get_delayed_manager();
- parts = /* !!! */get_elf_default_code_parts(binary->format, &parts_count);
- qsort(parts, parts_count, sizeof(bin_part *), compare_bin_parts);
-
+ parts = g_exe_format_get_parts(binary->format, &parts_count);
+ qsort(parts, parts_count, sizeof(GBinPart *), g_binary_part_compare);
g_signal_connect(manager, "disassembly-completed",
@@ -407,7 +407,7 @@ bin_t *g_openida_binary_get_data(const GOpenidaBinary *binary, off_t *length)
* *
******************************************************************************/
-exe_format *g_openida_binary_get_format(const GOpenidaBinary *binary)
+GExeFormat *g_openida_binary_get_format(const GOpenidaBinary *binary)
{
return binary->format;
@@ -623,7 +623,8 @@ void ack_completed_disassembly(GDelayedManager *manager, GOpenidaBinary *binary,
- line = g_rendering_line_find_by_address(lines, NULL, get_exe_entry_point(binary->format));
+ line = g_rendering_line_find_by_address(lines, NULL,
+ g_exe_format_get_entry_point(binary->format));
if (line != NULL) g_rendering_line_add_flag(line, RLF_ENTRY_POINT);
/* Action post-désassemblage */
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index e6fc698..0a8d0e9 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -31,7 +31,7 @@
#include "line.h"
#include "../arch/processor.h"
-#include "../format/exe_format.h"
+#include "../format/executable.h"
#include "../xml.h"
@@ -75,7 +75,7 @@ const char *g_openida_binary_get_filename(const GOpenidaBinary *);
bin_t *g_openida_binary_get_data(const GOpenidaBinary *, off_t *);
/* Fournit le format de fichier reconnu dans le contenu binaire. */
-exe_format *g_openida_binary_get_format(const GOpenidaBinary *);
+GExeFormat *g_openida_binary_get_format(const GOpenidaBinary *);
/* Fournit les options d'affichage définies pour le binaire. */
GRenderingOptions *g_openida_binary_get_options(const GOpenidaBinary *);
diff --git a/src/analysis/delayed.c b/src/analysis/delayed.c
index 1906713..6ec03e8 100644
--- a/src/analysis/delayed.c
+++ b/src/analysis/delayed.c
@@ -30,6 +30,7 @@
#include "line_code.h"
#include "line_comment.h"
#include "../common/dllist.h"
+#include "../format/format.h"
#include "../gtkext/gtkextstatusbar.h"
#include "../gtkext/iodamarshal.h"
@@ -49,7 +50,7 @@ typedef struct _disassembly_task
DL_LIST_ITEM(link); /* Lien vers les maillons */
- bin_part **parts; /* Parties binaires à traiter */
+ GBinPart **parts; /* Parties binaires à traiter */
size_t count; /* Nombre de ces parties */
} disassembly_task;
@@ -60,7 +61,7 @@ typedef struct _disassembly_task
/* Crée un tâche de désassemblage différé. */
-static disassembly_task *create_disassembly_task(GOpenidaBinary *, bin_part **, size_t);
+static disassembly_task *create_disassembly_task(GOpenidaBinary *, GBinPart **, size_t);
/* Efface une tâche de désassemblage de la mémoire. */
static void delete_disassembly_task(disassembly_task *);
@@ -142,7 +143,7 @@ static vmpa_t find_best_ending_address_for_routine(GRenderingLine *, size_t, con
* *
******************************************************************************/
-static disassembly_task *create_disassembly_task(GOpenidaBinary *owner, bin_part **parts, size_t count)
+static disassembly_task *create_disassembly_task(GOpenidaBinary *owner, GBinPart **parts, size_t count)
{
disassembly_task *result; /* Tâche à retourner */
@@ -321,7 +322,7 @@ static void *process_disassemblies(GDelayedManager *manager)
g_mutex_unlock(manager->disass_mutex);
- routines = get_all_exe_routines(g_openida_binary_get_format(task->owner), &routines_count);
+ routines = g_binary_format_get_routines(G_BIN_FORMAT(g_openida_binary_get_format(task->owner)), &routines_count);
qsort(routines, routines_count, sizeof(GBinRoutine *), g_binary_routine_rcompare);
/* Première étape */
@@ -412,7 +413,7 @@ static GRenderingLine *disassemble_binary_parts(disassembly_task *task, GBinRout
for (i = 0; i < task->count; i++)
{
- get_bin_part_values(task->parts[i], NULL, &len, NULL);
+ g_binary_part_get_values(task->parts[i], NULL, &len, NULL);
sum += len;
}
@@ -420,7 +421,7 @@ static GRenderingLine *disassemble_binary_parts(disassembly_task *task, GBinRout
for (i = 0; i < task->count; i++)
{
- get_bin_part_values(task->parts[i], &pos, &len, &base);
+ g_binary_part_get_values(task->parts[i], &pos, &len, &base);
/* Décodage des instructions */
@@ -715,7 +716,7 @@ static vmpa_t find_best_ending_address_for_routine(GRenderingLine *line, size_t
* *
******************************************************************************/
-void g_delayed_manager_schedule_disassembly(GDelayedManager *manager, GOpenidaBinary *binary, bin_part **parts, size_t count)
+void g_delayed_manager_schedule_disassembly(GDelayedManager *manager, GOpenidaBinary *binary, GBinPart **parts, size_t count)
{
disassembly_task *task; /* Nouveau désassemblage */
diff --git a/src/analysis/delayed.h b/src/analysis/delayed.h
index 5548531..437f968 100644
--- a/src/analysis/delayed.h
+++ b/src/analysis/delayed.h
@@ -54,7 +54,7 @@ typedef struct _GDelayedManagerClass GDelayedManagerClass;
GType g_delayed_manager_get_type(void);
/* Place un nouveau désassemblage en attente. */
-void g_delayed_manager_schedule_disassembly(GDelayedManager *, GOpenidaBinary *, bin_part **, size_t);
+void g_delayed_manager_schedule_disassembly(GDelayedManager *, GOpenidaBinary *, GBinPart **, size_t);
diff --git a/src/analysis/line_code.c b/src/analysis/line_code.c
index c44899e..697dd7d 100644
--- a/src/analysis/line_code.c
+++ b/src/analysis/line_code.c
@@ -29,6 +29,7 @@
#include "line-int.h"
+#include "../format/format.h"
@@ -220,7 +221,7 @@ void g_code_line_refresh_markup(GCodeLine *line, MainRendering rendering)
if (show_code)
{
- exe_content = get_exe_content(g_rendering_options_get_format(line->options), NULL);
+ exe_content = g_binary_format_get_content(G_BIN_FORMAT(g_rendering_options_get_format(line->options)), NULL);
max_bin_len = &G_RENDERING_LINE(line)->max_bin_len[rendering];
bin_code = (char *)calloc(*max_bin_len + 1, sizeof(char));
diff --git a/src/analysis/roptions.c b/src/analysis/roptions.c
index aab8ef7..4c49a15 100644
--- a/src/analysis/roptions.c
+++ b/src/analysis/roptions.c
@@ -28,7 +28,7 @@
/* Options de représentation (instance) */
struct _GRenderingOptions
{
- exe_format *format; /* Format du contenu bianire */
+ GExeFormat *format; /* Format du contenu bianire */
GArchProcessor *proc; /* Architecture utilisée */
bool show_address[MRD_COUNT]; /* Affichage de l'adresse ? */
@@ -105,7 +105,7 @@ static void g_rendering_options_init(GRenderingOptions *options)
* *
******************************************************************************/
-GRenderingOptions *g_rendering_options_new(exe_format *format, GArchProcessor *proc)
+GRenderingOptions *g_rendering_options_new(GExeFormat *format, GArchProcessor *proc)
{
GRenderingOptions *result; /* Structure à retourner */
@@ -131,7 +131,7 @@ GRenderingOptions *g_rendering_options_new(exe_format *format, GArchProcessor *p
* *
******************************************************************************/
-exe_format *g_rendering_options_get_format(const GRenderingOptions *options)
+GExeFormat *g_rendering_options_get_format(const GRenderingOptions *options)
{
return options->format;
diff --git a/src/analysis/roptions.h b/src/analysis/roptions.h
index 184f59a..85dc5fb 100644
--- a/src/analysis/roptions.h
+++ b/src/analysis/roptions.h
@@ -30,7 +30,7 @@
#include "../arch/processor.h"
-#include "../format/exe_format.h"
+#include "../format/executable.h"
@@ -63,10 +63,10 @@ typedef struct _GRenderingOptionsClass GRenderingOptionsClass;
GType g_rendering_options_get_type(void);
/* Crée un un groupe d'options pour le rendu des lignes. */
-GRenderingOptions *g_rendering_options_new(exe_format *, GArchProcessor *);
+GRenderingOptions *g_rendering_options_new(GExeFormat *, GArchProcessor *);
/* Fournit le format du contenu binaire représenté. */
-exe_format *g_rendering_options_get_format(const GRenderingOptions *);
+GExeFormat *g_rendering_options_get_format(const GRenderingOptions *);
/* Fournit l'architecture du contenu binaire représenté. */
GArchProcessor *g_rendering_options_get_processor(const GRenderingOptions *);