From c1025c6b445574bc680b1d31ed737873b90abb6d Mon Sep 17 00:00:00 2001 From: Søren Sandmann Date: Fri, 9 Feb 2007 21:30:01 +0000 Subject: Don't store the size of the symbol. (elf_parser_lookup_symbol): Look it up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fri Feb 9 16:16:34 2007 Søren Sandmann * elfparser.c (struct ElfSym): Don't store the size of the symbol. (elf_parser_lookup_symbol): Look it up here instaed. * binfile.c (bin_file_free): Use pre-decrement instead of post-decrement. (bin_file_check_inode): Clarify the warning a little svn path=/trunk/; revision=349 --- ChangeLog | 9 +++++++++ binfile.c | 9 ++++----- elfparser.c | 17 ++++++++++++----- sysprof-text.c | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 426e744..6c5d322 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Fri Feb 9 16:16:34 2007 Søren Sandmann + + * elfparser.c (struct ElfSym): Don't store the size of the symbol. + (elf_parser_lookup_symbol): Look it up here instaed. + + * binfile.c (bin_file_free): Use pre-decrement instead of + post-decrement. + (bin_file_check_inode): Clarify the warning a little + Mon Jan 22 17:42:29 2007 Søren Sandmann * sysprof-icon-32.png diff --git a/binfile.c b/binfile.c index 89b4421..02f26d7 100644 --- a/binfile.c +++ b/binfile.c @@ -269,7 +269,6 @@ bin_file_new (const char *filename) else { bf->elf = elf_parser_new (filename, NULL); - #if 0 if (!bf->elf) g_print ("Could not parse file %s\n", filename); @@ -313,7 +312,7 @@ bin_file_new (const char *filename) void bin_file_free (BinFile *bin_file) { - if (bin_file->ref_count-- == 0) + if (--bin_file->ref_count == 0) { g_hash_table_remove (bin_files, bin_file->filename); @@ -364,8 +363,8 @@ bin_file_lookup_symbol (BinFile *bin_file, } gboolean -bin_file_check_inode (BinFile *bin_file, - ino_t inode) +bin_file_check_inode (BinFile *bin_file, + ino_t inode) { if (bin_file->inode == inode) return TRUE; @@ -375,7 +374,7 @@ bin_file_check_inode (BinFile *bin_file, if (!bin_file->inode_check) { - g_print ("warning: %s has inode %lld. It should be %lld\n", + g_print ("warning: Inode mismatch for %s (disk: %lld, memory: %lld)\n", bin_file->filename, (guint64)bin_file->inode, (guint64)inode); diff --git a/elfparser.c b/elfparser.c index a9ec0d1..2dfcaf4 100644 --- a/elfparser.c +++ b/elfparser.c @@ -11,7 +11,6 @@ struct ElfSym { gulong offset; gulong address; - gulong size; }; struct Section @@ -381,8 +380,6 @@ read_table (ElfParser *parser, { parser->symbols[n_functions].address = addr; parser->symbols[n_functions].offset = offset; - parser->symbols[n_functions].size = - bin_record_get_uint (symbol, "st_size"); n_functions++; } @@ -485,9 +482,19 @@ elf_parser_lookup_symbol (ElfParser *parser, } #endif - if (result && result->address + result->size <= address) - result = NULL; + if (result) + { + gulong size; + BinRecord *record; + + record = bin_parser_get_record (parser->parser, parser->sym_format, result->offset); + size = bin_record_get_uint (record, "st_size"); + bin_record_free (record); + if (result->address + size <= address) + result = NULL; + } + return result; } diff --git a/sysprof-text.c b/sysprof-text.c index e142169..23c72bb 100644 --- a/sysprof-text.c +++ b/sysprof-text.c @@ -61,7 +61,7 @@ dump_data (Application *app) } } -void +static void signal_handler (int signo, gpointer data) { -- cgit v1.2.3