From 1becb2053fdbb0f04935e8b90104f1f9907988ea Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sun, 22 Apr 2018 22:01:37 +0200 Subject: Used the provided work group while loading ELF formats. --- plugins/elf/format.c | 9 +++++---- plugins/elf/symbols.c | 27 ++++++++++++--------------- plugins/elf/symbols.h | 4 ++-- src/analysis/binary.c | 2 +- src/format/format-int.h | 2 +- src/format/format.c | 5 +++-- src/format/format.h | 2 +- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/plugins/elf/format.c b/plugins/elf/format.c index 0fb2d1e..86682a2 100644 --- a/plugins/elf/format.c +++ b/plugins/elf/format.c @@ -70,7 +70,7 @@ static bool g_elf_format_analyze(GElfFormat *, wgroup_id_t, GtkStatusStack *); static SourceEndian g_elf_format_get_endianness(const GElfFormat *); /* Réalise un traitement post-désassemblage. */ -static void g_elf_format_complete_analysis(GElfFormat *, GtkStatusStack *); +static void g_elf_format_complete_analysis(GElfFormat *, wgroup_id_t, GtkStatusStack *); /* Indique le type d'architecture visée par le format. */ static const char *g_elf_format_get_target_machine(const GElfFormat *); @@ -377,7 +377,7 @@ static bool g_elf_format_analyze(GElfFormat *format, wgroup_id_t gid, GtkStatusS preload_binary_format(PGA_FORMAT_PRELOAD, base, base->info, status); - if (!load_elf_symbols(format, status)) + if (!load_elf_symbols(format, gid, status)) goto gefa_error; if (!find_all_elf_strings(format)) @@ -417,6 +417,7 @@ static SourceEndian g_elf_format_get_endianness(const GElfFormat *format) /****************************************************************************** * * * Paramètres : format = description de l'exécutable à manipuler. * +* gid = groupe de travail dédié. * * status = barre de statut à tenir informée. * * * * Description : Réalise un traitement post-désassemblage. * @@ -427,9 +428,9 @@ static SourceEndian g_elf_format_get_endianness(const GElfFormat *format) * * ******************************************************************************/ -static void g_elf_format_complete_analysis(GElfFormat *format, GtkStatusStack *status) +static void g_elf_format_complete_analysis(GElfFormat *format, wgroup_id_t gid, GtkStatusStack *status) { - refresh_elf_relocations(format, status); + refresh_elf_relocations(format, gid, status); } diff --git a/plugins/elf/symbols.c b/plugins/elf/symbols.c index 01b7a17..1cc0280 100644 --- a/plugins/elf/symbols.c +++ b/plugins/elf/symbols.c @@ -97,13 +97,13 @@ static bool load_elf_global_symbols(GElfFormat *, wgroup_id_t, GtkStatusStack *) static bool do_elf_relocation_loading(GElfLoading *, GElfFormat *, phys_t *); /* Charge en mémoire toutes les relocalisations présentes. */ -static bool load_elf_relocations(GElfFormat *, const elf_phdr *, elf_rel **, size_t *, GtkStatusStack *); +static bool load_elf_relocations(GElfFormat *, const elf_phdr *, elf_rel **, size_t *, wgroup_id_t, GtkStatusStack *); /* Assure l'intégration d'un symbole issu des relocalisations. */ static bool do_elf_relocation_renaming(GElfLoading *, GElfFormat *, GBinSymbol *); /* Applique les étiquettes issues des relocalisations. */ -static bool apply_elf_relocations(GElfFormat *, elf_rel *, size_t, sym_iter_t *, GtkStatusStack *); +static bool apply_elf_relocations(GElfFormat *, elf_rel *, size_t, sym_iter_t *, wgroup_id_t, GtkStatusStack *); @@ -115,6 +115,7 @@ static bool apply_elf_relocations(GElfFormat *, elf_rel *, size_t, sym_iter_t *, /****************************************************************************** * * * Paramètres : format = description de l'exécutable à compléter. * +* gid = groupe de travail impliqué. * status = barre de statut à tenir informée. * * * * Description : Charge en mémoire la liste humaine des symboles. * @@ -125,15 +126,12 @@ static bool apply_elf_relocations(GElfFormat *, elf_rel *, size_t, sym_iter_t *, * * ******************************************************************************/ -bool load_elf_symbols(GElfFormat *format, GtkStatusStack *status) +bool load_elf_symbols(GElfFormat *format, wgroup_id_t gid, GtkStatusStack *status) { bool result; /* Bilan à retourner */ - wgroup_id_t gid; /* Identifiant pour les tâches */ result = true; - gid = g_work_queue_define_work_group(get_work_queue()); - /* Symboles internes */ result &= load_elf_local_symbols(format, gid, status); @@ -921,6 +919,7 @@ static bool do_elf_relocation_loading(GElfLoading *loading, GElfFormat *format, * dynamic = en-tête de programme de type DYNAMIC. * * relocs = liste des relocalisations triées à charger. [OUT] * * count = taille de cette liste. [OUT] * +* gid = groupe de travail dédié. * * status = barre de statut à tenir informée. * * * * Description : Charge en mémoire toutes les relocalisations présentes. * @@ -931,7 +930,7 @@ static bool do_elf_relocation_loading(GElfLoading *loading, GElfFormat *format, * * ******************************************************************************/ -static bool load_elf_relocations(GElfFormat *format, const elf_phdr *dynamic, elf_rel **relocs, size_t *count, GtkStatusStack *status) +static bool load_elf_relocations(GElfFormat *format, const elf_phdr *dynamic, elf_rel **relocs, size_t *count, wgroup_id_t gid, GtkStatusStack *status) { bool result; /* Bilan à retourner */ GExeFormat *exec; /* Autre vision du format */ @@ -945,7 +944,6 @@ static bool load_elf_relocations(GElfFormat *format, const elf_phdr *dynamic, el bool ret; /* Bilan d'un appel */ activity_id_t msg; /* Message de progression */ GWorkQueue *queue; /* Gestionnaire de différés */ - wgroup_id_t gid; /* Identifiant pour les tâches */ guint runs_count; /* Qté d'exécutions parallèles */ phys_t run_size; /* Volume réparti par exécution*/ GElfLoading **loadings; /* Tâches de chargement */ @@ -1012,7 +1010,6 @@ static bool load_elf_relocations(GElfFormat *format, const elf_phdr *dynamic, el msg = gtk_status_stack_add_activity(status, _("Loading relocations..."), length); queue = get_work_queue(); - gid = g_work_queue_define_work_group(queue); runs_count = g_get_num_processors(); @@ -1080,6 +1077,7 @@ static bool load_elf_relocations(GElfFormat *format, const elf_phdr *dynamic, el /****************************************************************************** * * * Paramètres : format = informations chargées à consulter. * +* gid = groupe de travail dédié. * * status = barre de statut à tenir informée. * * * * Description : Actualise la désignation des fonctions externes à reloger. * @@ -1090,7 +1088,7 @@ static bool load_elf_relocations(GElfFormat *format, const elf_phdr *dynamic, el * * ******************************************************************************/ -bool refresh_elf_relocations(GElfFormat *format, GtkStatusStack *status) +bool refresh_elf_relocations(GElfFormat *format, wgroup_id_t gid, GtkStatusStack *status) { bool result; /* Bilan à retourner */ elf_phdr dynamic; /* En-tête de programme DYNAMIC*/ @@ -1110,7 +1108,7 @@ bool refresh_elf_relocations(GElfFormat *format, GtkStatusStack *status) /* Chargement des relocalisations */ - if (!load_elf_relocations(format, &dynamic, &relocs, &rel_count, status)) + if (!load_elf_relocations(format, &dynamic, &relocs, &rel_count, gid, status)) goto rer_quick_exit; /* Localisation du code de la PLT */ @@ -1142,7 +1140,7 @@ bool refresh_elf_relocations(GElfFormat *format, GtkStatusStack *status) if (result) { - result = apply_elf_relocations(format, relocs, rel_count, iter, status); + result = apply_elf_relocations(format, relocs, rel_count, iter, gid, status); delete_symbol_iterator(iter); @@ -1250,6 +1248,7 @@ static bool do_elf_relocation_renaming(GElfLoading *loading, GElfFormat *format, * relocs = table des relocalisations chargées. * * rel_count = nombre de ces éléments à interpréter. * * iter = itérateur sur les symboles à parcourir. * +* gid = groupe de travail dédié. * * status = barre de statut à tenir informée. * * * * Description : Applique les étiquettes issues des relocalisations. * @@ -1260,7 +1259,7 @@ static bool do_elf_relocation_renaming(GElfLoading *loading, GElfFormat *format, * * ******************************************************************************/ -static bool apply_elf_relocations(GElfFormat *format, elf_rel *relocs, size_t rel_count, sym_iter_t *iter, GtkStatusStack *status) +static bool apply_elf_relocations(GElfFormat *format, elf_rel *relocs, size_t rel_count, sym_iter_t *iter, wgroup_id_t gid, GtkStatusStack *status) { bool result; /* Bilan à retourner */ GExeFormat *exec; /* Autre vision du format */ @@ -1271,7 +1270,6 @@ static bool apply_elf_relocations(GElfFormat *format, elf_rel *relocs, size_t re uint32_t sym_count; /* Nombre de symboles présents */ activity_id_t msg; /* Message de progression */ GWorkQueue *queue; /* Gestionnaire de différés */ - wgroup_id_t gid; /* Identifiant pour les tâches */ GElfLoading *loading; /* Tâche de chargement */ exec = G_EXE_FORMAT(format); @@ -1302,7 +1300,6 @@ static bool apply_elf_relocations(GElfFormat *format, elf_rel *relocs, size_t re msg = gtk_status_stack_add_activity(status, _("Applying relocations..."), rel_count); queue = get_work_queue(); - gid = g_work_queue_define_work_group(queue); loading = g_elf_loading_new_for_applying(format, iter, str_start, relocs, rel_count, sym_start, sym_count, msg, do_elf_relocation_renaming); diff --git a/plugins/elf/symbols.h b/plugins/elf/symbols.h index 3bbc3ee..f51e504 100644 --- a/plugins/elf/symbols.h +++ b/plugins/elf/symbols.h @@ -38,7 +38,7 @@ /* Charge en mémoire la liste humaine des symboles. */ -bool load_elf_symbols(GElfFormat *, GtkStatusStack *); +bool load_elf_symbols(GElfFormat *, wgroup_id_t , GtkStatusStack *); @@ -46,7 +46,7 @@ bool load_elf_symbols(GElfFormat *, GtkStatusStack *); /* Actualise la désignation des fonctions externes à reloger. */ -bool refresh_elf_relocations(GElfFormat *, GtkStatusStack *); +bool refresh_elf_relocations(GElfFormat *, wgroup_id_t , GtkStatusStack *); diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 38cb503..8c3d3b6 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -1622,7 +1622,7 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, wgroup_id_t gid, GtkS disassemble_binary(binary, gid, status, &binary->disass_cache); - g_binary_format_complete_analysis(format, status); + g_binary_format_complete_analysis(format, gid, status); result = true; diff --git a/src/format/format-int.h b/src/format/format-int.h index 37dac0f..09586b9 100644 --- a/src/format/format-int.h +++ b/src/format/format-int.h @@ -47,7 +47,7 @@ typedef bool (* format_analyze_fc) (GBinFormat *, wgroup_id_t, GtkStatusStack *) typedef SourceEndian (* format_get_endian_fc) (const GBinFormat *); /* Réalise un traitement post-désassemblage. */ -typedef void (* format_complete_analysis_fc) (GBinFormat *, GtkStatusStack *); +typedef void (* format_complete_analysis_fc) (GBinFormat *, wgroup_id_t, GtkStatusStack *); /* Procède à la décompilation complète du format. */ typedef void (* format_decompile_fc) (const GBinFormat *, void/*GCodeBuffer*/ *, const char *); diff --git a/src/format/format.c b/src/format/format.c index 675fd2f..b28f4a7 100644 --- a/src/format/format.c +++ b/src/format/format.c @@ -426,6 +426,7 @@ void g_binary_format_activate_disassembling_context(GBinFormat *format, GProcCon /****************************************************************************** * * * Paramètres : format = description de l'exécutable à manipuler. * +* gid = groupe de travail dédié. * * status = barre de statut à tenir informée. * * * * Description : Réalise un traitement post-désassemblage. * @@ -436,14 +437,14 @@ void g_binary_format_activate_disassembling_context(GBinFormat *format, GProcCon * * ******************************************************************************/ -void g_binary_format_complete_analysis(GBinFormat *format, GtkStatusStack *status) +void g_binary_format_complete_analysis(GBinFormat *format, wgroup_id_t gid, GtkStatusStack *status) { GBinFormatClass *class; /* Classe de l'instance */ class = G_BIN_FORMAT_GET_CLASS(format); if (class->complete != NULL) - class->complete(format, status); + class->complete(format, gid, status); } diff --git a/src/format/format.h b/src/format/format.h index 982907c..44d005c 100644 --- a/src/format/format.h +++ b/src/format/format.h @@ -77,7 +77,7 @@ void g_binary_format_preload_disassembling_context(GBinFormat *, GProcContext *, void g_binary_format_activate_disassembling_context(GBinFormat *, GProcContext *, GtkStatusStack *); /* Réalise un traitement post-désassemblage. */ -void g_binary_format_complete_analysis(GBinFormat *, GtkStatusStack *); +void g_binary_format_complete_analysis(GBinFormat *, wgroup_id_t, GtkStatusStack *); -- cgit v0.11.2-87-g4458