summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@redhat.com>2006-03-04 03:28:26 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2006-03-04 03:28:26 +0000
commitebb772876861246dfe3fd05c3078f6884a38fa27 (patch)
treeff11dc121018f9a00cd7235cba80cc6659641ee5 /process.c
parent0d6d997f4a57a44701542830aacf848f6e151dcc (diff)
Check that the inodes match.
Fri Mar 3 22:28:03 2006 Soeren Sandmann <sandmann@redhat.com> * process.c (process_lookup_symbol): Check that the inodes match. * binfile.c (read_symbols): Read the inode of the file * binfile.c (read_symbols): Close the bfd if the symbol table could not be read.
Diffstat (limited to 'process.c')
-rw-r--r--process.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/process.c b/process.c
index 80e1bc8..c99f872 100644
--- a/process.c
+++ b/process.c
@@ -41,6 +41,7 @@ struct Map
gulong start;
gulong end;
gulong offset;
+ gulong inode;
#if 0
gboolean do_offset;
#endif
@@ -95,15 +96,16 @@ read_maps (int pid)
gulong start;
gulong end;
gulong offset;
+ gulong inode;
#if 0
g_print ("buffer: %s\n", buffer);
#endif
count = sscanf (
- buffer, "%lx-%lx %*15s %lx %*x:%*x %*u %255s",
- &start, &end, &offset, file);
- if (count == 4)
+ buffer, "%lx-%lx %*15s %lx %*x:%*x %lu %255s",
+ &start, &end, &offset, &inode, file);
+ if (count == 5)
{
Map *map;
@@ -114,6 +116,8 @@ read_maps (int pid)
map->end = end;
map->offset = offset;
+
+ map->inode = inode;
map->bin_file = NULL;
@@ -567,16 +571,26 @@ process_lookup_symbol (Process *process, gulong address)
return &process->undefined;
}
-
+
address -= map->start;
address += map->offset;
if (!map->bin_file)
map->bin_file = bin_file_new (map->filename);
-
+
/* 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 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.
+ */
+
+ address = 0x0;
+ }
+
result = bin_file_lookup_symbol (map->bin_file, address);
#if 0