Rudra Dutta CSC Spring 2007, Section 001

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Wheat and Barley Hand Sieves 7/24/08
Procedures 2 Intructions Supporting Procedures Making Use of a Stack.
1 Exceptions, Interrupts & Traps Operating System Hebrew University Spring 2007.
Computer Architecture CSCE 350
1 Storage Registers vs. memory Access to registers is much faster than access to memory Goal: store as much data as possible in registers Limitations/considerations:
Memory Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
FunctionsFunctions Systems Programming. Systems Programming: Functions 2 Functions   Simple Function Example   Function Prototype and Declaration.
Unix Process Environment. main Function A C program starts execution with a function called main. The prototype for the main function is: int main (int.
Digression: the “Stack” 1 CS502 Spring 2006 Digression: the “Stack” Imagine the following program:– int factorial(int n){ if (n
8051 ASSEMBLY LANGUAGE PROGRAMMING
Inline Function. 2 Expanded in a line when it is invoked Ie compiler replace the function call with function code To make a function inline the function.
FunctionsFunctions Systems Programming Concepts. Functions   Simple Function Example   Function Prototype and Declaration   Math Library Functions.
Storage & Linkage: Effects on Scope Rudra Dutta CSC Spring 2007, Section 001.
Console and File I/O - Basics Rudra Dutta CSC Spring 2007, Section 001.
Debugging, Build and Version Control Rudra Dutta CSC Spring 2007, Section 001.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Pointers, Heap Memory Rudra Dutta CSC Spring 2007, Section 001.
Computer Science and Software Engineering University of Wisconsin - Platteville 9. Recursion Yan Shi CS/SE 2630 Lecture Notes Partially adopted from C++
Functions and Procedures. Function or Procedure u A separate piece of code u Possibly separately compiled u Located at some address in the memory used.
String Library Calls (Representative, not Exhaustive) Rudra Dutta CSC Spring 2007, Section 001.
CSC3315 (Spring 2008)1 CSC 3315 Subprograms Hamid Harroud School of Science and Engineering, Akhawayn University
Exception Compiler Baojian Hua
Exception Handling Programmers must deal with errors and exceptional situations: User input errors Device errors Empty disk space, no memory Component.
Exception Compiler Baojian Hua
Samples of Descriptive Problems CSC/ECE 573, Sections 001 Fall, 2012.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Introduction CSC , Fall, 2013 Rudra Dutta.
Structs, Enums, Unions Rudra Dutta CSC Spring 2007, Section 001.
CSC 401 Data and Computer Communication Networks Fall 2011, Section 001 Rudra Dutta.
ISBN Chapter 10 Implementing Subprograms.
C Programming Chapters 11, . . .
First Compilation Rudra Dutta CSC Spring 2007, Section 001.
MIPS Subroutines Subroutine Call – jal subname Saves RA in $31 and jumps to subroutine entry label subname Subroutine Return – jr $31 Loads PC with return.
Multi-dimensional Arrays and other Array Oddities Rudra Dutta CSC Spring 2007, Section 001.
CS415 Project 1: Understanding Setjmp/Longjmp Manpreet Singh
Function Calling. Mips Assembly Call and Return Steps for procedure calling –Save the return address –Jump to the procedure (function) –Execute the procedure.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 12 Procedure Calling.
Nested Loops CS303E: Elements of Computers and Programming.
CSC , Fall, 2013 Project Work. Copyright Fall 2013, Rudra Dutta, NCSU Project Objectives Propose and develop a solution/tool for some specific.
Rice Equipment 7/24/08. Create New Rice Equipment Test Select FGIS-925 Rice CheckTest from dropdown list A new blank record will open Only Standard Users.
Eighth Lecture Exception Handling in Java
Instructions for test_function
Storage Classes There are three places in memory where data may be placed: In Data section declared with .data in assembly language in C - Static) On the.
Recitation 7 – 3/18/02 Outline fork and scheduling Signals
Exceptions Error Handling and Recovery
Jump-Oriented Programming
Debugging Memory Issues
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
MIPS Procedures.
Deitel- C:How to Program (5ed)
Date of download: 1/2/2018 Copyright © ASME. All rights reserved.
Functions and Procedures
Copyrights apply.
Reading Exercise (Routing) Policy-Mechanism Separation: PCE, ForCES
CSC 253 Lecture 8.
Computer Simulation of Networks
More on Your Project Program arguments:
Pick up the handout on your way in!!
MIPS Procedures.
CSC 253 Lecture 8.
MIPS Procedures.
NASA Secure Coding Rules
Analytics – Statistical Approaches
Yan Shi CS/SE 2630 Lecture Notes
Introduction to Computer Science
Quiz 2 ECE/CSC Fall 2010, Section 001, 601.
Rudra Dutta CSC Spring 2007, Section 001
Types of Errors And Error Analysis.
Blackfin Syntax Stores, Jumps, Calls and Conditional Jumps
Presentation transcript:

Rudra Dutta CSC 230 - Spring 2007, Section 001 Longjumps Rudra Dutta CSC 230 - Spring 2007, Section 001

“Long” jumps Violates function call-return discipline “Jump” is on stack, not source code Provided by the standard library Include <setjmp.h> Mark a place in the executing code where to come back (irrespective of current function call nesting) under certain circumstances Sometimes used for recovering from serious errors Copyright Rudra Dutta, NCSU, Spring, 2007

Longjump on the Stack Mark a place in the execution where to jump to Use setjmp to mark Pointer to current top of stack is saved At a future time, from inside a nested function call, can jump straight to this place in the stack Use longjmp Nested functions do not return (retroactively converted to “were not called”) MUST be nested (original function must still be on stack) Copyright Rudra Dutta, NCSU, Spring, 2007