相关文章推荐
逆袭的柿子  ·  [問題] ...·  7 月前    · 
稳重的啤酒  ·  R语言如何 ...·  1 年前    · 

C++ compilers need to generate multiple library symbols in compiled code for functions and data that have the same name. For example you may have two functions in a program with the same name but different function arguments.

To solve this problem C++ compilers will compile object code using name mangling . This is a technique where the symbol's name is changed to encode type information, such as the type of a function's arguments or signature.

This can be a problem later when examining object code, such as when you dump the symbol tables of compiled programs or libraries using binary file dumpers like 'nm' or 'dumpbin'. You will often see mangled debugging symbols in stack traces, crash dumps or log files. The symbols reported are often unreable.

Here are some mangled GCC symbols from part of an 'nm' dump that you can try out:

0000000000461fae W _ZNK8KxVectorI16KxfArcFileRecordjEixEj 000000000042ea8a W _ZNK8KxVectorI5KxSpeIcjEjE4sizeEv 000000000042d0e4 W _ZNK8KxVectorI5KxSpeIcjEjEixEj 0000000000433ec6 W _ZNK8KxVectorI6DlAtomjE4sizeEv 000000000043dfb0 W _ZNK8KxVectorI6DlAtomjEixEj 0000000000435f04 W _ZNK8KxVectorI6DlTypejE4sizeEv 000000000043df92 W _ZNK8KxVectorI6DlTypejEixEj 000000000042c3c8 W _ZNK8KxVectorI7KSrvHMEjE4sizeEv 00000000004435f8 W _ZNK8KxVectorIN4DlDb7DlDatumEjE4sizeEv 000000000043dc6c W _ZNK8KxVectorIN4DlDb7DlDatumEjEixEj 00000000004776da W _ZNK8KxVectorIP13KxLogObserverjE10idxIsValidEj 0000000000477684 W _ZNK8KxVectorIP13KxLogObserverjE4findERKS1_

And here are some mangled symbols produced by MSVC, dumped from 'dumpbin':

68E 00000000 SECT1FD notype External | ??_R3?$KxSet@V?$KxSpe@DI@@I@@8 691 00000000 SECT1FE notype External | ??_R2?$KxSet@V?$KxSpe@DI@@I@@8 694 00000000 SECT1FF notype External | ??_R1A@?0A@EA@?$KxSet@V?$KxSpe@DI@@I@@8 697 00000000 SECT200 notype External | ??_R1A@?0A@EA@?$KxTree@V?$KxSpe@DI@@I@@8 69A 00000000 SECT201 notype External | ??_R0?AV?$KxTree@V?$KxSpe@DI@@I@@@8 69D 00000000 SECT202 notype External | ??_R3?$KxTree@V?$KxSpe@DI@@I@@8 6A0 00000000 SECT203 notype External | ??_R2?$KxTree@V?$KxSpe@DI@@I@@8 6A3 00000000 SECT204 notype External | ??_R4?$KxTree@V?$KxSpe@DI@@I@@6B@ 6A6 00000000 SECT205 notype External | ??_R4?$KxSet@VKxSymbol32@@I@@6B@ 6A9 00000000 SECT206 notype External | ??_R0?AV?$KxSet@VKxSymbol32@@I@@@8 6AC 00000000 SECT207 notype External | ??_R3?$KxSet@VKxSymbol32@@I@@8 6AF 00000000 SECT208 notype External | ??_R2?$KxSet@VKxSymbol32@@I@@8 6B2 00000000 SECT209 notype External | ??_R1A@?0A@EA@?$KxSet@VKxSymbol32@@I@@8

This site can translate Itanium and MSVC C++ mangled names back to their original form, with the entire type or function signature.

We support mangled symbols generated by all modern C++ compilers including GCC, MSVC, Clang/LLVM, Intel ICC/ICX and many more.

Simply enter any text containing obfuscated symbols in the window below, and press "Demangle it!"

Using Demangle as a web API

You can demangle text programatically by making a POST request to:

https://demangler.com/raw

The body of the request should be encoded as a classic www-url encoded form content, or JSON or XML, with a single parameter input . You can use this for example to create a shell script that will demangle the output of another program:

#!/bin/bash curl --data-urlencode input@- https://demangler.com/raw

Which you can use like this:

nm libmylib.a | demangle.sh

Why is it so fast?

This is an orignal implementation of C++ demangling, written in C++ compiled to wasm, and served on Fastly CDN edges worldwide.

Our implementation is highly advanced and will demangle complex symbols that many other demanglers choke on, or get wrong. Try these monster symbols, compare to c++filt or llvm-cxxfilt, and then ask AI who did it better.

