網頁

2008年10月9日 星期四

GDB Script file

For Linux Applications

set solib-absolute-prefix /home/dean/rootfs/

set solib-search-path /home/dean/rootfs/lib/

target remote 192.168.38.38:1234

handle SIG32 nostop

For bootloader
Use JTAG (J-link) to debug bootloader ;take a example for u-boot

#
# J-LINK GDB SERVER initialization
#
# This connects to a GDB Server listening
# for commands on localhost at tcp port 2331
target remote 192.168.42.42:2331
# Set JTAG speed to 30 kHz
monitor speed 30
# Set GDBServer to big endian
monitor endian little
# Reset the chip to get to a known state.
monitor reset 1
#monitor WaitHalt 2000
#
# CPU core initialization (to be done by user)
#
# Set the processor mode
monitor reg cpsr = 0xd3
# Set auto JTAG speed
monitor speed auto
# Setup GDB FOR FASTER DOWNLOADS
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
# Load the program executable called "image.elf"
load /home/dean/u-boot-1.2.0/u-boot
#assign PC conter to the start of the program (address 0x01400004) saved in the flash
monitor reg pc = 0x01400004
#add symbol file to this flash start address (0x01400000) ;this context is the useless data
#for identification
add-symbol-file u-boot-1.2.0/u-boot 0x01400000
#set hardware breakpoint
monitor setBP 0x01400058