gba: Up the verbosity of the tracelogger. Using it, I was able to find a nasty bug: bitfields in cpsr\spsr were not being handled as expected by the compiler. Presumably the version and settings on GCC normally used for retrometeor does what's desired? Workaround applied.

This commit is contained in:
goyuken 2012-11-23 20:17:20 +00:00
parent 9ee8093f7a
commit 96880ccc4a
5 changed files with 34 additions and 14 deletions

View File

@ -31,16 +31,16 @@ namespace AMeteor
uint32_t dw;
struct
{
unsigned int mode : 5;
bool thumb : 1;
bool fiq_d : 1;
bool irq_d : 1;
unsigned int reserved : 19;
bool s_overflow : 1;
bool f_overflow : 1;
bool f_carry : 1;
bool f_zero : 1;
bool f_sign : 1;
unsigned int mode : 5;
unsigned int thumb : 1;
unsigned int fiq_d : 1;
unsigned int irq_d : 1;
unsigned int reserved : 19;
unsigned int s_overflow : 1;
unsigned int f_overflow : 1;
unsigned int f_carry : 1;
unsigned int f_zero : 1;
unsigned int f_sign : 1;
} b;
};
struct IPsr

View File

@ -52,7 +52,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMETEOR_EXPORTS;%(PreprocessorDefinitions);METDEBUG;METDEBUGLOG;_ITERATOR_DEBUG_LEVEL=0</PreprocessorDefinitions>
<DisableSpecificWarnings>4800;4396</DisableSpecificWarnings>
<DisableSpecificWarnings>4396;4800</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@ -68,7 +68,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMETEOR_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4800;4396</DisableSpecificWarnings>
<DisableSpecificWarnings>4396;4800</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -85,6 +85,8 @@ void trace_bizhawk(std::string msg);
#define IOS_ADD \
"0x" << std::setbase(16) << std::setw(8) << std::setfill('0') \
<< std::uppercase
#define IOS_TRACE \
std::setbase(16) << std::setw(8) << std::setfill('0') << std::uppercase
#define IOS_NOR \
std::setbase(10) << std::setw(0) << std::setfill(' ')

View File

@ -74,7 +74,16 @@ namespace AMeteor
if (traceenabled)
{
std::stringstream ss;
ss << IOS_ADD << R(15) << ' ' << Disassembler::Instruction(R(15), (uint16_t)code).ToString();
ss << IOS_TRACE << R(15) << ':' << std::setw(4) << code << " ";
ss.setf(std::ios::left, std::ios::adjustfield);
ss << std::setw(32) << std::setfill(' ') << Disassembler::Instruction(R(15), (uint16_t)code).ToString();
ss.setf(std::ios::right, std::ios::adjustfield);
ss << IOS_TRACE;
for (int i = 0; i < 16; i++)
ss << std::setw(8) << R(i) << ' ';
UpdateCpsr();
ss << std::setw(8) << m_st.cpsr.dw << ' ';
ss << std::setw(8) << m_st.spsr.dw << ' ';
trace_bizhawk(ss.str());
}
R(15) += 2;
@ -117,7 +126,16 @@ namespace AMeteor
if (traceenabled)
{
std::stringstream ss;
ss << IOS_ADD << R(15) << ' ' << Disassembler::Instruction(R(15), (uint32_t)code).ToString();
ss << IOS_TRACE << R(15) << ':' << std::setw(8) << code << ' ';
ss.setf(std::ios::left, std::ios::adjustfield);
ss << std::setw(32) << std::setfill(' ') << Disassembler::Instruction(R(15), (uint32_t)code).ToString();
ss.setf(std::ios::right, std::ios::adjustfield);
ss << IOS_TRACE;
for (int i = 0; i < 16; i++)
ss << std::setw(8) << R(i) << ' ';
UpdateCpsr();
ss << std::setw(8) << m_st.cpsr.dw << ' ';
ss << std::setw(8) << m_st.spsr.dw << ' ';
trace_bizhawk(ss.str());
}
R(15) += 4;