debug uClinux with gdb
first we need:--install uClinux_gnutools(I use arm-elf-tools-20011219.tar.gz)
--build uclinux(I use uClinux-dist-20030522.tar.gz)
--creat new link for linux:
# ln -s uClinux-dist/linux-2.4.x/linux linux
--build skyeye(I use skyeye-1.2.5_REL.tar.gz)
if you don't how to do these see https://www.ibm.com/developerworks/cn/linux/l-skyeye/part2/
next:
--run uClinux in skyeye with debug option:
# arm-elf-skyeye -d -e linux
Your elf file is little endian.
arch: arm
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0
mach info: name at91, mach_init addr 0x805cb28
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm7100 mmu ops
Loaded ROM images/romfs.img
exec file "linux"'s format is elf32-little.
load section .init: addr = 0x01000000size = 0x0000a000.
load section .text: addr = 0x0100a000size = 0x000c5c10.
load section .data: addr = 0x010d0000size = 0x00008320.
not load section .bss: addr = 0x010d8320size = 0x00022198 .
not load section .debug_abbrev: addr = 0x00000000size = 0x00039846 .
not load section .debug_info: addr = 0x00000000size = 0x016b6881 .
not load section .debug_line: addr = 0x00000000size = 0x002a8b67 .
not load section .debug_pubnames: addr = 0x00000000size = 0x0000b40d .
not load section .debug_aranges: addr = 0x00000000size = 0x000022e0 .
call ARMul_InitSymTable,kernel filename is linux.
start addr is set to 0x01000000 by exec file.
debugmode= 1, filename = skyeye.conf, server TCP port is 12345 //stop here wait gdb host conecte
Remote debugging using host:12345 //this show gdb has conected
--open other consle in your computer, go your uClinux dir
# arm-elf-gdb linux
GNU gdb 5.0
Copyright 2000 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=i686-pc-linux-gnu --target=arm-elf"...
(gdb) target remote 127.0.0.1:12345 //conecte target
Remote debugging using 127.0.0.1:12345
0x1000000 in stext () at af_packet.c:1891
1891 sock_unregister(PF_PACKET);
(gdb) break start_kernel //set breakpoint at start_kernel()
Breakpoint 1 at 0x100055c: file init/main.c, line 362.
(gdb) continue
Continuing.
Breakpoint 1, start_kernel () at init/main.c:362 //now program stop at start_kernel()
362 printk(linux_banner);
(gdb) list
357 /*
358 * Interrupts are still disabled. Do necessary setups, then
359 * enable them
360 */
361 lock_kernel();
362 printk(linux_banner);
363 setup_arch(&command_line);
364 printk("Kernel command line: %s\n", saved_command_line);
365 parse_options(command_line);
366 trap_init();
(gdb) break main.c:364
Breakpoint 2 at 0x1000578: file init/main.c, line 364.
(gdb) next //Note: next command has something wrong, if no breakpoint it will full run.
Breakpoint 2, start_kernel () at init/main.c:364
364 printk("Kernel command line: %s\n", saved_command_line);
(gdb) break main.c:366
Breakpoint 3 at 0x100058c: file init/main.c, line 366.
(gdb) next
365 parse_options(command_line);
(gdb) list
360 */
361 lock_kernel();
362 printk(linux_banner);
363 setup_arch(&command_line);
364 printk("Kernel command line: %s\n", saved_command_line);
365 parse_options(command_line);
366 trap_init();
367 init_IRQ();
368 sched_init();
369 softirq_init();
(gdb) step //'next' has someting wrong but 'step' is ok.
parse_options (line=0x10d8ec4 "@") at init/main.c:234
234 {
(gdb) list
229 *
230 * This routine also checks for options meant for the kernel.
231 * These options are not given to init - they are for internal kernel use only.
232 */
233 static void __init parse_options(char *line)
234 {
235 char *next,*quote;
236 int args, envs;
237
238 if (!*line)
(gdb) s
238 if (!*line)
(gdb) p args
$1 = 0
(gdb) p *next
$2 = 0 '\000'
......
enjoy it!
just beginning...
thanks yymusic & ksh
see--http://www.linuxfans.org/bbs/thread-181087-1-1.html 这个时候可以打印出向相关到寄存器到内容吗?
比如说 PC cpsr 到内容,谢谢! (gdb) info register
回复 #3 ksh 的帖子
多谢!多谢!
页:
[1]