summaryrefslogtreecommitdiffstats
path: root/base/debug
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 22:28:25 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 22:28:25 +0000
commitfcb30f7bc726a11540d942deec17baf62511c2e0 (patch)
treea6f695de8a0f6689cd7a7565ae199277f151141b /base/debug
parent216813957f67962e1c50fcbbad0d3e8fcd17760e (diff)
downloadchromium_src-fcb30f7bc726a11540d942deec17baf62511c2e0.zip
chromium_src-fcb30f7bc726a11540d942deec17baf62511c2e0.tar.gz
chromium_src-fcb30f7bc726a11540d942deec17baf62511c2e0.tar.bz2
Tag all tracked objects, including Tasks, with the program counter at the site of FROM_HERE.
This is to make it easier to determine the site Tasks are posted from in release builds, especially when only a minidump is available. It should help diagnose http://crbug.com/81499. I added a debug function to alias variables so that the optimizer will not strip them out if they are not live. The semantics of the MessageLoop::PostTask functions is changed and it is wrong but I am not sure what semantics are intended. It seems location information was no longer being tracked for Tasks wrapped as Closures and I don't know if this was intended. PTAL. Update: this has since been fixed. TEST=Set breakpoint in TaskClosureAdapter::Run and very that the post site can be located in an optimized build. BUG=81499 Review URL: http://codereview.chromium.org/7039020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug')
-rw-r--r--base/debug/alias.cc20
-rw-r--r--base/debug/alias.h20
2 files changed, 40 insertions, 0 deletions
diff --git a/base/debug/alias.cc b/base/debug/alias.cc
new file mode 100644
index 0000000..04122fb
--- /dev/null
+++ b/base/debug/alias.cc
@@ -0,0 +1,20 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/debug/alias.h"
+#include "build/build_config.h"
+
+namespace base {
+namespace debug {
+
+namespace {
+const void* g_global;
+}
+
+void Alias(const void* var) {
+ g_global = var;
+}
+
+} // namespace debug
+} // namespace base
diff --git a/base/debug/alias.h b/base/debug/alias.h
new file mode 100644
index 0000000..957afdb
--- /dev/null
+++ b/base/debug/alias.h
@@ -0,0 +1,20 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_DEBUG_ALIAS_H_
+#define BASE_DEBUG_ALIAS_H_
+#pragma once
+
+namespace base {
+namespace debug {
+
+// Make the optimizer think that var is aliased. This is to prevent it from
+// optimizing out variables that that would not otherwise be live at the point
+// of a potential crash.
+void Alias(const void* var);
+
+} // namespace debug
+} // namespace base
+
+#endif // BASE_DEBUG_ALIAS_H_