diff options
author | thestig@google.com <thestig@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 00:35:47 +0000 |
---|---|---|
committer | thestig@google.com <thestig@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 00:35:47 +0000 |
commit | 62e22cbfe72cf7d6784210516928ed445880b158 (patch) | |
tree | 8b36384f322dc337ef4b81d70f30de4f1bed7840 /chrome/app | |
parent | 959a20f4111f323a2420ea7010e4fa2a8aaac21a (diff) | |
download | chromium_src-62e22cbfe72cf7d6784210516928ed445880b158.zip chromium_src-62e22cbfe72cf7d6784210516928ed445880b158.tar.gz chromium_src-62e22cbfe72cf7d6784210516928ed445880b158.tar.bz2 |
Generate GUIDs for users who wish to upload crash reports. Include it in crash reports.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/118096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app')
-rw-r--r-- | chrome/app/breakpad_linux.cc | 58 | ||||
-rw-r--r-- | chrome/app/breakpad_linux.h | 7 |
2 files changed, 53 insertions, 12 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc index 0985bd4..0712241 100644 --- a/chrome/app/breakpad_linux.cc +++ b/chrome/app/breakpad_linux.cc @@ -36,8 +36,11 @@ static void write_uint64_hex(char* output, uint64_t v) { } } -pid_t UploadCrashDump(const char* filename, const char* crash_url, - unsigned crash_url_length) { +pid_t UploadCrashDump(const char* filename, + const char* crash_url, + unsigned crash_url_length, + const char* guid, + unsigned guid_length) { // WARNING: this code runs in a compromised context. It may not call into // libc nor allocate memory normally. @@ -128,6 +131,9 @@ pid_t UploadCrashDump(const char* filename, const char* crash_url, // Content-Disposition: form-data; name="ver" \r\n \r\n (11..15) // 1.2.3.4 \r\n (16, 17) // BOUNDARY \r\n (18, 19) + // Content-Disposition: form-data; name="guid" \r\n \r\n (20..24) + // 1.2.3.4 \r\n (25, 26) + // BOUNDARY \r\n (27, 28) // // zero or more: // Content-Disposition: form-data; name="url-chunk-1" \r\n \r\n (0..5) @@ -145,13 +151,14 @@ pid_t UploadCrashDump(const char* filename, const char* crash_url, static const char quote_msg[] = {'"'}; static const char chrome_linux_msg[] = "Chrome_Linux"; static const char ver_msg[] = "ver"; + static const char guid_msg[] = "guid"; static const char dashdash_msg[] = {'-', '-'}; static const char dump_msg[] = "upload_file_minidump\"; filename=\"dump\""; static const char content_type_msg[] = "Content-Type: application/octet-stream"; static const char url_chunk_msg[] = "url-chunk-"; - struct kernel_iovec iov[20]; + struct kernel_iovec iov[29]; iov[0].iov_base = mime_boundary; iov[0].iov_len = sizeof(mime_boundary) - 1; iov[1].iov_base = const_cast<char*>(rn); @@ -199,7 +206,28 @@ pid_t UploadCrashDump(const char* filename, const char* crash_url, iov[19].iov_base = const_cast<char*>(rn); iov[19].iov_len = sizeof(rn); - sys_writev(fd, iov, 20); + iov[20].iov_base = const_cast<char*>(form_data_msg); + iov[20].iov_len = sizeof(form_data_msg) - 1; + iov[21].iov_base = const_cast<char*>(guid_msg); + iov[21].iov_len = sizeof(guid_msg) - 1; + iov[22].iov_base = const_cast<char*>(quote_msg); + iov[22].iov_len = sizeof(quote_msg); + iov[23].iov_base = const_cast<char*>(rn); + iov[23].iov_len = sizeof(rn); + iov[24].iov_base = const_cast<char*>(rn); + iov[24].iov_len = sizeof(rn); + + iov[25].iov_base = const_cast<char*>(guid); + iov[25].iov_len = guid_length; + iov[26].iov_base = const_cast<char*>(rn); + iov[26].iov_len = sizeof(rn); + + iov[27].iov_base = mime_boundary; + iov[27].iov_len = sizeof(mime_boundary) - 1; + iov[28].iov_base = const_cast<char*>(rn); + iov[28].iov_len = sizeof(rn); + + sys_writev(fd, iov, 29); if (crash_url_length) { unsigned i = 0, done = 0; @@ -338,7 +366,7 @@ pid_t UploadCrashDump(const char* filename, const char* crash_url, id_buf[len] = 0; static const char msg[] = "\nCrash dump id: "; sys_write(2, msg, sizeof(msg) - 1); - sys_write(2, id_buf, my_strlen(buf)); + sys_write(2, id_buf, my_strlen(id_buf)); sys_write(2, "\n", 1); } sys_unlink(filename); @@ -369,6 +397,13 @@ pid_t UploadCrashDump(const char* filename, const char* crash_url, return child; } +// This is defined in chrome/browser/google_update_settings_linux.cc, it's the +// static string containing the user's unique GUID. We send this in the crash +// report. +namespace google_update { +extern std::string linux_guid; +} + static bool CrashDone(const char* dump_path, const char* minidump_id, void* context, @@ -390,7 +425,8 @@ static bool CrashDone(const char* dump_path, memcpy(path + dump_path_len + 1 + minidump_id_len, ".dmp", 4); path[dump_path_len + 1 + minidump_id_len + 4] = 0; - UploadCrashDump(path, NULL, 0); + UploadCrashDump(path, NULL, 0, google_update::linux_guid.data(), + google_update::linux_guid.length()); return true; } @@ -425,14 +461,16 @@ RendererCrashHandler(const void* crash_context, size_t crash_context_size, struct msghdr sys_msg; }; my_memset(&msg, 0, sizeof(struct kernel_msghdr)); - struct kernel_iovec iov[2]; + struct kernel_iovec iov[3]; iov[0].iov_base = const_cast<void*>(crash_context); iov[0].iov_len = crash_context_size; - iov[1].iov_base = const_cast<char*>(renderer_logging::active_url.data()); - iov[1].iov_len = renderer_logging::active_url.size(); + iov[1].iov_base = const_cast<char*>(google_update::linux_guid.data()); + iov[1].iov_len = google_update::linux_guid.size(); + iov[2].iov_base = const_cast<char*>(renderer_logging::active_url.data()); + iov[2].iov_len = renderer_logging::active_url.size(); msg.msg_iov = iov; - msg.msg_iovlen = 2; + msg.msg_iovlen = 3; char cmsg[kControlMsgSize]; memset(cmsg, 0, kControlMsgSize); msg.msg_control = cmsg; diff --git a/chrome/app/breakpad_linux.h b/chrome/app/breakpad_linux.h index 4df9b5e..e55d12e 100644 --- a/chrome/app/breakpad_linux.h +++ b/chrome/app/breakpad_linux.h @@ -6,7 +6,10 @@ #define CHROME_APP_BREAKPAD_LINUX_H_ extern void InitCrashReporter(); -extern int UploadCrashDump(const char* filename, const char* crash_url, - unsigned crash_url_length); +extern int UploadCrashDump(const char* filename, + const char* crash_url, + unsigned crash_url_length, + const char* guid, + unsigned guid_length); #endif // CHROME_APP_BREAKPAD_LINUX_H_ |