]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/BackTrace: demangle on FreeBSD also 12992/head
authorKefu Chai <kchai@redhat.com>
Thu, 19 Jan 2017 04:36:06 +0000 (12:36 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 22 Jan 2017 08:14:56 +0000 (16:14 +0800)
commit5647d5ee8e426edd18dbc5765a32951a6c7efdcf
tree1dcbe1a0c47aa1bf53a208c7f5e88f2675f9dfed
parent11dce465f0f3ca53a38886b5ca169b17e74653f5
common/BackTrace: demangle on FreeBSD also

the output on FreeBSD/clang looks like:

1: 0x44bfb3 <_Z3foov+0x413> at /usr/srcs/Ceph/work/ceph/build/bin/unittest_back_trace
2: 0x44c23e <_ZN20BackTrace_Basic_Test8TestBodyEv+0x1e> at /usr/srcs/Ceph/work/ceph/build/bin/unittest_back_trace
3: 0x4d068a <_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc+0x7a> at /usr/srcs/Ceph/work/ceph/build/bin/unittest_back_trace
4: 0x4b5977 <_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc+0x77> at /usr/srcs/Ceph/work/ceph/build/bin/unittest_back_trace
...

and update the test accordingly, as FreeBSD/clang uses '<>' to enclose
the mangled function and offset.

also, only demangle the C++ mangled names. those names always start with
"_Z". on FreeBSD, after demangling, "main" is turned into "unsigned
long", which does not make sense.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/BackTrace.cc
src/rocksdb
src/test/common/test_back_trace.cc