diff options
Diffstat (limited to 'src/analysis/binary.c')
-rw-r--r-- | src/analysis/binary.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 4bb9e43..f028cd6 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -40,6 +40,7 @@ #include "db/client.h" //#include "decomp/decompiler.h" #include "disass/disassembler.h" +#include "../arch/storage.h" #include "../common/extstr.h" #include "../common/cpp.h" #include "../common/xdg.h" @@ -1025,6 +1026,53 @@ static bool g_loaded_binary_connect_remote(GLoadedBinary *binary) } +/****************************************************************************** +* * +* Paramètres : binary = élément binaire à manipuler. * +* * +* Description : Sauvegarde le cache des instructions désassemblées. * +* * +* Retour : Bilan préliminaire de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_loaded_binary_save_cache(const GLoadedBinary *binary) +{ + bool result; /* Bilan à faire remonter */ + GArchProcessor *proc; /* Processeur concerné */ + GBinContent *content; /* Contenu brut représenté */ + const gchar *id; /* Identifiant court et unique */ + GAsmStorage *storage; /* Cache propre à constituer */ + + proc = g_loaded_binary_get_processor(binary); + content = g_loaded_binary_get_content(binary); + + id = g_binary_content_get_checksum(content); + + storage = g_asm_storage_new_compressed(proc, id); + + g_object_unref(G_OBJECT(content)); + g_object_unref(G_OBJECT(proc)); + + if (storage != NULL) + { + g_signal_connect(G_OBJECT(storage), "saved", G_CALLBACK(g_object_unref), NULL); + + g_asm_storage_save(storage); + + result = true; + + } + else + result = false; + + return result; + +} + + /* ---------------------------------------------------------------------------------- */ /* MANIPULATION DES COLLECTIONS */ @@ -1491,9 +1539,14 @@ static bool g_loaded_binary_save(const GLoadedBinary *binary, xmlDoc *xdoc, xmlX { bool result; /* Bilan à faire remonter */ + /* Mise en cache des instructions */ + + result = g_loaded_binary_save_cache(binary); + /* Elément divers associés au binaire */ - result = g_loaded_binary_save_storage(binary, xdoc, context, path); + if (result) + result = g_loaded_binary_save_storage(binary, xdoc, context, path); /* Sauvegarde côté serveur */ |