Making --debug = false work.
This commit is contained in:
parent
d1528e24bb
commit
ff66064275
|
@ -13,7 +13,7 @@
|
||||||
using namespace alloy;
|
using namespace alloy;
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG
|
#if 0 && DEBUG
|
||||||
#define DEFAULT_DEBUG_FLAG true
|
#define DEFAULT_DEBUG_FLAG true
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_DEBUG_FLAG false
|
#define DEFAULT_DEBUG_FLAG false
|
||||||
|
|
|
@ -35,12 +35,11 @@ void PPCHIRBuilder::Reset() {
|
||||||
start_address_ = 0;
|
start_address_ = 0;
|
||||||
instr_offset_list_ = NULL;
|
instr_offset_list_ = NULL;
|
||||||
label_list_ = NULL;
|
label_list_ = NULL;
|
||||||
|
with_debug_info_ = false;
|
||||||
HIRBuilder::Reset();
|
HIRBuilder::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool FLAGS_annotate_disassembly = true;
|
int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, bool with_debug_info) {
|
||||||
|
|
||||||
int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
|
|
||||||
Memory* memory = frontend_->memory();
|
Memory* memory = frontend_->memory();
|
||||||
const uint8_t* p = memory->membase();
|
const uint8_t* p = memory->membase();
|
||||||
|
|
||||||
|
@ -49,10 +48,13 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
|
||||||
instr_count_ =
|
instr_count_ =
|
||||||
(symbol_info->end_address() - symbol_info->address()) / 4 + 1;
|
(symbol_info->end_address() - symbol_info->address()) / 4 + 1;
|
||||||
|
|
||||||
Comment("%s fn %.8X-%.8X %s",
|
with_debug_info_ = with_debug_info;
|
||||||
symbol_info->module()->name(),
|
if (with_debug_info_) {
|
||||||
symbol_info->address(), symbol_info->end_address(),
|
Comment("%s fn %.8X-%.8X %s",
|
||||||
symbol_info->name());
|
symbol_info->module()->name(),
|
||||||
|
symbol_info->address(), symbol_info->end_address(),
|
||||||
|
symbol_info->name());
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate offset list.
|
// Allocate offset list.
|
||||||
// This is used to quickly map labels to instructions.
|
// This is used to quickly map labels to instructions.
|
||||||
|
@ -90,7 +92,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Instr* first_instr = 0;
|
Instr* first_instr = 0;
|
||||||
if (FLAGS_annotate_disassembly) {
|
if (with_debug_info_) {
|
||||||
if (label) {
|
if (label) {
|
||||||
AnnotateLabel(address, label);
|
AnnotateLabel(address, label);
|
||||||
}
|
}
|
||||||
|
@ -139,9 +141,6 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info) {
|
||||||
Comment("UNIMPLEMENTED!");
|
Comment("UNIMPLEMENTED!");
|
||||||
//DebugBreak();
|
//DebugBreak();
|
||||||
//TraceInvalidInstruction(i);
|
//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.
|
// Annotate the label, as we won't do it later.
|
||||||
if (FLAGS_annotate_disassembly) {
|
if (with_debug_info_) {
|
||||||
AnnotateLabel(address, label);
|
AnnotateLabel(address, label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
|
|
||||||
virtual void Reset();
|
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);
|
runtime::FunctionInfo* LookupFunction(uint64_t address);
|
||||||
Label* LookupLabel(uint64_t address);
|
Label* LookupLabel(uint64_t address);
|
||||||
|
@ -73,6 +73,7 @@ private:
|
||||||
PPCFrontend* frontend_;
|
PPCFrontend* frontend_;
|
||||||
|
|
||||||
// Reset each Emit:
|
// Reset each Emit:
|
||||||
|
bool with_debug_info_;
|
||||||
runtime::FunctionInfo* symbol_info_;
|
runtime::FunctionInfo* symbol_info_;
|
||||||
uint64_t start_address_;
|
uint64_t start_address_;
|
||||||
uint64_t instr_count_;
|
uint64_t instr_count_;
|
||||||
|
|
|
@ -90,7 +90,7 @@ int PPCTranslator::Translate(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit function.
|
// Emit function.
|
||||||
int result = builder_->Emit(symbol_info);
|
int result = builder_->Emit(symbol_info, debug_info != NULL);
|
||||||
XEEXPECTZERO(result);
|
XEEXPECTZERO(result);
|
||||||
|
|
||||||
// Stash raw HIR.
|
// Stash raw HIR.
|
||||||
|
|
Loading…
Reference in New Issue