This repository has been archived by the owner on Jan 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcallstack.h
47 lines (41 loc) · 1.59 KB
/
callstack.h
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
46
47
#ifndef _CALLSTACK_H
#define _CALLSTACK_H
#include "pin.H"
#include <string>
#include <fstream>
#include "shadowstack.h"
class CallStack {
std::vector<IMG> images;
std::vector<ADDRINT> return_stack;
std::vector<ADDRINT> call_stack;
ShadowStack* shadow_stack_for_main;
std::vector<ShadowStack*> shadow_stack;
ADDRINT first_fun_start;
std::vector<ADDRINT> call_stack_fun_start;
bool addrIsInMainImg(ADDRINT addr);
std::string findImgName(ADDRINT addr);
public:
void push_fun_start(ADDRINT fun_start, ADDRINT sp);
void pop_fun_start();
std::string getLastFuncStartAddr();
std::string getLastFuncStartAddrImgOffset();
unsigned long findLowAddressForAddr(ADDRINT addr);
void push(IMG img);
void push(ADDRINT call_addr, ADDRINT return_addr, ADDRINT start_addr, ADDRINT stack_pointer);
// bool indicates, if the item was present at all.
// pop() also removes all items in front of 'item'
// which might be the case with 'fake calls'. This
// case is also simply reported with a 'true'
// return value.
bool pop(ADDRINT return_addr, int &event_id, std::ofstream &TraceXMLFile, std::map<std::string, std::vector<HowardType*>* >* stackTypeDB);
StackChunk* findStackChunkByAddress(unsigned long address);
void addStackChunk(ADDRINT sp, ADDRINT size, std::vector<HowardType*> *types, int &event_id, std::ofstream &TraceXMLFile);
ShadowStack *getLastShadowStack();
bool addrInRedZone(unsigned long address);
std::string print_call(bool checkForMain = true);
std::string last_callstack_element(bool checkForMain = true);
std::string print_return();
std::string print_start();
void print();
};
#endif