[英]How to set breakpoint by function name inside anonymous namespace in Visual Studio?
I have the following code: 我有以下代码:
namespace
{
void Foo()
{
}
}
namespace Bar
{
void Foo()
{
}
}
int main()
{
Foo();
Bar::Foo();
return 0;
}
I want to put breakpoint on Foo()
inside anonymous namespace by name (Ctrl+B key binding). 我想通过名称(Ctrl + B键绑定)将断点放在匿名命名空间内的Foo()
)上。 I can do it for function inside named namespace Bar
with no problem by name Bar::Foo
. 我可以在命名空间Bar
而没有名称Bar::Foo
。 I tried anonymous namespace::Foo
for anonymous namespace but VS fails to parse this name, i guess because of whitespace character in name. 我为匿名命名空间尝试了anonymous namespace::Foo
,但VS无法解析此名称,我猜是因为名称中有空白字符。 Also I tried to put different quotation marks but with no luck. 我也尝试使用不同的引号,但没有运气。 Is it possible at all to put this breakpoint? 是否可以设置这个断点?
I encountered a similar problem a long time ago ( Debugging data in 'anynomous namespaces' (C++) ). 很久以前我遇到过类似的问题( 在'anynomous namespaces'(C ++)中调试数据 )。 I wanted to look at the value of a data member in an unnamed namespace, but I couldn't get this done. 我想查看未命名的命名空间中的数据成员的值,但我无法完成此操作。
Finally, somebody pointed me to http://msdn.microsoft.com/en-us/library/0888kc6a%28VS.80%29.aspx . 最后,有人向我指出了http://msdn.microsoft.com/en-us/library/0888kc6a%28VS.80%29.aspx 。 Maybe you can get the decorated function name and put a breakpoint on that. 也许你可以获得装饰的函数名称并在其上设置断点。
It looks like Visual Studio can't set breakpoint by function name inside anonymous namespace. 看起来Visual Studio无法通过匿名命名空间内的函数名设置断点。 Even WinDbg can't do this. 即使是WinDbg也无法做到这一点。
If you have sources you can set breakpoint by line. 如果您有源,可以逐行设置断点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.