summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-08-12 19:05:31 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-08-12 19:05:31 (GMT)
commit4b2f65ed2125cd7b6ef598cf02738f6c839d8935 (patch)
treede62e9daaafe63248c45202004758e91b7341cc5 /src/analysis
parentb5c6bcea25b1b840fd6c8e89a4a3c9fbd83ba84b (diff)
Extended the loading process of binary formats to prepare the DWARF support.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@568 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binaries/file.c18
-rw-r--r--src/analysis/binary-int.h1
-rw-r--r--src/analysis/binary.h1
3 files changed, 18 insertions, 2 deletions
diff --git a/src/analysis/binaries/file.c b/src/analysis/binaries/file.c
index c946572..75f2c18 100644
--- a/src/analysis/binaries/file.c
+++ b/src/analysis/binaries/file.c
@@ -173,7 +173,7 @@ GLoadedBinary *g_file_binary_new_from_file(const char *filename)
content = g_binary_content_new_from_file(filename);
if (content == NULL) goto lbf_error;
- target = find_matching_format(content);
+ target = find_matching_format(content, NULL);
desc = get_binary_format_name(target);
if (desc == NULL)
@@ -185,7 +185,7 @@ GLoadedBinary *g_file_binary_new_from_file(const char *filename)
else
log_variadic_message(LMT_INFO, _("Detected format: %s"), desc);
- loaded->format = G_EXE_FORMAT(load_new_named_format(target, content));
+ loaded->format = G_EXE_FORMAT(load_new_named_format(target, content, NULL));
if (loaded->format == NULL)
{
@@ -194,6 +194,20 @@ GLoadedBinary *g_file_binary_new_from_file(const char *filename)
goto lbf_error;
}
+ target = find_matching_format(content, loaded->format);
+ desc = get_binary_format_name(target);
+
+ if (desc != NULL)
+ {
+ log_variadic_message(LMT_INFO, _("Detected debug format: %s"), desc);
+
+ loaded->debug = G_DBG_FORMAT(load_new_named_format(target, content, loaded->format));
+
+ if (loaded->debug == NULL)
+ log_simple_message(LMT_ERROR, _("Error while loading the debug information for binary"));
+
+ }
+
target = g_exe_format_get_target_machine(loaded->format);
desc = get_arch_processor_name(target);
diff --git a/src/analysis/binary-int.h b/src/analysis/binary-int.h
index 64a957d..4bfb14e 100644
--- a/src/analysis/binary-int.h
+++ b/src/analysis/binary-int.h
@@ -61,6 +61,7 @@ struct _GLoadedBinary
get_binary_name_fc get_name; /* Obtention d'une description */
GExeFormat *format; /* Format du binaire */
+ GDbgFormat *debug; /* Informations de débogage */
GArchProcessor *proc; /* Architecture du binaire */
GArchInstruction *instrs; /* Instructions d'assemblage */
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 768f53a..6b7d338 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -33,6 +33,7 @@
#include "db/protocol.h"
#include "../arch/processor.h"
#include "../common/xml.h"
+#include "../format/debuggable.h"
#include "../format/executable.h"
#include "../glibext/gcodebuffer.h"