Bug 685870 - Fix about:memory's smaps breakdown on Android. r=khuey
authorJustin Lebar <justin.lebar@gmail.com>
Sat, 10 Sep 2011 11:20:48 -0400
changeset 77910 d069439624f53f01c6438687ff4a261a802167a7
parent 77909 c5ed260e9a49f44f2286e0231bf4f6ffaec85535
child 77911 ab8c0ebe600b7687cba76d7c2a429772ac9c0830
push id340
push userclegnitto@mozilla.com
push dateTue, 08 Nov 2011 22:56:33 +0000
treeherdermozilla-beta@f745dc151615 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs685870
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 685870 - Fix about:memory's smaps breakdown on Android. r=khuey
xpcom/base/MapsMemoryReporter.cpp
--- a/xpcom/base/MapsMemoryReporter.cpp
+++ b/xpcom/base/MapsMemoryReporter.cpp
@@ -236,38 +236,41 @@ MapsReporter::ParseMapping(
   //   address           perms offset  dev   inode  pathname
   //   02366000-025d8000 rw-p 00000000 00:00 0      [heap]
 
   const int argCount = 8;
 
   unsigned long long addrStart, addrEnd;
   char perms[5];
   unsigned long long offset;
-  unsigned int devMajor, devMinor, inode;
+  char devMajor[3];
+  char devMinor[3];
+  unsigned int inode;
   char path[1025];
 
   // A path might not be present on this line; set it to the empty string.
   path[0] = '\0';
 
   // This is a bit tricky.  Whitespace in a scanf pattern matches *any*
   // whitespace, including newlines.  We want this pattern to match a line
   // with or without a path, but we don't want to look to a new line for the
   // path.  Thus we have %u%1024[^\n] at the end of the pattern.  This will
   // capture into the path some leading whitespace, which we'll later trim off.
-  int numRead = fscanf(aFile, "%llx-%llx %4s %llx %u:%u %u%1024[^\n]",
-                       &addrStart, &addrEnd, perms, &offset, &devMajor,
-                       &devMinor, &inode, path);
+  int numRead = fscanf(aFile, "%llx-%llx %4s %llx %2s:%2s %u%1024[^\n]",
+                       &addrStart, &addrEnd, perms, &offset, devMajor,
+                       devMinor, &inode, path);
 
   // Eat up any whitespace at the end of this line, including the newline.
   fscanf(aFile, " ");
 
   // We might or might not have a path, but the rest of the arguments should be
   // there.
-  if (numRead != argCount && numRead != argCount - 1)
+  if (numRead != argCount && numRead != argCount - 1) {
     return NS_ERROR_FAILURE;
+  }
 
   nsCAutoString name, description;
   GetReporterNameAndDescription(path, perms, name, description);
 
   while (true) {
     nsresult rv = ParseMapBody(aFile, name, description, aCallback, aClosure);
     if (NS_FAILED(rv))
       break;