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

Slides:



Advertisements
Similar presentations
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
Advertisements

DEBUGGING IN THE REAL WORLD : Recitation 4.
CSE 451: Operating Systems Section 1. Why are you here? 9/30/102.
CSE 451: Operating Systems Section 2 Shells and System Calls.
1 CSE 451 Section Autumn 2004 Alex Moshchuk Office hours: Tue 1-2, Thu 4:30-5:30 Allen 218 (or lab)
CSE 451 Section Autumn 2005 Richard Dunn Office hours: WTh 3:30-4:20 Allen 216 (or lab)
CSE451 Section 7: Virtual memory. Table of content Real address space Process creation optimization Debugging: watch point.
CSE 303 Lecture 13a Debugging C programs
Declaring Arrays Declare an array of 10 elements: int nums[10]; Best practice: #define SIZE 10 int nums[SIZE]; // cannot be int[SIZE] nums; C99: int nums[someVariable]
C and Data Structures Baojian Hua
Memory Layout C and Data Structures Baojian Hua
Copyright 2013 – Noah Mendelsohn Process Memory Noah Mendelsohn Tufts University Web:
Debugging Cluster Programs using symbolic debuggers.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2011.
Outline Midterm results Static variables Memory model
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
CSE 451 – Operating Systems Section, Autumn 2003 TAs: Mike Swift Adrienne Noble
CSE 232: C++ debugging in Visual Studio and emacs C++ Debugging (in Visual Studio and emacs) We’ve looked at programs from a text-based mode –Shell commands.
CSE 332: C++ debugging Why Debug a Program? When your program crashes –Finding out where it crashed –Examining program memory at that point When a bug.
CPS4200 Unix Systems Programming Chapter 2. Programs, Processes and Threads A program is a prepared sequence of instructions to accomplish a defined task.
CSE 351 GDB Introduction. Lab 1 Status? How is Lab 1 going? I’ll be available at the end of class to answer questions There are office hours later today.
CSE 451: Operating Systems Section 3: Project 0 recap, Project 1.
CSc 352 Debugging Tools Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
CSE451 Section 2: Spring 2006 Kurtis Heimerl, YongChul Kwon
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
Operating Systems CMPSC 473 Introduction and Overview August 24, Lecture 1 Instructor: Bhuvan Urgaonkar.
CSE 332: C++ expressions Expressions: Operators and Operands Operators obey arity, associativity, and precedence int result = 2 * 3 + 5; // assigns 11.
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 10/11/2006 Lecture 7 – Introduction to C.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2014.
CSE 451 Section 1 C Refresher (or introduction?) Project 0.
CSE 451 Section Autumn 2004 Alex Moshchuk Office hours: Tue 2-3, Thu 4:30-5:30 Allen 216 (or lab)
Hank Childs, University of Oregon April 6 th, 2015 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ / / / /
Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 4, 2010 CSCE 212Honors Computer Organization.
Institute of Radio Physics and Electronics ILug-Cal Introduction to GDB Institute of Radio Physics and Electronics and Indian GNU/Linux Users Group Kolkata.
Background Survey Answers Operating Systems CS 550 Spring 2016 Kenneth Chiu.
Winter 2009 Tutorial #6 Arrays Part 2, Structures, Debugger
CSE 374 Programming Concepts & Tools
CSE 451 C refresher.
Chapter 1: A Tour of Computer Systems
Process Memory COMP 40: Machine Structure and
CSE 374 Programming Concepts & Tools
CSE 303 Concepts and Tools for Software Development
Editor, Compiler, Linker, Debugger, Makefiles
Program Execution in Linux
Checking Memory Management
Lab: ssh, scp, gdb, valgrind
Recitation: C Review TA’s 19 Feb 2018.
Introduction to Operating Systems
Terminos españoles de ingeneria de computacion.
Memory Management III: Perils and pitfalls Mar 13, 2001
Memory Allocation CS 217.
CSc 352 Debugging Tools Saumya Debray Dept. of Computer Science
CSE451 Fall 2008 Section 1 Roxana Geambasu
When your program crashes
Pointers The C programming language gives us the ability to directly manipulate the contents of memory addresses via pointers. Unfortunately, this power.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2015.
CNT4704: Analysis of Computer Communication Network Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Fall 2011.
Program Execution in Linux
Appendix F C Programming Environment on UNIX Systems
Homework Continue with K&R Chapter 5 Skipping sections for now
Reminders Project 1 due tomorrow at 5:00 pm
CISC 361 Operating Systems Midterm Review
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2016.
Makefiles, GDB, Valgrind
15213 C Primer 17 September 2002.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2013.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2010.
Intro to Programming (in JavaScript)
CSE 303 Concepts and Tools for Software Development
Presentation transcript:

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

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

More administrative infomation Office hour Prof. John Zahorjan Wed 3:30 – 4:20 @ CSE534 YongChul Kwon Mon & Thr 2:30-3:20 @ CSE216 By appointment Kurtis Heimerl Mon & Wed & Fri 12:30-1:20 @ CSExxx

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

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®

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

Project 0 C programming warm-up

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

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?

Example

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

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

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

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?

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