Commit 25c070b4 authored by danakj's avatar danakj Committed by Commit Bot

Add more crash keys to debug 1125106

Include dumps of the SiteInfo and ProcessLock for the current
RenderFrameHost and the speculative RenderFrameHost.

Also introduce SCOPED_CRASH_KEY_${TYPE} macros in base/ to simplify
writing crash keys and make them more readable.

R=alexmos@chromium.org

Bug: 1125106
Change-Id: I2e068592d9a74b196457be7fa5f96deae58c2011
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2477094
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817680}
parent 013a9973
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/base_export.h" #include "base/base_export.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
namespace base { namespace base {
...@@ -69,6 +70,35 @@ class BASE_EXPORT ScopedCrashKeyString { ...@@ -69,6 +70,35 @@ class BASE_EXPORT ScopedCrashKeyString {
DISALLOW_COPY_AND_ASSIGN(ScopedCrashKeyString); DISALLOW_COPY_AND_ASSIGN(ScopedCrashKeyString);
}; };
// Helper macros for putting a local variable crash key on the stack before
// causing a crash or calling CrashWithoutDumping().
#define SCOPED_CRASH_KEY_STRING32(category, name, value) \
static base::debug::CrashKeyString* const crash_key_string_##name = \
base::debug::AllocateCrashKeyString(#category "-" #name, \
base::debug::CrashKeySize::Size32); \
base::debug::ScopedCrashKeyString crash_scoper_##name( \
crash_key_string_##name, (value))
#define SCOPED_CRASH_KEY_STRING64(category, name, value) \
static base::debug::CrashKeyString* const crash_key_string_##name = \
base::debug::AllocateCrashKeyString(#category "-" #name, \
base::debug::CrashKeySize::Size64); \
base::debug::ScopedCrashKeyString crash_scoper_##name( \
crash_key_string_##name, (value))
#define SCOPED_CRASH_KEY_STRING256(category, name, value) \
static base::debug::CrashKeyString* const crash_key_string_##name = \
base::debug::AllocateCrashKeyString(#category "-" #name, \
base::debug::CrashKeySize::Size256); \
base::debug::ScopedCrashKeyString crash_scoper_##name( \
crash_key_string_##name, (value))
#define SCOPED_CRASH_KEY_BOOL(category, name, value) \
SCOPED_CRASH_KEY_STRING32(category, name, (value) ? "true" : "false")
#define SCOPED_CRASH_KEY_NUMBER(category, name, value) \
SCOPED_CRASH_KEY_STRING32(category, name, base::NumberToString(value))
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// The following declarations are used to initialize the crash key system // The following declarations are used to initialize the crash key system
// in //base by providing implementations for the above functions. // in //base by providing implementations for the above functions.
......
...@@ -6364,81 +6364,56 @@ void RenderFrameHostImpl::CommitNavigation( ...@@ -6364,81 +6364,56 @@ void RenderFrameHostImpl::CommitNavigation(
// TODO(crbug.com/1125106): A same document navigation can not be done // TODO(crbug.com/1125106): A same document navigation can not be done
// with a provisional frame, and yet it is happening inside a provisional // with a provisional frame, and yet it is happening inside a provisional
// frame somehow. // frame somehow.
using base::debug::AllocateCrashKeyString; RenderFrameHostImpl* current = frame_tree_node()->current_frame_host();
using base::debug::CrashKeySize; std::string from_url;
using base::debug::CrashKeyString; std::string from_site_info;
using base::debug::ScopedCrashKeyString; std::string from_process_lock;
int64_t from_item_seq_number = -2;
static CrashKeyString* const to_url_key = AllocateCrashKeyString( int64_t from_document_seq_number = -2;
"SpecSameDocNav-to-url", CrashKeySize::Size256); std::string to_url;
static CrashKeyString* const is_speculative_key = AllocateCrashKeyString( std::string to_site_info;
"SpecSameDocNav-is-speculative", CrashKeySize::Size32); std::string to_process_lock;
static CrashKeyString* const dest_rfh_last_committed_url_key = int64_t to_item_seq_number;
AllocateCrashKeyString("SpecSameDocNav-dest-rfh-last-committed-url", int64_t to_document_seq_number;
CrashKeySize::Size256); if (current) {
static CrashKeyString* const browser_initiated_key = SiteInstanceImpl* current_site = current->GetSiteInstance();
AllocateCrashKeyString("SpecSameDocNav-is-browser-initiated",
CrashKeySize::Size32); from_url = current->GetLastCommittedURL().possibly_invalid_spec();
static CrashKeyString* const to_item_sequence_number_key = from_site_info = current_site->GetSiteInfo().GetDebugString();
AllocateCrashKeyString("SpecSameDocNav-to-item-sequence-number", from_process_lock = current_site->GetProcessLock().ToString();
CrashKeySize::Size32); delegate_->GetFrameSequenceNumbersForDebugging(
static CrashKeyString* const to_document_sequence_number_key = current, from_item_seq_number, from_document_seq_number);
AllocateCrashKeyString("SpecSameDocNav-to-document-sequence-number", }
CrashKeySize::Size32); to_url = navigation_request->GetURL().possibly_invalid_spec();
static CrashKeyString* const from_url_key = AllocateCrashKeyString( to_site_info = GetSiteInstance()->GetSiteInfo().GetDebugString();
"SpecSameDocNav-from-url", CrashKeySize::Size256); to_process_lock = GetSiteInstance()->GetProcessLock().ToString();
static CrashKeyString* from_item_sequence_number_key = to_item_seq_number = navigation_request->ItemSequenceNumberForDebugging();
AllocateCrashKeyString("SpecSameDocNav-from-item-sequence-number", to_document_seq_number =
CrashKeySize::Size32); navigation_request->DocumentSequenceNumberForDebugging();
static CrashKeyString* from_document_sequence_number_key =
AllocateCrashKeyString("SpecSameDocNav-from-document-sequence-number", bool is_speculative =
CrashKeySize::Size32);
ScopedCrashKeyString to_url_scoper(
to_url_key, common_params->url.possibly_invalid_spec());
const bool is_speculative =
frame_tree_node()->render_manager()->speculative_frame_host() == this; frame_tree_node()->render_manager()->speculative_frame_host() == this;
ScopedCrashKeyString is_speculative_scoper( SCOPED_CRASH_KEY_BOOL(SpecSameDocNav, is_speculative, is_speculative);
is_speculative_key, is_speculative ? "true" : "false"); SCOPED_CRASH_KEY_BOOL(SpecSameDocNav, browser_initiated,
navigation_request->browser_initiated());
ScopedCrashKeyString dest_rfh_last_committed_url_scoper(
dest_rfh_last_committed_url_key, SCOPED_CRASH_KEY_NUMBER(SpecSameDocNav, from_item_sequence_number,
GetLastCommittedURL().possibly_invalid_spec()); from_item_seq_number);
SCOPED_CRASH_KEY_NUMBER(SpecSameDocNav, to_item_sequence_number,
const bool browser_initiated = navigation_request->browser_initiated(); to_item_seq_number);
ScopedCrashKeyString browser_initiated_scoper( SCOPED_CRASH_KEY_NUMBER(SpecSameDocNav, from_document_sequence_number,
browser_initiated_key, browser_initiated ? "true" : "false"); from_document_seq_number);
SCOPED_CRASH_KEY_NUMBER(SpecSameDocNav, to_document_sequence_number,
const std::string& to_item_sequence_number_string = base::NumberToString( to_document_seq_number);
navigation_request->ItemSequenceNumberForDebugging()); SCOPED_CRASH_KEY_STRING256(SpecSameDocNav, from_url, from_url);
ScopedCrashKeyString to_item_sequence_number_scoper( SCOPED_CRASH_KEY_STRING256(SpecSameDocNav, to_url, to_url);
to_item_sequence_number_key, to_item_sequence_number_string); SCOPED_CRASH_KEY_STRING256(SpecSameDocNav, from_site_info,
from_site_info);
const std::string& to_document_sequence_number_string = SCOPED_CRASH_KEY_STRING256(SpecSameDocNav, to_site_info, to_site_info);
base::NumberToString( SCOPED_CRASH_KEY_STRING256(SpecSameDocNav, from_process_lock,
navigation_request->DocumentSequenceNumberForDebugging()); from_process_lock);
ScopedCrashKeyString to_document_sequence_number_scoper( SCOPED_CRASH_KEY_STRING256(SpecSameDocNav, to_process_lock,
to_document_sequence_number_key, to_document_sequence_number_string); to_process_lock);
ScopedCrashKeyString from_url_reset(
from_url_key, last_committed_url_.possibly_invalid_spec());
int64_t from_item_sequence_number = -1;
int64_t from_document_sequence_number = -1;
delegate_->GetFrameSequenceNumbersForDebugging(
this, from_item_sequence_number, from_document_sequence_number);
const std::string& from_item_sequence_number_string =
base::NumberToString(from_item_sequence_number);
ScopedCrashKeyString from_item_sequence_number_scoper(
from_item_sequence_number_key, from_item_sequence_number_string);
const std::string& from_document_sequence_number_string =
base::NumberToString(from_document_sequence_number);
ScopedCrashKeyString from_document_sequence_number_scoper(
from_document_sequence_number_key,
from_document_sequence_number_string);
base::debug::DumpWithoutCrashing(); base::debug::DumpWithoutCrashing();
} }
......
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