linux嵌入式gdb调试指南,Linux环境下的GDB调试方法(嵌入式系统课程实验指导材料).ppt...

Linux环境下的GDB调试方法(嵌入式系统课程实验指导材料)

嵌入式Linux的GDB远程调试 郗闽军 GDB的远程调试功能 GDB是GNU免费提供的调试除错工具可以用于C C++ Pascal和 Fortran等程序的跟踪调试 嵌入式Linux系统中,开发人员能够在宿主机上面使用GDB进行远程调试 运行在宿主机上的GDB通过串口或TCP连接与运行在目标机上的调试插桩stub协同工作 使用GDB标准远程串行协议 实现对目标机上的系统内核和上层应用的监控和调试功能 GDB远程调试实践 所需软件工具 armv4l-unknown-linux-gdb 运行在宿主机上 实现gdb的功能 gdbserver 运行在目标机上 用于armv4l-unknown-linux-gdb与目标机的连接 需要调试的程序 下载到目标机上面 注意!编译程序时必须使用调试选项 armv4l-unknown-linux-gcc –g Gdb远程调试 使用tcp/ip协议 目标机端 运行gdbserver等待宿主机的连接 [root@localhost gdb]./gdbserver 192.168.0.10:2345 hello 在终端上面将显示 Process hello created:pid=72 此时,正等待宿主机的连接 Gdb远程调试 使用tcp/ip 宿主机端 [user@host host] armv4l-unknown-linux-gdb hello 进入gdb调试界面 (gdb) 建立与目标机端的连接 (gdb) target remote 192.168.0.11:2345 出现如下信息表示已经成功建立连接 宿主机端: Remote debugging using 192.168.0.11:2345 0x40002a90 in ??( ) 目标机端: Remote debugging from host 192.168.0.10 Gdb远程调试 使用tcp/ip 连接成功 使用gdb进行远程调试 Gdb远程调试 使用串口 PC上需要两个串口 (/dev/ttyS0 ,/dev/ttyS1) 一个用做目标机的终端显示 (/dev/ttyS0) 一个用来实现远程调试 (/dev/ttyS1) 与使用tcp/ip方式类似 目标机端 [root@target /mnt/yaffs] ./gdbserver /dev/ttyS1 hello 宿主机端 [root@localhost host] armv4l-unknown-linux-gdb hello 进入gdb (gdb) target remote /dev/ttyS1 Gdb下常用的命令 break [file:]function Set a breakpoint at function (in file). run [arglist] Start your program (with arglist, if specified). bt Backtrace: display the program stack. print expr Display the value of an expression. c Continue running your program (after stopping, e.g. at a breakpoint). next Execute next program line (after stopping); step over any function calls in the line. Gdb下常用的命令 edit [file:]function look at the program line where it is presently stopped. list [file:]function type the text of the program in the vicinity of where it is presently stopped. step Execute next program line (after stopping); step into any function calls in the line. help [name] Show information about GDB command name, or general information about using GDB. quit Exit from GDB. * * 嵌入式系统课程实验

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值