gdb+qemu 调试uboot,符号表需要重新加载到指定地址

Debugging u-boot in RAM:
(example on the qong board)


a) start debugger

arm-linux-gdb u-boot

[hs@pollux u-boot]$ arm-linux-gdb u-boot
GNU gdb Red Hat Linux (6.7-2rh)
Copyright © 2007 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=i686-pc-linux-gnu --target=arm-linux”.
The target architecture is set automatically (currently arm)

(gdb)


b) connect to target

target remote bdi10:2001

(gdb) target remote bdi10:2001
Remote debugging using bdi10:2001
0x8ff17f10 in ?? ()
(gdb)


c) discard symbol-file

(gdb) symbol-file
Discard symbol table from `/home/hs/celf/u-boot/u-boot’? (y or n) y
No symbol file now.
(gdb)


d) load new symbol table:

(gdb) add-symbol-file u-boot 0x8ff08000
add symbol table from file “u-boot” at
.text_addr = 0x8ff08000
(y or n) y
Reading symbols from /home/hs/celf/u-boot/u-boot…done.
(gdb) c
Continuing.
^C
Program received signal SIGSTOP, Stopped (signal).
0x8ff17f18 in serial_getc () at serial_mxc.c:192
192 while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY);
(gdb)

add-symbol-file u-boot 0x8ff08000
^^^^^^^^^^
get this address from u-boot bdinfo command
or get it from gd->relocaddr in gdb

=> bdinfo
rch_number = XXXXXXXXXX
boot_params = XXXXXXXXXX
DRAM bank = XXXXXXXXXX
-> start = XXXXXXXXXX
-> size = XXXXXXXXXX
ethaddr = XXXXXXXXXX
ip_addr = XXXXXXXXXX
baudrate = XXXXXXXXXX
TLB addr = XXXXXXXXXX
relocaddr = 0x8ff08000
^^^^^^^^^^
reloc off = XXXXXXXXXX
irq_sp = XXXXXXXXXX
sp start = XXXXXXXXXX
FB base = XXXXXXXXXX

or interrupt execution by any means and re-load the symbols at the location
specified by gd->relocaddr – this is only valid after board_init_f.

(gdb) set $s = gd->relocaddr
(gdb) symbol-file
(gdb) add-symbol-file u-boot $s

Now you can use gdb as usual 😃

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值