gdb命令调试技巧 一.信息显示1.显示gdb版本 (gdb) show version2.显示gdb版权 (gdb) show version or show warranty3.启动时不显示提示信息gdb -q exe 或者.bashrc 添加alias gdb="gdb -q",重启shell4.退出时不显示提示信息(gdb) set confirm off5.输出信息多时不会暂停输出(gdb)set pagination off 二.函数1.列出函数的名字(gdb) info
一.常用普通调试命令 1.简单介绍GDB 介绍: gdb是Linux环境下的代码调试⼯具.使⽤:需要在源代码⽣成的时候加上 -g 选项.开始使⽤: gdb binFile退出: ctrl + d 或 quit 2.调试过程 (1)list命令 list linenum 显⽰binFile第linenum行周围的源代码,接着上次的位置往下列,每次列10⾏. list function 显示函数名为function的函数的源程序 list
一般有一个默认名字 但是具体运行到哪一个线程,需要猜 为了节约时间,提高效率 可以给线程写个中文名(因为默认就是英文,写中文,一眼就能挑出来) 以RTC定时器为例子 final TimerRtc timerRtc = new TimerRtc(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { new Thread("rtc实时时钟") { @Override public void run
先介绍一下GDB多线程调试的基本命令. info threads 显示当前可调试的所有线程,每个线程会有一个GDB为其分配的ID,后面操作线程的时候会用到这个ID. 前面有*的是当前调试的线程. thread ID 切换当前调试的线程为指定ID的线程. break thread_test.c:123 thread all 在所有线程中相应的行上设置断点 thread apply ID1 ID2 command 让一个或者多个线程执行GDB命令command. thread apply all c
GDB深入研究 一.GDB代码调试 (一)GDB调试实例 在终端中编译一个示例C语言小程序,保存到文件 gdb-sample.c 中,用GCC编译之 #include <stdio.h> ; int tempFunction(int a, int b) { printf("tempFunction is called, a = %d, b = %d /n", a, b); return (a + b); } int main() { int n; n = ; n++; n-
GDB深入研究 一.GDB代码调试 (一)GDB调试实例 在终端中编译一个示例C语言小程序,保存到文件 gdb-sample.c 中,用GCC编译之 #include <stdio.h> int nGlobalVar = 0; int tempFunction(int a, int b) { printf("tempFunction is called, a = %d, b = %d /n", a, b); return (a + b); } int main() { in