G D B S E R V E R F O R A R M , X S C A L E A N D C O R T E X
U S E R M A N U A L
Debugging Embedded Linux
This is an example of loading a Linux kernel to RAM.
...
(gdb) # Reset the processor and stop it.
(gdb) # Use the delayed (-d option) monitor command
(gdb) # that will be executed by the next 'continue'.
(gdb) monitor -d reset /halt
Command delayed.
(gdb) c
Continuing.
(gdb) # Set a breakpoint at the kernel entry point.
(gdb) hbreak *0x90008000
Hardware assisted breakpoint 5 at 0x90008000
(gdb) c
Continuing.
Breakpoint 5, 0x90008000 in ?? ()
(gdb) # Load the kernel image linked to a virtual address
(gdb) # (0xC000_0000 for the ARM architecture).
(gdb) # Offset the virtual address so that the code is loaded
(gdb) # at a physical RAM address (here, 0x9000_0000).
(gdb) monitor set verify-memory 1
(gdb) load L:/Linux/ltib/rpm/BUILD/linux/vmlinux 0xD0000000
Loading section .text.head, size 0x240 lma 0x90008000
Loading section .init, size 0x1edc0 lma 0x90008240
Loading section .text, size 0x34f5b8 lma 0x90027000
Loading section .text.init, size 0xd4 lma 0x903765b8
Loading section __ksymtab, size 0x53b8 lma 0x90377000
Loading section __ksymtab_gpl, size 0x1d90 lma 0x9037c3b8
Loading section __kcrctab, size 0x29dc lma 0x9037e148
Loading section __kcrctab_gpl, size 0xec8 lma 0x90380b24
Loading section __ksymtab_strings, size 0xf86c lma 0x903819ec
Loading section __param, size 0xda8 lma 0x90391258
Loading section .data, size 0x265a8 lma 0x90392000
Loading section .init.rodata, size 0x100 lma 0x903b85a8
Start address 0xc0008000, load size 3865908
Transfer rate: 158 KB/sec, 15779 bytes/write.
Warning: the current language does not match this frame.
(gdb) # The start address is in the virtual memory.
(gdb) # Change it to the physical memory address where
(gdb) # the code has been loaded.
(gdb) p /x $pc
$9 = 0xc0008000
(gdb) set $pc=0x90008000
(gdb) p /x $pc
$10 = 0x90008000
(gdb) # Examine the kernel_entry() parameters.
(gdb) p /x $r0
$11 = 0x0
13