summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-05-21 12:08:29 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-05-21 12:08:29 (GMT)
commit7e5b1add6fdeb74b2356acf8ccf7009f45cfa85e (patch)
treeb7373554017e97fcbe24db79d9818272764e858d /src/analysis
parent5dd935b27a765177960bdfe4d2fcb296cbbd41da (diff)
Changed the hierarchy of format objects.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c23
-rw-r--r--src/analysis/disass/area.c3
-rw-r--r--src/analysis/disass/disassembler.c2
-rw-r--r--src/analysis/disass/fetch.c3
-rw-r--r--src/analysis/disass/output.c3
5 files changed, 20 insertions, 14 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index bdee11b..ad4ec1f 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -47,6 +47,7 @@
#include "../core/logs.h"
#include "../core/params.h"
#include "../core/processors.h"
+#include "../format/known.h"
#include "../glibext/gbinarycursor.h"
#include "../glibext/gloadedpanel.h"
#include "../gtkext/easygtk.h"
@@ -417,7 +418,7 @@ const char *g_loaded_binary_get_name(const GLoadedBinary *binary, bool full)
const char *result; /* Description à retourner */
GBinContent *content; /* Contenu binaire mannipulé */
- content = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
+ content = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
result = g_binary_content_describe(content, full);
@@ -851,7 +852,7 @@ static bool g_loaded_binary_connect_internal(GLoadedBinary *binary)
/* Détermination de l'identifiant */
- content = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
+ content = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
checksum = g_binary_content_get_checksum(content);
g_object_unref(G_OBJECT(content));
@@ -888,7 +889,7 @@ static bool g_loaded_binary_connect_remote(GLoadedBinary *binary)
/* Détermination de l'identifiant */
- content = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
+ content = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
checksum = g_binary_content_get_checksum(content);
g_object_unref(G_OBJECT(content));
@@ -1596,7 +1597,7 @@ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *binary)
{
GBinContent *result; /* Contenu interne à renvoyer */
- result = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
+ result = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
return result;
@@ -1619,7 +1620,7 @@ static const char *g_loaded_binary_get_format_name(const GLoadedBinary *binary)
{
const char *result; /* Désignation à retourner */
- result = g_binary_format_get_name(G_BIN_FORMAT(binary->format));
+ result = g_known_format_get_key(G_KNOWN_FORMAT(binary->format));
return result;
@@ -1656,14 +1657,16 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool connect, bool ca
format = G_BIN_FORMAT(binary->format);
- desc = g_binary_format_get_description(format);
+ desc = g_known_format_get_description(G_KNOWN_FORMAT(format));
if (desc == NULL)
log_simple_message(LMT_WARNING, _("Unnamed format"));
else
log_variadic_message(LMT_INFO, _("Selected format: %s"), desc);
- result = g_binary_format_analyze(format, gid, status);
+ free(desc);
+
+ result = g_known_format_analyze(G_KNOWN_FORMAT(format), gid, status);
if (!result) goto glba_exit;
/* Architecture visée */
@@ -1707,7 +1710,7 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool connect, bool ca
disassemble_binary(binary, gid, status, &context);
- g_binary_format_complete_analysis(format, gid, status);
+ g_known_format_complete_analysis(G_KNOWN_FORMAT(format), gid, status);
if (cache)
{
@@ -1847,7 +1850,7 @@ static const char *g_loaded_binary_describe(const GLoadedBinary *binary, bool fu
const char *result; /* Description à retourner */
GBinContent *content; /* Contenu binaire mannipulé */
- content = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
+ content = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
result = g_binary_content_describe(content, full);
@@ -1967,7 +1970,7 @@ static GtkWidget *g_loaded_binary_build_view(GLoadedBinary *binary, unsigned int
switch (index)
{
case BVW_HEX:
- content = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
+ content = g_known_format_get_content(G_KNOWN_FORMAT(binary->format));
display = gtk_hex_display_new(content);
g_object_unref(G_OBJECT(content));
break;
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index eaec25d..351bb9e 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -40,6 +40,7 @@
#include "../../core/global.h"
#include "../../core/logs.h"
#include "../../core/nproc.h"
+#include "../../format/known.h"
#include "../../format/format.h"
#include "../../glibext/delayed-int.h"
@@ -282,7 +283,7 @@ static void init_mem_area_from_addr(mem_area *area, const vmpa2t *addr, phys_t l
init_mrange(&area->range, addr, len);
- content = g_binary_format_get_content(area->format);
+ content = g_known_format_get_content(G_KNOWN_FORMAT(area->format));
area->content = g_restricted_content_new(content, &area->range);
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index d35628b..607f1e4 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -398,7 +398,7 @@ void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusS
*/
format = G_BIN_FORMAT(g_loaded_binary_get_format(binary));
- content = g_binary_format_get_content(format);
+ content = g_known_format_get_content(G_KNOWN_FORMAT(format));
lang = g_asm_language_new();
*cache = g_buffer_cache_new(content);
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index dc06511..f3fd462 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -32,6 +32,7 @@
#include "area.h"
#include "../../core/global.h"
+#include "../../format/known.h"
#include "../../format/format.h"
#include "../../glibext/delayed-int.h"
@@ -411,7 +412,7 @@ GArchInstruction **disassemble_binary_content(GLoadedBinary *binary, GProcContex
template.ctx = ctx;
- content = g_binary_format_get_content(format);
+ content = g_known_format_get_content(G_KNOWN_FORMAT(format));
length = g_binary_content_compute_size(content);
g_object_unref(G_OBJECT(content));
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index ff2b526..f2e423c 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -31,6 +31,7 @@
#include "../../core/logs.h"
+#include "../../format/known.h"
#include "../../format/format.h"
#include "../../format/symiter.h"
#include "../../glibext/generators/rborder.h"
@@ -125,7 +126,7 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
msize = g_arch_processor_get_memory_size(proc);
- content = g_binary_format_get_content(G_BIN_FORMAT(format));
+ content = g_known_format_get_content(G_KNOWN_FORMAT(format));
g_arch_processor_lock(proc);