Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Side by Side Diff: src/processor/proc_maps_linux.cc

Issue 1288323003: Fix format specifier in proc maps to support 32-bit architectures. (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/google_breakpad/processor/proc_maps_linux.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "google_breakpad/processor/proc_maps_linux.h" 5 #include "google_breakpad/processor/proc_maps_linux.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #if defined(OS_LINUX) || defined(OS_ANDROID) 10 #if defined(OS_LINUX) || defined(OS_ANDROID)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 int path_index = 0; 54 int path_index = 0;
55 55
56 // Sample format from man 5 proc: 56 // Sample format from man 5 proc:
57 // 57 //
58 // address perms offset dev inode pathname 58 // address perms offset dev inode pathname
59 // 08048000-08056000 r-xp 00000000 03:0c 64593 /usr/sbin/gpm 59 // 08048000-08056000 r-xp 00000000 03:0c 64593 /usr/sbin/gpm
60 // 60 //
61 // The final %n term captures the offset in the input string, which is used 61 // The final %n term captures the offset in the input string, which is used
62 // to determine the path name. It *does not* increment the return value. 62 // to determine the path name. It *does not* increment the return value.
63 // Refer to man 3 sscanf for details. 63 // Refer to man 3 sscanf for details.
64 if (sscanf(line, "%lx-%lx %4c %lx %hhx:%hhx %ld %n", 64 if (sscanf(line, "%" SCNx64 "-%" SCNx64 " %4c %" SCNx64" %hhx:%hhx %"
65 &region.start, &region.end, permissions, &region.offset, 65 SCNd64 " %n", &region.start, &region.end, permissions,
66 &region.major_device, &region.minor_device, &region.inode, 66 &region.offset, &region.major_device, &region.minor_device,
67 &path_index) < 7) { 67 &region.inode, &path_index) < 7) {
68 BPLOG(ERROR) << "sscanf failed for line: " << line; 68 BPLOG(ERROR) << "sscanf failed for line: " << line;
69 return false; 69 return false;
70 } 70 }
71 71
72 region.permissions = 0; 72 region.permissions = 0;
73 73
74 if (permissions[0] == 'r') 74 if (permissions[0] == 'r')
75 region.permissions |= MappedMemoryRegion::READ; 75 region.permissions |= MappedMemoryRegion::READ;
76 else if (permissions[0] != '-') 76 else if (permissions[0] != '-')
77 return false; 77 return false;
(...skipping 17 matching lines...) Expand all
95 regions.push_back(region); 95 regions.push_back(region);
96 regions.back().path.assign(line + path_index); 96 regions.back().path.assign(line + path_index);
97 regions.back().line.assign(line); 97 regions.back().line.assign(line);
98 } 98 }
99 99
100 regions_out->swap(regions); 100 regions_out->swap(regions);
101 return true; 101 return true;
102 } 102 }
103 103
104 } // namespace google_breakpad 104 } // namespace google_breakpad
OLDNEW
« no previous file with comments | « src/google_breakpad/processor/proc_maps_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698