I have a linux program which terminates with:
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? 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.
You can use gdb to see where the exception is being thrown:
(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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With