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

Unified Diff: src/platform-linux.cc

Issue 4210: Parse /proc/self/maps lines better to handle variations between Linux kernels... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc (revision 323)
+++ src/platform-linux.cc (working copy)
@@ -38,11 +38,12 @@
// executable. Otherwise, OS raises an exception when executing code
// in that page.
#include <sys/types.h> // mmap & munmap
-#include <sys/mman.h> // mmap & munmap
-#include <sys/stat.h> // open
+#include <sys/mman.h> // mmap & munmap
+#include <sys/stat.h> // open
#include <sys/fcntl.h> // open
-#include <unistd.h> // getpagesize
-#include <execinfo.h> // backtrace, backtrace_symbols
+#include <unistd.h> // getpagesize
+#include <execinfo.h> // backtrace, backtrace_symbols
+#include <strings.h> // index
#include <errno.h>
#include <stdarg.h>
@@ -335,12 +336,13 @@
if (result < 1) break;
} while (buffer[bytes_read] != '\n');
buffer[bytes_read] = 0;
- // There are 56 chars to ignore at this point in the line.
- if (bytes_read < 56) continue;
// Ignore mappings that are not executable.
if (buffer[3] != 'x') continue;
+ char* start_of_path = index(buffer, '/');
+ // There may be no filename in this line. Skip to next.
+ if (start_of_path == NULL) continue;
buffer[bytes_read] = 0;
- LOG(SharedLibraryEvent(buffer + 56, start, end));
+ LOG(SharedLibraryEvent(start_of_path, start, end));
}
close(fd);
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698