summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorXTra.KrazzY <XTra.KrazzY@gmail.com>2009-02-04 15:28:39 +0000
committerXTra.KrazzY <XTra.KrazzY@gmail.com>2009-02-04 15:28:39 +0000
commit77215fd27ccb7cdeb82fed24a7a8d4d4ad4c33a4 (patch)
tree66474d38e6c2ade00b700916d176ed7857cdf09b /Source/Core
parentc43d8e9dcd1e08acf1b2287c4b64f5a9f31c8fab (diff)
Joined work of nakee and mine, cleanup the logging code a bit.
This solves the random __Log symbol and crash problem on linux Please tell us if you find problems in the logging code git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2109 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/Common.h27
-rw-r--r--Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp16
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h6
-rw-r--r--Source/Core/VideoCommon/Src/VideoCommon.h26
4 files changed, 35 insertions, 40 deletions
diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h
index 8b241bf8db..646f335027 100644
--- a/Source/Core/Common/Src/Common.h
+++ b/Source/Core/Common/Src/Common.h
@@ -196,14 +196,10 @@ inline u64 swap64(u64 data) {return(((u64)swap32(data) << 32) | swap32(data >> 3
} // end of namespace Common
-//////////////////////////////////////////////////////////////////////////////////////////
// Utility functions
-// ŻŻŻŻŻŻŻŻŻ
-///////////////////////////
// Message alerts
-// ŻŻŻŻŻŻŻŻŻ
enum MSG_TYPE
{
INFORMATION,
@@ -230,12 +226,7 @@ extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* fo
-///////////////////////////
// Logging
-// ŻŻŻŻŻŻŻŻŻ
-
-extern void __Log(int logNumber, const char* text, ...);
-extern void __Logv(int log, int v, const char *format, ...);
// dummy class
class LogTypes
@@ -279,14 +270,25 @@ class LogTypes
};
};
+#ifdef LOGGING
+extern void __Log(int logNumber, const char* text, ...);
+extern void __Logv(int log, int v, const char *format, ...);
void Host_UpdateLogDisplay();
// Logging macros. LOGGING is turned on from earlier in this file
-#ifdef LOGGING
+#ifdef _WIN32
#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__);
#define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, __VA_ARGS__);
+#define LOGP(t, ...) __Log(t, __VA_ARGS__);
+#define LOGVP(t,v, ...) __Log(t + (v)*100, __VA_ARGS__);
+#else
+#define LOG(t, ...) __Log(LogTypes::t, ##__VA_ARGS__);
+#define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, ##__VA_ARGS__);
+#define LOGP(t, ...) __Log(t, ##__VA_ARGS__);
+#define LOGVP(t,v, ...) __Log(t + (v)*100, ##__VA_ARGS__);
+#endif
#define _dbg_assert_(_t_, _a_) \
if (!(_a_)){\
@@ -305,6 +307,8 @@ void Host_UpdateLogDisplay();
#define LOG(_t_, ...)
#define LOGV(_t_,_v_, ...)
+#define LOGP(_t_, ...)
+#define LOGVP(_t_,_v_, ...)
#define _dbg_clear_()
#ifndef _dbg_assert_
#define _dbg_assert_(_t_, _a_) ;
@@ -326,9 +330,7 @@ void Host_UpdateLogDisplay();
#endif
-//////////////////////////////////////////////////////////////////////////////////////////
// Compile time asserts
-// ŻŻŻŻŻŻŻŻŻ
namespace
{
@@ -344,7 +346,6 @@ namespace
#endif
#endif
}
-//////////////////////////////////
#endif // #ifndef _COMMON_H
diff --git a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp
index 85d265cec2..0d6ce0ba60 100644
--- a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp
+++ b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp
@@ -106,19 +106,19 @@ void PrintCallstack()
}
}
-void PrintCallstack(LogTypes::LOG_TYPE _Log)
+void PrintCallstack(LogTypes::LOG_TYPE type)
{
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
- __Logv(_Log, 1, "\n == STACK TRACE - SP = %08x ==\n", PowerPC::ppcState.gpr[1]);
+ LOGVP(type, 1, "\n == STACK TRACE - SP = %08x ==\n", PowerPC::ppcState.gpr[1]);
if (LR == 0) {
- __Logv(_Log, 1, " LR = 0 - this is bad\n");
+ LOGVP(type, 1, " LR = 0 - this is bad\n");
}
int count = 1;
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
{
- __Log(_Log, " * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR);
+ LOGP(type, " * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR);
count++;
}
@@ -129,14 +129,14 @@ void PrintCallstack(LogTypes::LOG_TYPE _Log)
const char *str = g_symbolDB.GetDescription(func);
if (!str || strlen(str) == 0 || !strcmp(str, "Invalid"))
str = "(unknown)";
- __Logv(_Log, 3, " * %s [ addr = %08x ]\n", str, func);
+ LOGVP(type, 3, " * %s [ addr = %08x ]\n", str, func);
addr = Memory::ReadUnchecked_U32(addr);
}
}
-void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title)
+void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title)
{
- __Log(_Log, _title);
+ LOGP(type, _title);
for (u32 j=0; j<_Size;)
{
std::string Temp;
@@ -150,7 +150,7 @@ void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const ch
break;
}
- __Log(_Log, " Data: %s", Temp.c_str());
+ LOGP(type, " Data: %s", Temp.c_str());
}
}
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h
index 41fdefbe18..8fb92223ab 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h
@@ -138,12 +138,12 @@ protected:
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8,
int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0)
{
- // Because I have to use __Logv here I add this #if
+ // Because I have to use LOGV here I add this #if
#if defined(_DEBUG) || defined(DEBUGFAST)
- __Logv(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str());
+ LOGVP(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str());
for (u32 i = 0; i < _NumberOfCommands; i++)
{
- __Logv(LogType, Verbosity, " Command%02i: 0x%08x", i,
+ LOGVP(LogType, Verbosity, " Command%02i: 0x%08x", i,
Memory::Read_U32(_CommandAddress + i*4));
}
#endif
diff --git a/Source/Core/VideoCommon/Src/VideoCommon.h b/Source/Core/VideoCommon/Src/VideoCommon.h
index a035072cf6..a404e06cce 100644
--- a/Source/Core/VideoCommon/Src/VideoCommon.h
+++ b/Source/Core/VideoCommon/Src/VideoCommon.h
@@ -86,29 +86,23 @@ struct TRectangle
};
-//////////////////////////////////////////////////////////////////////////////////////////
+
// Logging
// ŻŻŻŻŻŻŻŻŻŻ
void DebugLog(const char* _fmt, ...); // This one goes to the main program
-void __Log(const char *format, ...); // This one is for the local console
-void __Log(int type, const char *format, ...);
void HandleGLError();
-#define ERROR_LOG __Log
-
-#if defined(_DEBUG) || defined(DEBUGFAST)
- // FIXME ugly hack for debug to build should use logmanager
- //#define INFO_LOG if( g_Config.iLog & CONF_LOG ) __Log
- //#define PRIM_LOG if( g_Config.iLog & CONF_PRIMLOG ) __Log
- #define INFO_LOG __Log
- #define PRIM_LOG __Log
- #define DEBUG_LOG __Log
+#ifdef _WIN32
+#define ERROR_LOG(...) LOG(VIDEO, __VA_ARGS__)
+#define INFO_LOG(...) LOG(VIDEO, __VA_ARGS__)
+#define PRIM_LOG(...) LOG(VIDEO, __VA_ARGS__)
+#define DEBUG_LOG(...) LOG(VIDEO, __VA_ARGS__)
#else
- #define INFO_LOG(...)
- #define PRIM_LOG(...)
- #define DEBUG_LOG(...)
+#define ERROR_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
+#define INFO_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
+#define PRIM_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
+#define DEBUG_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
#endif
-///////////////////////////////////
#endif // _VIDEOCOMMON_H