diff --git a/include/base/SMPFunction.h b/include/base/SMPFunction.h index 9fa4d324422753310795e6157fb3fa03ca1fc7b4..80786f0329d8e5f9537694b0fc9f53a1c2ed6b16 100644 --- a/include/base/SMPFunction.h +++ b/include/base/SMPFunction.h @@ -258,6 +258,7 @@ public: }; STARS_Function_t *GetFuncInfo(void) const; inline STARS_ea_t GetFirstFuncAddr(void) const { return FirstEA; }; + inline STARS_ea_t GetFuncID(void) const { return FuncInfo->getFuncID(); }; uint16_t GetJumpToFollowNodeCounter(STARS_ea_t InstAddr) const; inline long GetTypedDefs(void) const { return TypedDefs; }; inline long GetUntypedDefs(void) const { return UntypedDefs; }; diff --git a/include/interfaces/abstract/STARSFunction.h b/include/interfaces/abstract/STARSFunction.h index 175b3557b13520aa519e32703bf01cd1f957970c..82c95c64d6e57196905e0db5f3fcba3f48d9972e 100644 --- a/include/interfaces/abstract/STARSFunction.h +++ b/include/interfaces/abstract/STARSFunction.h @@ -12,6 +12,7 @@ class STARS_Function_t virtual char* GetFunctionName(char* name, const int len) const = 0; virtual STARS_ea_t get_startEA() = 0; virtual STARS_ea_t get_endEA() = 0; + virtual STARS_ea_t getFuncID(void) const = 0; virtual std::size_t GetFuncSize() = 0; virtual std::size_t GetFrameSize() = 0; virtual void SetFrameSize(std::size_t size) = 0; diff --git a/include/interfaces/idapro/STARSFunction.h b/include/interfaces/idapro/STARSFunction.h index 8453ad72b801e7f22e51cc5e3b2f7aa51928c0c8..b3a54465da10ad73aac9dc14b2a3453934e842c2 100644 --- a/include/interfaces/idapro/STARSFunction.h +++ b/include/interfaces/idapro/STARSFunction.h @@ -27,9 +27,10 @@ public: virtual STARS_ea_t get_startEA() { return the_func->startEA; } virtual STARS_ea_t get_endEA() { return the_func->endEA; } #else - virtual STARS_ea_t get_startEA() { return the_func->start_ea; } - virtual STARS_ea_t get_endEA() { return the_func->end_ea; } + virtual STARS_ea_t get_startEA() { return the_func->start_ea; } + virtual STARS_ea_t get_endEA() { return the_func->end_ea; } #endif + virtual STARS_ea_t getFuncID(void) const { return the_func->start_ea; }; virtual std::size_t GetFuncSize() { return (std::size_t) (get_endEA() - get_startEA()); } virtual char* GetFunctionName(char* name, const int len) const { qstring TempName; diff --git a/include/interfaces/irdb/STARSFunction.h b/include/interfaces/irdb/STARSFunction.h index 67162dca8bfbbbdeca41186e642804bf31045dd2..2de04cef4c01a56bed1ff94fb0ef118b7c0208bf 100644 --- a/include/interfaces/irdb/STARSFunction.h +++ b/include/interfaces/irdb/STARSFunction.h @@ -21,10 +21,12 @@ public: { strncpy((char*)name,the_func->getName().c_str(),len); return (char*)name; } // get entry point of function - virtual STARS_ea_t get_startEA() { return the_func->getEntryPoint()->getBaseID(); } + virtual STARS_ea_t get_startEA() { return the_func->getEntryPoint()->getBaseID(); } // clc needs to review and get back to me. - virtual STARS_ea_t get_endEA() { assert(0); } + virtual STARS_ea_t get_endEA() { assert(0); } + + virtual STARS_ea_t getFuncID(void) const { return (STARS_ea_t) the_func->getBaseID(); }; // return # of instructions. virtual std::size_t GetFuncSize() { return the_func->getInstructions().size(); } @@ -34,7 +36,7 @@ public: //This chunk of things is going away? // init class-local variable with IRDB value // and these are accessors to that. - virtual std::size_t GetFrameSize(){ return the_func -> getStackFrameSize(); } + virtual std::size_t GetFrameSize(){ return the_func->getStackFrameSize(); } // should go away. diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp index ddffb9415dba0251409db598fa76f0f0bfb66ad0..569094c2b77b01572391890b2461591d12d84380 100644 --- a/src/base/SMPFunction.cpp +++ b/src/base/SMPFunction.cpp @@ -7008,11 +7008,11 @@ void SMPFunction::ComputeLoopNests(void) { // Emit info on loop nesting and preheader blocks. // Annotations look like: -// LOOP [loop #] FIRSTINST [hex inst ID at beginning of loop header] PREHEADER [hex inst ID] BLOCKLIST [hex inst IDs] ZZ INNERLOOPS [loop #'s] ZZ +// [hex func ID] [func size] LOOP [loop #] FIRSTINST [hex inst ID at beginning of loop header] PREHEADER [hex inst ID] BLOCKLIST [hex inst IDs] ZZ INNERLOOPS [loop #'s] ZZ void SMPFunction::EmitLoopNestAnnotations(void) { if (0 < this->LoopCount) { FILE *LoopAnnotFile = global_STARS_program->GetLoopsAnnotFile(); - SMP_fprintf(LoopAnnotFile, "FUNC %18llx LOOPCOUNT %zu \n", (uint64_t) this->GetFirstFuncAddr(), this->LoopCount); + SMP_fprintf(LoopAnnotFile, "%18llx %6zu LOOPCOUNT %zu \n", (uint64_t) this->GetFuncID(), this->FuncInfo->GetFuncSize(), this->LoopCount); for (size_t LoopIndex = 0; LoopIndex < this->LoopCount; ++LoopIndex) { int HeaderBlockNum = this->LoopHeadBlockNumbers[LoopIndex]; SMPBasicBlock *HeaderBlock = this->GetBlockByNum((size_t) HeaderBlockNum); @@ -7022,8 +7022,8 @@ void SMPFunction::EmitLoopNestAnnotations(void) { if (PreheaderBlockNum >= 0) { PreheaderFirstInstAddr = this->GetBlockByNum(PreheaderBlockNum)->GetFirstNonMarkerAddr(); } - SMP_fprintf(LoopAnnotFile, "LOOP %zu FIRSTINST %18llx PREHEADER %18llx BLOCKLIST ", - LoopIndex, (uint64_t) FirstHeaderInstAddr, PreheaderFirstInstAddr); + SMP_fprintf(LoopAnnotFile, "%18llx %6zu LOOP %zu FIRSTINST %18llx PREHEADER %18llx BLOCKLIST ", + (uint64_t) this->GetFuncID(), this->FuncInfo->GetFuncSize(), LoopIndex, (uint64_t) FirstHeaderInstAddr, (uint64_t) PreheaderFirstInstAddr); // Emit the first inst ID for each block in the loop. list<size_t> LoopBlockList;