Debugging data in 'anonymous namespaces' (C++)

后端 未结 2 663
眼角桃花
眼角桃花 2020-12-30 06:24

Recently, I got a crash dump file from a customer. I could track the problem down to a class that could contain incorrect data, but I only got a void-pointer to the class,

2条回答
  •  清歌不尽
    2020-12-30 07:25

    Referencing anonymous namespaces in Visual Studio Debugger's expressions is not supported (at least as of VS 2017) and it's really annoying.

    From https://docs.microsoft.com/en-us/visualstudio/debugger/expressions-in-the-debugger#c-expressions

    Anonymous namespaces are not supported. If you have the following code, you cannot add test to the watch window:

    namespace mars
    {   
        namespace  
        {  
            int test = 0;   
        }   
    }   
    int main()   
    {   
        // Adding a watch on test does not work.   
        mars::test++;   
        return 0;   
    }
    

提交回复
热议问题