gdb在Ubuntu下单的terminal下的使用

先sudo启动gdb
attach the_pid_num_you_want_to_attach //attach到你要调试的进程

info threads //查看当前要调试的程序含有哪些thread
help info //如果不知道info这个命令怎么用。
help info threads //如果不知道info threads这个命令怎么用。

c //让程序继续运行

thread the_num_of_one_threads //从1开始,选择进入哪个thread

ctrl+c //在程序没有断点时,暂停程序的执行

你可以不离开gdb,直接执行shell命令,比如:

(gdb) shell ls

(gdb) !ls
这里,"!"和命令之间不需要有空格(即,有也成)。

猜你喜欢

转载自www.cnblogs.com/praiseslow/p/10026331.html