使用dbx捕获AIX上的C++异常
Catch C++ exceptions on AIX with dbx
我有一个C++应用程序,它在AIX机器上为某些输入数据终止,并显示"错误分配"错误消息。
有没有一种方法可以在dbx中运行程序,并在抛出异常时捕获它?我在IBM的文档中没有看到任何关于它的内容。
如果您的C++应用程序是用XL C/C++编译的,请在__DoThrowV6上设置断点。
$ cat throw.C
int foo(int x)
{
if (x < 0)
throw 99;
return x+1;
}
int main()
{
int y;
y = -5;
try
{
foo(y);
}
catch(...)
{
}
return 0;
}
$ xlC -g -o throw throw.C
$ dbx ./throw
Type 'help' for help.
reading symbolic information ...
(dbx) stop in __DoThrowV6
[1] stop in __DoThrowV6
(dbx) run
[1] stopped in __DoThrowV6 at 0xd1be7e00
0xd1be7e00 (__DoThrowV6) 7c0802a6 mflr r0
(dbx) where
__DoThrowV6() at 0xd1be7e00
foo(int)(x = -5), line 4 in "throw.C"
main(), line 14 in "throw.C"
(dbx)
__DoThrowV6是在抛出异常时调用的,因此从调用堆栈中可以看到该异常是从源文件抛出的第4行抛出的。C
相关文章:
- 处理多个异常集合的C++方法
- 我在c++代码中生成了一个运行时#3异常
- 孤立代码块在结构中引发异常
- C++中的赋值发生,尽管右侧出现异常
- 从构造函数抛出异常时如何克服内存泄漏
- 异常属于C++中的线程还是进程
- 当类定义不可见时捕获异常
- 引发异常:读取访问冲突**dynamicArray**为0x1118235.发生
- 为什么异常不退出程序?
- 为什么我应该在异常处理中使用std::cerr而不是std::cout
- 如何修复链表类实现的未处理异常0xDDDDDDDD
- 关于:C++中异常对象的范围:为什么我没有得到副本?
- 是什么导致了Unity 3D中的"错误线程异常"?
- 如何将strftime中的格式错误作为异常捕获
- 创建具有 new in 函数和"this is nullptr"异常的对象
- 尝试使用智能指针时引发异常
- 函数如何通知用户它基于函数原型抛出异常?
- 是否值得降低我的代码的可读性,以便在出现内存不足错误时提供异常安全性?
- 当我使用 C++ 中的 C# dll 来使用 Selenium 时,存在异常处理问题
- Pytorch torch.cholesky忽略异常