Making --debug = false work.

This commit is contained in:
Ben Vanik 2014-01-06 22:46:21 -08:00
parent d1528e24bb
commit ff66064275
4 changed files with 15 additions and 15 deletions

View File

@ -13,7 +13,7 @@
using namespace alloy;
#if DEBUG
#if 0 && DEBUG
#define DEFAULT_DEBUG_FLAG true
#else
#define DEFAULT_DEBUG_FLAG false

View File

@ -35,12 +35,11 @@ void PPCHIRBuilder::Reset() {
start_address_ = 0;
instr_offset_list_ = NULL;
label_list_ = NULL;
with_debug_info_ = false;
HIRBuilder::Reset();
}
const bool FLAGS_annotate_disassembly = true;
int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, bool with_debug_info) {
Memory* memory = frontend_->memory();
const uint8_t* p = memory->membase();
@ -49,10 +48,13 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
instr_count_ =
(symbol_info->end_address() - symbol_info->address()) / 4 + 1;
Comment("%s fn %.8X-%.8X %s",
symbol_info->module()->name(),
symbol_info->address(), symbol_info->end_address(),
symbol_info->name());
with_debug_info_ = with_debug_info;
if (with_debug_info_) {
Comment("%s fn %.8X-%.8X %s",
symbol_info->module()->name(),
symbol_info->address(), symbol_info->end_address(),
symbol_info->name());
}
// Allocate offset list.
// This is used to quickly map labels to instructions.
@ -90,7 +92,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
}
Instr* first_instr = 0;
if (FLAGS_annotate_disassembly) {
if (with_debug_info_) {
if (label) {
AnnotateLabel(address, label);
}
@ -139,9 +141,6 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
Comment("UNIMPLEMENTED!");
//DebugBreak();
//TraceInvalidInstruction(i);
// This printf is handy for sort/uniquify to find instructions.
printf("unimplinstr %s\n", i.type->name);
}
}
@ -192,7 +191,7 @@ Label* PPCHIRBuilder::LookupLabel(uint64_t address) {
}
// Annotate the label, as we won't do it later.
if (FLAGS_annotate_disassembly) {
if (with_debug_info_) {
AnnotateLabel(address, label);
}
}

View File

@ -33,7 +33,7 @@ public:
virtual void Reset();
int Emit(runtime::FunctionInfo* symbol_info);
int Emit(runtime::FunctionInfo* symbol_info, bool with_debug_info);
runtime::FunctionInfo* LookupFunction(uint64_t address);
Label* LookupLabel(uint64_t address);
@ -73,6 +73,7 @@ private:
PPCFrontend* frontend_;
// Reset each Emit:
bool with_debug_info_;
runtime::FunctionInfo* symbol_info_;
uint64_t start_address_;
uint64_t instr_count_;

View File

@ -90,7 +90,7 @@ int PPCTranslator::Translate(
}
// Emit function.
int result = builder_->Emit(symbol_info);
int result = builder_->Emit(symbol_info, debug_info != NULL);
XEEXPECTZERO(result);
// Stash raw HIR.