100 likes | 121 Views
Sign up for the mailing list, read the website, start reading the book, and complete homework due Monday. 5 challenging projects, learn C and UNIX skills. Computing resources available. Project details, debugging tips, and improving code quality discussed.
E N D
Reminders • Sign up for mailing list • Read the web site • Start reading the book • Homework due Monday • Check access to forkbomb.cs.washington.edu and your directory on it: /cse451/yourusername • Read & start project 0
451 Projects • 5 projects • First two – individual, others – groups of 3 • Need basic C and UNIX skills • See helpful links on project page • Challenging • Don’t leave until last minute • Learn a lot of cool stuff
Computing Resources • Develop your code on dedicated 451 Linux host: • forkbomb • Test your code on VMWare PCs in 006 • Do not use attu (except on project 0)
First Project • Introduces C and Unix skills you’ll need • Show of hands – who’s done C? • Function pointers? • gdb? • typedef?
UNIX & C help • Unix & C tutorial links on 451 projects page • What do I use to compile stuff in C? • gcc. For example, gcc –o shell shell.c –Wall –g • On project 0, we’ve provided a Makefile • Help! I’m crashing! • Use gdb to debug • gdb tutorials linked on web site • What do I use to type up my code? • I recommend emacs (look for emacs tutorials) • Others like VS.NET, vim
Refreshing C skills; code quality • What’s wrong with this: char *buffer; buffer = malloc(100); strcpy(buffer, param); • How do we fix this?
C Debugging hint #define MYDEBUG // comment out to disable debugging #ifdef MYDEBUG #define DEBUG(x) x #else #define DEBUG(x) #endif … int main() { … printf(“normal output”); DEBUG(printf(“debug output“)); … }
Debugging relevant on later projects • Just for printing: #ifdef MYDEBUG # ifdef __KERNEL__ /* This one if debugging is on, and kernel space */ # define PDEBUG(fmt, args...) printk(“myprg: " fmt, ## args) # else /* This one for user space */ # define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args) # endif #else # define PDEBUG(fmt, args...) /* not debugging: nothing */ #endif • works for both for kernel and userspace • To use: PDEBUG(“Testing two numbers: %d and %d\n”, num, num2);