Presentation is loading. Please wait.

Presentation is loading. Please wait.

YongChul Kwon yongchul@cs CSE451 Section 1: Spring 2006 YongChul Kwon yongchul@cs.

Similar presentations


Presentation on theme: "YongChul Kwon yongchul@cs CSE451 Section 1: Spring 2006 YongChul Kwon yongchul@cs."— Presentation transcript:

1 YongChul Kwon yongchul@cs
CSE451 Section 1: Spring 2006 YongChul Kwon

2 Reminders Sign up for mailing list Read the web site
Start reading the book Homework due Monday Read & start project 0 Project 0 due Tuesday Check access to forkbomb.cs.washington.edu

3 More administrative infomation
Office hour Prof. John Zahorjan Wed 3:30 – CSE534 YongChul Kwon Mon & Thr CSE216 By appointment Kurtis Heimerl Mon & Wed & Fri CSExxx

4 CSE451 projects <=5 interesting & challenging projects
Practice C & UNIX Shell & process control User-level threads Virtual memory trace analysis File systems Likely to be the same as past

5 Resources Use ‘forkbomb.cs.washington.edu’! VMware machines in 006
Well-managed(?) sandbox Do not disturb other students VMware machines in 006 Only for the final project Will distribute image for VMware player®

6 Advices Start early Read & code thoroughly Use tools It is HARD!
Top-down From Big picture to details Use tools Editors, debuggers, compiler, shell, … Pencil & paper

7 Project 0 C programming warm-up

8 C Remember what you did in CSE303 Do you remember
I know it is a painful memory… Do you remember Pointer & pointer arithmetic Stack & heap User defined data type Preprocessor String manipulation Standard C library

9 New in this course System call Union Function pointer % man 3 strcpy
% man 3 fopen % man 2 open Union Function pointer What is a function? How is it stored in binary? How is it mapped into memory? What is a function pointer?

10 Example

11 Poll How do you “debug” your program?
Print, print, print, print, print, … Stare & spot Ask friends Use debugger Other

12 GDB Most frequent GDB commands
Execution: run, continue, step, next Browsing stack: up, down, backtrace Investigate data: display, print Break point: break, clear, condition Browsing source: list Don’t forget to specify ‘-g’ when you compile

13 Debugging relevant on later projects
This slide is borrowed from section 1 in Winter 2006 In C99 #ifdef DEBUG # ifdef __KERNEL__ /* This one if debugging is on, and kernel space */ # define PDEBUG(...) printk(__VA_ARGS__) # else /* This one for user space */ # define PDEBUG(...) fprintf(stderr, __VA_ARGS__) # endif #else # define PDEBUG(...) /* not debugging: nothing */ #endif Usage PDEBUG(“Num1 : %d, Num2 : %do numbers: %d and %d\n”, num, num2); Don’t forget to declare DEBUG to enable

14 Write a safe code What is the problem of following code?
char *buf = (char *)malloc(32); strcpy(buf, argv[1]); How can we fix it?

15 Probable errors Why do we get segmentation fault?
Why do we get bus error? Do we have to write memory-leak-free program? Why? Operating system Web server Shell Homework


Download ppt "YongChul Kwon yongchul@cs CSE451 Section 1: Spring 2006 YongChul Kwon yongchul@cs."

Similar presentations


Ads by Google