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.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.cc')
-rw-r--r-- | base/debug/stack_trace.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc index 94ce145..1919abc 100644 --- a/base/debug/stack_trace.cc +++ b/base/debug/stack_trace.cc @@ -9,6 +9,7 @@ #include <string.h> #include <algorithm> +#include <sstream> namespace base { namespace debug { @@ -30,5 +31,11 @@ const void *const *StackTrace::Addresses(size_t* count) const { return NULL; } +std::string StackTrace::ToString() const { + std::stringstream stream; + OutputToStream(&stream); + return stream.str(); +} + } // namespace debug } // namespace base |