diff options
author | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-11 18:11:17 +0000 |
---|---|---|
committer | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-11 18:11:17 +0000 |
commit | 28f1d82073ff16dab8d12d6714548fab07933b70 (patch) | |
tree | 874ef45122dc3077df0c37f2ae4ae4662d0ff39d /components | |
parent | 9b2034036bc89b9045d904128e76ef94165f6bc7 (diff) | |
download | chromium_src-28f1d82073ff16dab8d12d6714548fab07933b70.zip chromium_src-28f1d82073ff16dab8d12d6714548fab07933b70.tar.gz chromium_src-28f1d82073ff16dab8d12d6714548fab07933b70.tar.bz2 |
Add instrumentation help figure out why the client ID is sometimes
missing from uploaded crashes.
BUG=371817
Review URL: https://codereview.chromium.org/275213003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/breakpad/app/breakpad_win.cc | 64 |
1 files changed, 53 insertions, 11 deletions
diff --git a/components/breakpad/app/breakpad_win.cc b/components/breakpad/app/breakpad_win.cc index 76f8fe7..b721b24 100644 --- a/components/breakpad/app/breakpad_win.cc +++ b/components/breakpad/app/breakpad_win.cc @@ -396,6 +396,29 @@ long WINAPI ServiceExceptionFilter(EXCEPTION_POINTERS* info) { return EXCEPTION_EXECUTE_HANDLER; } +// Sets |key| to |value|, g_dynamic_entries_lock must be held. +static void SetCrashKeyValueLocked(const std::wstring& safe_key, + const std::wstring& safe_value) { + DCHECK(g_dynamic_entries && g_dynamic_entries_lock); + DCHECK(safe_key.length() < google_breakpad::CustomInfoEntry::kNameMaxLength); + DCHECK(safe_value.length() < + google_breakpad::CustomInfoEntry::kValueMaxLength); + g_dynamic_entries_lock->AssertAcquired(); + + DynamicEntriesMap::iterator it = g_dynamic_entries->find(safe_key); + google_breakpad::CustomInfoEntry* entry = NULL; + if (it == g_dynamic_entries->end()) { + if (g_dynamic_entries->size() >= kMaxDynamicEntries) + return; + entry = &(*g_custom_entries)[g_dynamic_keys_offset++]; + g_dynamic_entries->insert(std::make_pair(safe_key, entry)); + } else { + entry = it->second; + } + + entry->set(safe_key.data(), safe_value.data()); +} + // NOTE: This function is used by SyzyASAN to annotate crash reports. If you // change the name or signature of this function you will break SyzyASAN // instrumented releases of Chrome. Please contact syzygy-team@chromium.org @@ -419,18 +442,28 @@ extern "C" void __declspec(dllexport) __cdecl SetCrashKeyValueImpl( DCHECK(g_dynamic_entries_lock); base::AutoLock lock(*g_dynamic_entries_lock); - DynamicEntriesMap::iterator it = g_dynamic_entries->find(safe_key); - google_breakpad::CustomInfoEntry* entry = NULL; - if (it == g_dynamic_entries->end()) { - if (g_dynamic_entries->size() >= kMaxDynamicEntries) - return; - entry = &(*g_custom_entries)[g_dynamic_keys_offset++]; - g_dynamic_entries->insert(std::make_pair(safe_key, entry)); - } else { - entry = it->second; - } + SetCrashKeyValueLocked(safe_key, safe_value); + + // TODO(siggi): remove this code, see http://crbug.com/371817. + static size_t guid_set_count = 0; + if (safe_key == L"guid") { + // Bracket the value to get something recorded if it's set to the empty + // string. Truncate to 61 char max, to allow for brackets and terminating + // zero in the allotted 64 chars. + std::wstring bracketed_guid = base::StringPrintf(L"{%.61ls}", value); + if (guid_set_count == 0) { + // Keep track of the first GUID set. + SetCrashKeyValueLocked(L"first-guid", bracketed_guid); + } else { + // Keep track of the last GUID set. + SetCrashKeyValueLocked(L"last-guid", bracketed_guid); + } - entry->set(safe_key.data(), safe_value.data()); + // Bump the set count and record the latest. + ++guid_set_count; + SetCrashKeyValueLocked(L"guid-set-count", + base::StringPrintf(L"%d", guid_set_count)); + } } extern "C" void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl( @@ -447,6 +480,15 @@ extern "C" void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl( return; it->second->set_value(NULL); + + // TODO(siggi): remove this code, see http://crbug.com/371817. + static size_t guid_clear_count = 0; + if (key_string == L"guid") { + // Bump the clear count and record the latest. + ++guid_clear_count; + SetCrashKeyValueLocked(L"guid-clear-count", + base::StringPrintf(L"%d", guid_clear_count)); + } } } // namespace |