Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.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
C++11 C++;:如何调试&x27;总线错误';使用lldb?_C++11_Lldb - Fatal编程技术网

C++11 C++;:如何调试&x27;总线错误';使用lldb?

C++11 C++;:如何调试&x27;总线错误';使用lldb?,c++11,lldb,C++11,Lldb,我不熟悉lldb调试。最近,我编译了我的代码并尝试测试它。编译后,当我运行它时,我会得到“总线错误””。因此,我想使用lldb调试器来找出问题。终端向我提供如下输出: $ lldb ./testLSTMForwardPass (lldb) target create "./testLSTMForwardPass" Current executable set to './testLSTMForwardPass' (x86_64). (lldb) run Process 96512 launche

我不熟悉
lldb
调试。最近,我编译了我的代码并尝试测试它。编译后,当我运行它时,我会得到“总线错误””。因此,我想使用
lldb
调试器来找出问题。终端向我提供如下输出:

$ lldb ./testLSTMForwardPass
(lldb) target create "./testLSTMForwardPass"
Current executable set to './testLSTMForwardPass' (x86_64).
(lldb) run
Process 96512 launched: './testLSTMForwardPass' (x86_64)
Testing LSTM Forward pass:
Process 96512 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x102742ba8)
    frame #0: 0x0000000102742ba8
->  0x102742ba8: addb   %al, (%rax)
    0x102742baa: addb   %al, (%rax)
    0x102742bac: addb   %al, (%rax)
    0x102742bae: addb   %al, (%rax)
Target 0: (testLSTMForwardPass) stopped.
(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x102742ba8)
  * frame #0: 0x0000000102742ba8
    frame #1: 0x00000001015a1768 libMatrix.so`TMatrixT<double>::operator=(this=0x00007ffeefbfdd60, source=0x0000000102742b60) at TMatrixT.cxx:1739 [opt]
    frame #2: 0x00000001015a16e8 libMatrix.so`TMatrixT<double>::TMatrixT(this=0x00007ffeefbfdd60, another=0x0000000102742b60) at TMatrixT.cxx:87 [opt]
    frame #3: 0x0000000100006cf0 testLSTMForwardPass`double testForwardPass<TMVA::DNN::TReference<double> >(timeSteps=<unavailable>, batchSize=<unavailable>, stateSize=<unavailable>, inputSize=<unavailable>) at TestLSTMForwardPass.h:98 [opt]
    frame #4: 0x000000010000695a testLSTMForwardPass`main at TestLSTMForwardPass.cxx:28 [opt]
    frame #5: 0x00007fff65722145 libdyld.dylib`start + 1
    frame #6: 0x00007fff65722145 libdyld.dylib`start + 1
$lldb./testLSTMForwardPass
(lldb)目标创建“/testLSTMForwardPass”
当前可执行文件设置为“./testLSTMForwardPass”(x86_64)。
(lldb)运行
已启动进程96512:“./testLSTMForwardPass”(x86_64)
测试LSTM向前传球:
进程96512已停止
*线程#1,队列='com.apple.main thread',停止原因=EXC#U BAD#U访问(代码=2,地址=0x102742ba8)
帧#0:0x0000000102742ba8
->0x102742ba8:添加%al,(%rax)
0x102742baa:添加%al,(%rax)
0x102742bac:添加%al,(%rax)
0x102742bae:添加%al,(%rax)
目标0:(testLSTMForwardPass)已停止。
(lldb)英国电信
*线程#1,队列='com.apple.main thread',停止原因=EXC#U BAD#U访问(代码=2,地址=0x102742ba8)
*帧#0:0x0000000102742ba8
帧#1:0x00000001015a1768 libMatrix.so`TMatrixT::operator=(this=0x00007ffeeffdd60,source=0x0000000102742b60)位于TMatrixT.cxx:1739[opt]
帧#2:0x00000001015a16e8 libMatrix.so`TMatrixT::TMatrixT(这个=0x00007FFEEBFDD60,另一个=0x0000000102742b60)位于TMatrixT.cxx:87[opt]
帧#3:0x0000000100006cf0 testLSTMForwardPass`testLSTMForwardPass处的双testForwardPass(timeSteps=,batchSize=,stateSize=,inputSize=),h:98[opt]
帧#4:0x000000010000695a testLSTMForwardPass`主帧位于testLSTMForwardPass.cxx:28[opt]
帧#5:0x00007fff65722145 libdyld.dylib`start+1
帧#6:0x00007fff65722145 libdyld.dylib`start+1

我无法理解这个输出意味着什么。如果有人能帮助我正确理解它,那就太好了。:)

回溯显示函数名、文件名和行号。最新的帧位于顶部(最低数字),最旧的帧位于底部(最高数字),因此很容易理解。不,我的意思是,我应该如何指出具体的行错误?对不起,我有点困惑。新增:)什么,您的意思是像输出的
TMatrixT.cxx:1739
部分一样?这意味着崩溃发生在文件
TMatrixT.cxx
,行
1739
中。因为它在图书馆里,所以我怀疑你能否在那里找到坠机的根本原因。相反,在文件
TestLSTMForwardPass.h
testForwardPass
函数的
98行
中,查看堆栈下面的几个帧。在文件
TestLSTMForwardPass.cxx
main
函数中,第28行
28
。哦,我们基本上是根据帧查看代码行。非常感谢你。那会有帮助的。我真的很感谢您的帮助:)“我们基本上是根据帧查看代码行”是的,您可以在调试器中正确地执行此操作。阅读有关lldb基本命令的帮助。