summaryrefslogtreecommitdiff
path: root/src/analysis/binaries/file.c
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/binaries/file.c
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/binaries/file.c')
-rw-r--r--src/analysis/binaries/file.c18
1 files changed, 16 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);