diff options
Diffstat (limited to 'src/analysis/binaries/file.c')
-rw-r--r-- | src/analysis/binaries/file.c | 18 |
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); |