是否有 C++ 的在线名称 demangler?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3006438/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 11:45:46  来源:igfitidea点击:

Is there an online name demangler for C++?

c++demangler

提问by Roman Starkov

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?

有人知道有这样的服务吗?

回答by Rafael Baptista

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

我创建了这样一个在线服务: 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.

这是一个 gcc c++ 符号 demangler。您只需将堆栈跟踪或 nm 的输出复制到文本框中,它就会返回名称已取消的输出。

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

@Update:它现在也对 MSVC 和 Java 符号进行了解码。

回答by nattofriends

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

这可能有点晚了,但我根据这个问题创建了一个。它适用于我尝试过的输入,通过 __cxa_demangle 和 __unDName 支持 g++ 和 msvc++,通过 Emscripten 编译为 Javascript。希望这对某人有所帮助:c++filtjs

Edit: Fixed escaping problem

编辑:固定转义问题

回答by Dummy00001

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

大多数(如果不是全部)C++ 编译器都带有c++filt工具,它可以准确地完成您显然在寻找的内容。

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

如果你想通过鼠标点击它......为它编写一个 GUI ;)

回答by Shafik Yaghmour

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.

如果您只需要支持 GCC 和 Clang,您还可以选择使用Coliru,它可能是最通用的在线 C++ 编译器

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 examplewhich 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)
           ^^^^^^^^^^^

回答by zed_0xff

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

仅供参考,还有一个 Ruby gem 可以破坏 Borland/MS/任何错误的名称:unmangler