Fix DEBUG logging (didn't work!). Shuffle around the log levels to make more sense (now NOTICE is the top one and always on), the rest is ERROR, WARNING, INFO, DEBUG. Fix the log levels of a lot of stuff. Use macros instead of numbers for various log level checks.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2700 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-03-20 20:52:37 +00:00
parent 554a930fe9
commit aa7fe1edee
23 changed files with 100 additions and 86 deletions

View File

@@ -53,11 +53,11 @@ void Console_Submit(const char *cmd)
if (addr)
{
#if LOGLEVEL >= INFO_LEVEL
#if MAX_LOGLEVEL >= INFO_LEVEL
u32 EA =
#endif
Memory::CheckDTLB(addr, Memory::FLAG_NO_EXCEPTION);
INFO_LOG(CONSOLE, "EA 0x%08x to 0x%08x", addr, EA);
#endif
}
else
{

View File

@@ -106,20 +106,20 @@ void PrintCallstack()
}
}
void PrintCallstack(LogTypes::LOG_TYPE type)
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
{
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
GENERIC_LOG(type, LogTypes::LWARNING, "== STACK TRACE - SP = %08x ==",
GENERIC_LOG(type, level, "== STACK TRACE - SP = %08x ==",
PowerPC::ppcState.gpr[1]);
if (LR == 0) {
GENERIC_LOG(type, LogTypes::LWARNING, " LR = 0 - this is bad");
GENERIC_LOG(type, level, " LR = 0 - this is bad");
}
int count = 1;
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
{
GENERIC_LOG(type, LogTypes::LINFO, " * %s [ LR = %08x ]",
GENERIC_LOG(type, level, " * %s [ LR = %08x ]",
g_symbolDB.GetDescription(LR), LR);
count++;
}
@@ -131,7 +131,7 @@ void PrintCallstack(LogTypes::LOG_TYPE type)
const char *str = g_symbolDB.GetDescription(func);
if (!str || strlen(str) == 0 || !strcmp(str, "Invalid"))
str = "(unknown)";
GENERIC_LOG(type, LogTypes::LINFO, " * %s [ addr = %08x ]", str, func);
GENERIC_LOG(type, level, " * %s [ addr = %08x ]", str, func);
addr = Memory::ReadUnchecked_U32(addr);
}
}

View File

@@ -34,7 +34,7 @@ struct CallstackEntry
bool GetCallstack(std::vector<CallstackEntry> &output);
void PrintCallstack();
void PrintCallstack(LogTypes::LOG_TYPE _Log);
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level);
void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title);
} // end of namespace Debugger

View File

@@ -35,7 +35,7 @@ void HLE_OSPanic()
GetStringVA(Error);
PanicAlert("OSPanic: %s", Error.c_str());
ERROR_LOG(OSREPORT,"(PC=%08x), OSPanic: %s", LR, Error.c_str());
ERROR_LOG(OSREPORT, "(PC=%08x), OSPanic: %s", LR, Error.c_str());
NPC = LR;
}
@@ -50,7 +50,7 @@ void HLE_OSReport()
PC = LR;
// PanicAlert("(PC=%08x) OSReport: %s", LR, ReportMessage.c_str());
ERROR_LOG(OSREPORT,"(PC=%08x) OSReport: %s", LR, ReportMessage.c_str());
NOTICE_LOG(OSREPORT, "(PC=%08x) OSReport: %s", LR, ReportMessage.c_str());
PC = hackPC;
}
@@ -65,7 +65,7 @@ void HLE_vprintf()
PC = LR;
// PanicAlert("(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str());
ERROR_LOG(OSREPORT,"(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str());
NOTICE_LOG(OSREPORT, "(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str());
PC = hackPC;
}
@@ -80,7 +80,7 @@ void HLE_printf()
PC = LR;
// PanicAlert("(PC=%08x) Printf: %s ", LR, ReportMessage.c_str());
ERROR_LOG(OSREPORT,"(PC=%08x) Printf: %s ", LR, ReportMessage.c_str());
NOTICE_LOG(OSREPORT, "(PC=%08x) Printf: %s ", LR, ReportMessage.c_str());
PC = hackPC;
}

View File

@@ -589,7 +589,7 @@ void STACKALIGN GatherPipeBursted()
Common::SyncInterlockedExchangeAdd((LONG*)&fifo.CPReadWriteDistance, GPFifo::GATHER_PIPE_SIZE);
// High watermark overflow handling (hacked way)
u32 ct=0;
u32 ct = 0;
if (fifo.CPReadWriteDistance > fifo.CPHiWatermark)
{
// we should raise an Ov interrupt for an accurate fifo emulation and let PPC deal with it.
@@ -608,14 +608,17 @@ void STACKALIGN GatherPipeBursted()
// - CPU can write to fifo
// - disable Underflow interrupt
WARN_LOG(COMMANDPROCESSOR, "(GatherPipeBursted): CPHiWatermark reached");
INFO_LOG(COMMANDPROCESSOR, "(GatherPipeBursted): CPHiWatermark reached");
// Wait for GPU to catch up
while (!(fifo.bFF_BPEnable && fifo.bFF_Breakpoint) && fifo.CPReadWriteDistance > fifo.CPLoWatermark)
{
ct++;
Common::SleepCurrentThread(1);
}
if (ct) {WARN_LOG(COMMANDPROCESSOR, "(GatherPipeBursted): %lu ms for nothing :[", ct);}
if (ct) {
// This is actually kind of fine. See big comment above.
DEBUG_LOG(COMMANDPROCESSOR, "(GatherPipeBursted): waited %lu ms. ", ct);
}
/**/
}
// check if we are in sync

