summaryrefslogtreecommitdiffstats
path: root/base/debug
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-06-28 21:49:31 +0100
committerKristian Monsen <kristianm@google.com>2011-07-08 17:55:00 +0100
commitddb351dbec246cf1fab5ec20d2d5520909041de1 (patch)
tree158e3fb57bdcac07c7f1e767fde3c70687c9fbb1 /base/debug
parent6b92e04f5f151c896e3088e86f70db7081009308 (diff)
downloadexternal_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.zip
external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.gz
external_chromium-ddb351dbec246cf1fab5ec20d2d5520909041de1.tar.bz2
Merge Chromium at r12.0.742.93: Initial merge by git
Change-Id: Ic5ee2fec31358bbee305f7e915442377bfa6cda6
Diffstat (limited to 'base/debug')
-rw-r--r--base/debug/debug_on_start_win.h7
-rw-r--r--base/debug/debugger.h16
-rw-r--r--base/debug/debugger_posix.cc5
-rw-r--r--base/debug/leak_tracker_unittest.cc4
-rw-r--r--base/debug/stack_trace.cc4
-rw-r--r--base/debug/stack_trace.h11
-rw-r--r--base/debug/stack_trace_posix.cc17
-rw-r--r--base/debug/stack_trace_win.cc8
-rw-r--r--base/debug/trace_event.h6
-rw-r--r--base/debug/trace_event_win.cc4
-rw-r--r--base/debug/trace_event_win.h12
11 files changed, 59 insertions, 35 deletions
diff --git a/base/debug/debug_on_start_win.h b/base/debug/debug_on_start_win.h
index 5a1081d..4a5c120 100644
--- a/base/debug/debug_on_start_win.h
+++ b/base/debug/debug_on_start_win.h
@@ -24,6 +24,11 @@
namespace base {
namespace debug {
+// There is no way for this code, as currently implemented, to work across DLLs.
+// TODO(rvargas): It looks like we really don't use this code, at least not for
+// Chrome. Figure out if it's really worth implementing something simpler.
+#if !defined(BASE_DLL)
+
// Debug on start functions and data.
class DebugOnStart {
public:
@@ -69,6 +74,8 @@ DECLSPEC_SELECTANY DebugOnStart::PIFV debug_on_start = &DebugOnStart::Init;
#endif // _WIN64
+#endif // defined(BASE_DLL)
+
} // namespace debug
} // namespace base
diff --git a/base/debug/debugger.h b/base/debug/debugger.h
index 77bde0d..bb937a0 100644
--- a/base/debug/debugger.h
+++ b/base/debug/debugger.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -10,16 +10,18 @@
#define BASE_DEBUG_DEBUGGER_H
#pragma once
+#include "base/base_api.h"
+
namespace base {
namespace debug {
// Starts the registered system-wide JIT debugger to attach it to specified
// process.
-bool SpawnDebuggerOnProcess(unsigned process_id);
+BASE_API bool SpawnDebuggerOnProcess(unsigned process_id);
// Waits wait_seconds seconds for a debugger to attach to the current process.
// When silent is false, an exception is thrown when a debugger is detected.
-bool WaitForDebugger(int wait_seconds, bool silent);
+BASE_API bool WaitForDebugger(int wait_seconds, bool silent);
// Returns true if the given process is being run under a debugger.
//
@@ -28,18 +30,18 @@ bool WaitForDebugger(int wait_seconds, bool silent);
//
// WARNING: Because of this, on OS X, a call MUST be made to this function
// BEFORE the sandbox is enabled.
-bool BeingDebugged();
+BASE_API bool BeingDebugged();
// Break into the debugger, assumes a debugger is present.
-void BreakDebugger();
+BASE_API void BreakDebugger();
// Used in test code, this controls whether showing dialogs and breaking into
// the debugger is suppressed for debug errors, even in debug mode (normally
// release mode doesn't do this stuff -- this is controlled separately).
// Normally UI is not suppressed. This is normally used when running automated
// tests where we want a crash rather than a dialog or a debugger.
-void SetSuppressDebugUI(bool suppress);
-bool IsDebugUISuppressed();
+BASE_API void SetSuppressDebugUI(bool suppress);
+BASE_API bool IsDebugUISuppressed();
} // namespace debug
} // namespace base
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index 2eacaf9..bf90a0f 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -10,6 +10,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/param.h>
#include <sys/stat.h>
#if !defined(OS_NACL)
#include <sys/sysctl.h>
@@ -33,8 +34,8 @@
#include "base/basictypes.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/safe_strerror_posix.h"
-#include "base/scoped_ptr.h"
#include "base/string_piece.h"
#include "base/stringprintf.h"
diff --git a/base/debug/leak_tracker_unittest.cc b/base/debug/leak_tracker_unittest.cc
index 2e6a9a5..99df4c1 100644
--- a/base/debug/leak_tracker_unittest.cc
+++ b/base/debug/leak_tracker_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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/leak_tracker.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
index 5be4c5c..7c44f7a 100644
--- a/base/debug/stack_trace.cc
+++ b/base/debug/stack_trace.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -10,7 +10,7 @@ namespace debug {
StackTrace::~StackTrace() {
}
-const void *const *StackTrace::Addresses(size_t* count) {
+const void *const *StackTrace::Addresses(size_t* count) const {
*count = count_;
if (count_)
return trace_;
diff --git a/base/debug/stack_trace.h b/base/debug/stack_trace.h
index 8afc32c..acc7223 100644
--- a/base/debug/stack_trace.h
+++ b/base/debug/stack_trace.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,6 +8,7 @@
#include <iosfwd>
+#include "base/base_api.h"
#include "build/build_config.h"
#if defined(OS_WIN)
@@ -20,7 +21,7 @@ namespace debug {
// A stacktrace can be helpful in debugging. For example, you can include a
// stacktrace member in a object (probably around #ifndef NDEBUG) so that you
// can later see where the given object was created from.
-class StackTrace {
+class BASE_API StackTrace {
public:
// Creates a stacktrace from the current location.
StackTrace();
@@ -38,13 +39,13 @@ class StackTrace {
// Gets an array of instruction pointer values. |*count| will be set to the
// number of elements in the returned array.
- const void* const* Addresses(size_t* count);
+ const void* const* Addresses(size_t* count) const;
// Prints a backtrace to stderr
- void PrintBacktrace();
+ void PrintBacktrace() const;
// Resolves backtrace to symbols and write to stream.
- void OutputToStream(std::ostream* os);
+ void OutputToStream(std::ostream* os) const;
private:
// From http://msdn.microsoft.com/en-us/library/bb204633.aspx,
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index 879110d..958cfdf 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,6 +9,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/param.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/types.h>
@@ -30,8 +31,8 @@
#include "base/basictypes.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/safe_strerror_posix.h"
-#include "base/scoped_ptr.h"
#include "base/string_piece.h"
#include "base/stringprintf.h"
@@ -105,7 +106,7 @@ void DemangleSymbols(std::string* text) {
// names and attach these. Otherwise just use raw addresses. Returns true
// if any symbol name is resolved. Returns false on error and *may* fill
// in |error_message| if an error message is available.
-bool GetBacktraceStrings(void **trace, int size,
+bool GetBacktraceStrings(void *const *trace, int size,
std::vector<std::string>* trace_strings,
std::string* error_message) {
#ifdef ANDROID
@@ -168,11 +169,16 @@ StackTrace::StackTrace() {
count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);
}
+<<<<<<< HEAD
void StackTrace::PrintBacktrace() {
#if (defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || defined(ANDROID)
#if defined(ANDROID)
return;
#else
+=======
+void StackTrace::PrintBacktrace() const {
+#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+>>>>>>> chromium.org at r12.0.742.93
if (backtrace_symbols_fd == NULL)
return;
#endif // ANDROID
@@ -185,11 +191,16 @@ void StackTrace::PrintBacktrace() {
}
}
+<<<<<<< HEAD
void StackTrace::OutputToStream(std::ostream* os) {
#if (defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || defined(ANDROID)
#if defined(ANDROID)
return;
#else
+=======
+void StackTrace::OutputToStream(std::ostream* os) const {
+#if defined(OS_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+>>>>>>> chromium.org at r12.0.742.93
if (backtrace_symbols == NULL)
return;
#endif // ANDROID
diff --git a/base/debug/stack_trace_win.cc b/base/debug/stack_trace_win.cc
index 510d35b..97376a2 100644
--- a/base/debug/stack_trace_win.cc
+++ b/base/debug/stack_trace_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,7 +11,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
namespace base {
@@ -174,11 +174,11 @@ StackTrace::StackTrace(EXCEPTION_POINTERS* exception_pointers) {
}
}
-void StackTrace::PrintBacktrace() {
+void StackTrace::PrintBacktrace() const {
OutputToStream(&std::cerr);
}
-void StackTrace::OutputToStream(std::ostream* os) {
+void StackTrace::OutputToStream(std::ostream* os) const {
SymbolContext* context = SymbolContext::GetInstance();
DWORD error = context->init_error();
if (error != ERROR_SUCCESS) {
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index e5c2cbd..6e818e1 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -31,8 +31,8 @@
#include <string>
-#include "base/scoped_ptr.h"
-#include "base/singleton.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
#include "base/time.h"
#include "base/timer.h"
diff --git a/base/debug/trace_event_win.cc b/base/debug/trace_event_win.cc
index 005ff62..4929944 100644
--- a/base/debug/trace_event_win.cc
+++ b/base/debug/trace_event_win.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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/trace_event_win.h"
#include "base/logging.h"
-#include "base/singleton.h"
+#include "base/memory/singleton.h"
#include <initguid.h> // NOLINT
namespace base {
diff --git a/base/debug/trace_event_win.h b/base/debug/trace_event_win.h
index a1c79ba..9049bdb 100644
--- a/base/debug/trace_event_win.h
+++ b/base/debug/trace_event_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,6 +8,8 @@
#pragma once
#include <string>
+
+#include "base/base_api.h"
#include "base/win/event_trace_provider.h"
#define TRACE_EVENT_BEGIN(name, id, extra) \
@@ -40,7 +42,7 @@ namespace debug {
// This EtwTraceProvider subclass implements ETW logging
// for the macros above on Windows.
-class TraceLog : public base::win::EtwTraceProvider {
+class BASE_API TraceLog : public base::win::EtwTraceProvider {
public:
enum EventType {
EVENT_BEGIN,
@@ -117,13 +119,13 @@ class TraceLog : public base::win::EtwTraceProvider {
};
// The ETW trace provider GUID.
-extern const GUID kChromeTraceProviderName;
+BASE_API extern const GUID kChromeTraceProviderName;
// The ETW event class GUID for 32 bit events.
-extern const GUID kTraceEventClass32;
+BASE_API extern const GUID kTraceEventClass32;
// The ETW event class GUID for 64 bit events.
-extern const GUID kTraceEventClass64;
+BASE_API extern const GUID kTraceEventClass64;
// The ETW event types, IDs 0x00-0x09 are reserved, so start at 0x10.
const base::win::EtwEventType kTraceEventTypeBegin = 0x10;