ubuntu 如何使用gdb在gdk_x_error()上中断?

uwopmtnx  于 6个月前  发布在  其他
关注(0)|答案(1)|浏览(95)

我的问题如下:一个应用程序(即eclipse)在我的机器上崩溃,并显示以下错误消息:

The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 16911 error_code 3 request_code 3 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
  that is, you will receive the error a while after causing it.
  To debug your program, run it with the --sync command line
  option to change this behavior. You can then get a meaningful
  backtrace from your debugger if you break on the gdk_x_error() function.)

字符串
现在我想做的是按照错误消息的建议运行gdb,但是我没有成功,也没有显示任何回溯。
我没有太多的调试经验。无论如何,我尝试了以下方法:
1)Activate -dbgsym repositories
2)安装eclipse dbg符号(命令sudo apt-get install ^eclipse-.*dbgsym
3)安装libgtk-3-0-dbglibgtk2.0-0-dbg和所有与^libgdk.*dbg匹配的软件包
4)运行gdb:

(gdb) file /usr/lib/eclipse/eclipse
Reading symbols from /usr/lib/eclipse/eclipse...
Reading symbols from /usr/lib/debug/.build-
id/c2/8e5f4ebdd67159093d8ee6e6daf58ab6fab94c.debug...done.
done.
(gdb) break gdk_x_error
Function "gdk_x_error" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
(gdb) run --sync

**[更新]**我也尝试了以下方法(没有成功):

1)(3)同上
4)运行gdb:

(gdb) file /usr/lib/eclipse/eclipse
Reading symbols from /usr/lib/eclipse/eclipse...
Reading symbols from /usr/lib/debug/.build-
id/c2/8e5f4ebdd67159093d8ee6e6daf58ab6fab94c.debug...done.
done.
(gdb) break main
Breakpoint 1 at 0x4010a0: file ../eclipseMain.c, line 101.
(gdb) run --sync
Starting program: /usr/lib/eclipse/eclipse --sync
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main (argc=2, argv=0x7fffffffdf18) at ../eclipseMain.c:101
101 ../eclipseMain.c: file or directory not found.
(gdb) break gdk_x_error
Function "gdk_x_error" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
(gdb) cont

[/Update]

测试结果:
当应用程序崩溃时,输出与上面相同,没有显示任何额外的信息。我假设我的方法是错误的,或者我加载了错误的调试符号。(因为它说“gdk_x_error”未定义。)

[Update 2]当我在崩溃后输入bt时,它显示No Stack.[/Update 2]

我怎么做才能得到有意义的回溯?有什么想法吗?

tzdcorbm

tzdcorbm1#

如果gdb找不到gdk_x_error,你可以在_XError上中断,就像建议的here一样。

相关问题