-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackFrame.h
More file actions
45 lines (38 loc) · 1.36 KB
/
StackFrame.h
File metadata and controls
45 lines (38 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* StackFrame.h
*
* Header file for StackFrame module that provides functionality relating to
* stack frames and printing out stack frame data.
*
*/
#ifndef STACKFRAME_H_
#define STACKFRAME_H_
#define BYTES_PER_LINE 8
#define ZERO 0
#define ONE 1
#define TWO 2
#define DEFAULT_STRING_LENGTH 16
/*
* Gets hold of the base pointer in the stack frame of the function that called getBasePointer
* (i.e. the base pointer in getBasePointer's caller's stack frame).
* @return the base pointer of getBasePointer's caller's stack frame
*
*/
unsigned long getBasePointer();
/*
* Gets hold of the return address in the stack frame of the function that called getReturnAddress
* (i.e. the return address to which getReturnAddress's caller will return to upon completion).
* @return the return address of getReturnAddress's caller
*/
unsigned long getReturnAddress();
/*
* Prints out stack frame data (formatted as hexadecimal values) between two given base pointers in the call stack.
* @param basePointer the later basePointer (lower memory address)
* @param previousBasePointer a previous base pointer (higher memory address)
*/
void printStackFrameData(unsigned long basePointer, unsigned long previousBasePointer);
/*
* Prints out a given number of stack frames starting from the caller's stack frame.
*/
void printStackFrames(int number);
#endif /* STACKFRAME_H_ */