diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-12-29 10:30:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-12-29 10:30:28 (GMT) |
commit | 9f9041e11efa71cb043425cd5e89daea0247e76c (patch) | |
tree | 84d8704c291a5efef46af1e14a2aa3544dc29455 /src/analysis/disass/output.c | |
parent | 403a0519ec85a156a7f306b045d9cab619302473 (diff) |
Cut binary data into several areas using all the available CPUs and less memory.
Diffstat (limited to 'src/analysis/disass/output.c')
-rw-r--r-- | src/analysis/disass/output.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 0d85870..fe4d705 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -59,7 +59,7 @@ void print_disassembled_instructions(GCodeBuffer *buffer, GExeFormat *format, GArchProcessor *proc, GtkStatusStack *status) { - GPortionLayer *layer; /* Couche première de portions */ + GBinPortion *root; /* Couche première de portions */ GBinPortion **portions; /* Morceaux d'encadrement */ size_t portions_count; /* Taille de cette liste */ size_t portion_index; /* Prochaine portion à traiter */ @@ -99,12 +99,29 @@ void print_disassembled_instructions(GCodeBuffer *buffer, GExeFormat *format, GA + bool collect_all_portions(GBinPortion *portion, GBinPortion *parent, BinaryPortionVisit visit, void *unused) + { + if (visit == BPV_ENTER || visit == BPV_SHOW) + { + portions = (GBinPortion **)realloc(portions, ++portions_count * sizeof(GBinPortion *)); + portions[portions_count - 1] = portion; + } + + return true; + + } - layer = g_exe_format_get_main_layer(format); + portions = NULL; + portions_count = 0; - portions = g_portion_layer_collect_all_portions(layer, &portions_count); portion_index = 0; + root = g_exe_format_get_portions(format); + + g_binary_portion_visit(root, (visit_portion_fc)collect_all_portions, NULL); + + g_object_unref(G_OBJECT(root)); + symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &sym_count); sym_index = 0; @@ -339,9 +356,6 @@ void print_disassembled_instructions(GCodeBuffer *buffer, GExeFormat *format, GA if (portions != NULL) free(portions); - g_object_unref(G_OBJECT(layer)); - - fprintf(stderr, "MISSING :: %u symbols\n", _missing); |