This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch 2/2+7.6] /proc/PID/smaps: Linux kernel 3.8.3 compat.
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 29 Mar 2013 20:53:17 +0100
- Subject: [patch 2/2+7.6] /proc/PID/smaps: Linux kernel 3.8.3 compat.
Hi,
with kernel-3.8.3-203.fc18.x86_64 I get:
warning: Error parsing {s,}maps file '/proc/30100/smaps'
for example on gdb.base/gcore.exp as this Linux kernel has:
7fff76bfe000-7fff76c00000 r-xp 00000000 00:00 0 [vdso]
Size: 8 kB
[...]
Locked: 0 kB
VmFlags: rd ex mr mw me de
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
so the parsing fails on the "VmFlags" line.
While it is 'obvious' GDB CVS inaccessible to me now so neither regression
tested nor checked in yet.
Thanks,
Jan
gdb/
2013-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix compatibility with Linux kernel 3.8.3.
* linux-tdep.c (linux_find_memory_regions_full): Move variable number
to more inner block. Remove parsing of NUMBER from outer block.
Parse NUMBER only if KEYWORD has been identified.
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index cc63e9b..9def108 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -720,20 +720,30 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
line = strtok (NULL, "\n"))
{
char keyword[64 + 1];
- unsigned long number;
- if (sscanf (line, "%64s%lu kB\n", keyword, &number) != 2)
+ if (sscanf (line, "%64s", keyword) != 1)
{
warning (_("Error parsing {s,}maps file '%s'"), mapsfilename);
break;
}
if (strcmp (keyword, "Anonymous:") == 0)
has_anonymous = 1;
- if (number != 0 && (strcmp (keyword, "Shared_Dirty:") == 0
- || strcmp (keyword, "Private_Dirty:") == 0
- || strcmp (keyword, "Swap:") == 0
- || strcmp (keyword, "Anonymous:") == 0))
- modified = 1;
+ if (strcmp (keyword, "Shared_Dirty:") == 0
+ || strcmp (keyword, "Private_Dirty:") == 0
+ || strcmp (keyword, "Swap:") == 0
+ || strcmp (keyword, "Anonymous:") == 0)
+ {
+ unsigned long number;
+
+ if (sscanf (line, "%*s%lu", &number) != 1)
+ {
+ warning (_("Error parsing {s,}maps file '%s' number"),
+ mapsfilename);
+ break;
+ }
+ if (number != 0)
+ modified = 1;
+ }
}
/* Older Linux kernels did not support the "Anonymous:" counter.