Commit a9e4a68e authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Parse /proc/self/maps lines better to handle variations between Linux kernels.

It seems noone has had time to file a bug on this.
Review URL: http://codereview.chromium.org/4210

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@360 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9d30045d
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <sys/fcntl.h> // open #include <sys/fcntl.h> // open
#include <unistd.h> // getpagesize #include <unistd.h> // getpagesize
#include <execinfo.h> // backtrace, backtrace_symbols #include <execinfo.h> // backtrace, backtrace_symbols
#include <strings.h> // index
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -335,12 +336,13 @@ void OS::LogSharedLibraryAddresses() { ...@@ -335,12 +336,13 @@ void OS::LogSharedLibraryAddresses() {
if (result < 1) break; if (result < 1) break;
} while (buffer[bytes_read] != '\n'); } while (buffer[bytes_read] != '\n');
buffer[bytes_read] = 0; 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. // Ignore mappings that are not executable.
if (buffer[3] != 'x') continue; 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; buffer[bytes_read] = 0;
LOG(SharedLibraryEvent(buffer + 56, start, end)); LOG(SharedLibraryEvent(start_of_path, start, end));
} }
close(fd); close(fd);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment