GDB可以调试抓住鼠标的劣等吗?

发布于 2025-02-09 02:46:05 字数 217 浏览 2 评论 0 原文

当GDB达到断点时,下次抓住了鼠标时,我的鼠标行不通。由于我在IDE中使用GDB,因此完全冻结了计算机。数小时的搜索仅显示“ - no_grab”某处,这在任何GDB文档中都不是。所以问题是: 是否有命令或选项告诉GDB在断点停止时瞬间解开鼠标?

我也很好奇Xlib是否可以表明某些窗口抓住了鼠标并提供窗口的ID?此搜索从未提供答案。

我将很高兴知道这是不可能的,并停止进一步搜索。谢谢。

When gdb hits a breakpoint, while inferior has grabbed the mouse, my mouse does not work. Since I use gdb within an IDE, that completely freezes the computer. Hours of search only showed "--no_grab" somewhere, which is not in any gdb documentation. So the question is:
Is there a command or option to tell gdb to momentarily ungrab the mouse while stopped at a breakpoint?

I was also curious whether xlib could indicate that some window has grabbed the mouse, and provide the ID of the window? This search never provided an answer.

I will be more than glad to know neither is possible, and stop further search. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

擦肩而过的背影 2025-02-16 02:46:05

GDB对Xlib不了解,也不了解抓取鼠标的想法,这是您要调试的程序的一部分。

您可能会从GDB调用正确的库函数来解开鼠标,可以找到该文档在这里,但看起来很像:

(gdb) call function_to_ungrab_mouse()

当然,这会使您的程序处于意外状态,因此,当您恢复时,它可能不会像您期望的那样行事,所以在继续之前,可能要调用该功能再次抓住鼠标。

如果您知道特定的断点位于捕获鼠标的位置,并且在击中断点时始终想解开抓地力,则可以使用断点命令,这些记录为

(gdb) break LOCATION_WHERE_MOUSE_IS_GRABBED
(gdb) commands
call function_to_ungrab_mouse()
end
(gdb)

sourceware.org/gdb/current/onlinedocs/gdb/break-commands.html#break-commands“ rel =“ nofollow noreferrer”>在这里 设施是远程调试。在运行X应用程序的机器上,您要调试您可以使用 gdbserver 启动或附加到应用程序。然后,在其他机器上您可以运行GDB并连接到GDBSERVER。现在,当应用程序断开并抓住鼠标时,您的第二台机器将不会受到影响,您可以继续进行调试。当然,使用GDBSERVER的设置可能更多地参与其中,您需要访问运行GDB的计算机上的应用程序源代码,并且您需要两台机器之间的网络访问,但这可能是一个解决方案。

GDB has no understanding of xlib, or of the idea of grabbing (or ungrabbing) the mouse, this is all part of the program you are debugging.

You could potentially, from GDB, call the correct library function to ungrab the mouse, the documentation for this can be found here, but would look something like:

(gdb) call function_to_ungrab_mouse()

Of course, this would leave your program in an unexpected state, so when you resume it might not behave as you expect, so before you continue you might want to call the function to grab the mouse again.

If you know that a particular breakpoint is at a location where the mouse is grabbed, and you always want to ungrab when you hit that breakpoint, then you could make use of breakpoint commands, these are documented here, but would look something like:

(gdb) break LOCATION_WHERE_MOUSE_IS_GRABBED
(gdb) commands
call function_to_ungrab_mouse()
end
(gdb)

Another option to consider, if you have the facilities, is remote debugging. On the machine running the X application you want to debug you can use gdbserver to either start, or attach to the application. Then, on a different machine you can run GDB and connect to gdbserver. Now when the application breaks, and the mouse is grabbed, your second machine will not be impacted, and you can continue to debug. Of course, the setup with gdbserver can be a little more involved, you'll need access to the application source code on the machine running GDB, and you'll need network access between the two machines, but this could be a solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文