diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-07-12 22:26:49 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-07-12 22:26:49 (GMT) |
commit | 7e1c5ac72a317d39952843239023c0fa506f2322 (patch) | |
tree | 206b4f7ca4165c22b796d90e3343f677296b0857 /src | |
parent | 254254db8c09eb4b4f8523e73551c13ec281d194 (diff) |
Cleaned the code handling binary symbols.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@548 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/disass/area.c | 2 | ||||
-rw-r--r-- | src/analysis/disass/output.c | 4 | ||||
-rw-r--r-- | src/arch/arm/v7/post.c | 8 | ||||
-rw-r--r-- | src/format/dex/pool.c | 4 | ||||
-rw-r--r-- | src/format/elf/helper_arm.c | 18 | ||||
-rw-r--r-- | src/format/elf/helper_x86.c | 14 | ||||
-rw-r--r-- | src/format/elf/strings.c | 2 | ||||
-rw-r--r-- | src/format/elf/symbols.c | 4 | ||||
-rw-r--r-- | src/format/symbol.c | 157 | ||||
-rw-r--r-- | src/format/symbol.h | 27 | ||||
-rw-r--r-- | src/gui/panels/strings.c | 2 | ||||
-rw-r--r-- | src/gui/panels/symbols.c | 6 | ||||
-rw-r--r-- | src/gui/status.c | 2 | ||||
-rw-r--r-- | src/panels/strings.c | 9 |
14 files changed, 117 insertions, 142 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c index 94d659b..4c54a27 100644 --- a/src/analysis/disass/area.c +++ b/src/analysis/disass/area.c @@ -435,7 +435,7 @@ static void update_address_as_routine(GBinFormat *format, const vmpa2t *addr) if (!found) { - symbol = g_binary_symbol_new(STP_ROUTINE, NULL, ~0); + symbol = g_binary_symbol_new(STP_ROUTINE); g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); } diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 324975b..91c865a 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -114,10 +114,10 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[i])); if (saddr == NULL) continue; - //if (g_binary_symbol_to_string(symbols[i]) == NULL) continue; + //if (g_binary_symbol_get_label(symbols[i]) == NULL) continue; printf(" <symbol> '%s' -> 0x%08lx\n", - "g_binary_symbol_to_string(symbols[i])", + "g_binary_symbol_get_label(symbols[i])", saddr->virtual); } diff --git a/src/arch/arm/v7/post.c b/src/arch/arm/v7/post.c index dce9c86..e95bd66 100644 --- a/src/arch/arm/v7/post.c +++ b/src/arch/arm/v7/post.c @@ -78,7 +78,7 @@ void post_process_branch_instructions(GArchInstruction *instr, GArchProcessor *p g_binary_routine_set_range(routine, &trange); - symbol = g_binary_symbol_new(STP_CODE_LABEL, NULL, ~0); + symbol = g_binary_symbol_new(STP_CODE_LABEL); g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); @@ -142,7 +142,7 @@ void post_process_branch_and_link_instructions(GArchInstruction *instr, GArchPro g_binary_routine_set_range(routine, &trange); - symbol = g_binary_symbol_new(STP_ROUTINE, NULL, ~0); + symbol = g_binary_symbol_new(STP_ROUTINE); g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); @@ -206,7 +206,7 @@ void post_process_comp_and_branch_instructions(GArchInstruction *instr, GArchPro g_binary_routine_set_range(routine, &trange); - symbol = g_binary_symbol_new(STP_CODE_LABEL, NULL, ~0); + symbol = g_binary_symbol_new(STP_CODE_LABEL); g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); @@ -289,7 +289,7 @@ void post_process_ldr_instructions(GArchInstruction *instr, GArchProcessor *proc g_binary_routine_set_range(routine, &trange); - symbol = g_binary_symbol_new(STP_CODE_LABEL, NULL, ~0); + symbol = g_binary_symbol_new(STP_CODE_LABEL); g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); diff --git a/src/format/dex/pool.c b/src/format/dex/pool.c index 0c982cd..a869873 100644 --- a/src/format/dex/pool.c +++ b/src/format/dex/pool.c @@ -55,8 +55,8 @@ bool find_all_dex_strings(GDexFormat *format) text = get_string_from_dex_pool(format, i); if (text == NULL) continue; - symbol = g_binary_symbol_new(STP_STRING, NULL, i); - g_binary_symbol_set_alt_name(symbol, strdup(text)); + symbol = g_binary_symbol_new(STP_STRING); + g_binary_symbol_set_alt_label(symbol, text); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); diff --git a/src/format/elf/helper_arm.c b/src/format/elf/helper_arm.c index efc8a3d..c77df55 100644 --- a/src/format/elf/helper_arm.c +++ b/src/format/elf/helper_arm.c @@ -118,7 +118,7 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, g_binary_routine_set_range(routine, &range); - symbol = g_binary_symbol_new(STP_ROUTINE, NULL, ~0); + symbol = g_binary_symbol_new(STP_ROUTINE); g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); @@ -131,7 +131,7 @@ bool load_elf_arm_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, ((unsigned int)ELF_SHDR(format, (*relxxx), sh_addr) + ELF_REL(format, reloc, r_offset))); */ - //symbol = g_binary_symbol_new(STP_FUNCTION, name, ELF_REL(format, reloc, r_offset)); + //symbol = g_binary_symbol_new(STP_FUNCTION)); //g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); break; @@ -269,7 +269,7 @@ bool load_elf_x86_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, name = "unknown"; } - symbol = g_binary_symbol_new(STP_FUNCTION, name, ELF_REL(format, reloc, r_offset)); + symbol = g_binary_symbol_new(STP_FUNCTION); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); break; @@ -430,19 +430,19 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &symbols_count); for (j = 0; j < symbols_count; j++) - if (g_binary_symbol_get_address(symbols[j]) == address) + if (0 /* FIXME g_binary_symbol_get_address(symbols[j]) == address*/) { /* Nom final */ - new_len = strlen(g_binary_symbol_to_string(symbols[j])) + 4 + 1; + new_len = strlen(g_binary_symbol_get_label(symbols[j])) + 4 + 1; new_name = calloc(new_len, sizeof(char)); - snprintf(new_name, new_len, "%s@plt", g_binary_symbol_to_string(symbols[j])); + snprintf(new_name, new_len, "%s@plt", g_binary_symbol_get_label(symbols[j])); g_arch_instruction_get_location(instructions[i], NULL, NULL, &address); /* Routine */ - routine = try_to_demangle_routine(g_binary_symbol_to_string(symbols[j])); + routine = try_to_demangle_routine(g_binary_symbol_get_label(symbols[j])); ///g_binary_routine_set_address(routine, address); @@ -450,7 +450,7 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru /* Symbole uniquement */ - symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address); + symbol = g_binary_symbol_new(STP_FUNCTION); g_binary_symbol_attach_routine(symbol, routine); @@ -558,7 +558,7 @@ void translate_dyn_elf_relocations(GElfFormat *format, GArchInstruction **instru /* Symbole uniquement */ - symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address); + symbol = g_binary_symbol_new(STP_FUNCTION); g_binary_symbol_attach_routine(symbol, routine); diff --git a/src/format/elf/helper_x86.c b/src/format/elf/helper_x86.c index 742d1c3..deb1ead 100644 --- a/src/format/elf/helper_x86.c +++ b/src/format/elf/helper_x86.c @@ -121,7 +121,7 @@ bool load_elf_x86_relocated_symbols(GElfFormat *format, const elf_shdr *relxxx, name = "unknown"; } - symbol = g_binary_symbol_new(STP_FUNCTION, name, ELF_REL(format, reloc, r_offset)); + symbol = g_binary_symbol_new(STP_FUNCTION); g_binary_format_add_symbol(G_BIN_FORMAT(format), symbol); break; @@ -282,19 +282,19 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &symbols_count); for (j = 0; j < symbols_count; j++) - if (g_binary_symbol_get_address(symbols[j]) == address) + if (0 /* FIXME g_binary_symbol_get_address(symbols[j]) == address*/) { /* Nom final */ - new_len = strlen(g_binary_symbol_to_string(symbols[j])) + 4 + 1; + new_len = strlen(g_binary_symbol_get_label(symbols[j])) + 4 + 1; new_name = calloc(new_len, sizeof(char)); - snprintf(new_name, new_len, "%s@plt", g_binary_symbol_to_string(symbols[j])); + snprintf(new_name, new_len, "%s@plt", g_binary_symbol_get_label(symbols[j])); g_arch_instruction_get_location(instructions[i], NULL, NULL, &address); /* Routine */ - routine = try_to_demangle_routine(g_binary_symbol_to_string(symbols[j])); + routine = try_to_demangle_routine(g_binary_symbol_get_label(symbols[j])); ///g_binary_routine_set_address(routine, address); @@ -302,7 +302,7 @@ void translate_exe_elf_relocations(GElfFormat *format, GArchInstruction **instru /* Symbole uniquement */ - symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address); + symbol = g_binary_symbol_new(STP_FUNCTION); g_binary_symbol_attach_routine(symbol, routine); @@ -410,7 +410,7 @@ void translate_dyn_elf_relocations(GElfFormat *format, GArchInstruction **instru /* Symbole uniquement */ - symbol = g_binary_symbol_new(STP_FUNCTION, new_name, address); + symbol = g_binary_symbol_new(STP_FUNCTION); g_binary_symbol_attach_routine(symbol, routine); diff --git a/src/format/elf/strings.c b/src/format/elf/strings.c index c11d53b..6832f5b 100644 --- a/src/format/elf/strings.c +++ b/src/format/elf/strings.c @@ -209,7 +209,7 @@ bool parse_elf_string_data(GElfFormat *format, off_t start, off_t size, vmpa_t a label = create_string_label(G_BIN_FORMAT(format), &pos, &data[i], end - i); - g_binary_symbol_set_label(symbol, label); + g_binary_symbol_set_alt_label(symbol, label); free(label); diff --git a/src/format/elf/symbols.c b/src/format/elf/symbols.c index 655eda1..1fa3d0e 100644 --- a/src/format/elf/symbols.c +++ b/src/format/elf/symbols.c @@ -201,7 +201,7 @@ static void register_elf_entry_point(GElfFormat *format, virt_t vaddr, phys_t le g_binary_routine_set_range(routine, &range); - symbol = g_binary_symbol_new(STP_ENTRY_POINT, "XXX", ~0); + symbol = g_binary_symbol_new(STP_ENTRY_POINT); g_binary_symbol_attach_routine(symbol, routine); _g_binary_format_add_symbol(base, symbol, false); @@ -622,7 +622,7 @@ static bool load_elf_internal_symbols(GElfFormat *format) /* Symbole uniquement */ - symbol = g_binary_symbol_new(STP_ROUTINE, name, ~0); + symbol = g_binary_symbol_new(STP_ROUTINE); g_binary_symbol_attach_routine(symbol, routine); break; diff --git a/src/format/symbol.c b/src/format/symbol.c index f676e9e..898f00d 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -36,13 +36,8 @@ struct _GBinSymbol SymbolType type; /* Type du symbole */ - const char *name; /* Désignation du symbole */ - vmpa_t address; /* Adresse du symbole */ - char *alt; /* Nom alternatif */ - char *tmp_label; /* REMME */ - union { GArchInstruction *instr; /* Instruction correspondante */ @@ -68,6 +63,12 @@ static void g_binary_symbol_class_init(GBinSymbolClass *); /* Initialise une instance de symbole d'exécutable. */ static void g_binary_symbol_init(GBinSymbol *); +/* Supprime toutes les références externes. */ +static void g_binary_symbol_dispose(GBinSymbol *); + +/* Procède à la libération totale de la mémoire. */ +static void g_binary_symbol_finalize(GBinSymbol *); + /* Indique le type défini pour un symbole d'exécutable. */ @@ -88,6 +89,12 @@ G_DEFINE_TYPE(GBinSymbol, g_binary_symbol, G_TYPE_OBJECT); static void g_binary_symbol_class_init(GBinSymbolClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_binary_symbol_dispose; + object->finalize = (GObjectFinalizeFunc)g_binary_symbol_finalize; } @@ -112,9 +119,49 @@ static void g_binary_symbol_init(GBinSymbol *symbol) /****************************************************************************** * * -* Paramètres : type = type de symbole à créer. * -* name = désignation humaine du symbole. * -* address = adresse associée au symbole. * +* Paramètres : symbol = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_binary_symbol_dispose(GBinSymbol *symbol) +{ + /* TODO... */ + + G_OBJECT_CLASS(g_binary_symbol_parent_class)->dispose(G_OBJECT(symbol)); + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_binary_symbol_finalize(GBinSymbol *symbol) +{ + free(symbol->alt); + + G_OBJECT_CLASS(g_binary_symbol_parent_class)->finalize(G_OBJECT(symbol)); + +} + + +/****************************************************************************** +* * +* Paramètres : type = type de symbole à créer. * * * * Description : Crée un nouveau symbole d'exécutable. * * * @@ -124,15 +171,13 @@ static void g_binary_symbol_init(GBinSymbol *symbol) * * ******************************************************************************/ -GBinSymbol *g_binary_symbol_new(SymbolType type, const char *name, vmpa_t address) +GBinSymbol *g_binary_symbol_new(SymbolType type) { GBinSymbol *result; /* Nouveau symbole à renvoyer */ result = g_object_new(G_TYPE_BIN_SYMBOL, NULL); result->type = type; - result->name = name; - result->address = address; return result; @@ -214,17 +259,22 @@ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *symbol) * * * Paramètres : symbol = symbole à venir consulter. * * * -* Description : Fournit la description humaine du symbole. * +* Description : Fournit un étiquette pour viser un symbole. * * * -* Retour : Nom du symbole sous forme de chaîne de caractères. * +* Retour : Chaîne de caractères renvoyant au symbole. * * * * Remarques : - * * * ******************************************************************************/ -const char *g_binary_symbol_to_string(const GBinSymbol *symbol) +const char *g_binary_symbol_get_label(const GBinSymbol *symbol) { - const char *result; /* Désignation à retourner */ + const char *result; /* Etiquette à retourner */ + + if (symbol->alt != NULL) + return symbol->alt; + + result = NULL; switch (symbol->type) { @@ -235,7 +285,7 @@ const char *g_binary_symbol_to_string(const GBinSymbol *symbol) break; default: - result = (symbol->alt != NULL ? symbol->alt : symbol->name); + result = NULL; break; } @@ -245,67 +295,22 @@ const char *g_binary_symbol_to_string(const GBinSymbol *symbol) } -vmpa_t g_binary_symbol_get_address(const GBinSymbol *symbol) -{ - - return 0; - -} - - - - - - - - - -void g_binary_symbol_set_label(GBinSymbol *symbol, const char *lbl) -{ - symbol->tmp_label = strdup(lbl); - -} - - /****************************************************************************** * * * Paramètres : symbol = symbole à venir consulter. * +* alt = désignation humaine alternative à favoriser. * * * -* Description : Fournit un étiquette pour viser un symbole. * +* Description : Définit un autre nom pour le symbole. * * * -* Retour : Chaîne de caractères renvoyant au symbole. * +* Retour : - * * * * Remarques : - * * * ******************************************************************************/ -const char *g_binary_symbol_get_label(const GBinSymbol *symbol) +void g_binary_symbol_set_alt_label(GBinSymbol *symbol, const char *alt) { - const char *result; /* Etiquette à retourner */ - - result = NULL; - - - /* TODO : utiliser des types pour les instructions */ - if (symbol->tmp_label != NULL) - return symbol->tmp_label; - - - switch (symbol->type) - { - case STP_ROUTINE: - case STP_ENTRY_POINT: - case STP_CODE_LABEL: - result = g_binary_routine_get_name(symbol->extra.routine); - break; - - default: - result = NULL; - break; - - } - - return result; + symbol->alt = strdup(alt); } @@ -415,26 +420,6 @@ const mrange_t *g_binary_symbol_get_range(const GBinSymbol *symbol) /****************************************************************************** * * -* Paramètres : symbol = symbole à venir consulter. * -* alt = désignation humaine alternative à favoriser. * -* * -* Description : Définit un autre nom pour le symbole. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_binary_symbol_set_alt_name(GBinSymbol *symbol, char *alt) -{ - symbol->alt = alt; - -} - - -/****************************************************************************** -* * * Paramètres : symbol = symbole à venir consulter. * * routine = prototype de la fonction représentée. * * type = (nouveau) type du symbole attaché. * diff --git a/src/format/symbol.h b/src/format/symbol.h index 49cde56..e0b657d 100644 --- a/src/format/symbol.h +++ b/src/format/symbol.h @@ -52,7 +52,8 @@ typedef enum _SymbolType #define G_TYPE_BIN_SYMBOL g_binary_symbol_get_type() #define G_BIN_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_binary_symbol_get_type(), GBinSymbol)) #define G_IS_BIN_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_binary_symbol_get_type())) -#define G_BIN_SYMBOL_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_binary_symbol_get_type(), GBinSymbolIface)) +#define G_BIN_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BIN_SYMBOL, GBinSymbolClass)) +#define G_IS_BIN_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BIN_SYMBOL)) #define G_BIN_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BIN_SYMBOL, GBinSymbolClass)) @@ -67,7 +68,7 @@ typedef struct _GBinSymbolClass GBinSymbolClass; GType g_binary_symbol_get_type(void); /* Crée un nouveau symbole d'exécutable. */ -GBinSymbol *g_binary_symbol_new(SymbolType, const char *, vmpa_t); +GBinSymbol *g_binary_symbol_new(SymbolType); /* Compare deux symboles d'exécutable selon leurs propriétés. */ int g_binary_symbol_cmp(const GBinSymbol **, const GBinSymbol **); @@ -75,30 +76,18 @@ int g_binary_symbol_cmp(const GBinSymbol **, const GBinSymbol **); /* Fournit le type du symbole. */ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *); -/* Fournit la description humaine du symbole. */ -const char *g_binary_symbol_to_string(const GBinSymbol *); - -/* Fournit l'adresse associée à un symbole. */ -vmpa_t g_binary_symbol_get_address(const GBinSymbol *); /////////////////// - - - -void g_binary_symbol_set_label(GBinSymbol *symbol, const char *lbl); - - - /* Fournit un étiquette pour viser un symbole. */ const char *g_binary_symbol_get_label(const GBinSymbol *); +/* Définit un autre nom pour le symbole. */ +void g_binary_symbol_set_alt_label(GBinSymbol *, const char *); + /* Raffine la définition de l'emplacement d'un symbole. */ void g_binary_symbol_fix_range(GBinSymbol *, const vmpa2t *); /* Fournit l'emplacement où se situe un symbole. */ const mrange_t *g_binary_symbol_get_range(const GBinSymbol *); -/* Définit un autre nom pour le symbole. */ -void g_binary_symbol_set_alt_name(GBinSymbol *, char *); - /* Attache la routine associée au symbole. */ void _g_binary_symbol_attach_routine(GBinSymbol *, GBinRoutine *, SymbolType); @@ -137,7 +126,7 @@ GDbComment *g_binary_symbol_get_comment(const GBinSymbol *); do \ { \ _cmt = g_db_comment_new(_pos, _txt, true); \ - _sym = g_binary_symbol_new(STP_DATA, NULL, 0); \ + _sym = g_binary_symbol_new(STP_DATA); \ g_binary_symbol_attach_instruction(_sym, _ins); \ g_binary_symbol_set_comment(_sym, _cmt); \ g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \ @@ -147,7 +136,7 @@ GDbComment *g_binary_symbol_get_comment(const GBinSymbol *); #define ADD_STR_AS_SYM(_fmt, _sym, _ins) \ do \ { \ - _sym = g_binary_symbol_new(STP_RO_STRING, NULL, 0); \ + _sym = g_binary_symbol_new(STP_RO_STRING); \ g_binary_symbol_attach_instruction(_sym, _ins); \ g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \ } \ diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index 825c510..7996553 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -687,7 +687,7 @@ static void on_string_value_edited(GtkCellRendererText *renderer, gchar *path, g gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, STC_STRING, &symbol, -1); - g_binary_symbol_set_label(symbol, new); + g_binary_symbol_set_alt_label(symbol, new); g_object_unref(G_OBJECT(symbol)); diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c index 42098c8..9b32aa5 100644 --- a/src/gui/panels/symbols.c +++ b/src/gui/panels/symbols.c @@ -680,7 +680,7 @@ static void reload_symbols_for_new_list_view(GSymbolsPanel *panel) gtk_tree_store_set(panel->store, &iter, SBC_SYMBOL, symbols[i], SBC_PICTURE, icon, - SBC_NAME, g_binary_symbol_to_string(symbols[i]), + SBC_NAME, g_binary_symbol_get_label(symbols[i]), SBC_ADDRESS, virt, -1); @@ -861,7 +861,7 @@ static void reload_symbols_for_new_tree_view(GSymbolsPanel *panel) gtk_tree_store_set(panel->store, &iter, SBC_SYMBOL, symbols[i], SBC_PICTURE, icon, - SBC_NAME, g_binary_symbol_to_string(symbols[i]), + SBC_NAME, g_binary_symbol_get_label(symbols[i]), SBC_ADDRESS, virt, -1); @@ -1052,7 +1052,7 @@ static bool is_symbol_filtered(GSymbolsPanel *panel, const GBinSymbol *symbol) if (panel->filter == NULL) return false; - ret = regexec(panel->filter, g_binary_symbol_to_string(symbol), 1, &match, 0); + ret = regexec(panel->filter, g_binary_symbol_get_label(symbol), 1, &match, 0); if (ret == REG_NOMATCH) return true; diff --git a/src/gui/status.c b/src/gui/status.c index 2637f28..41cad1a 100644 --- a/src/gui/status.c +++ b/src/gui/status.c @@ -408,7 +408,7 @@ static void focus_address_in_status_info(GStatusInfo *info, GLoadedBinary *binar if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), addr, &symbol, &diff)) { - label = g_binary_symbol_to_string(symbol); + label = g_binary_symbol_get_label(symbol); if (label != NULL) { diff --git a/src/panels/strings.c b/src/panels/strings.c index 1362ee1..8fd7ae6 100644 --- a/src/panels/strings.c +++ b/src/panels/strings.c @@ -125,7 +125,8 @@ void handle_new_exe_on_strings_panel(GtkWidget *panel, const GExeFormat *format) size_t count; /* Nombre des chaînes */ GBinSymbol **symbols; /* Liste des chaînes trouvées */ size_t i; /* Boucle de parcours */ - char address[11]; /* Conversion de l'adresse */ + const mrange_t *range; /* Emplacement de symbole */ + char address[VMPA_MAX_LEN]; /* Conversion de l'adresse */ GtkTreeIter iter; /* Point d'insertion */ store = g_object_get_data(G_OBJECT(panel), "store"); @@ -136,13 +137,13 @@ void handle_new_exe_on_strings_panel(GtkWidget *panel, const GExeFormat *format) { if (g_binary_symbol_get_target_type(symbols[i]) != STP_STRING) continue; - /* FIXME : adresses autres que 32 bits */ - snprintf(address, 11, "0x%08llx", g_binary_symbol_get_address(symbols[i])); + range = g_binary_symbol_get_range(symbols[i]); + mrange_virt_to_string(range, MDS_UNDEFINED, true, address, NULL); gtk_tree_store_append(store, &iter, NULL); gtk_tree_store_set(store, &iter, STC_ADDRESS, address, - STC_STRING, g_binary_symbol_to_string(symbols[i]), + STC_STRING, g_binary_symbol_get_label(symbols[i]), -1); } |