简体   繁体   English

stst :: bad_function_call的callstack

[英]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.

相关问题 导致std :: bad_function_call的原因是什么? - What causes std::bad_function_call? 意外的std :: bad_function_call递归 - unexpected std::bad_function_call in recursion 从外部函数构造 std::function 给出 std::bad_function_call - Constructing std::function from extern functions gives std::bad_function_call c++ std::map 比较函数导致运行时“bad_function_call” - c++ std::map compare function leads to runtime "bad_function_call" std :: bad_function_call在visual studio中调用std :: swap时 - std::bad_function_call when calling std::swap in visual studio std :: bad_function_call自调用递归lambda但没有提示 - std::bad_function_call of self-calling recursive lambda but no hints 为什么我的线程池有时会抛出 `std::bad_function_call` 或 `double free or corruption (!prev)` - Why does my thread pool sometimes throw `std::bad_function_call` or `double free or corruption (!prev)` 将 avx 变量传递给 std::function 时引发 bad_function_call 和分段错误 - bad_function_call thrown and segmentation fault caused when passing avx variables to std::function 运行 dpcpp 代码时终止代码为 std::bad_function_call - Terminating code as std::bad_function_call when running the dpcpp code 使用Lambda的C ++回调失败并显示bad_function_call - C++ callback with lambda fails with bad_function_call
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM