Skip to main content.
Navigation:
DENX
>
DULG
>
GDBScripts
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
DULG
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
DULG Home
BoardSelect
Manual
FAQ
Application Notes
Changes
Index
List of pages in DULG
Search
%SECTION0{name=GDBScripts}% GDB Startup File and Utility Scripts In addition to the =add-module= macro, the followin example GDB startup file contains a few other useful settings and macros, which you may want to adjust to your local environment: <verbatim> set output-radix 16 target remote bdi:2001 define reset detach target remote bdi:2001 end define add-module shell ~/add-symbol-file.sh $arg0 source ~/add-symbol-file.gdb end document add-module Usage: add-module <module> Do add-symbol-file for module <module> automatically. Note: A map file with the extension ".map" must have been created with "insmod -m <module> > <module>.map" in advance. end </verbatim> The following shell script _~/add-symbol-file.sh_ is used to run the GDB _add-symbol-file_ command automatically: <verbatim> #!/bin/sh # # Constructs the GDB "add-symbol-file" command string # from the map file of the specified kernel module. add_sect() { ADDR=`awk '/^'$1' / {print $3}' $MAPFILE` if [ "$ADDR" != "" ]; then echo "-s $1 0x`awk '/^'$1' / {print $3}' $MAPFILE`" fi } [ $# == 1 ] && [ -r "$1" ] || { echo "Usage: $0 <module>" >&2 ; exit 1 ; } MAPFILE=$1.map ARGS="0x`awk '/^.text / {print $3}' $MAPFILE`\ `add_sect .rodata`\ `add_sect .data`\ `add_sect .sdata`\ `add_sect .bss`\ `add_sect .sbss`\ " echo "add-symbol-file $1 $ARGS" > ~/add-symbol-file.gdb </verbatim>
10.2. Linux Kernel Debugging
1. Abstract
10.4. Tips and Tricks
Prev
Home
Next