UTPA STEM/CBI Courses/Assembly Programming/Exception Handling
Course Title: Assembly Programming
Lecture Topic: Exception Handling
Instructor: Matt Patitz
Institution: UTPA
Backwards Design
[edit | edit source]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
- System architecture
- Content Priorities
- Enduring Understanding
- High level understanding of how exceptions are handled by the OS and hardware
- Enduring Understanding
- Important to Do and Know
- Debug mixed C and assembly language applications
- Important to Do and Know
- Worth Being Familiar with
- Specific registers containing exception information
- Syntax of assembly language
- Worth Being Familiar with
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
- In Class (groups)
- Homework (individual)
- Perform a programming project to modify the exception handler to handle a memory access error
- Homework (individual)
- Summative Assessment
- Exam questions giving snippets of an exception handler in which students must correctly identify bugs and complete missing sections
Legacy Cycle
[edit | edit source]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
[edit | edit source]- What are three possible causes of exceptions generated by C++ code?
- What mechanism is in place to handle these exceptions?
Test Your Mettle Quiz
[edit | edit source]- How many exceptions would be raised by a given piece of code?
- Which registers will contain information relevant to the exception when the exception handler begins execution?
- Fill in some missing code for proper handling of a particular type of exception.