[SERVER-9586] Demangle C++ names when printing stack trace Created: 05/May/13  Updated: 18/Apr/14  Resolved: 24/May/13

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: 2.4.3
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Farooq Mela Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

The shell does not demangle C++ function and method names when print a stack trace. Example:

Sat May  4 14:04:52.352   Assertion failure isABSONObj() src/mongo/db/../bson/bson-inl.h 183
0x10017116b 0x100135396 0x10001bbde 0x100001e21 0x7fff8d4af94a 0 0x10015f232 0x10015fdad 0x100160095 0x10007104d 0x1000a2581 0x1000627bf 0x10007e3eb 0x100127a85 0x10010f92f 0x3258efc4c4db
 0   mongo                               0x000000010017116b _ZN5mongo15printStackTraceERSo + 43
 1   mongo                               0x0000000100135396 _ZN5mongo12verifyFailedEPKcS1_j + 310
 2   mongo                               0x000000010001bbde _ZNK5mongo11shell_utils18ConnectionRegistry30killOperationsOnAllConnectionsEb + 1342
 3   mongo                               0x0000000100001e21 _Z10quitNicelyi + 145
 4   libsystem_c.dylib                   0x00007fff8d4af94a _sigtramp + 26
 5   ???                                 0x0000000000000000 0x0 + 0
 6   mongo                               0x000000010015f232 _ZN5mongo13MessagingPort4recvERNS_7MessageE + 130
 7   mongo                               0x000000010015fdad _ZN5mongo13MessagingPort4recvERKNS_7MessageERS1_ + 45
 8   mongo                               0x0000000100160095 _ZN5mongo13MessagingPort4callERNS_7MessageES2_ + 53
 9   mongo                               0x000000010007104d _ZN5mongo18DBClientConnection4callERNS_7MessageES2_bPSs + 77
 10  mongo                               0x00000001000a2581 _ZN5mongo14DBClientCursor4initEv + 161
 11  mongo                               0x00000001000627bf _ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 191
 12  mongo                               0x000000010007e3eb _ZN5mongo18DBClientConnection5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 139
 13  mongo                               0x0000000100127a85 _ZN5mongo9mongoFindEPNS_7V8ScopeERKN2v89ArgumentsE + 965
 14  mongo                               0x000000010010f92f _ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE + 175
 15  ???                                 0x00003258efc4c4db 0x0 + 55357561160923
Sat May  4 14:04:52.354 terminate() called in shell, printing stack:
0x10017116b 0x100001d33 0x7fff862703c9 0x7fff86270424 0x7fff8627158b 0x10013556c 0x10001bbde 0x100001e21 0x7fff8d4af94a 0 0x10015f232 0x10015fdad 0x100160095 0x10007104d 0x1000a2581 0x1000627bf 0x10007e3eb 0x100127a85 0x10010f92f 0x3258efc4c4db
 0   mongo                               0x000000010017116b _ZN5mongo15printStackTraceERSo + 43
 1   mongo                               0x0000000100001d33 _Z11myterminatev + 67
 2   libc++abi.dylib                     0x00007fff862703c9 _ZL19safe_handler_callerPFvvE + 8
 3   libc++abi.dylib                     0x00007fff86270424 __cxa_bad_typeid + 0
 4   libc++abi.dylib                     0x00007fff8627158b _ZL23__gxx_exception_cleanup19_Unwind_Reason_CodeP17_Unwind_Exception + 0
 5   mongo                               0x000000010013556c _ZN5mongo12verifyFailedEPKcS1_j + 780
 6   mongo                               0x000000010001bbde _ZNK5mongo11shell_utils18ConnectionRegistry30killOperationsOnAllConnectionsEb + 1342
 7   mongo                               0x0000000100001e21 _Z10quitNicelyi + 145
 8   libsystem_c.dylib                   0x00007fff8d4af94a _sigtramp + 26
 9   ???                                 0x0000000000000000 0x0 + 0
 10  mongo                               0x000000010015f232 _ZN5mongo13MessagingPort4recvERNS_7MessageE + 130
 11  mongo                               0x000000010015fdad _ZN5mongo13MessagingPort4recvERKNS_7MessageERS1_ + 45
 12  mongo                               0x0000000100160095 _ZN5mongo13MessagingPort4callERNS_7MessageES2_ + 53
 13  mongo                               0x000000010007104d _ZN5mongo18DBClientConnection4callERNS_7MessageES2_bPSs + 77
 14  mongo                               0x00000001000a2581 _ZN5mongo14DBClientCursor4initEv + 161
 15  mongo                               0x00000001000627bf _ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 191
 16  mongo                               0x000000010007e3eb _ZN5mongo18DBClientConnection5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 139
 17  mongo                               0x0000000100127a85 _ZN5mongo9mongoFindEPNS_7V8ScopeERKN2v89ArgumentsE + 965
 18  mongo                               0x000000010010f92f _ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE + 175
 19  ???                                 0x00003258efc4c4db 0x0 + 55357561160923

It should instead print something like this:

