UTPA STEM/CBI Courses/Assembly Programming/Exception Handling

Course Title: Assembly Programming

Lecture Topic: Exception Handling

Instructor: Matt Patitz

Institution: UTPA

Backwards Design
Course Objectives


 * Primary Objectives- By the next class period students will be able to:
 * Understand and modify an exception handler


 * Sub Objectives- The objectives will require that students be able to:
 * Debug by stepping into assembly code
 * Understand the basic mechanisms of exception handling
 * Know assembly language syntax and register usage conventions


 * Difficulties- Students may have difficulty:
 * Setting up the development environment
 * Ensuring that there are no unintended side-effects from the exception handler


 * Real-World Contexts- There are many ways that students can use this material in the real-world, such as:
 * Understand the effects of errors in code

Model of Knowledge


 * Concept Map
 * System architecture
 * System components
 * Processor
 * ALU
 * Control
 * Register
 * Interconnects
 * Memory
 * System bus
 * I/O systems
 * Assembly programming
 * General syntax
 * Register conventions
 * Procedure calls and stack frames
 * Interface between OS and hardware
 * Exception handling


 * Content Priorities
 * Enduring Understanding
 * High level understanding of how exceptions are handled by the OS and hardware


 * Important to Do and Know
 * Debug mixed C and assembly language applications


 * Worth Being Familiar with
 * Specific registers containing exception information
 * Syntax of assembly language

Assessment of Learning


 * Formative Assessment
 * In Class (groups)
 * Find and characterize errors code which will raise exceptions
 * Discuss modifications of exception handler and their impact on the system


 * Homework (individual)
 * Perform a programming project to modify the exception handler to handle a memory access error


 * Summative Assessment
 * Exam questions giving snippets of an exception handler in which students must correctly identify bugs and complete missing sections

Legacy Cycle
OBJECTIVE

By the next class period, students will be able to:
 * Understand and modify an exception handler

The objectives will require that students be able to:
 * Debug by stepping into assembly code
 * Understand the basic mechanisms of exception handling
 * Know assembly language syntax and register usage conventions

THE CHALLENGE

You are the system administrator of a critical university system. Unfortunately, as a measure to save money, the university has hired several freshman programmers who haven't even completed Computer Science I to code new modules. How can you protect your system from the frequent crashes caused by the many errors introduced by these programmers?

GENERATE IDEAS

Have students come up with several examples of C++ code which would raise exceptions.

MULTIPLE PERSPECTIVES

As a class, discuss the examples that were generated. Pick two exception types and discuss how the OS could most gracefully handle them. Look at an incomplete exception handler and analyze its behavior.

RESEARCH & REVISE

In groups, students write a C++ code which raises the two types of exceptions selected. Then they practice executing it and debugging by stepping into the exception handler. Next, they implement the exception handling routines decided upon by the class.

TEST YOUR METTLE

Students are given feedback on their code, then a quiz which presents a new type of exception which they should be able to write a code to handle it in a specified way.

GO PUBLIC

Exam questions giving snippets of an exception handler in which students must correctly identify bugs and complete missing sections.

Pre-Lesson Quiz

 * 1) What are three possible causes of exceptions generated by C++ code?
 * 2) What mechanism is in place to handle these exceptions?

Test Your Mettle Quiz

 * 1) How many exceptions would be raised by a given piece of code?
 * 2) Which registers will contain information relevant to the exception when the exception handler begins execution?
 * 3) Fill in some missing code for proper handling of a particular type of exception.