Skip to content
Snippets Groups Projects
STARSFunction.h 2.07 KiB
Newer Older
jdh8d's avatar
jdh8d committed
#ifndef STARS_IDA_Function_h
#define STARS_IDA_Function_h

#include <funcs.hpp>
#include <frame.hpp>

#include "interfaces/STARSTypes.h"

jdh8d's avatar
jdh8d committed
class STARS_IDA_Function_t : public STARS_Function_t
{
	public:



jdh8d's avatar
jdh8d committed
		STARS_IDA_Function_t(func_t* func) : 
			the_func(func), 
			frsize(the_func->frsize),
			SharedChunks(false), 
			UnsharedChunks(false)
		{}
jdh8d's avatar
jdh8d committed

jdh8d's avatar
jdh8d committed

                virtual STARS_ea_t get_startEA() { return the_func->startEA; }
                virtual STARS_ea_t get_endEA() { return the_func->endEA; }
jdh8d's avatar
jdh8d committed
                virtual char* GetFunctionName(const char* name, const int len) const
			{ return ::get_func_name(the_func->startEA,(char*)name,len); }
				virtual std::size_t GetFrameSize() { return frsize; }
				virtual void SetFrameSize(std::size_t fs) { frsize = fs; }
				virtual std::size_t GetSavedRegSize() { return the_func->frregs; }
				virtual std::size_t GetIncomingArgumentSize() { return the_func->argsize; }
				virtual std::size_t GetFrameReturnAddressSize() { return ::get_frame_retsize(the_func); }
jdh8d's avatar
jdh8d committed
		virtual bool FunctionUsesFP() { return (0 != (the_func->flags & (FUNC_FRAME | FUNC_BOTTOMBP))); } 
jdh8d's avatar
 
jdh8d committed
		virtual bool IsStaticFunction() { return (0 != (the_func->flags & FUNC_STATIC)); } 
jdh8d's avatar
jdh8d committed
		virtual bool IsLibraryFunction() { return (0 != (the_func->flags & FUNC_LIB)); } 
		virtual bool IsStackPointerAnalyzed() { return the_func->analyzed_sp(); }
jdh8d's avatar
jdh8d committed
                virtual uint64_t get_spd(STARS_ea_t ea) { return ::get_spd(the_func,ea); }
jdh8d's avatar
jdh8d committed
		virtual bool HasReturnPoints() { return the_func->does_return(); }
jdh8d's avatar
jdh8d committed
		virtual bool IsMultiEntry();
                virtual void MarkSharedChunks();
                virtual bool HasSharedChunks() const {return SharedChunks; }
                virtual void SetSharedChunks(bool v) { SharedChunks=v; }
jdh8d's avatar
jdh8d committed
		virtual void UpdateXrefs();
		virtual void BuildFuncIR(SMPFunction *func);
jdh8d's avatar
jdh8d committed
		virtual bool FindDistantCodeFragment(SMPFunction* func, STARS_ea_t TargetAddr);


jdh8d's avatar
jdh8d committed



jdh8d's avatar
jdh8d committed

		/* temporary cast operator for testing */
		operator func_t* () { return the_func; }

	private:

		func_t* the_func;
jdh8d's avatar
jdh8d committed
		bool SharedChunks;
		bool UnsharedChunks;
jdh8d's avatar
jdh8d committed
};

#endif