aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-04-05 19:17:15 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-04-05 19:17:15 +0000
commit9ead1b844cdb9577b65dec7beb61fda3bf99a12e (patch)
tree4139281885882968f5891af0021fbc235102a31a /gdb
parentd1794952bac2edb39746459aea05517124b01dbf (diff)
downloadgdb-9ead1b844cdb9577b65dec7beb61fda3bf99a12e.zip
gdb-9ead1b844cdb9577b65dec7beb61fda3bf99a12e.tar.gz
gdb-9ead1b844cdb9577b65dec7beb61fda3bf99a12e.tar.bz2
gdb/
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/linux-tdep.c24
2 files changed, 24 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9d31964..63c3fa9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2013-04-05 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.
+
+2013-04-05 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Fix variable name shadowing.
* linux-tdep.c (linux_find_memory_regions_full): Rename outer variable
filename to mapsfilename and update its uses.
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.