DebugKernel

Table of contents
No headers

You can use insight GDB GUI to debug kernel. Insight is the (same) GDB integrated with GUI interface.
You must include JTAG debug module in SOPC Builder. Using level 1 is OK. But level 2 is better, as it supports two hardware data watchpoints.
(Placing a hardware data watchpoint as "awatch *(int *)0" is very useful to catch a common NULL pointer dereference bug.)

The debug info (-g) is disabled by default. To enable debug info,

Kernel hacking -->
[*] Kernel debugging 
 [*] Compile the kernel with debug info 

To disable optimization of your driver, add rule like this to your Makefile, eg, driver/net/Makefile,

CFLAGS_atse.o = -O0

You may find more info from
linux-2.6/Documentation/kbuild/makefiles.txt


The kernel object file is linux-2.6.x/vmlinux, which is an ELF format object containing debug information. You can not use zImage here, as the debug information is stripped off. You may use the same method to debug u-boot or others. If you want to debug kernel modules or user space programs, you need will more setup than what is described here. The debugging of user space programs will be discussed in another wiki later.

1.You will need USB-blaster and jtagd properly configured. Run "jtagconfig" to verify it is working.
You may refer to QuartusforLinux , LinuxGdbServer or alteraforum for related.

2. Configure sof 
nios2-configure-sof  path_to/your_system.sof

3. Edit a file, say linux.gdb, containing gdb startup commands. You may add more break points to the codes which you want to debug.
This is optional, but it is handy to use a command file rather than do it by hand.
file linux-2.6.x/vmlinux
target remote localhost:2342
load linux-2.6.x/vmlinux
break *start_kernel
jump *_start

4. Edit a short shell script, say debuglinux.sh, to start gdb-server to listen at, say 2342 port, and start insight. 
Remember to do chmod +x debuglinux.sh . You can also modify nios2-debug to do the same job.
nios2-gdb-server-wrapped --reset-target --tcpport 2342 &
nios2-elf-insight --command=path_to/linux.gdb


5. If you use jtag uart for console, you need to start "nios2-terminal".
Then start debugger. 
cd uClinux-dist
path_to/debuglinux.sh


Using cable "USB-Blaster [USB 4-1.2]", device 1, instance 0x00
Pausing target processor: OK
Listening on port 2342 for connection from GDB: accepted

Screenshot-main.c - Source Window.png



6. Wait about 1 minute. The insight GUI will come out with a source code window, stopped at main() in start.c . You can begin debugging now.

You may find more insight usage from Redhat GNUPro Debugger Tools PDF (2454 KB) .
You may also find GDB manual at your nios2eds installation, file:///opt/altera7.2/nios2eds/docum...s/gdb/gdb.html .
Peter Jay Salzman's GDB guideUsing GNU's GDB Debugger


To debug module, see Module section offsets in /sys/module [LWN.net]  .
kernel config,
General setup ---> [*] Configure standard kernel features (for small systems) ---> [*] Load all symbols for debugging/ksymoops
Then, you can find the section locations of module, and add symbols.

   

Tag page
Viewing 1 of 1 comments: view all
Aubry appears in louis vuitton Spring Collection 2010Your comment is touching but it sounds louis vuitton speedy, I'm so sick of you and your racist kind harping on about being previously disadvantaged, and that the whites had it so good, we had to work for what we had, the louis vuitton shop didn't give us anything back then, louis vuitton replica, and today we still have what we have because when we meet adversity or poverty we just work harder, replica louis vuitton and our children and we teach them of no work no pay. What are you looking for now a free ride, the ANC has had plenty of time to give you that! Or Super louis vuitton Malema to rescue you.
Posted 01:22, 9 Mar 2010
Viewing 1 of 1 comments: view all
You must login to post a comment.
SourceForge.net