[英]Callstack for std::bad_function_call
I have a linux program which terminates with: 我有一个linux程序终止于:
terminate called after throwing an instance of 'std::bad_function_call'
In the call stack I sadly don't see from where the bad function is called. 在调用堆栈中,我遗憾地看不到调用坏函数的位置。 Also it does very much iterations before generating this error, so I cannot really debug it by hand.
此外,它在生成此错误之前进行了很多迭代,因此我无法手动调试它。
Is there a way to get to the problematic piece of code? 有没有办法找到有问题的代码?
Can you set a catchpoint from gdb? 你能从gdb设置一个catchpoint吗? You'll want to execute
你想要执行
catch throw
from gdb command line before running the program, and then a breakpoint will be hit when an exception is thrown. 在运行程序之前从gdb命令行开始,然后在抛出异常时将触发断点。
You can use gdb to see where the exception is being thrown: 您可以使用gdb查看抛出异常的位置:
(gdb) catch throw
That will stop whenever a new exception is thrown in your program, and you will see where it happened. 每当你的程序中抛出一个新的异常时,它就会停止,你会看到它发生的地方。
please reference to this website. 请参考本网站。 In my case, this problem was caused by using null function pointer.
在我的情况下,这个问题是由使用空函数指针引起的。 http://www.cplusplus.com/reference/functional/bad_function_call/
http://www.cplusplus.com/reference/functional/bad_function_call/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.