跳过一行而不必输入行号吗

跳过一行而不必输入行号吗

本文介绍了我可以使用 gdb 跳过一行而不必输入行号吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用 jump 将程序计数器设置为特定的行,这样我就可以跳过一行或多行(或再次执行某些行).我可以轻松跳过下一行而无需输入行号吗?

I know I can use jump to set the program counter to a specific line and so I can skip one or more lines (or execute some lines again). Can I easily just skip the next line without having to enter line numbers?

这将非常方便在运行时注释掉"某些内容.

This would be very convenient to "comment out" something at run time.

推荐答案

jump +1

跳到下一行,即跳过当前行.您可能还想将它与 tbreak +1 结合起来,在跳转目标处设置一个临时断点.

jumps to the next line line i.e. skipping the current line. You may also want to combine it with tbreak +1 to set a temporary breakpoint at the jump target.

参见 http://sourceware.org/gdb/current/onlinedocs/gdb/Specify-Location.html 了解使用 gdb 表达位置的更多方式.

See http://sourceware.org/gdb/current/onlinedocs/gdb/Specify-Location.html for more ways of expressing locations with gdb.

注意,没有断点的gdb很可能会继续正常执行而不是跳转.因此,如果跳跃似乎不起作用,请确保在目的地设置断点.

Note that without a breakpoint gdb is likely to continue execution normally instead of jumping. So if jumping doesn't seem to work, make sure you set a breakpoint at the destination.

这篇关于我可以使用 gdb 跳过一行而不必输入行号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:03