Debug uboot on QEMU ARM model with GDB

本文介绍如何在QEMU ARM模型上运行U-Boot,并使用GDB进行远程调试。通过特定的命令行参数启动QEMU作为GDB服务器,然后在另一个终端中启动GDB客户端连接到该服务器进行调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

u-boot runs on QEMU ARM model , we can start GDB server on QEMU with command line parameters '-s -S' as following:

chunxie@chunxie-VirtualBox:~/uboot-mainline/u-boot$ qemu-system-arm -M vexpress-a9 -nographic -m 512 -kernel u-boot -s -S

Then in another terminal, we can start gdb to connect to GDB server(TCP port local:1234) as following:

chunxie@chunxie-VirtualBox:~/uboot-mainline/u-boot$ /opt/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gdb 
GNU gdb (Linaro GDB 2016.02) 7.10.1.20160210-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.launchpad.net/gcc-linaro>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file u-boot
Reading symbols from u-boot...done.
(gdb) target remote:1234
Remote debugging using :1234
warning: remote target does not support file transfer, attempting to access files from local filesystem.
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
_start () at arch/arm/lib/vectors.S:54
54		b	reset
(gdb) l
49	
50	#ifdef CONFIG_SYS_DV_NOR_BOOT_CFG
51		.word	CONFIG_SYS_DV_NOR_BOOT_CFG
52	#endif
53	
54		b	reset
55		ldr	pc, _undefined_instruction
56		ldr	pc, _software_interrupt
57		ldr	pc, _prefetch_abort
58		ldr	pc, _data_abort
(gdb) 

Here we can see gdb commands 'target' can connect to GDB server. Now we can do normal GDB debug.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值