gdb调试Apollo

这篇博客介绍了如何在Linux环境下使用GDB调试Apollo项目。在编译时需要添加-g选项以包含调试信息。调试Apollo时,先启动核心进程和Dreamview,然后针对不同模块如planning或prediction,使用特定命令启动调试。在调试过程中,可以设置断点、运行程序并进行详细调试。文章还列举了一些常用的GDB命令。
摘要由CSDN通过智能技术生成

gdb 例子

编译生成执行文件:(Linux下)

    cc -g tst.c -o tst

使用GDB调试:

hchen/test>  gdb tst  <---------- 启动GDB
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-suse-linux"...

(gdb) l     <-------------------- l命令相当于list,从第一行开始例出原码。
1        #include <stdio.h>
2
3        int func(int n)
4        {
   
5                int sum=0,i;
6                for(i=0; i<n; i++)
7                {
   
8                        sum+=i;
9                }
10               return sum;
(gdb)       <-------------------- 直接回车表示,重复上一次命令
11       }
12
13
14       main()
15       {
   
16               int i;
17               long result = 0;
18               for(i=1; i<=100; i++)
19               {
   
20                       result += i;   

(gdb) break 16    <-------------------- 设置断点,在源程序第16行处。 或者 b 16  删除 d 16
Breakpoint 1 at 0x8048496: file tst.c, line 16.
(gdb) break func  <-------------------- 设置断点,在函数func()入口处。
Breakpoint 2 at 0x8048456: file tst.c, line 5.
(gdb) info break  <-------------------- 查看断点信息。
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x08048496 in main at tst.c:16
2   breakpoint     keep y   0x08048456 in func at tst.c:5
(gdb
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值