diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-03-15 00:01:58 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-03-15 00:01:58 (GMT) |
commit | b94be85e00d7770af4de93bbba91b421cfb6faea (patch) | |
tree | ea16d5248b293b3a458ad16625c6919315a4aa4a | |
parent | fab9d7cd46922abea7d94f36dcd4630cdf3f4719 (diff) |
Marked lines which are able to start a group of lines as width managers.
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | plugins/readdex/class.c | 9 | ||||
-rw-r--r-- | plugins/readdex/code.c | 8 | ||||
-rw-r--r-- | plugins/readdex/header.c | 2 | ||||
-rw-r--r-- | plugins/readdex/ids.c | 16 | ||||
-rw-r--r-- | src/analysis/disass/output.c | 17 | ||||
-rw-r--r-- | src/format/symbol.c | 61 | ||||
-rw-r--r-- | src/format/symbol.h | 6 |
8 files changed, 118 insertions, 16 deletions
@@ -1,3 +1,18 @@ +16-03-15 Cyrille Bagard <nocbos@gmail.com> + + * plugins/readdex/class.c: + * plugins/readdex/code.c: + * plugins/readdex/header.c: + * plugins/readdex/ids.c: + Update code. + + * src/analysis/disass/output.c: + Mark lines which are able to start a group of lines as width managers. + + * src/format/symbol.c: + * src/format/symbol.h: + Mark symbols as able to start a group of lines. + 16-03-14 Cyrille Bagard <nocbos@gmail.com> * plugins/readelf/header.c: diff --git a/plugins/readdex/class.c b/plugins/readdex/class.c index 3f0608a..ccfdf9d 100644 --- a/plugins/readdex/class.c +++ b/plugins/readdex/class.c @@ -105,6 +105,9 @@ bool annotate_dex_class_defs(const GDexFormat *format) free(text); + if (i == 0) + g_binary_symbol_define_as_block_start(symbol, true); + /* access_flags */ copy_vmpa(&start, &pos); @@ -261,6 +264,8 @@ static bool annotate_dex_class_data(const GDexFormat *format, const GDexClass *c free(text); + g_binary_symbol_define_as_block_start(symbol, true); + /* instance_fields_size */ copy_vmpa(&start, &pos); @@ -365,6 +370,8 @@ static bool annotate_dex_encoded_field(const GDexFormat *format, vmpa2t *pos) free(text); + g_binary_symbol_define_as_block_start(symbol, true); + /* access_flags */ copy_vmpa(&start, pos); @@ -427,6 +434,8 @@ static bool annotate_dex_encoded_method(const GDexFormat *format, const encoded_ free(text); + g_binary_symbol_define_as_block_start(symbol, true); + /* access_flags */ copy_vmpa(&start, pos); diff --git a/plugins/readdex/code.c b/plugins/readdex/code.c index 971117e..24813ea 100644 --- a/plugins/readdex/code.c +++ b/plugins/readdex/code.c @@ -99,6 +99,8 @@ bool annotate_dex_code_item(const GDexFormat *format, uleb128_t offset) free(text); + g_binary_symbol_define_as_block_start(symbol, true); + /* ins_size */ copy_vmpa(&start, &pos); @@ -253,6 +255,8 @@ static bool annotate_dex_try_item(const GDexFormat *format, vmpa2t *pos, const v free(text); + g_binary_symbol_define_as_block_start(symbol, true); + /* insn_count */ copy_vmpa(&start, pos); @@ -336,6 +340,8 @@ static bool annotate_dex_encoded_catch_handler_list(const GDexFormat *format, vm free(text); + g_binary_symbol_define_as_block_start(symbol, true); + /* instance_fields_size */ g_imm_operand_as_uleb128(G_IMM_OPERAND(operand), &size); @@ -396,6 +402,8 @@ static bool annotate_dex_encoded_catch_handler(const GDexFormat *format, vmpa2t free(text); + g_binary_symbol_define_as_block_start(symbol, true); + g_imm_operand_as_leb128(G_IMM_OPERAND(operand), &size); has_catch_all = (size <= 0); diff --git a/plugins/readdex/header.c b/plugins/readdex/header.c index 183ca82..999baa4 100644 --- a/plugins/readdex/header.c +++ b/plugins/readdex/header.c @@ -82,6 +82,8 @@ bool annotate_dex_header(GDexFormat *format) ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("DEX magic number")); + g_binary_symbol_define_as_block_start(symbol, true); + /* checksum */ copy_vmpa(&start, &pos); diff --git a/plugins/readdex/ids.c b/plugins/readdex/ids.c index 54d0bd7..c9f1cb5 100644 --- a/plugins/readdex/ids.c +++ b/plugins/readdex/ids.c @@ -89,6 +89,9 @@ bool annotate_dex_string_ids(const GDexFormat *format) free(text); + if (i == 0) + g_binary_symbol_define_as_block_start(symbol, true); + /* Description de la chaîne : taille */ operand = g_arch_instruction_get_operand(instr, 0); @@ -178,6 +181,9 @@ bool annotate_dex_type_ids(const GDexFormat *format) free(text); + if (i == 0) + g_binary_symbol_define_as_block_start(symbol, true); + } g_object_unref(G_OBJECT(content)); @@ -236,6 +242,9 @@ bool annotate_dex_proto_ids(const GDexFormat *format) free(text); + if (i == 0) + g_binary_symbol_define_as_block_start(symbol, true); + /* return_type_idx */ copy_vmpa(&start, &pos); @@ -320,6 +329,9 @@ bool annotate_dex_field_ids(const GDexFormat *format) free(text); + if (i == 0) + g_binary_symbol_define_as_block_start(symbol, true); + /* type_idx */ copy_vmpa(&start, &pos); @@ -404,6 +416,9 @@ bool annotate_dex_method_ids(const GDexFormat *format) free(text); + if (i == 0) + g_binary_symbol_define_as_block_start(symbol, true); + /* proto_idx */ copy_vmpa(&start, &pos); @@ -437,4 +452,3 @@ bool annotate_dex_method_ids(const GDexFormat *format) return true; } - diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 07165c0..51b0a04 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -246,21 +246,8 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form /* Début d'un groupe bien cohérent avec les alignements ? */ - switch (g_binary_symbol_get_target_type(symbols[sym_index])) - { - case STP_ROUTINE: - case STP_OBJECT: - case STP_FUNCTION: - case STP_ENTRY_POINT: - case STP_STRING: - case STP_RO_STRING: - g_buffer_line_add_flag(line, BLF_WIDTH_MANAGER); - break; - - default: - break; - - } + if (g_binary_symbol_is_block_start(symbols[sym_index])) + g_buffer_line_add_flag(line, BLF_WIDTH_MANAGER); /* Commentaire ? */ diff --git a/src/format/symbol.c b/src/format/symbol.c index 58fdfb3..2c2e5ad 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -36,6 +36,7 @@ struct _GBinSymbol SymbolType type; /* Type du symbole */ + bool block_start; /* Début d'un bloc ? */ char *alt; /* Nom alternatif */ union @@ -244,6 +245,66 @@ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *symbol) /****************************************************************************** * * +* Paramètres : symbol = symbole à venir compléter. * +* start = indication quant à la nature du symbole. * +* * +* Description : Définit si un symbole est susceptible de démarrer un bloc. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_symbol_define_as_block_start(GBinSymbol *symbol, bool start) +{ + symbol->block_start = start; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir consulter. * +* * +* Description : Indique si un symbole est susceptible de démarrer un bloc. * +* * +* Retour : Capacité de rassemblement du symbole. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_binary_symbol_is_block_start(GBinSymbol *symbol) +{ + bool result; /* Statut à retourner */ + + switch (g_binary_symbol_get_target_type(symbol)) + { + case STP_ROUTINE: + case STP_OBJECT: + case STP_FUNCTION: + case STP_ENTRY_POINT: + case STP_STRING: + case STP_RO_STRING: + result = true; + break; + + default: + result = false; + break; + + } + + result |= symbol->block_start; + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : symbol = symbole à venir consulter. * * * * Description : Fournit un étiquette pour viser un symbole. * diff --git a/src/format/symbol.h b/src/format/symbol.h index 6f2078c..c616a85 100644 --- a/src/format/symbol.h +++ b/src/format/symbol.h @@ -83,6 +83,12 @@ int g_binary_symbol_cmp(const GBinSymbol **, const GBinSymbol **); /* Fournit le type du symbole. */ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *); +/* Définit si un symbole est susceptible de démarrer un bloc. */ +void g_binary_symbol_define_as_block_start(GBinSymbol *, bool); + +/* Indique si un symbole est susceptible de démarrer un bloc. */ +bool g_binary_symbol_is_block_start(GBinSymbol *); + /* Fournit un étiquette pour viser un symbole. */ const char *g_binary_symbol_get_label(const GBinSymbol *); |