开发者

Uncaught exception - debugging techniques (C++)

开发者 https://www.devze.com 2023-03-08 20:45 出处:网络
I have encountered a curious scenario in which the following unlikely code: try{ throw Core::ValueError();

I have encountered a curious scenario in which the following unlikely code:

try{
  throw Core::ValueError();
}
catch (Core::Error &e){
 开发者_高级运维 ...
}

(ValueError inherits from Error inherits from std::exception)

results in the exception being caught if compiled into an executable, but not if compiled into a particular shared library.

And so my questions:

  1. What debugging tools and/or techniques can I use to peek inside the black-box that is the exception handling process? Can I step through it with gdb?

  2. Is there any information I could pull out of the Mach-o headers that would tell me anything about the catchablility (if you will) of certain exceptions by certain catch clauses? In particular, can I look say at the "gcc_except_tab" section with its lovely LSDA's, or the symbols table, or another part, and deduce any problem with symbol visibility or other issue relevant to catching exceptions?

I did find an online source that claimed a solution using a chicken, seven rat tails and a particle accelerator, but I figured I'd try StackOverflow first and leave the black magic as a last resort.

(I'm running i686-apple-darwin10-g++-4.2.1 on OSX 10.6.7)


You are throwing a temporary object so you should catch( Core::Error const& e ).

0

精彩评论

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