Skip to content
Snippets Groups Projects
SMPProgram.h 1.31 KiB
Newer Older
clc5q's avatar
clc5q committed
#ifndef SMPPROGRAM_H
#define SMPPROGRAM_H 1

// SMPProgram.h
//
// This header defines the interfaces needed for analyzing whole programs.

#include <utility>
#include <list>
#include <vector>
#include <map>
#include <set>

#include <cstddef>

#include <pro.h>
#include <ida.hpp>
#include <ua.hpp>

#include "SMPDataFlowAnalysis.h"
#include "SMPInstr.h"
#include "SMPBasicBlock.h"
#include "SMPFunction.h"

using namespace std;

struct GlobalVar {
	ea_t addr;
	size_t size;
	char name[MAXSTR];
	bool ReadOnly;  // came from read-only data segment type
	flags_t flags;
};

// Class encapsulating all that the SMP static analyzer cares to know
//  about a whole program.
class SMPProgram {
public:
	// Constructors
	SMPProgram(void);  // Default constructor
	~SMPProgram(void); // Destructor
	// Get methods
	// Set methods
	// Query methods
	// Printing methods
	void Dump(void); // debug dump
	// Analysis methods
	void Analyze(void);  // Analyze all functions in the program
	void EmitAnnotations(FILE *AnnotFile); // Emit annotations for all functions
private:
	// Data
	map<ea_t, SMPFunction *> FuncMap; // all functions in the program
	map<ea_t, struct GlobalVar> GlobalVarTable; // all global static variables

	// Methods
	void InitStaticDataTable(void); // Gather info about global static data locations
}; // end class SMPProgram

#endif