summaryrefslogtreecommitdiffstats
path: root/src/common/assert.cc
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2016-05-10 15:56:55 +0200
committerKefu Chai <kchai@redhat.com>2017-01-15 20:03:22 +0100
commit74025efec8ad4520b7c2f12e8f153b29dc74cd16 (patch)
tree81e212b9a47ca279db44012f450bdde53f8b381d /src/common/assert.cc
parentMerge pull request #12784 from LiumxNL/fix-wrongly-delete-routed-op (diff)
downloadceph-74025efec8ad4520b7c2f12e8f153b29dc74cd16.tar.xz
ceph-74025efec8ad4520b7c2f12e8f153b29dc74cd16.zip
common/BackTrace: add operator<<
replace BackTrace::print() with the operator<< where the former is used. Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/common/assert.cc')
-rw-r--r--src/common/assert.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common/assert.cc b/src/common/assert.cc
index 340391742e8..d4dd048c2fa 100644
--- a/src/common/assert.cc
+++ b/src/common/assert.cc
@@ -50,7 +50,6 @@ namespace ceph {
tss << ceph_clock_now();
char buf[8096];
- BackTrace *bt = new BackTrace(1);
snprintf(buf, sizeof(buf),
"%s: In function '%s' thread %llx time %s\n"
"%s: %d: FAILED assert(%s)\n",
@@ -60,7 +59,7 @@ namespace ceph {
// TODO: get rid of this memory allocation.
ostringstream oss;
- bt->print(oss);
+ oss << BackTrace(1);
dout_emergency(oss.str());
dout_emergency(" NOTE: a copy of the executable, or `objdump -rdS <executable>` "
@@ -68,7 +67,7 @@ namespace ceph {
if (g_assert_context) {
lderr(g_assert_context) << buf << std::endl;
- bt->print(*_dout);
+ *_dout << oss.str();
*_dout << " NOTE: a copy of the executable, or `objdump -rdS <executable>` "
<< "is needed to interpret this.\n" << dendl;
@@ -130,7 +129,7 @@ namespace ceph {
// TODO: get rid of this memory allocation.
ostringstream oss;
- bt->print(oss);
+ oss << *bt;
dout_emergency(oss.str());
dout_emergency(" NOTE: a copy of the executable, or `objdump -rdS <executable>` "
@@ -138,7 +137,7 @@ namespace ceph {
if (g_assert_context) {
lderr(g_assert_context) << buf << std::endl;
- bt->print(*_dout);
+ *_dout << oss.str();
*_dout << " NOTE: a copy of the executable, or `objdump -rdS <executable>` "
<< "is needed to interpret this.\n" << dendl;