| Index: components/breakpad/app/breakpad_win.cc
|
| diff --git a/components/breakpad/app/breakpad_win.cc b/components/breakpad/app/breakpad_win.cc
|
| index b721b2498c01419427e4ed275060e472f0fb6fe9..76f8fe7ee92475d48cd2ea0350fa716b48867ac8 100644
|
| --- a/components/breakpad/app/breakpad_win.cc
|
| +++ b/components/breakpad/app/breakpad_win.cc
|
| @@ -396,14 +396,28 @@
|
| 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();
|
| +// 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
|
| +// before doing so!
|
| +extern "C" void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(
|
| + const wchar_t* key, const wchar_t* value) {
|
| + if (!g_dynamic_entries)
|
| + return;
|
| +
|
| + // CustomInfoEntry limits the length of key and value. If they exceed
|
| + // their maximum length the underlying string handling functions raise
|
| + // an exception and prematurely trigger a crash. Truncate here.
|
| + std::wstring safe_key(std::wstring(key).substr(
|
| + 0, google_breakpad::CustomInfoEntry::kNameMaxLength - 1));
|
| + std::wstring safe_value(std::wstring(value).substr(
|
| + 0, google_breakpad::CustomInfoEntry::kValueMaxLength - 1));
|
| +
|
| + // If we already have a value for this key, update it; otherwise, insert
|
| + // the new value if we have not exhausted the pre-allocated slots for dynamic
|
| + // entries.
|
| + 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;
|
| @@ -419,53 +433,6 @@
|
| 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
|
| -// before doing so!
|
| -extern "C" void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(
|
| - const wchar_t* key, const wchar_t* value) {
|
| - if (!g_dynamic_entries)
|
| - return;
|
| -
|
| - // CustomInfoEntry limits the length of key and value. If they exceed
|
| - // their maximum length the underlying string handling functions raise
|
| - // an exception and prematurely trigger a crash. Truncate here.
|
| - std::wstring safe_key(std::wstring(key).substr(
|
| - 0, google_breakpad::CustomInfoEntry::kNameMaxLength - 1));
|
| - std::wstring safe_value(std::wstring(value).substr(
|
| - 0, google_breakpad::CustomInfoEntry::kValueMaxLength - 1));
|
| -
|
| - // If we already have a value for this key, update it; otherwise, insert
|
| - // the new value if we have not exhausted the pre-allocated slots for dynamic
|
| - // entries.
|
| - DCHECK(g_dynamic_entries_lock);
|
| - base::AutoLock lock(*g_dynamic_entries_lock);
|
| -
|
| - 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);
|
| - }
|
| -
|
| - // 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(
|
| const wchar_t* key) {
|
| if (!g_dynamic_entries)
|
| @@ -480,15 +447,6 @@
|
| 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
|
|
|