Only generate debug info when in --debug mode (or asked).

This commit is contained in:
Ben Vanik
2013-12-22 09:50:31 -08:00
parent c92142ca02
commit de6dc92663
10 changed files with 43 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ public:
virtual int DeclareFunction(
runtime::FunctionInfo* symbol_info) = 0;
virtual int DefineFunction(
runtime::FunctionInfo* symbol_info,
runtime::FunctionInfo* symbol_info, bool with_debug_info,
runtime::Function** out_function) = 0;
protected:

View File

@@ -92,10 +92,11 @@ int PPCFrontend::DeclareFunction(
}
int PPCFrontend::DefineFunction(
FunctionInfo* symbol_info,
FunctionInfo* symbol_info, bool with_debug_info,
Function** out_function) {
PPCTranslator* translator = translator_pool_.Allocate(this);
int result = translator->Translate(symbol_info, out_function);
int result = translator->Translate(
symbol_info, with_debug_info, out_function);
translator_pool_.Release(translator);
return result;
}

View File

@@ -32,7 +32,7 @@ public:
virtual int DeclareFunction(
runtime::FunctionInfo* symbol_info);
virtual int DefineFunction(
runtime::FunctionInfo* symbol_info,
runtime::FunctionInfo* symbol_info, bool with_debug_info,
runtime::Function** out_function);
private:

View File

@@ -9,6 +9,7 @@
#include <alloy/frontend/ppc/ppc_translator.h>
#include <alloy/alloy-private.h>
#include <alloy/compiler/passes.h>
#include <alloy/frontend/tracing.h>
#include <alloy/frontend/ppc/ppc_frontend.h>
@@ -56,6 +57,7 @@ PPCTranslator::~PPCTranslator() {
int PPCTranslator::Translate(
FunctionInfo* symbol_info,
bool with_debug_info,
Function** out_function) {
// Scan the function to find its extents. We only need to do this if we
// haven't already been provided with them from some other source.
@@ -70,7 +72,10 @@ int PPCTranslator::Translate(
}
// NOTE: we only want to do this when required, as it's expensive to build.
DebugInfo* debug_info = new DebugInfo();
DebugInfo* debug_info = NULL;
if (FLAGS_debug || with_debug_info) {
debug_info = new DebugInfo();
}
// Stash source.
if (debug_info) {

View File

@@ -31,6 +31,7 @@ public:
~PPCTranslator();
int Translate(runtime::FunctionInfo* symbol_info,
bool with_debug_info,
runtime::Function** out_function);
private: