开发者

C++ exception information from core file

开发者 https://www.devze.com 2023-03-13 00:28 出处:网络
I have a program that catches unknown exceptio开发者_Python百科n. The code looks like this: try {

I have a program that catches unknown exceptio开发者_Python百科n. The code looks like this:

try {
    ...
} catch (...) {
    abort(); // generates core file
}

I have a core file and the executable. Is there any way for me to know what exception it caught and where in the code it was generated without recompiling or running again in gdb? I was thinking about trying to figure out all this from the core file using gdb. Any ideas how to do that?

PS: I am on Linux CentOS 5.4


Unless you are passing the backtrace information to the exception (like explained here) and unless that exception is caught, there are no ways to get the information from where the exception is thrown.

Since the catch all (catch(...)) block caught an exception, you can not get that information.


As far as I know you won't be able to get wich exception has been trapped into a catch (...)

Look at this post:

how to get message of catch-all exception

0

精彩评论

暂无评论...
验证码 换一张
取 消