Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Debugging 如何在Clang++;?_Debugging_C++11_Optimization_Lldb_Clang++ - Fatal编程技术网

Debugging 如何在Clang++;?

Debugging 如何在Clang++;?,debugging,c++11,optimization,lldb,clang++,Debugging,C++11,Optimization,Lldb,Clang++,我正试图调试一些C++11代码,而LLDB却毫无用处。代码大致如下所示: void f(my_type dt) { try { g(h(dt)); } catch ( /* reasonable exception type here */ ) { } } 当我在g(h(dt))行上放置断点时,LLDB坚持认为dt的值不可用。它肯定不能被省略掉,因为它在实现h时被用作某些数据库查询的输入 我使用CMake,它使用以下标志进行编译: CXX_FLAGS = -

我正试图调试一些C++11代码,而LLDB却毫无用处。代码大致如下所示:

void f(my_type dt) {
   try {
      g(h(dt));
   }
   catch ( /* reasonable exception type here */ ) {
   }
}
当我在
g(h(dt))
行上放置断点时,LLDB坚持认为
dt
的值不可用。它肯定不能被省略掉,因为它在实现
h
时被用作某些数据库查询的输入

我使用CMake,它使用以下标志进行编译:

CXX_FLAGS = -g -O0 -fPIC -std=c++11 -stdlib=libc++ -Wall
我确认(使用
make VERBOSE=true
)这些标志确实用于构建项目。据我所知,应该包含完整的调试信息,并关闭所有优化。情况显然并非如此我可以添加哪些其他标志来强制Clang,以在整个调用堆栈中保持所有参数和变量可用?

不幸的是,使用小文件和函数的小测试用例不会重现这个问题:大多数情况下,变量会像我预期的那样保留下来

我在一台运行约塞米蒂的Mac电脑上工作

$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

这很可能是编译器中的错误。在-O0时,它应该在变量定义块期间始终保持变量活动。事实上可能是这样,但有人在编译器管道中的某个地方忘记了它的位置


如果你能举出一些例子来说明这个问题,你不介意与llvm的同事们分享,那么请向llvm bugzilla()或Apple llvm团队提交一个bug。

-fno-inline
可能?不,
-fno-inline
没有帮助。