Sat May  4 14:06:17.138   Assertion failure isABSONObj() src/mongo/bson/bson-inl.h 183
0x10c7c1d4d 0x10c79ffcc 0x10c757351 0x10c6e3e0a 0x10c6d5cd5 0x7fff8d4af94a 0x10d5f20a0 0x10c7b6c4c 0x10c7b7291 0x10c7b7628 0x10c71b0ae 0x10c71b2fd 0x10c73e39a 0x10c718b70 0x10c724532 0x10c79a637 0x10c783882 0x23cf5ea4ce17
 0          0x10c7c1d4d mongo::printStackTrace(std::ostream&) + 61
 1          0x10c79ffcc mongo::verifyFailed(char const*, char const*, unsigned int) + 284
 2          0x10c757351 mongo::BSONElement::embeddedObject() const + 193
 3          0x10c6e3e0a mongo::shell_utils::ConnectionRegistry::killOperationsOnAllConnections(bool) const + 524
 4          0x10c6d5cd5 quitNicely(int) + 85
 5       0x7fff8d4af94a _sigtramp + 26
 6          0x10d5f20a0 0x0 + 4519305376
 7          0x10c7b6c4c mongo::MessagingPort::recv(mongo::Message&) + 112
 8          0x10c7b7291 mongo::MessagingPort::recv(mongo::Message const&, mongo::Message&) + 33
 9          0x10c7b7628 mongo::MessagingPort::call(mongo::Message&, mongo::Message&) + 52
 10         0x10c71b0ae mongo::DBClientConnection::call(mongo::Message&, mongo::Message&, bool, std::string*) + 88
 11         0x10c71b2fd non-virtual thunk to mongo::DBClientConnection::call(mongo::Message&, mongo::Message&, bool, std::string*) + 13
 12         0x10c73e39a mongo::DBClientCursor::init() + 304
 13         0x10c718b70 mongo::DBClientBase::query(std::string const&, mongo::Query, int, int, mongo::BSONObj const*, int, int) + 180
 14         0x10c724532 mongo::DBClientConnection::query(std::string const&, mongo::Query, int, int, mongo::BSONObj const*, int, int) + 130
 15         0x10c79a637 mongo::mongoFind(mongo::V8Scope*, v8::Arguments const&) + 1031
 16         0x10c783882 mongo::V8Scope::v8Callback(v8::Arguments const&) + 116
 17      0x23cf5ea4ce17 0x0 + 39373553061399
Sat May  4 14:06:17.141 terminate() called in shell, printing stack:
0x10c7c1d4d 0x10c6d5eaf 0x7fff862703c9 0x7fff86270424 0x7fff8627158b 0x10c7a0113 0x10c757351 0x10c6e3e0a 0x10c6d5cd5 0x7fff8d4af94a 0x10d5f20a0 0x10c7b6c4c 0x10c7b7291 0x10c7b7628 0x10c71b0ae 0x10c71b2fd 0x10c73e39a 0x10c718b70 0x10c724532 0x10c79a637
 0          0x10c7c1d4d mongo::printStackTrace(std::ostream&) + 61
 1          0x10c6d5eaf myterminate() + 79
 2       0x7fff862703c9 safe_handler_caller(void (*)()) + 8
 3       0x7fff86270424 __cxa_bad_typeid + 0
 4       0x7fff8627158b __gxx_exception_cleanup(_Unwind_Reason_Code, _Unwind_Exception*) + 0
 5          0x10c7a0113 mongo::verifyFailed(char const*, char const*, unsigned int) + 611
 6          0x10c757351 mongo::BSONElement::embeddedObject() const + 193
 7          0x10c6e3e0a mongo::shell_utils::ConnectionRegistry::killOperationsOnAllConnections(bool) const + 524
 8          0x10c6d5cd5 quitNicely(int) + 85
 9       0x7fff8d4af94a _sigtramp + 26
 10         0x10d5f20a0 0x0 + 4519305376
 11         0x10c7b6c4c mongo::MessagingPort::recv(mongo::Message&) + 112
 12         0x10c7b7291 mongo::MessagingPort::recv(mongo::Message const&, mongo::Message&) + 33
 13         0x10c7b7628 mongo::MessagingPort::call(mongo::Message&, mongo::Message&) + 52
 14         0x10c71b0ae mongo::DBClientConnection::call(mongo::Message&, mongo::Message&, bool, std::string*) + 88
 15         0x10c71b2fd non-virtual thunk to mongo::DBClientConnection::call(mongo::Message&, mongo::Message&, bool, std::string*) + 13
 16         0x10c73e39a mongo::DBClientCursor::init() + 304
 17         0x10c718b70 mongo::DBClientBase::query(std::string const&, mongo::Query, int, int, mongo::BSONObj const*, int, int) + 180
 18         0x10c724532 mongo::DBClientConnection::query(std::string const&, mongo::Query, int, int, mongo::BSONObj const*, int, int) + 130
 19         0x10c79a637 mongo::mongoFind(mongo::V8Scope*, v8::Arguments const&) + 1031



 Comments   
Comment by Matt Kangas [ 24/May/13 ]

Confirmed that we want mangled names in stack traces. Andrew replied to Farooq and closed the pull request.

Comment by Farooq Mela [ 05/May/13 ]

I have submitted a pull request that fixes this:

https://github.com/mongodb/mongo/pull/419

Generated at Thu Feb 08 03:20:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.