emacs gdb跳转到游标(emacs gdb jump to cursor)

编程入门 行业动态 更新时间:2024-10-23 13:22:29
emacs gdb跳转到游标(emacs gdb jump to cursor)

我刚刚在emacs中运行gdb时发现了Cx Ca Cj (跳转到游标)。 我最初假设它相当于在光标所在的位置设置中断并继续( c )到该语句。 但是,我似乎正在观察使用跳转时没有任何干预语句(在prev断点和当前光标位置之间)正在执行的行为。 任何人都可以确认或否认这个吗?

我猜如果它没有执行语句,它相当于能够从调试器中注释掉一段代码,即无需返回到src,显式注释掉然后重新编译。 我可以看到这可能有用,但绝对不是我所期待的。

如果这就是正在发生的事情,那么后续问题就是有一个'继续游标'命令(干预语句被执行)?

I have just discovered C-x C-a C-j (jump to cursor) when running gdb in emacs. I initially assumed that it was the equivalent of setting a break wherever the cursor is and continuing (c) to that statement. However I seem to be observing the behaviour that when using jump none of the intervening statements (between the prev breakpoint and the current cursor location) are being executed. Can anyone confirm or deny this?

I guess if it isn't executing the statements it is equivalent to being able to comment out a block of code 'from within' the debugger, i.e. without having to go back into the src, explicitly comment out and then recompile. I can see that could be useful, but it definitely wasn't what I was expecting.

If that is what's happening then a follow up question would be is there a 'continue to cursor' command (where the intervening statements do get executed)?

最满意答案

我相信你需要的是Cx Ca Cu ( Mx gud-until )而不是Mx gud-jump 。 后者,正如Emacs手册中明确指出的那样

将程序的执行点传输到当前行。 换句话说,程序执行的下一行将是您给出命令的那一行[...]有关详细信息,请参阅有关jump的GDB手册条目。

I believe what you need is C-x C-a C-u (M-x gud-until) instead of M-x gud-jump. The latter, as the Emacs manual quite clearly states, simply

transfers the program's execution point to the current line. In other words, the next line that the program executes will be the one where you gave the command [...] See the GDB manual entry regarding jump for details.

更多推荐

本文发布于:2023-08-07 21:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465968.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:游标   跳转到   gdb   emacs   jump

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!