diff --git a/ChangeLog b/ChangeLog index 4d7ec027..254c0ce0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jun 2 01:10:38 2008 Søren Sandmann + + * binfile.c (get_debug_binaries): Simplify loop. + Mon Jun 2 00:58:17 2008 Søren Sandmann * binfile.c (get_debug_binaries): Actually recurse on the diff --git a/binfile.c b/binfile.c index 74c9ba4e..fc1fd552 100644 --- a/binfile.c +++ b/binfile.c @@ -147,9 +147,9 @@ get_build_id_file (ElfParser *elf) } static ElfParser * -get_debuglink_file (ElfParser *elf, - const char *filename, - char **new_name) +get_debuglink_file (ElfParser *elf, + const char *filename, + char **new_name) { #define N_TRIES 4 const char *basename; @@ -217,42 +217,41 @@ get_debug_binaries (GList *files, const char *filename) { ElfParser *build_id_file; - ElfParser *debuglink_file; GHashTable *seen_names; GList *free_us = NULL; +#if 0 build_id_file = get_build_id_file (elf); if (build_id_file) return g_list_prepend (files, build_id_file); +#endif /* .gnu_debuglink is actually a chain of debuglinks, and - * there have been cases where you'd have to follow it. + * there have been real-world cases where following it was + * necessary to get useful debug information. */ seen_names = g_hash_table_new (g_str_hash, g_str_equal); - do + while (elf) { char *debug_name; if (g_hash_table_lookup (seen_names, filename)) break; - + g_hash_table_insert (seen_names, (char *)filename, (char *)filename); - debuglink_file = get_debuglink_file (elf, filename, &debug_name); + elf = get_debuglink_file (elf, filename, &debug_name); - if (debuglink_file) + if (elf) { + files = g_list_prepend (files, elf); free_us = g_list_prepend (free_us, debug_name); - files = g_list_prepend (files, debuglink_file); - filename = debug_name; - elf = debuglink_file; } } - while (debuglink_file); - + g_list_foreach (free_us, (GFunc)g_free, NULL); g_list_free (free_us);