Specifications
10. Debugging
10.1. Debugging of U-Boot
10.1.1. Debugging of U-Boot Before Relocation◊
10.1.2. Debugging of U-Boot After Relocation◊
♦
10.2. Linux Kernel Debugging
10.2.1. Linux Kernel and Statically Linked Device Drivers◊
10.2.2. Dynamically Loaded Device Drivers (Modules)◊
10.2.3. GDB Macros to Simplify Module Loading◊
♦
10.3. GDB Startup File and Utility Scripts♦
10.4. Tips and Tricks♦
10.5. Application Debugging
10.5.1. Local Debugging◊
10.5.2. Remote Debugging◊
♦
10.6. Debugging with Graphical User Interfaces♦
•
10. Debugging
The purpose of this document is not to provide an introduction into programming and debugging in general.
We assume that you know how to use the GNU debugger gdb and probably it's graphical frontends like ddd.
We also assume that you have access to adequate tools for your work, i. e. a BDI2000 BDM/JTAG debugger.
The following discussion assumes that the host name of your BDI2000 is bdi.
Please note that there are several limitations in earlier versions of GDB. The version of GDB as distributed
with the ELDK contains several bug fixes and extensions. If you find that your GDB behaves differently, have
a look at the GDB sources and patches that come with the ELDK source.
10.1. Debugging of U-Boot
When U-Boot starts it is running from ROM space. Running from flash would make it nearly impossible to
read from flash while executing code from flash not to speak of updating the U-Boot image in flash itself. To
be able to do just that, U-Boot relocates itself to RAM. We therefore have two phases with different program
addresses. The following sections show how to debug U-Boot in both phases.
10.1.1. Debugging of U-Boot Before Relocation
Before relocation, the addresses in the ELF file can be used without any problems, so debugging U-Boot in
this phase with the BDI2000 is quite easy:
bash[0]$ ${CROSS_COMPILE}gdb u-boot
GNU gdb 5.1.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-redhat-linux --target=ppc-linux"...
(gdb) target remote bdi:2001
Remote debugging using bdi:2001
0xfffffffc in ?? ()
(gdb) b cpu_init_f
Breakpoint 1 at 0xfffd3310: file cpu_init.c, line 136.
(gdb) c
Continuing.
Breakpoint 1, cpu_init_f () at cpu_init.c:136
10.1. Debugging of U-Boot 130