diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/disass/links.c | 6 | ||||
-rw-r--r-- | src/analysis/disass/links.h | 2 | ||||
-rw-r--r-- | src/arch/target.c | 20 | ||||
-rw-r--r-- | src/arch/target.h | 2 | ||||
-rw-r--r-- | src/format/format.c | 11 | ||||
-rw-r--r-- | src/format/format.h | 2 | ||||
-rw-r--r-- | src/gtkext/gtkstatusstack.c | 2 | ||||
-rw-r--r-- | src/gui/dialogs/gotox.c | 2 |
8 files changed, 19 insertions, 28 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c index 28cb124..0ce107a 100644 --- a/src/analysis/disass/links.c +++ b/src/analysis/disass/links.c @@ -32,7 +32,7 @@ /* Complète un désassemblage accompli pour une instruction. */ -static void convert_immediate_into_target(GArchInstruction *, size_t, const GBinFormat *); +static void convert_immediate_into_target(GArchInstruction *, size_t, GBinFormat *); @@ -134,7 +134,7 @@ void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev) * * ******************************************************************************/ -static void convert_immediate_into_target(GArchInstruction *instr, size_t index, const GBinFormat *format) +static void convert_immediate_into_target(GArchInstruction *instr, size_t index, GBinFormat *format) { GArchOperand *op; /* Opérande numérique en place */ GImmOperand *imm; /* Version native de l'opérande*/ @@ -179,7 +179,7 @@ static void convert_immediate_into_target(GArchInstruction *instr, size_t index, * * ******************************************************************************/ -void establish_links_for_instruction(GArchInstruction *instr, const GBinFormat *format, const GArchProcessor *proc) +void establish_links_for_instruction(GArchInstruction *instr, GBinFormat *format, const GArchProcessor *proc) { bool skip; /* Saut des conversions */ size_t count; /* Nombre d'opérandes présents */ diff --git a/src/analysis/disass/links.h b/src/analysis/disass/links.h index b1f5a71..d12710b 100644 --- a/src/analysis/disass/links.h +++ b/src/analysis/disass/links.h @@ -35,7 +35,7 @@ void establish_natural_link(GArchInstruction *, GArchInstruction *); /* Complète un désassemblage accompli pour une instruction. */ -void establish_links_for_instruction(GArchInstruction *, const GBinFormat *, const GArchProcessor *); +void establish_links_for_instruction(GArchInstruction *, GBinFormat *, const GArchProcessor *); diff --git a/src/arch/target.c b/src/arch/target.c index 4e731ec..bf4da3a 100644 --- a/src/arch/target.c +++ b/src/arch/target.c @@ -307,7 +307,7 @@ virt_t g_target_operand_get_addr(const GTargetOperand *operand) * * ******************************************************************************/ -bool g_target_operand_resolve(GTargetOperand *operand, const GBinFormat *format, bool strict) +bool g_target_operand_resolve(GTargetOperand *operand, GBinFormat *format, bool strict) { bool result; /* Bilan à retourner */ vmpa2t addr; /* Adresse de recherche */ @@ -320,23 +320,7 @@ bool g_target_operand_resolve(GTargetOperand *operand, const GBinFormat *format, init_vmpa(&addr, VMPA_NO_PHYSICAL, operand->addr); - result = g_binary_format_resolve_symbol(format, &addr, &operand->symbol, &operand->diff); - - /** - * En cas de succès, le compteur de références du symbole trouvé a été incrémenté. - */ - - if (strict) - result &= (operand->diff == 0); - - if (!result && operand->symbol != NULL) - { - g_object_unref(G_OBJECT(operand->symbol)); - - operand->symbol = NULL; - operand->diff = 0; - - } + result = g_binary_format_resolve_symbol(format, &addr, strict, &operand->symbol, &operand->diff); return result; diff --git a/src/arch/target.h b/src/arch/target.h index a284c09..9031ddc 100644 --- a/src/arch/target.h +++ b/src/arch/target.h @@ -64,7 +64,7 @@ MemoryDataSize g_target_operand_get_size(const GTargetOperand *); virt_t g_target_operand_get_addr(const GTargetOperand *); /* Tente une résolution de symbole. */ -bool g_target_operand_resolve(GTargetOperand *, const GBinFormat *, bool); +bool g_target_operand_resolve(GTargetOperand *, GBinFormat *, bool); /* Fournit les indications concernant le symbole associé. */ GBinSymbol *g_target_operand_get_symbol(const GTargetOperand *, phys_t *); diff --git a/src/format/format.c b/src/format/format.c index 5b44156..ef8258f 100644 --- a/src/format/format.c +++ b/src/format/format.c @@ -812,6 +812,7 @@ bool g_binary_format_find_next_symbol_at(GBinFormat *format, const vmpa2t *addr, * * * Paramètres : format = informations chargées à consulter. * * addr = adresse à cibler lors des recherches. * +* strict = indication de tolérance acceptée. * * symbol = éventuel symbole trouvé à déréfenrencer. [OUT] * * diff = décallage entre l'adresse et le symbole. [OUT] * * * @@ -823,17 +824,23 @@ bool g_binary_format_find_next_symbol_at(GBinFormat *format, const vmpa2t *addr, * * ******************************************************************************/ -bool g_binary_format_resolve_symbol(GBinFormat *format, const vmpa2t *addr, GBinSymbol **symbol, phys_t *diff) +bool g_binary_format_resolve_symbol(GBinFormat *format, const vmpa2t *addr, bool strict, GBinSymbol **symbol, phys_t *diff) { bool result; /* Bilan à retourner */ const mrange_t *range; /* Espace mémoire parcouru */ - result = g_binary_format_find_symbol_for(format, addr, symbol); + if (strict) + result = g_binary_format_find_symbol_at(format, addr, symbol); + else + result = g_binary_format_find_symbol_for(format, addr, symbol); if (result) { range = g_binary_symbol_get_range(*symbol); *diff = compute_vmpa_diff(get_mrange_addr(range), addr); + + assert(!strict || *diff == 0); + } return result; diff --git a/src/format/format.h b/src/format/format.h index e21e478..4d5cac5 100644 --- a/src/format/format.h +++ b/src/format/format.h @@ -92,7 +92,7 @@ bool g_binary_format_find_symbol_for(GBinFormat *, const vmpa2t *, GBinSymbol ** bool g_binary_format_find_next_symbol_at(GBinFormat *, const vmpa2t *, GBinSymbol **); /* Recherche le symbole correspondant à une adresse. */ -bool g_binary_format_resolve_symbol(GBinFormat *, const vmpa2t *, GBinSymbol **, phys_t *); +bool g_binary_format_resolve_symbol(GBinFormat *, const vmpa2t *, bool, GBinSymbol **, phys_t *); /* Fournit le prototype de toutes les routines détectées. */ GBinRoutine **g_binary_format_get_routines(const GBinFormat *, size_t *); diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c index 95166d7..cff10fe 100644 --- a/src/gtkext/gtkstatusstack.c +++ b/src/gtkext/gtkstatusstack.c @@ -578,7 +578,7 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL /* Symbole concerné */ - if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), addr, &symbol, &diff)) + if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), addr, false, &symbol, &diff)) { label = g_binary_symbol_get_label(symbol); diff --git a/src/gui/dialogs/gotox.c b/src/gui/dialogs/gotox.c index 5d19fee..0511be8 100644 --- a/src/gui/dialogs/gotox.c +++ b/src/gui/dialogs/gotox.c @@ -378,7 +378,7 @@ static void add_new_location_to_list(GtkTreeStore *store, GLoadedBinary *binary, { format = G_BIN_FORMAT(g_loaded_binary_get_format(binary)); - if (g_binary_format_resolve_symbol(format, addr, &symbol, &diff)) + if (g_binary_format_resolve_symbol(format, addr, true, &symbol, &diff)) { label = g_binary_symbol_get_label(symbol); |