_ZGVN5libcw24_GLOBAL__N_cbll.cc0ZhUKa23compiler_bug_workaroundISt6vectorINS_13omanip_id_tctINS_5debug32memblk_types_manipulator_data_ctEEESaIS6_EEE3idsE _ZNKSt14priority_queueIP27timer_event_request_base_ctSt5dequeIS1_SaIS1_EE13timer_greaterE3topEv _ZN5libcw5debug13cwprint_usingINS_9_private_12GlobalObjectEEENS0_17cwprint_using_tctIT_EERKS5_MS5_KFvRSt7ostreamE _ZNSbIcSt11char_traitsIcEN5libcw5debug27no_alloc_checking_allocatorEE12_S_constructIPcEES6_T_S7_RKS3_ _ZNK15nsBaseHashtableI15nsUint32HashKey8nsCOMPtrI4IFooEPS2_E13EnumerateReadEPF15PLDHashOperatorRKjS4_PvES9_ _ZN5aaaaa6bbbbbb5cccccIN23ddddddddddddddddddddddd3eeeENS2_4ffff16ggggggggggggggggENS0_9hhhhhhhhhES6_S6_S6_S6_S6_S6_S6_EE _ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE _ZNSt13_Alloc_traitsISbIcSt18string_char_traitsIcEN5libcw5debug9_private_17allocator_adaptorIcSt24__default_alloc_templateILb0ELi327664EELb1EEEENS5_IS9_S7_Lb1EEEE15_S_instancelessE _ZNK7strings8internal8SplitterINS_9delimiter5AnyOfENS_9SkipEmptyEEcvT_ISt6vectorI12basic_stringIcSt11char_traitsIcESaIcEESaISD_EEvEEv _ZSt18uninitialized_copyIN9__gnu_cxx17__normal_iteratorIPSt4pairISsPFbP6sqlitePPcEESt6vectorIS9_SaIS9_EEEESE_ET0_T_SG_SF_ _ZN3Psi7VariantIIcPKcEE5visitIIRZN11VariantTest9TestVisit11test_methodEvEUlS2_E0_RZNS6_11test_methodEvEUlcE1_RZNS6_11test_methodEvEUlNS_4NoneEE_EEENS_13VariantDetail19SelectVisitorResultIIDpT_EE4typeEDpOSG_ _ZNSt9_Any_data9_M_accessIPZN13ThreadManager10futureTaskISt5_BindIFSt7_Mem_fnIM6RunnerFvvEEPS5_EEEEvOT_EUlvE_EERSC_v _ZNSt9_Any_data9_M_accessIPZN13ThreadManager7newTaskIRSt5_BindIFSt7_Mem_fnIM5DiaryFivEEPS5_EEIEEESt6futureINSt9result_ofIFT_DpT0_EE4typeEEOSF_DpOSG_EUlvE_EERSF_v _ZN3mdr16in_cached_threadIRZNK4cudr6GPUSet17parallel_for_eachIZN5tns3d20shape_representation7compute7GPUImpl7executeERKNS_1AINS_7ptr_refIKjEELl3ELl3ENS_8c_strideILl1ELl0EEEEERKNS8_INS9_IjEELl4ELl1ESD_EEEUliRKNS1_7ContextERNS7_5StateEE_JSt6vectorISO_SaISO_EEEEEvOT_DpRT0_EUlSP_E_JSt17reference_wrapperISO_EEEENS_12ScopedFutureIDTclfp_spcl7forwardISW_Efp0_EEEEESV_DpOSW_ _ZSt7forwardIRN1x14refobjiteratorINS0_3refINS0_4mime30multipart_section_processorObjIZ15get_body_parserIZZN14mime_processor21make_section_iteratorERKNS2_INS3_10sectionObjENS0_10ptrrefBaseEEEbENKUlvE_clEvEUlSB_bE_ZZNS6_21make_section_iteratorESB_bENKSC_clEvEUlSB_E0_ENS1_INS2_INS0_20outputrefiteratorObjIiEES8_EEEERKSsSB_OT_OT0_EUlmE_NS3_32make_multipart_default_discarderISP_EEEES8_EEEEEOT_RNSt16remove_referenceISW_E4typeE _Z7ZipWithI7QStringS0_5QListZN4oral6detail16AdaptCreateTableI7AccountEES0_RKNS3_16CachedFieldsDataEEUlRKS0_SA_E_ET1_IDTclfp1_cvT__EcvT0__EEEERKT1_ISC_ERKT1_ISD_ET2_

Contact

Email questions and comments to rafael@demangler.com

(Now I get it.)