This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Patch: Fix the segment missing in gcore maps parser.
- From: "Nora Pan" <qpan at mvista dot com>
- To: <gdb-patches at sources dot redhat dot com>
- Date: Sun, 20 Mar 2005 16:55:45 -0800
- Subject: Patch: Fix the segment missing in gcore maps parser.
A bug in gdb /proc/<pid>/maps parser causes gcore can't capture the
segments following the one with a file name and zero inode entry in the
maps file. For example:
30028000-3002f000 rw-s 00000000 00:05 0 /SYSV0000bdad (deleted)
Okay for mainline?
--
Nora Pan
MontaVista Software
2005-03-18 Nora Pan <qpan@mvista.com>
* linux-nat.c (read_mapping): Capturing the segments after the
one with file name and zero inode.
diff -urNp src/gdb.orig/linux-nat.c src/gdb/linux-nat.c
--- src/gdb.orig/linux-nat.c 2005-03-06 08:42:20.000000000 -0800
+++ src/gdb/linux-nat.c 2005-03-18 17:48:05.000000000 -0800
@@ -2453,7 +2453,8 @@ read_mapping (FILE *mapfile,
int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
addr, endaddr, permissions, offset, device, inode);
- if (ret > 0 && ret != EOF && *inode != 0)
+ filename[0] = '\0';
+ if (ret > 0 && ret != EOF)
{
/* Eat everything up to EOL for the filename. This will prevent
weird filenames (such as one with embedded whitespace) from
@@ -2464,11 +2465,7 @@ read_mapping (FILE *mapfile,
only. */
ret += fscanf (mapfile, "%[^\n]\n", filename);
}
- else
- {
- filename[0] = '\0'; /* no filename */
- fscanf (mapfile, "\n");
- }
+
return (ret != 0 && ret != EOF);
}