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

Unified Diff: breakpad/linux/minidump_writer.cc

Issue 146001: Fill in sys_info->csd_version_rva on Linux. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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: breakpad/linux/minidump_writer.cc
===================================================================
--- breakpad/linux/minidump_writer.cc (revision 18986)
+++ breakpad/linux/minidump_writer.cc (working copy)
@@ -51,6 +51,7 @@
#include <errno.h>
#include <sys/ucontext.h>
#include <sys/user.h>
+#include <sys/utsname.h>
#include "client/minidump_file_writer.h"
#include "google_breakpad/common/minidump_format.h"
@@ -599,6 +600,7 @@
dirent->location = si.location();
WriteCPUInformation(si.get());
+ WriteOSInformation(si.get());
return true;
}
@@ -770,6 +772,52 @@
return true;
}
+ bool WriteOSInformation(MDRawSystemInfo* sys_info) {
+ sys_info->platform_id = MD_OS_LINUX;
+
+ struct utsname uts;
+ if (uname(&uts))
+ return false;
+
+ static const size_t buf_len = 512;
+ char buf[buf_len] = {0};
+ size_t space_left = buf_len - 1;
+ const char* info_table[] = {
+ uts.sysname,
+ uts.release,
+ uts.version,
+ uts.machine,
+ NULL
+ };
+ bool first_item = true;
+ for (const char** cur_info = info_table; *cur_info; cur_info++) {
+ static const char* separator = " ";
+ size_t separator_len = strlen(separator);
+ size_t info_len = strlen(*cur_info);
+ if (info_len == 0)
+ continue;
+
+ if (space_left < info_len + (first_item ? 0 : separator_len))
+ break;
+
+ if (!first_item) {
+ strcat(buf, separator);
+ space_left -= separator_len;
+ }
+
+ first_item = false;
+ strcat(buf, *cur_info);
+ space_left -= info_len;
+ }
+
+ MDLocationDescriptor location;
+ if (!minidump_writer_.WriteString(buf, 0, &location))
+ return false;
+ sys_info->csd_version_rva = location.rva;
+
+ return true;
+ }
+
bool WriteProcFile(MDLocationDescriptor* result, pid_t pid,
const char* filename) {
char buf[80];
« 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