From 3d28b198f12671e4933890a4b79933d064593ce3 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 7 May 2016 18:34:44 +0200 Subject: Added debug code to avoid crashes with wrongly disassembled binaries. --- ChangeLog | 8 ++++++++ src/analysis/disass/routines.c | 12 ++++++++++++ src/format/elf/symbols.c | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1ab08bd..7057d72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +16-05-07 Cyrille Bagard + + * src/analysis/disass/routines.c: + Add debug code to avoid crashes with wrongly disassembled binaries. + + * src/format/elf/symbols.c + Extend a debug output. + 16-05-06 Cyrille Bagard * src/arch/arm/v7/Makefile.am: diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c index 3e0aa71..94afbe4 100644 --- a/src/analysis/disass/routines.c +++ b/src/analysis/disass/routines.c @@ -304,6 +304,18 @@ void g_routines_study_handle_blocks(GRoutinesStudy *study, size_t index) knight = begin_dragon_knight(study->proc, coverage, range, start); + + /** + * FIXME + * L'état 'knight == NULL' peut avoir deux origines : + * - soit le binaire est mal-formé. + * - soit le désassemblage s'est mal déroulé. + * Dans les deux cas, on obtient un symbole qui n'a pas d'instruction de départ. + * A traiter autrement qu'en filtrant sur knight... + */ + if (knight == NULL) return; + + /* Traitement par blocs */ detect_loops_in_code(knight); diff --git a/src/format/elf/symbols.c b/src/format/elf/symbols.c index fa7cb8f..91a4b71 100644 --- a/src/format/elf/symbols.c +++ b/src/format/elf/symbols.c @@ -646,7 +646,7 @@ static bool load_elf_internal_symbols(GElfFormat *format) /* Routine */ - printf("SYM ADDING>> '%s'\n", name); + printf("SYM ADDING>> '%s' @ 0x%08x\n", name, (unsigned int)virt); routine = try_to_demangle_routine(name); -- cgit v0.11.2-87-g4458