Reputation: 14071
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?
Upvotes: 7
Views: 10651
Reputation: 609
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/
Upvotes: 2
Reputation: 208416
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.
Upvotes: 4
Reputation: 24561
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.
Upvotes: 11