mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
added a way to pretty-print functions for MinGw
This commit is contained in:
parent
d7f671f9da
commit
cae3e5617f
@ -192,6 +192,13 @@ static inline void reset_LastError()
|
||||
//#define PRINT_DEBUG(...) fprintf(stdout, __VA_ARGS__)
|
||||
extern const std::string dbg_log_file;
|
||||
extern const std::chrono::time_point<std::chrono::high_resolution_clock> startup_counter;
|
||||
|
||||
#if defined(__LINUX__) || defined(GNUC) || defined(__MINGW32__) || defined(__MINGW64__) // MinGw
|
||||
#define EMU_FUN_NAME __PRETTY_FUNCTION__
|
||||
#else
|
||||
#define EMU_FUN_NAME __FUNCTION__##"()"
|
||||
#endif
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#define PRINT_DEBUG(a, ...) do { \
|
||||
auto __prnt_dbg_ctr = std::chrono::high_resolution_clock::now(); \
|
||||
@ -200,8 +207,8 @@ static inline void reset_LastError()
|
||||
auto __prnt_dbg_ms = std::chrono::duration_cast<std::chrono::duration<unsigned long long, std::milli>>(__prnt_dbg_duration); \
|
||||
auto __prnt_dbg_f = fopen(dbg_log_file.c_str(), "a"); \
|
||||
if (!__prnt_dbg_f) break; \
|
||||
fprintf(__prnt_dbg_f, "[%llu ms, %llu us] [tid %lu] %s() " a "\n", \
|
||||
__prnt_dbg_ms.count(), __prnt_dbg_micro.count(), GetCurrentThreadId(), __FUNCTION__, ##__VA_ARGS__); \
|
||||
fprintf(__prnt_dbg_f, "[%llu ms, %llu us] [tid %lu] %s " a "\n", \
|
||||
__prnt_dbg_ms.count(), __prnt_dbg_micro.count(), GetCurrentThreadId(), EMU_FUN_NAME, ##__VA_ARGS__); \
|
||||
fclose(__prnt_dbg_f); \
|
||||
WSASetLastError(0); \
|
||||
} while (0)
|
||||
@ -215,7 +222,7 @@ static inline void reset_LastError()
|
||||
auto __prnt_dbg_f = fopen(dbg_log_file.c_str(), "a"); \
|
||||
if (!__prnt_dbg_f) break; \
|
||||
fprintf(__prnt_dbg_f, "[%llu ms, %llu us] [tid %ld] %s " a "\n", \
|
||||
__prnt_dbg_ms.count(), __prnt_dbg_micro.count(), syscall(SYS_gettid), __PRETTY_FUNCTION__, ##__VA_ARGS__); \
|
||||
__prnt_dbg_ms.count(), __prnt_dbg_micro.count(), syscall(SYS_gettid), EMU_FUN_NAME, ##__VA_ARGS__); \
|
||||
fclose(__prnt_dbg_f); \
|
||||
} while (0)
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user