+ All Categories
Home > Documents > Lab 10 Department of Computer Science and Information Engineering National Taiwan University Lab10...

Lab 10 Department of Computer Science and Information Engineering National Taiwan University Lab10...

Date post: 02-Jan-2016
Category:
Upload: sandra-mathews
View: 213 times
Download: 0 times
Share this document with a friend
Popular Tags:
16
Lab 10 Department of Computer Science and Information Engineering National Taiwan University Computer System Laboratory Lab10 – Debugging II 2014/12/2 1 /16
Transcript

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /161

Computer System Laboratory

Lab10 – Debugging II

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /162

Experimental Goal

Learn how to debug Linux in source-level by Domingo.

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /163

Environment

Host System Windows XP

Build System VirtualBox + Ubuntu 8.04

Target System Creator XScale PXA270

Software Domingo Linux kernel

You can download all software from RSWiki CSL Course Software

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /164

Introduction to Debugging

Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected.

In Lab2, we introduce Domingo, which is an integrated development environment developed by Microtime Computer Inc. Domingo can be used to not only transfer binaries to RAM but also debug in

source-level.

In this lab, we will introduce how to debug Linux kernel in source-level.

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /165

Prepare Linux Kernel and Source Codes

We prepare a Linux kernel with some bugs for this Lab.

Step 1: download Linux source codes (linux-2.6.15.3.lab10.tar.gz).

Step 2: please refer to Lab5 to configure creator_pxa270_partitions[] for your filesystem.

Step 3: compile the new Linux kernel.

Step 4: convert to U-Boot bootable image. You can set image name in mkimage to identify different kernel images.

Step 5: copy to PXA270.

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /166

Domingo Configuration (1/2)

Step 1: create a new project for PXA270.

Step 2: configure “OS support”. “Config” “OS support” “Linux 2.6”

Step 3: configure Linux path. “Linux 2.6” “Linux Path Setting...” Linux Debug Information (vmlinux) = the path of vmlinux Linux dist Path = the path of linux directory Device Driver Path = the path of device drivers S is your network drive of samba server.

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /167

Domingo Configuration (2/2)

Step 4: since the path of Linux source codes in Ubuntu is different from Windows XP, we need to configure “ELF path substitution” to replace the path. “Debug” “Default ELF Path Substitution...” Path Prefix = your path of kernel compilation Replace As = S:\

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /168

Download Linux in Domingo (1/3)

Step 1: connect to your PXA270 in Domingo.

Step 2: load debug module. “Debug” “Load Module...” Choose vmlinux.

Step 3-1: configure the module. ModuleFormat = Elf for ARM Options = ELF path substitution Download Raw Data = unchecked Goto Main Address =

0xa0008000;start_kernel Linux - Dynamic Loaded Module =

checked

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /169

Download Linux in Domingo (2/3)

Step 3-2: Additional Modules... =

Set the path of zImage, i.e., <linux directory>\arch\arm\boot\zImage. Set the start address to P;a0008000.

Step 4: execute “UART View” or putty to access the console of PXA270.

Step 5: click “Ok” to start downloading Linux.

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /1610

Download Linux in Domingo (3/3)

After downloading is complete, you will see the Linux is stopped at start_kernel() function.

Now, you can start debugging the Linux kernel.

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /1611

Troubleshooting

If you can not download the Linux image, you may refer to the following settings (TA’s): Workgroup = MSHOME <build-system-ip> = 192.168.0.101 <path of Linux> = /home/lab202/CSL/10201/lab8/pxa270/ <share> = Creator Path of linux directory = /home/lab202/CSL/10201/lab8/pxa270/linux Path of vmlinux = /home/lab202/CSL/10201/lab8/pxa270/linux/vmlinux Path of Linux device drivers = /home/lab202/CSL/10201/lab8/pxa270/linux/drivers

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /1612

Debug Linux in Domingo (1/3)

You can select specific functions on the menu bar for debugging. M: images. F: source files in the specific image M. L: functions in the specific source file F.

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /1613

Debug Linux in Domingo (2/3)

You can set breakpoints by clicking the line number. Breakpoints can be cancelled by clicking again.

After setting breakpoints, you can continue the program by following operations.

breakpoints

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /1614

Debug Linux in Domingo (3/3)

You can see register values in register window.

You also can watch variables in watch list.

Please refer to Domingo tutorial for more information. “View” “Tutorial”

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /1615

Debug Linux Kernel

Please use Domingo to find out why the values of memory clock and system bus clock are zero.

?

2014/12/2

Lab 10 Department of Computer Science and Information EngineeringNational Taiwan University /1616

Lab Requirement

Show how you find and correct the bug of Linux kernel we gave.

2014/12/2


Recommended