From 282783bf2bf47ad4b7140e23678b5e368297ab68 Mon Sep 17 00:00:00 2001 From: Soren Sandmann Pedersen Date: Thu, 8 May 2008 00:17:13 +0000 Subject: [PATCH] Fix bug where the build id name was generated incorrectly. 2008-05-07 Soren Sandmann Pedersen * binfile.c (get_build_id_file): Fix bug where the build id name was generated incorrectly. Make a copy of the debug name, not the input name. svn path=/trunk/; revision=418 --- ChangeLog | 7 +++++++ TODO | 3 +++ binfile.c | 6 +++--- elfparser.c | 6 ++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08007f20..7dec45ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-05-07 Soren Sandmann Pedersen + + * binfile.c (get_build_id_file): Fix bug where the build id name + was generated incorrectly. + + Make a copy of the debug name, not the input name. + 2008-04-26 Soren Sandmann * process.c (get_kernel_symbols): Don't leak kallsyms diff --git a/TODO b/TODO index 62e9c7ef..f2f0fcce 100644 --- a/TODO +++ b/TODO @@ -57,6 +57,9 @@ Before 1.2: * Find out why the samples label won't right adjust +* If we end up believing the kernel's own stacktraces, maybe + /proc/kallsyms shouldn't be parsed until the user hits profile. + * Elf bugs: - error handling for bin_parser is necessary. diff --git a/binfile.c b/binfile.c index fd6dd23a..8c956418 100644 --- a/binfile.c +++ b/binfile.c @@ -172,7 +172,7 @@ get_build_id_file (ElfParser *elf, return NULL; init = g_strndup (build_id, 2); - rest = g_strdup_printf (build_id + 2, ".debug"); + rest = g_strdup_printf ("%s%s", build_id + 2, ".debug"); tries = g_list_append (tries, g_build_filename ("/usr", "lib", "debug", ".build-id", init, rest, NULL)); tries = g_list_append (tries, g_build_filename (debug_file_directory, ".build-id", init, rest, NULL)); @@ -188,7 +188,7 @@ get_build_id_file (ElfParser *elf, if (file_id && strcmp (build_id, file_id) == 0) { - *new_name = g_strdup (filename); + *new_name = g_strdup (name); result = parser; break; } @@ -406,7 +406,7 @@ bin_file_lookup_symbol (BinFile *bin_file, #endif #if 0 - g_print ("%lx undefined in %s (textoffset %d)\n", address + bin_file->text_offset, bin_file->filename, bin_file->text_offset); + g_print ("%lx undefined in %s (textoffset %x)\n", address + bin_file->text_offset, bin_file->filename, bin_file->text_offset); #endif return (const BinSymbol *)bin_file->undefined_name; diff --git a/elfparser.c b/elfparser.c index 5a777a4e..ccd92542 100644 --- a/elfparser.c +++ b/elfparser.c @@ -618,7 +618,13 @@ elf_parser_lookup_symbol (ElfParser *parser, parser->parser, parser->sym_format, "st_size"); if (size > 0 && result->address + size <= address) + { +#if 0 + g_print (" elf: ends at %lx, so rejecting\n", + result->address + size); +#endif result = NULL; + } } if (result)