From 64750293757199a92f95bdfb065ef979522e2934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Tue, 10 Oct 2006 00:52:44 +0000 Subject: [PATCH] +2006-10-09 Soren Sandmann + + * binfile.c (bin_file_get_inode): Remove this function + + * binfile.c (bin_file_check_inode): New function. Only print inode + warning once per BinFile. + + * process.c (process_get_vdso_bytes): Remove debug spew + --- ChangeLog | 9 +++++++++ binfile.c | 29 +++++++++++++++++++++++------ binfile.h | 3 ++- process.c | 12 ++++-------- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6fd32da..209834a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-10-09 Soren Sandmann + + * binfile.c (bin_file_get_inode): Remove this function + + * binfile.c (bin_file_check_inode): New function. Only print inode + warning once per BinFile. + + * process.c (process_get_vdso_bytes): Remove debug spew + 2006-10-09 Soren Sandmann * process.c (process_get_vdso_bytes): New function. diff --git a/binfile.c b/binfile.c index 91eadc86..94866d97 100644 --- a/binfile.c +++ b/binfile.c @@ -45,11 +45,13 @@ struct BinFile ElfParser * elf; char * filename; - ino_t inode; char * undefined_name; gulong text_offset; + + gboolean inode_check; + ino_t inode; }; /* FIXME: error handling */ @@ -244,7 +246,8 @@ bin_file_new (const char *filename) bf->elf = find_separate_debug_file (bf->elf, filename); } - + + bf->inode_check = FALSE; bf->inode = read_inode (filename); bf->filename = g_strdup (filename); bf->undefined_name = g_strdup_printf ("In file %s", filename); @@ -309,14 +312,28 @@ bin_file_lookup_symbol (BinFile *bin_file, return (const BinSymbol *)bin_file->undefined_name; } -ino_t -bin_file_get_inode (BinFile *bin_file) +gboolean +bin_file_check_inode (BinFile *bin_file, + ino_t inode) { - return bin_file->inode; + if (bin_file->inode == inode) + return TRUE; + + if (!bin_file->inode_check) + { + g_print ("warning: %s has inode %lld. It should be %lld\n", + bin_file->filename, + (guint64)bin_file->inode, (guint64)inode); + + bin_file->inode_check = TRUE; + } + + return FALSE; } const char * -bin_symbol_get_name (BinFile *file, const BinSymbol *symbol) +bin_symbol_get_name (BinFile *file, + const BinSymbol *symbol) { if (file->undefined_name == (char *)symbol) return file->undefined_name; diff --git a/binfile.h b/binfile.h index c9f012fe..713b2250 100644 --- a/binfile.h +++ b/binfile.h @@ -36,7 +36,8 @@ BinFile * bin_file_new (const char *filename); void bin_file_free (BinFile *bin_file); const BinSymbol *bin_file_lookup_symbol (BinFile *bin_file, gulong address); -ino_t bin_file_get_inode (BinFile *bin_file); +gboolean bin_file_check_inode (BinFile *bin_file, + ino_t inode); const char * bin_symbol_get_name (BinFile *bin_file, const BinSymbol *symbol); diff --git a/process.c b/process.c index 95a84f7e..ae73990f 100644 --- a/process.c +++ b/process.c @@ -118,9 +118,9 @@ read_maps (int pid) if (strcmp (map->filename, "[vdso]") == 0) { - /* The kernel reports offset the same as the - * mapping address, which doesn't make much sense - * to me. So just zero it out here + /* For the vdso, the kernel reports 'offset' as the + * the same as the mapping addres. This doesn't make + * any sense to me, so we just zero it here. */ #if 0 g_print ("fixing up\n"); @@ -202,8 +202,6 @@ process_get_vdso_bytes (gsize *length) if (length) *length = n_bytes; - g_print ("the vdso is %p\n", bytes); - return bytes; } @@ -660,14 +658,12 @@ process_lookup_symbol (Process *process, gulong address) /* g_print ("%s: start: %p, load: %p\n", */ /* map->filename, map->start, bin_file_get_load_address (map->bin_file)); */ - if (map->inode != bin_file_get_inode (map->bin_file)) + if (!bin_file_check_inode (map->bin_file, map->inode)) { /* If the inodes don't match, it's probably because the * file has changed since the process started. Just return * the undefined symbol in that case. */ - g_print ("warning: %s has wrong inode (%d, should be %d)\n", - map->filename, map->inode, bin_file_get_inode (map->bin_file)); address = 0x0; }