我可以使用gdb跳过一行而不必输入行号吗? [英] Can I use gdb to skip a line without having to type line numbers?
问题描述
我知道我可以使用 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?
在运行时注释掉某些东西非常方便。 b $ b
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跳过一行而不必输入行号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!