相关疑难解决方法(0)

gdb - 防止在捕获/重新抛出情况下丢失回溯

是否可以重新抛出异常而不会丢失gdb中的反向跟踪?或者有没有办法在gdb中"备份"几行并从那里返回跟踪?我在GDB 7.7.1上,这是最新的.

我有时会发现自己遇到这样的情况,需要从异常的原始抛出中回溯,并且需要注释掉try/catch部分,重新​​编译并在gdb中重新运行.

try {
   someFuncThatCanThrowException();
} catch(exceptionType& exception) {
   if(@CAN_RECOVER@) {
      ...
   } else {
      throw;
   }
}
Run Code Online (Sandbox Code Playgroud)

- - 要么 - -

try {
   someFuncThatCanThrowException();
} catch(exceptionType& exception) {
   exception.printMessageToCout();
   throw;
}
Run Code Online (Sandbox Code Playgroud)

c++ gdb exception-handling exception

5
推荐指数
1
解决办法
698
查看次数

标签 统计

c++ ×1

exception ×1

exception-handling ×1

gdb ×1