diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp index c778b489d7d3fdc8bacab5afbd1f43651c52a915..38fb4a6c59139e02a7a40c3393b7bbd9f8897293 100644 --- a/src/base/SMPFunction.cpp +++ b/src/base/SMPFunction.cpp @@ -74,7 +74,7 @@ using namespace std; #define SMP_DEBUG_SWITCH_TABLE_INFO 0 #define SMP_OPTIMIZE_BLOCK_PROFILING 0 #define SMP_AUDIT_STACK_POINTER_DELTAS 0 -#define SMP_COMPARE_IDA_STARS_STACK_POINTER_DELTAS 1 +#define SMP_COMPARE_IDA_STARS_STACK_POINTER_DELTAS 0 #define STARS_AGGRESSIVE_SIGNEDNESS_PROPAGATION 1 #define STARS_BUILD_LOOP_BITSET 1 // Build bitset in this->FuncLoopsByBlock #define STARS_DEBUG_MEMORY_CORRUPTION 0 @@ -1116,8 +1116,9 @@ STARS_sval_t SMPFunction::ComputeGlobalStackAdjustment(void) { bool SMPFunction::UseIDAStackPointerDeltas(void) { list<SMPInstr *>::iterator InstIter; SMPInstr *CurrInst; + bool IDATraceFlag = false; #if SMP_COMPARE_IDA_STARS_STACK_POINTER_DELTAS - bool IDATraceFlag = (0 == strcmp("do_length", this->GetFuncName())); + IDATraceFlag = (0 == strcmp("do_length", this->GetFuncName())); #endif InstIter = this->Instrs.begin(); @@ -1148,15 +1149,18 @@ bool SMPFunction::AnalyzeStackPointerDeltas(void) { bool StackPointerRestoreSeen = false; // Stack pointer restored; must become true if ConflictingValuesSeen bool ReturnSeen = false; bool IDAProSucceeded = this->AnalyzedSP; + bool DebugFlag = false; + bool TraceFlag = false; + bool IDATraceFlag = false; #if SMP_COMPARE_IDA_STARS_STACK_POINTER_DELTAS - bool DebugFlag = (0 == strcmp("__libc_csu_fini", this->GetFuncName())); - bool TraceFlag = (0 == strcmp("__libc_csu_fini", this->GetFuncName())); + DebugFlag = (0 == strcmp("__libc_csu_fini", this->GetFuncName())); + TraceFlag = (0 == strcmp("__libc_csu_fini", this->GetFuncName())); #endif if (!this->HasGoodRTLs()) { SMP_msg("INFO: Using IDA Pro stack pointer deltas for BADRTLS function %s .\n", this->GetFuncName()); - (void) this->UseIDAStackPointerDeltas(); + // (void) this->UseIDAStackPointerDeltas(); this->AnalyzedSP = false; return false; // leave it unsolved } @@ -1616,7 +1620,8 @@ bool SMPFunction::AnalyzeStackPointerDeltas(void) { } } if (!this->AnalyzedSP) { - (void) this->UseIDAStackPointerDeltas(); + ; + // (void) this->UseIDAStackPointerDeltas(); } else { // Success, so try to find saved/restored register pairs so that we do not @@ -4061,6 +4066,7 @@ void SMPFunction::AdvancedAnalysis(void) { } for ( ; InstIter != this->Instrs.end(); ++InstIter) { CurrInst = (*InstIter); + STARS_ea_t InstAddr = CurrInst->GetAddr(); // for debugging breakpoints // We can finally search for stack loads now that UseFP has been fixed by // MDFixUseFP(). Otherwise, we would do this in SMPInstr::Analyze(), // but the UseFP flag is not ready that early. @@ -4070,29 +4076,14 @@ void SMPFunction::AdvancedAnalysis(void) { // This used to be called from within SMPInstr.Analyze(), but info such as UseFP // is not available that early. CurrInst->MDFixupDefUseLists(); - } -#endif - InstIter = this->Instrs.begin(); - if ((*InstIter)->IsMarkerInst()) { - ++InstIter; // skip marker inst - } - for ( ; InstIter != this->Instrs.end(); ++InstIter) { - CurrInst = (*InstIter); - STARS_ea_t InstAddr = CurrInst->GetAddr(); // for debugging breakpoints + if (CurrInst->HasGoodRTL()) CurrInst->SyncAllRTs(this->UsesFramePointer(), this->GetFramePtrStackDelta()); // Detect indirect memory references. CurrInst->AnalyzeIndirectRefs(this->UseFP); - -#if 0 - // Is the instruction a branch to a target outside the function? If - // so, this function has shared tail chunks. - if (CurrInst->IsBranchToFarChunk() && (!CurrInst->IsTailCall())) { - this->SharedChunks = true; - } + } #endif - } // end for all instructions // Audit the call instructions and call targets. // !!!!****!!!! NOTE: Not sure the address range checks in this code are valid