diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-07-04 12:39:01 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-07-04 12:39:01 (GMT) |
commit | ade3ee4fd3b78e96deb08210838643969f2f6699 (patch) | |
tree | 09003a6f4ac00c09560de9ea9a91c125a7b14f68 /src/analysis/disass | |
parent | a0463dfa8fe232d01ea925668f393d7507fa787b (diff) |
Updated the API for building symbol labels.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r-- | src/analysis/disass/output.c | 15 | ||||
-rw-r--r-- | src/analysis/disass/routines.c | 16 |
2 files changed, 24 insertions, 7 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 928ee16..b9b0f1f 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -83,6 +83,7 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, GLineGenerator *generator; /* Générateur de contenu ajouté*/ const vmpa2t *saddr; /* Adresse de symbole */ int compared; /* Bilan d'une comparaison */ + char *label; /* Etiquette de symbole */ char *errmsg; /* Description d'une erreur */ SymbolType stype; /* Type de symbole trouvé */ vmpa2t intro_addr; /* Adresse de début de code */ @@ -212,12 +213,16 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, if (compared <= 0) break; - log_variadic_message(LMT_BAD_BINARY, - _("Unable to find a proper location for symbol '%s' @ 0x%08x"), - g_binary_symbol_get_label(symbol), get_phy_addr(saddr)); + label = g_binary_symbol_get_label(symbol); - asprintf(&errmsg, _("Unable to find a proper location for symbol '%s'"), - g_binary_symbol_get_label(symbol)); + if (label == NULL) + asprintf(&errmsg, _("Unable to find a proper location for symbol")); + + else + { + asprintf(&errmsg, _("Unable to find a proper location for symbol '%s'"), label); + free(label); + } g_arch_processor_add_error(proc, APE_LABEL, saddr, errmsg); diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c index a0f756c..f04611f 100644 --- a/src/analysis/disass/routines.c +++ b/src/analysis/disass/routines.c @@ -24,6 +24,9 @@ #include "routines.h" +#include <malloc.h> + + #include "dragon.h" #include "limit.h" #include "loop.h" @@ -336,6 +339,7 @@ void g_routines_study_handle_blocks(GRoutinesStudy *study, GBinRoutine *routine, const mrange_t *range; /* Couverture d'une routine */ const vmpa2t *start; /* Adresse de départ */ const instr_coverage *coverage; /* Instructions couvertes */ + char *label; /* Etiquette du symbole */ VMPA_BUFFER(loc); /* Position de la routine */ dragon_knight *knight; /* Complexité de code posée */ GBlockList *blocks; /* Liste de blocs basiques */ @@ -358,10 +362,18 @@ void g_routines_study_handle_blocks(GRoutinesStudy *study, GBinRoutine *routine, */ if (coverage == NULL) { + label = g_binary_symbol_get_label(symbol); + vmpa2_to_string(start, MDS_UNDEFINED, loc, NULL); - log_variadic_message(LMT_BAD_BINARY, _("Skipped out of bound routine '%s' @ %s"), - g_binary_routine_get_name(routine), loc); + if (label == NULL) + log_variadic_message(LMT_BAD_BINARY, _("Skipped out of bound routine @ %s"), loc); + + else + { + log_variadic_message(LMT_BAD_BINARY, _("Skipped out of bound routine '%s' @ %s"), label, loc); + free(label); + } return; |