113

I'm getting a fairly long and confusing link error, and would love it if I could just paste it into some textbox on some website and have the names un-mangled for me.

Does anyone know of such a service?

Roman Starkov
  • 52,420
  • 33
  • 225
  • 300

5 Answers5

144

I have created such an online serivice: https://demangler.com

This is a gcc c++ symbol demangler. You just copy a stack trace, or the output of nm into a text box, and it will return the output with the names demangled.

@Update: It now demangles MSVC and Java symbols also.

Rafael Baptista
  • 10,259
  • 4
  • 35
  • 56
  • This one worked for me, but not the one in the more popular answer: _ZN9cdnalizer11rewriteHTMLINS_6apache8IteratorEcEET_RKSsRKNS_6ConfigES3_S3_St8functionIFS3_RKS3_SB_EES9_IFvSsEE – matiu Dec 28 '13 at 06:52
  • Your demangler cannot demangle ref qualifiers for Itanium. I am looking at _ZNR4test1fEv generated by Clang. – Puppy Jun 20 '14 at 20:53
  • Thanks, nice site! Could you please add `white-space: normal` or similar to the responseSection
     tag (and maybe add line numbers)? Long one-line output isn't readable currently.
    – jplatte Jun 22 '14 at 13:20
  • 1
    You should be careful. Most real-world implementations of demanglers are horribly buggy and insecure. They basically only work on mangled names that the same platform produced, but may run into high complexity or flat out memory errors on general inputs. – Kerrek SB Mar 29 '17 at 00:07
  • 11
    I have used it regularly. It appears to be down, though.It was a very nice, useful page – chrise Apr 26 '19 at 05:20
  • the link doesn't work anymore – Yug Singh Jul 13 '20 at 16:08
  • The link appears to be working again. – Karu Apr 07 '21 at 02:17
106

This might be a bit late, but I created one, based on this question. It works with the inputs I tried on, supports g++ and msvc++ via __cxa_demangle and __unDName, compiled to Javascript via Emscripten. Hope this helps someone: c++filtjs

Edit: Fixed escaping problem

nattofriends
  • 1,200
  • 2
  • 9
  • 5
  • 6
    Awesome! Thank you! Perhaps mention "Online C++ name demangler" somewhere on the page, so that people can find you via Google? – Roman Starkov Mar 19 '12 at 10:55
  • Is it possible to extend this tool for other OS? I wanted to particularly look forward to port it for AIX, Solaris and HPUX – Abhijit Oct 11 '12 at 07:47
  • Thanks for the tool. Very nice and handy. a small notice is that the tool don't handle templates correctly. MyClass::doStuff will have hidden. – Yousf Dec 19 '12 at 20:56
  • Probably because the HTML output is not escaped. – Puppy Mar 10 '13 at 13:48
  • 1
    Okay, should be fixed now. – nattofriends Mar 22 '13 at 17:42
  • very nice indeed, but I would like a small C source instead. – Zibri May 03 '13 at 18:55
  • 3
    @Zibri: a "small C source" is not online. For that, use the existing c++filt and undname utilities. – nattofriends May 03 '13 at 21:23
  • @Abhijit: It's not about an OS, it's about _toolchains_. g++ and msvc++ for instance. – Mooing Duck May 24 '13 at 17:27
  • 1
    @nattofriends: Your tool doesn't seem to escape brackets, see `??_R3?$KxSet@V?$KxSpe@DI@@I@@8`. – Mooing Duck May 24 '13 at 17:33
  • @nattofriends Template parameters seem to be lost in cases such as `_Z6kernelIfLj3EEvPT_5arrayIPKS0_XT0_EES5_S2_IjXT0_EES6_S0_`, although for `_Z8positionILj3EE5arrayIjXT_EERKS1_` the parameter of the function *is* displayed properly (probably because it starts with a number and therefore can't be an html tag) – Joe Jul 18 '13 at 11:34
  • 1
    Jup, definitely the escaping, just added [htmlEncode.js](http://www.tumuski.com/code/htmlencode/) and replaced `$("#out").html("
    "+out+"
    ");` by `$("#out").html("
    "+htmlEncode(out)+"
    ");` and now templates are displayed correctly
    – Joe Jul 18 '13 at 11:42
  • Thanks Joe, I'll do that soon. – nattofriends Jul 18 '13 at 18:22
  • 2
    It would be very helpful if you could fix your issue with templates that others have mentioned. This has caused at least one [spurious question](http://stackoverflow.com/questions/21284752/g-name-mangling-slightly-different) on SO. – Shafik Yaghmour Jan 22 '14 at 15:01
27

Most (if not all) C++ compilers come with c++filt tool which does precisely what you apparently looking for.

If you want it at the mouse click... well write a GUI for it ;)

Dummy00001
  • 14,958
  • 5
  • 32
  • 56
9

There are two copy-and-paste online solutions:

If you only need support for GCC and Clang, you also have the option of using Coliru, which is probably the most versatile online C++ compiler.

This is not quite as simple as cut, paste, and click - but not too much harder - and it looks like there are no issues with template parameters as was noted above. You just need to modify the command line to run something like this:

cat main.cpp | c++filt -t

See it live with this example which demangles:

_Z6kernelIfLj3EEvPT_5arrayIPKS0_XT0_EES5_S2_IjXT0_EES6_S0_

to:

void kernel<float, 3u>(float*, array<float const*, 3u>, array<float const*, 3u>, array<unsigned int, 3u>, array<unsigned int, 3u>, float)
           ^^^^^^^^^^^
Community
  • 1
  • 1
Shafik Yaghmour
  • 143,425
  • 33
  • 399
  • 682
1

FYI, there's also a Ruby gem to demangle Borland/MS/whatever mangled names: unmangler

zed_0xff
  • 29,646
  • 7
  • 48
  • 70