4

在运行我自己的基于 Qt 的 OpenGL 应用程序时,我在 fglrx dri 库中遇到分段错误。我从 gdb 获得的回溯(为 Qt 和我自己的应用程序安装了 dbg 符号):

Thread 1 (Thread 0xb7fd9720 (LWP 1809)):
#0  0x06276705 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#1  0x000020dc in ?? ()
#2  0x000020d9 in ?? ()
#3  0x00000000 in ?? ()

我无法从我的代码中看到我调用导致分段错误的 fglrx 函数的位置。如何扩展此回溯以将其完全从 main() 函数向下查看到 fglrx dri 库?

编辑:确认我自己的应用程序是用调试符号构建的:

Reading symbols from /home/user/fglrx crash/crashtest-build-desktop-Qt_4_8_1__Qt-4_8_1__Debug/crashtest...done.
(gdb) br main
Breakpoint 1 at 0x804996d: file ../program/main.cpp, line 21.
(gdb) run
Starting program: /home/user/fglrx crash/crashtest-build-desktop-Qt_4_8_1__Qt-4_8_1__Debug/crashtest  [Thread debugging using libthread_db enabled]

Breakpoint 1, main (argc=1, argv=0xbffff2a4) at ../program/main.cpp:21
21      QApplication a(argc, argv);
(gdb) bt
#0  main (argc=1, argv=0xbffff2a4) at ../program/main.cpp:21
(gdb) n
[New Thread 0xb7d2bb70 (LWP 2475)]
[New Thread 0xb752ab70 (LWP 2476)]
22      QMainWindow w;
(gdb) bt
#0  main (argc=1, argv=0xbffff2a4) at ../program/main.cpp:22
(gdb) s
QFlags<Qt::WindowType>::QFlags (this=0xbffff164) at /usr/local/Trolltech/Qt-4.8.1/include/QtCore/qglobal.h:2284
2284        Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
(gdb) bt
#0  QFlags<Qt::WindowType>::QFlags (this=0xbffff164) at /usr/local/Trolltech/Qt-4.8.1/include/QtCore/qglobal.h:2284
#1  0x080499a4 in main (argc=1, argv=0xbffff2a4) at ../program/main.cpp:22
4

2 回答 2

0

您还必须为自己的二进制文件生成调试符号。-g使用 GCC 的选项编译您的应用程序。调试时也建议关闭优化;-O0为此目的使用 GCC 的标志。

于 2012-06-23T10:16:55.063 回答
0

The simple and awful answer is you can't. According to Graham Sellers of AMD, the driver is compiled with the -fomit-frame-pointer flag, which confuses gdb if it's deeper down the stack.

于 2013-12-10T21:08:54.753 回答