我正在各个点打印我的应用程序中的堆栈跟踪来调试问题,除了我的c ++函数的符号名称仍然被破坏之外,它工作得很好.在linux上我使用c ++ filt将它们转换为更可读的东西......在Mac上...它不起作用?!?!
macbook:matthew$ c++filt _ZN10GSemaphore6UnlockEv
_ZN10GSemaphore6UnlockEv
Run Code Online (Sandbox Code Playgroud)
即使手册页中提供的示例也不起作用.是什么赋予了?
我在GCC C++编译器上运行代码,输出type_info :: name:
#include <iostream>
#include <typeinfo>
using namespace std;
class shape {
protected:
int color;
public:
virtual void draw() = 0;
};
class Circle: public shape {
protected:
int color;
public:
Circle(int a = 0): color(a) {};
void draw();
};
void Circle::draw() {
cout<<"color: "<<color<<'\n';
}
class triangle: public shape {
protected:
int color;
public:
triangle(int a = 0): color(a) {};
void draw();
};
void triangle::draw() {
cout<<"color: "<<color<<'\n';
}
int main() {
Circle* a;
triangle* b; …Run Code Online (Sandbox Code Playgroud) 在我的开发环境中,我正在使用GNU C++ 3.4.6编译代码库.代码正在开发中,不幸的是偶尔崩溃.很高兴能够通过demangler运行回溯,我使用c ++ filt 3.4.当函数具有许多STL参数时,问题就来了.考虑
My_callback::operator()(
Status&,
std::set<std::string> const&,
std::vector<My_parameter*> const&,
My_attribute_set const&,
std::vector<My_parameter_base*> const&,
std::vector<My_parameter> const&,
std::set<std::string> const&
)
{
// ...
}
Run Code Online (Sandbox Code Playgroud)
当此函数在回溯中时,我平台上的错位输出是:
(_ZN30My_callbackclER11StatusRKSt3setISsSt4lessISsESaISsEERKSt6vectorIP13My_parameterSaISB_EERK17My_attribute_setRKS9_IP18My_parameter_baseSaISK_EERKS9_ISA_SaISA_EES8_+0x76a) [0x13ffdaa]
Run Code Online (Sandbox Code Playgroud)
c ++ filt巧妙地将其解析为
(My_callback::operator()(Status&, std::set<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<My_parameter*, std::allocator<My_parameter*> > const&, My_attribute_set const&, std::vector<My_parameter_base*, std::allocator<My_parameter_base*> > const&, std::vector<My_parameter, std::allocator<My_parameter> > const&, std::set<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)+0x76a) [0x13ffdaa]
Run Code Online (Sandbox Code Playgroud)
这与使用模板时遇到的编译器错误相同.但是,STL是一个相当规则且可识别的模板包.所以我希望有人在那里创建了一个增强版的c …