GDB最常用的命令

Posted SpaceVision

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GDB最常用的命令相关的知识,希望对你有一定的参考价值。


GDB 最常用的命令

b main​ - Puts a breakpoint at the beginning of the program

b​ - Puts a breakpoint at the current line

b N​ - Puts a breakpoint at line N

b +N​ - Puts a breakpoint N lines down from the current line

b fn​ - Puts a breakpoint at the beginning of function "fn"

d N​ - Deletes breakpoint number N

info break​ - list breakpoints

r​ - Runs the program until a breakpoint or error

c​ - Continues running the program until the next breakpoint or error

f​ - Runs until the current function is finished

s​ - Runs the next line of the program

s N​ - Runs the next N lines of the program

n​ - Like s, but it does not step into functions

u N​ - Runs until you get N lines in front of the current line

p var​ - Prints the current value of the variable "var"

bt​ - Prints a stack trace

u​ - Goes up a level in the stack

d​ - Goes down a level in the stack

q​ - Quits gdb


以上是关于GDB最常用的命令的主要内容,如果未能解决你的问题,请参考以下文章

GDB常用命令

gdb常用命令记录

GDB的常用命令

GDB常用调试命令

GDB调试——常用的命令

gdb调试工具常用命令 && kdb