diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 16:13:40 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 16:13:40 +0000 |
commit | d4114baa6a01b346441eae309493c31149d8296a (patch) | |
tree | 8415f979dea2d0ca0a3c885ab3652845d794e906 /base/debug/stack_trace_unittest.cc | |
parent | 173fd09e335caa8fe487e10516f1709e7b1f8197 (diff) | |
download | chromium_src-d4114baa6a01b346441eae309493c31149d8296a.zip chromium_src-d4114baa6a01b346441eae309493c31149d8296a.tar.gz chromium_src-d4114baa6a01b346441eae309493c31149d8296a.tar.bz2 |
Add StackTrace::ToString().
This can be used for debug logging like:
LOG(ERROR) << base::debug::StackTrace().ToString();
As opposed to
std::strstream stream;
base::debug::StackTrace().OutputToStream(&stream);
LOG(ERROR) << stream.str();
BUG=none
TEST=add a test to stack_unitttest and confirm it passes
Review URL: http://codereview.chromium.org/8206015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug/stack_trace_unittest.cc')
-rw-r--r-- | base/debug/stack_trace_unittest.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/base/debug/stack_trace_unittest.cc b/base/debug/stack_trace_unittest.cc index ce5f313..925f619 100644 --- a/base/debug/stack_trace_unittest.cc +++ b/base/debug/stack_trace_unittest.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. @@ -28,6 +28,9 @@ TEST(StackTrace, MAYBE_OutputToStream) { trace.OutputToStream(&os); std::string backtrace_message = os.str(); + // ToString() should produce the same output. + EXPECT_EQ(backtrace_message, trace.ToString()); + #if defined(OS_POSIX) && !defined(OS_MACOSX) && NDEBUG // Stack traces require an extra data table that bloats our binaries, // so they're turned off for release builds. We stop the test here, |