【跟我一起学gdb】(10)自动化gdb脚本之 list 命令

main.c

tom@ubuntu:~/dvp$ cat -n main.c
     1	const char* acWordsList[] = {"hello", "world", "good", "BeiJing"};
     2	
     3	static int s = 0;
     4	
     5	typedef struct
     6	{
     7		int iW;
     8		int iH;
     9		int iX;
    10		int iY;
    11	}BOX_ST;
    12	
    13	BOX_ST stBox;
    14	
    15	int sum(const int a, const int b)
    16	{
    17		int c = a + b;
    18		
    19		return c;
    20	}
    21	
    22	int main()
    23	{
    24		for (int i = 0; i < 18; ++i)
    25		{
    26			stBox.iW = i;
    27			stBox.iH = i;
    28			stBox.iX = i;
    29			stBox.iY = i;
    30			
    31			s = sum(i,i+2);
    32		}
    33		
    34		return 0;
    35	}
tom@ubuntu:~/dvp$ 

list命令的使用

(gdb) help list
List specified function or line.
With no argument, lists ten more lines after or around previous listing.
"list -" lists the ten lines before a previous ten-line listing.
One argument specifies a line, and ten lines are listed around that line.
Two arguments with comma between specify starting and ending lines to list.
Lines can be specified in these ways:
  LINENUM, to list around that line in current file,
  FILE
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值