+2006-10-09 Soren Sandmann <sandmann@redhat.com>

+
+       * 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
+
This commit is contained in:
Søren Sandmann Pedersen
2006-10-10 00:52:44 +00:00
parent b54b0809b6
commit 6475029375
4 changed files with 38 additions and 15 deletions

View File

@ -1,3 +1,12 @@
2006-10-09 Soren Sandmann <sandmann@redhat.com>
* 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 <ssp@localhost.localdomain>
* process.c (process_get_vdso_bytes): New function.

View File

@ -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;

View File

@ -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);

View File

@ -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;
}