View File

@@ -447,7 +447,7 @@ void ExecuteCommand(UDIDMAControlRegister& _DMAControlReg)
//=========================================================================================================
case 0x12:
{
#if LOGLEVEL >= 3
#if MAX_LOGLEVEL >= INFO_LEVEL
u32 offset = dvdMem.Command[1];
// u32 sourcelength = dvdMem.Command[2];
#endif
@@ -504,10 +504,10 @@ void ExecuteCommand(UDIDMAControlRegister& _DMAControlReg)
//=========================================================================================================
case 0xAB:
{
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
u32 offset = dvdMem.Command[1] << 2;
#endif
DEBUG_LOG(DVDINTERFACE, "DVD: Trying to seek: offset=%08x", offset);
DEBUG_LOG(DVDINTERFACE, "DVD: Seek: offset=%08x (ignoring)", offset);
}
break;
@@ -537,7 +537,7 @@ void ExecuteCommand(UDIDMAControlRegister& _DMAControlReg)
// ugly hack to catch the disable command
if (dvdMem.Command[1]!=0)
{
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
u8 subCommand = (dvdMem.Command[0] & 0x00FF0000) >> 16;
#endif

View File

@@ -184,7 +184,7 @@ void CEXIIPL::TransferByte(u8& _uByte)
m_RTC[i] = pGCTime[i^3];
}
#if LOGLEVEL >= 3
#if MAX_LOGLEVEL >= INFO_LEVEL
if ((m_uAddress & 0xF0000000) == 0xb0000000)
{

View File

@@ -241,9 +241,17 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
{
command = byte; // first byte is command
byte = 0xFF; // would be tristate, but we don't care.
WARN_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x", command)
if(command == cmdClearStatus)
switch (command)
{
case 0x52:
INFO_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x at position 0. seems normal.", command);
break;
default:
WARN_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x at position 0", command);
break;
}
if (command == cmdClearStatus)
{
status &= ~MC_STATUS_PROGRAMEERROR;
status &= ~MC_STATUS_ERASEERROR;

View File

@@ -65,7 +65,7 @@ namespace Memory
// #define NOCHECK
// Always disable memory checks if the Release build
#if LOGLEVEL < 4
#if MAX_LOGLEVEL < 4
#define NOCHECK
#endif

View File

@@ -237,14 +237,12 @@ void WriteToHardware(u32 em_address, const T data, u32 effective_address, Memory
// ----------------
u32 Read_Opcode(const u32 _Address)
{
#if LOGLEVEL >= 4
if (_Address == 0x00000000)
{
// FIXME use assert?
PanicAlert("Program tried to read from [00000000]");
PanicAlert("Program tried to read an opcode from [00000000]. It has crashed.");
return 0x00000000;
}
#endif
u32 _var = 0;
ReadFromHardware<u32>(_var, _Address, _Address, FLAG_OPCODE);
@@ -283,7 +281,7 @@ u16 Read_U16(const u32 _Address)
u32 Read_U32(const u32 _Address)
{
/*#if LOGLEVEL >= 4
/*#if MAX_LOGLEVEL >= 4
if (_Address == 0x00000000)
{
//PanicAlert("Program tried to read from [00000000]");

View File

@@ -593,12 +593,12 @@ void RunSIBuffer()
else
outLength++;
#if LOGLEVEL >= 3
#if MAX_LOGLEVEL >= INFO_LEVEL
int numOutput =
#endif
g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength);
INFO_LOG(SERIALINTERFACE, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);
INFO_LOG(SERIALINTERFACE, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);
// Transfer completed
GenerateSIInterrupt(INT_TCINT);

View File

@@ -236,9 +236,11 @@ IWII_IPC_HLE_Device* CreateDevice(u32 _DeviceID, const std::string& _rDeviceName
0x933e.... with the same .... as in the _CommandAddress. */
// ----------------
bool AckCommand(u32 _Address)
{
Debugger::PrintCallstack(LogTypes::WII_IPC_HLE);
WARN_LOG(WII_IPC_HLE, "AckCommand: 0%08x (num: %i) PC=0x%08x", _Address, g_AckNumber, PC);
{
#if MAX_LOG_LEVEL >= DEBUG_LEVEL
Debugger::PrintCallstack(LogTypes::WII_IPC_HLE, LogTypes::LDEBUG);
#endif
INFO_LOG(WII_IPC_HLE, "AckCommand: 0%08x (num: %i) PC=0x%08x", _Address, g_AckNumber, PC);
std::list<u32>::iterator itr = g_Ack.begin();
while (itr != g_Ack.end())

View File

@@ -155,7 +155,7 @@ protected:
u32 BufferOffset = BufferVector;
Memory::Write_U32(1, _CommandAddress + 0x4);
for (u32 i=0; i<NumberInBuffer; i++)
for (u32 i = 0; i < NumberInBuffer; i++)
{
u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
@@ -163,7 +163,7 @@ protected:
INFO_LOG(WII_IPC_HLE, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i);
std::string Temp;
for (u32 j=0; j<InBufferSize; j++)
for (u32 j = 0; j < InBufferSize; j++)
{
char Buffer[128];
sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j));
@@ -184,7 +184,7 @@ protected:
INFO_LOG(WII_IPC_HLE,"%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i);
INFO_LOG(WII_IPC_HLE, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize);
#if defined LOGLEVEL && LOGLEVEL > NOTICE_LEVEL
#if defined(MAX_LOGLEVEL) && MAX_LOGLEVEL >= INFO_LEVEL
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, LogTypes::LINFO);
#endif
}

View File

@@ -266,7 +266,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32
case 0x86:
{
Memory::Memset(_BufferOut, 0, _BufferOutSize);
WARN_LOG(WII_IPC_DVD, "%s executes DVDLowClearCoverInterrupt (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
INFO_LOG(WII_IPC_DVD, "%s executes DVDLowClearCoverInterrupt (Buffer 0x%08x, 0x%x)", GetDeviceName().c_str(), _BufferOut, _BufferOutSize);
}
break;

View File

@@ -611,7 +611,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL
AddEventToQueue(Event);
// Log
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
static char LinkType[][128] =
{
{ "HCI_LINK_SCO 0x00 - Voice"},
@@ -627,7 +627,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL
DEBUG_LOG(WII_IPC_WIIMOTE, " COD[0]: 0x%02x", pEventRequestConnection->uclass[0]);
DEBUG_LOG(WII_IPC_WIIMOTE, " COD[1]: 0x%02x", pEventRequestConnection->uclass[1]);
DEBUG_LOG(WII_IPC_WIIMOTE, " COD[2]: 0x%02x", pEventRequestConnection->uclass[2]);
DEBUG_LOG(WII_IPC_WIIMOTE, " LinkType: %s", LinkType[pEventRequestConnection->LinkType]);
// DEBUG_LOG(WII_IPC_WIIMOTE, " LinkType: %s", LinkType[pEventRequestConnection->LinkType]);
return true;
};
@@ -716,7 +716,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _
g_GlobalHandle = pConnectionComplete->Connection_Handle;
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
static char s_szLinkType[][128] =
{
{ "HCI_LINK_SCO 0x00 - Voice"},
@@ -1410,7 +1410,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandHostBufferSize(u8* _Input)
// ----------------
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageTimeOut(u8* _Input)
{
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
// command parameters
hci_write_page_timeout_cp* pWritePageTimeOut = (hci_write_page_timeout_cp*)_Input;
#endif
@@ -1440,7 +1440,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
hci_write_scan_enable_rp Reply;
Reply.status = 0x00;
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
static char Scanning[][128] =
{
{ "HCI_NO_SCAN_ENABLE"},
@@ -1461,7 +1461,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
{
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= 4
// command parameters
hci_write_inquiry_mode_cp* pInquiryMode = (hci_write_inquiry_mode_cp*)_Input;
#endif
@@ -1470,7 +1470,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
hci_write_inquiry_mode_rp Reply;
Reply.status = 0x00;
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
static char InquiryMode[][128] =
{
{ "Standard Inquiry Result event format (default)" },
@@ -1487,7 +1487,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageScanType(u8* _Input)
{
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
// command parameters
hci_write_page_scan_type_cp* pWritePageScanType = (hci_write_page_scan_type_cp*)_Input;
#endif
@@ -1496,7 +1496,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageScanType(u8* _Input)
hci_write_page_scan_type_rp Reply;
Reply.status = 0x00;
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
static char PageScanType[][128] =
{
{ "Mandatory: Standard Scan (default)" },
@@ -1553,7 +1553,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiry(u8* _Input)
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input)
{
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
// command parameters
hci_write_inquiry_scan_type_cp* pSetEventFilter = (hci_write_inquiry_scan_type_cp*)_Input;
#endif
@@ -1657,7 +1657,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input)
// command parameters
hci_accept_con_cp* pAcceptCon = (hci_accept_con_cp*)_Input;
#if LOGLEVEL >= 4
#if MAX_LOGLEVEL >= DEBUG_LEVEL
static char s_szRole[][128] =
{
{ "Master (0x00)"},