diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-11-12 20:19:25 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-11-12 20:19:25 (GMT) |
commit | 0194351c3401df90ab8f7cffb0d40968fb4c31ad (patch) | |
tree | eacc2d17769cf91685cdbe3c33ea789fb81fa01b /src/analysis | |
parent | 771f21b9d5dd2b394359304a660418bbc84befda (diff) |
Provided a way to wait for analysis endings without signals.
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 54 | ||||
-rw-r--r-- | src/analysis/binary.h | 3 | ||||
-rw-r--r-- | src/analysis/disass/disassembler.c | 4 |
3 files changed, 57 insertions, 4 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 4d9e8a8..7b0e528 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -44,6 +44,7 @@ #include "../common/xdg.h" #include "../core/collections.h" #include "../core/formats.h" +#include "../core/global.h" #include "../core/params.h" #include "../core/processors.h" #include "../glibext/chrysamarshal.h" @@ -140,6 +141,8 @@ static bool g_loaded_binary_connect_remote(GLoadedBinary *); +/* Lance l'analyse d'un élément binaire chargé. */ +static void _g_loaded_binary_analyse(GLoadedBinary *, disassembly_ack_fc); @@ -1371,10 +1374,10 @@ bool _g_loaded_binary_remove_from_collection(GLoadedBinary *binary, DBFeatures f - /****************************************************************************** * * * Paramètres : binary = élément binaire à traiter. * +* ack = éventuelle fonction à appeler en conclusion. * * * * Description : Lance l'analyse d'un élément binaire chargé. * * * @@ -1384,7 +1387,7 @@ bool _g_loaded_binary_remove_from_collection(GLoadedBinary *binary, DBFeatures f * * ******************************************************************************/ -void g_loaded_binary_analyse(GLoadedBinary *binary) +static void _g_loaded_binary_analyse(GLoadedBinary *binary, disassembly_ack_fc ack) { /* Détermination de l'identifiant */ @@ -1398,7 +1401,7 @@ void g_loaded_binary_analyse(GLoadedBinary *binary) g_loaded_binary_connect_internal(binary); - disassemble_binary(binary, &binary->disass_cache, ack_completed_disassembly); + disassemble_binary(binary, &binary->disass_cache, ack); @@ -1410,6 +1413,51 @@ void g_loaded_binary_analyse(GLoadedBinary *binary) /****************************************************************************** * * +* Paramètres : binary = élément binaire à traiter. * +* * +* Description : Lance l'analyse d'un élément binaire chargé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_loaded_binary_analyse(GLoadedBinary *binary) +{ + _g_loaded_binary_analyse(binary, ack_completed_disassembly); + +} + + +/****************************************************************************** +* * +* Paramètres : binary = élément binaire à traiter. * +* * +* Description : Lance l'analyse d'un binaire chargé et attend sa conclusion. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_loaded_binary_analyse_and_wait(GLoadedBinary *binary) +{ + GWorkQueue *queue; /* Gestionnaire de différés */ + + _g_loaded_binary_analyse(binary, NULL); + + queue = get_work_queue(); + g_work_queue_wait_for_completion(queue, DEFAULT_WORK_GROUP); + + ack_completed_disassembly(NULL, binary); + +} + + +/****************************************************************************** +* * * Paramètres : binary = élément binaire à consulter. * * * * Description : Fournit le format de fichier reconnu dans le contenu binaire.* diff --git a/src/analysis/binary.h b/src/analysis/binary.h index d6b9a5b..2df42aa 100644 --- a/src/analysis/binary.h +++ b/src/analysis/binary.h @@ -173,6 +173,9 @@ bool _g_loaded_binary_remove_from_collection(GLoadedBinary *, DBFeatures, GDbIte /* Lance l'analyse d'un élément binaire chargé. */ void g_loaded_binary_analyse(GLoadedBinary *); +/* Lance l'analyse d'un binaire chargé et attend sa conclusion. */ +void g_loaded_binary_analyse_and_wait(GLoadedBinary *); + /* Fournit le format de fichier reconnu dans le contenu binaire. */ bool g_loaded_binary_attach_debug_info(GLoadedBinary *, GBinContent *); diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c index 976ef11..7a066fc 100644 --- a/src/analysis/disass/disassembler.c +++ b/src/analysis/disass/disassembler.c @@ -706,7 +706,9 @@ void disassemble_binary(GLoadedBinary *binary, GBufferCache **cache, disassembly g_object_unref(G_OBJECT(format)); disass = g_delayed_disassembly_new(binary, *cache); - g_signal_connect(disass, "work-completed", G_CALLBACK(ack), binary); + + if (ack != NULL) + g_signal_connect(disass, "work-completed", G_CALLBACK(ack), binary); queue = get_work_queue(); g_work_queue_schedule_work(queue, G_DELAYED_WORK(disass), DEFAULT_WORK_GROUP); |