简体   繁体   English

如何跳过GDB调试器中的某些行?

[英]How to skip some lines in the GDB debugger?

如何在GDB调试器中跳过一行?

You may find these links interesting : 您可能会发现以下链接很有趣:

GDB Tutorial - Main commands GDB教程-主要命令

Another tutorial 另一个教程

In short, you can use : 简而言之,您可以使用:

  • next to execute the current line and directly go to the next one (if the line is a function call, it doesn't step into the function), next执行当前行并直接转到下一行(如果该行是函数调用,则不会进入该函数),
  • step to execute the current line (if it's a function call, it enters the function and stops at its first statement), 执行当前行的step (如果是函数调用,则进入函数并在其第一条语句处停止),
  • until X to execute the code and stop on line X until X执行代码并在X行上停止
  • b X and then run or continue , to set a breakpoint on line X and execute the code until line X is reached. b X ,然后runcontinue ,以在X行上设置断点并执行代码,直到到达X行为止。

If you really want to skip a line, thus stepping to the next one but NOT executing it, you can use jump X (X being a line number). 如果您确实要跳过一行,从而跳至下一行但不执行,则可以使用jump X (X是行号)。 Be careful and use breakpoints, because using jump will make the debugger resume code execution from line X. 请小心并使用断点,因为使用jump将使调试器从X行恢复代码执行。

several ways 几种方法

next 下一个

to step a line 踩线

until 1234 直到1234

to continue until the line 1234. 继续直到第1234行。

如果要跳过某些行的执行,可以手动更改程序计数器并继续执行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM