Run-Time Error Handling Wes Weimer, George Necula.

Slides:



Advertisements
Similar presentations
CHECKING MEMORY SAFETY AND TEST GENERATION USING B LAST By: Pashootan Vaezipoor Computing Science Dept of Simon Fraser University.
Advertisements

De necessariis pre condiciones consequentia sine machina P. Consobrinus, R. Consobrinus M. Aquilifer, F. Oratio.
Yoshi
An Introduction to Java Programming and Object- Oriented Application Development Chapter 8 Exceptions and Assertions.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 15: Exception Handling.
Error Handling with Exceptions Concepts C and other earlier languages often had multiple error-handling schemes, and these were generally established.
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
CSI 3120, Exception handling, page 1 Exception and Event Handling Credits Robert W. Sebesta, Concepts of Programming Languages, 8 th ed., 2007 Dr. Nathalie.
Specifying and Verifying Device Drivers Wes Weimer George Necula Gregoire Sutre.
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Type-Safe Programming in C George Necula EECS Department University of California, Berkeley.
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
Exceptions in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© Copyright Eliyahu Brutman Exceptions. © Copyright Eliyahu Brutman Exceptions and Design Patterns - 2 Introduction to Exception Handling Definition:
Exceptions David Rabinowitz. March 3rd, 2004 Object Oriented Design Course 2 The Role of Exceptions Definition: a method succeeds if it terminates in.
Software Reliability Methods Sorin Lerner. Software reliability methods: issues What are the issues?
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
A Type System for Expressive Security Policies David Walker Cornell University.
May 9, 2001OSQ Retreat 1 Run-Time Type Checking for Pointers and Arrays in C Wes Weimer, George Necula Scott McPeak, S.P. Rahul, Raymond To.
Mechanized Metatheory for User- Defined Type Extensions Dan Marino, Brian Chin, Todd Millstein UCLA Gang Tan Boston College Robert J. Simmons, David Walker.
Adding Contracts to Ada Ehud Lamm Adding Design By Contract to Ada.
1 Reliable Adaptive Distributed Systems Armando Fox, Michael Jordan, Randy H. Katz, David Patterson, George Necula, Ion Stoica, Doug Tygar.
Practical Exception Specifications ECOOP Workshop Exception Handling in Object Oriented Systems Donna Malayeri and Jonathan Aldrich.
May 22, 2002OSQ Retreat 1 CCured: Taming C Pointers George Necula Scott McPeak Wes Weimer
Cormac Flanagan University of California, Santa Cruz Hybrid Type Checking.
Introduction to Java Chapter 11 Error Handling. Motivations When a program runs into a runtime error, the program terminates abnormally. How can you handle.
1 Exception and Event Handling (Based on:Concepts of Programming Languages, 8 th edition, by Robert W. Sebesta, 2007)
Language Evaluation Criteria
1 Exception Handling Introduction to Exception Handling Exception Handling in PLs –Ada –C++ –Java Sebesta Chapter 14.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 18 Exception Handling.
Chapter 13, Slide 1 Exception Handling Exception handling is a language feature that allows the programmer to handle runtime "exceptional conditions."
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
Object Oriented Programming Elhanan Borenstein Lecture #4.
Exceptions Handling the unexpected. RHS – SWC 2 The Real World So far, most of our code has been somewhat näive We have assumed that nothing goes wrong…
Exceptions and assertions CSE 331 University of Washington.
CSC 395 – Software Engineering Lecture 10: Execution-based Testing –or– We can make it better than it was. Better...faster...agiler.
Exception Handling Unit-6. Introduction An exception is a problem that arises during the execution of a program. An exception can occur for many different.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
BIO Java 1 Exception Handling Aborting program not always a good idea – can’t lose messages – E-commerce: must ensure correct handling of private.
COMP3190: Principle of Programming Languages
Design by Contract Ranga Rodrigo based on Mark Priestley's Lectures.
© Mohamed Nuzrath Java Programming :: Chapter 6 :: Prepared & Presented By :: Mohamed Nuzrath [ Major In Programming ] NCC Programme coordinator IT Lecturer.
COP4020 Programming Languages Exception Handling Prof. Robert van Engelen (modified by Prof. Em. Chris Lacher)
Exceptions in C++. Exceptions  Exceptions provide a way to handle the errors generated by our programs by transferring control to functions called handlers.
CS212: Object Oriented Analysis and Design Lecture 19: Exception Handling.
1 Lecture07: Memory Model 5/2/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
1 Lecture 17 Static Types type safety, static vs dynamic checks, subtyping Ras Bodik Ali and Mangpo Hack Your Language! CS164: Introduction to Programming.
Karlstad University Computer Science Design Contracts and Error Management External and internal errors and their contracts.
Error Handling Tonga Institute of Higher Education.
Lecture10 Exception Handling Jaeki Song. Introduction Categories of errors –Compilation error The rules of language have not been followed –Runtime error.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 10: Programming Exceptionally.
ECE122 L23: Exceptions December 6, 2007 ECE 122 Engineering Problem Solving with Java Lecture 24 Exceptions.
DB Programming Course Lecture 4. Errors Two types of errors can be found in a program: compilation errors and runtime errors. There is a special section.
CSE 332: C++ Exceptions Motivation for C++ Exceptions Void Number:: operator/= (const double denom) { if (denom == 0.0) { // what to do here? } m_value.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Heath Carroll Bill Hanczaryk Rich Porter.  A Theory of Type Polymorphism in Programming ◦ Robin Milner (1977)  Milner credited with introducing the.
Jeremy Nimmer, page 1 Automatic Generation of Program Specifications Jeremy Nimmer MIT Lab for Computer Science Joint work with.
Optimistic Hybrid Analysis
Java Exceptions a quick review….
C++ Exceptions.
Generics, Exceptions and Undo Command
Java Programming Language
Exception Handling and Event Handling
EE422C Software Implementation II
Exception Handling In Text: Chapter 14.
Ninth step for Learning C++ Programming
Tenth step for Learning C++ Programming
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Concurrent Cache-Oblivious B-trees Using Transactional Memory
Presentation transcript:

Run-Time Error Handling Wes Weimer, George Necula

Motivation ► Static Safety Analyses:  Good  Often Incomplete  Or program may actually have bugs ► Could ask the programmers …  Fix it, annotate it, tell us if it is a bug, etc.  Not always feasible  Loops, heap data structures, preconditions, etc.

Add Run-Time Checks ► CCured, virtual memory hardware ► Perl’s Taint Analysis ► Java downcasts ► SLAM / BLAST  Use predicates to instrument error paths ► Now nothing can possibly go wrong!

When Good Checks Go Bad ► Most common * Java exception handler: catch (Exception e) { catch (Exception e) {e.printStackTrace(System.err);System.exit(-1); } ► Second most common: catch (Exception e) { ; } catch (Exception e) { ; } ► Can we do more than Abort or Ignore?

Why So Abysmal? ► Ironclad error-handling is  Repetitive – no way to set generic policies  Path- and flow-sensitive  Distant – handling separate from normal code  Complicated by exceptions ► Programs have errors in their error-handling ► Let’s add language support!

Plan ► Annotate interfaces and actions with  Compensations  Obligations  Things-to-be-done-before-leaving  Ways to restore invariants ► Keep dynamic stacks of these at run-time  As first-class citizens ► Like ‘sagas’ or ‘compensating xactions’

Guarantees ► Strong static type system + run-time checks ► Obligations cannot be ignored ► Dynamic extents (e.g., loops) handled ► Nesting, passing obligations, etc. ► Can enforce (but is more general than):  t 1 … t n  t 1 … t k c k … c 1

Why not use … ► Transactions, failure transparency, discount checking, system-level undo, linear type systems, regions, guide, purely static methods, more general exceptions, workflow, flowmark, Barbara Liskov, vino, …  All are imperfect fits for this area.

Conclusion ► Many sources of run-time errors in code  And we’re adding new ones with CCured, etc. ► Run-time is only “too late” if unhandled ► What to do when a run-time error occurs? ► Difficult to specify! ► Let’s make it easier to code up. ► Future: automatic inference  For standard libraries and interfaces