From 645d283aa5c113a937595ecbc062c5e028f7661c Mon Sep 17 00:00:00 2001 From: clc5q <clc5q@git.zephyr-software.com> Date: Wed, 14 Feb 2018 17:37:56 +0000 Subject: [PATCH] Bug fix; don't generate extra ASM file (speedup); generate SWITCHTABLE xrefs even in reduced mode. Former-commit-id: cafdc6c48b96c549a52794dbb7ef3cf2b09dedc3 --- src/base/SMPFunction.cpp | 7 +++++++ src/base/SMPInstr.cpp | 8 ++++++++ src/drivers/idapro/SMPStaticAnalyzer.cpp | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp index b9d9e405..54488ec6 100644 --- a/src/base/SMPFunction.cpp +++ b/src/base/SMPFunction.cpp @@ -14152,6 +14152,13 @@ void SMPFunction::EmitAnnotations(FILE *AnnotFile, FILE *InfoAnnotFile) { DeallocTrigger = false; } CurrInst->EmitAnnotations(this->UseFP, AllocSeen, this->NeedsStackReferent, AnnotFile, InfoAnnotFile); + + // Emit annotations for IDA Pro switch table analyses. + SMPitype CurrDataFlow = CurrInst->GetDataFlowType(); + if (CurrDataFlow == INDIR_JUMP) { + global_STARS_program->PrintAllCodeToCodeXrefs(addr, CurrInst->GetSize(), false, false); + } + } // end for all instructions // Free memory for the memory-constrained reduced analysis case. diff --git a/src/base/SMPInstr.cpp b/src/base/SMPInstr.cpp index 3ad82c93..94a3f766 100644 --- a/src/base/SMPInstr.cpp +++ b/src/base/SMPInstr.cpp @@ -1228,7 +1228,11 @@ SMPRegTransfer::~SMPRegTransfer() { // Get the left operand, and normalize it if it is a stack operand. STARSOpndTypePtr SMPRegTransfer::GetLeftOperand(void) const { STARSOpndTypePtr TempOp = this->LeftOperand; +#if 0 if (this->ParentInst->AreDefsNormalized() && (0 != this->ParentInst->GetStackPtrOffset())) { +#else + if (this->ParentInst->AreDefsNormalized()) { +#endif STARS_ea_t InstAddr = this->ParentInst->GetAddr(); TempOp = this->ParentInst->GetBlock()->GetFunc()->GetNormalizedOperand(InstAddr, TempOp); } @@ -1238,7 +1242,11 @@ STARSOpndTypePtr SMPRegTransfer::GetLeftOperand(void) const { // Get the right operand, and normalize it if it is a stack operand. STARSOpndTypePtr SMPRegTransfer::GetRightOperand(void) const { STARSOpndTypePtr TempOp = this->RightOperand; +#if 0 if (this->ParentInst->AreDefsNormalized() && (0 != this->ParentInst->GetStackPtrOffset())) { +#else + if (this->ParentInst->AreDefsNormalized()) { +#endif STARS_ea_t InstAddr = this->ParentInst->GetAddr(); TempOp = this->ParentInst->GetBlock()->GetFunc()->GetNormalizedOperand(InstAddr, TempOp); } diff --git a/src/drivers/idapro/SMPStaticAnalyzer.cpp b/src/drivers/idapro/SMPStaticAnalyzer.cpp index 2d621b5c..40d7e473 100644 --- a/src/drivers/idapro/SMPStaticAnalyzer.cpp +++ b/src/drivers/idapro/SMPStaticAnalyzer.cpp @@ -63,7 +63,7 @@ using namespace std; -#define SMP_DEBUG_DELAY 0 // for setting an early breakpoint to attach gdb +#define SMP_DEBUG_DELAY 0 // for setting an early breakpoint // Set to 1 for debugging output #define SMP_DEBUG 1 @@ -87,7 +87,7 @@ int FuncsProcessed = 0; #define SMP_IDAP_RUN_DELAY 0 // Delay in IDAP_run() so we can attach debugger to process. -#define STARS_GENERATE_ASM_FILE 1 // Generate ASM file at end of processing? +#define STARS_GENERATE_ASM_FILE 0 // Generate ASM file at end of processing? #define STARS_GENERATE_DIF_FILE STARS_SCCP_CONVERT_UNREACHABLE_BLOCKS // If we optimize, generate DIF file typedef op_t STARSOpndType; @@ -352,7 +352,7 @@ bool IDAP_run(size_t arg) { time_t current; time(&start); - SMP_msg("debug delay for 15 seconds.\n"); + SMP_msg("delay for 15 seconds.\n"); printf("delay for 15 seconds.\n"); do { time(¤t); -- GitLab