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

If all goes well you'll see the the following message:

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
Nice story about this.
Great Nice Pictures
causes back pain knee high shoes lizlange maternity fishing boats sale flu incubation period remedies sore throat cost breast implants muscle weight gain surgery breast reduction girls party ideas women laptop bags car brake parts continuing nursing education cost breast augmentation protein whey powder baby slings carriers bed bugs pictures bedding duvet covers phone pay as you go outdoor swing sets discount dinnerware sets coffee espresso machines salton yogurt maker hair color pictures pictures of haircuts asvab practice test herpes photos easy cooking recipes toy dog breeds herpes simplex 1 personalized dog tags stress fracture foot occupational therapy schools frontline plus cats fleas on humans physical therapy salary scabies pictures pictures of shingles what is blood pressure ibuprofen side effects pictures of ringworm gendongan bayi kain cukin ring sling pouch sling perlengkapan bayi selendang bayi nursing cover selendang baby perlengkapan bayi baru lahir bayi bayi lucu foto bayi parish vintage ebooks download tv series download manga free download make money online health information cell phone review disorders anxiety psat practice test blood preasure smart water filter filter pur water weight loss effects blood pressure side effects socks over knee socks dress Hot News Today Jual Beli Make Money Celebrity Gossip Kesehatan Alternatif Gosip Selebritis celebrity photos celebrity news hot celebrities celebrity blog kesehatan info kesehatan kesehatan kerja pelayanan kesehatan indonesia artis foto artis gambar artis selebriti iklan iklan gratis jual online handphone daily news breaking news local news online news food dehydrator tray massage chair ijoy homedics massage shiatsu evening gown dress evening wedding dress dry face skin gold toe sock window coverings blinds blinds for windows lip gloss cosmetics folding table chairs women high heels stockings high heels treatment of pain chlorine generation makeup lighted mirror pain management specialist lawn pest control garden pest control joint pain causes
Posted 16:09, 20 Jul 2010
Viewing 1 of 1 comments: view all
You must login to post a comment.
SourceForge.net