Permalink
Browse files

Merge pull request #1547 from RadWolfie/fix-log-macro

Fix log macro for pointer output and remove duplicate code
  • Loading branch information...
LukeUsher committed Feb 6, 2019
2 parents 60f2f4e + ff4da75 commit d9fcc83ade72810af6fe20c05c6a9c522e35dd41
Showing with 13 additions and 15 deletions.
  1. +1 −3 src/common/Logging.h
  2. +12 −12 src/core/kernel/exports/EmuKrnlLogging.cpp
@@ -457,8 +457,6 @@ extern thread_local std::string _logThreadPrefix;
#define ENUM2STR_HEADER(EnumType) extern TYPE2PCHAR_HEADER(EnumType); LOGRENDER_HEADER_BY_REF(EnumType);
#define ENUM2STR_START(EnumType) TYPE2PCHAR_HEADER(EnumType) { switch (value) {
#define ENUM2STR_CASE(a) case a: return #a;
// ENUM2STR_CASE_DEF is needed for #define'd symbols
#define ENUM2STR_CASE_DEF(a) case a: return #a;
#define ENUM2STR_END(EnumType) default: return "Unknown_"#EnumType; } }
#define ENUM2STR_END_and_LOGRENDER(EnumType) ENUM2STR_END(EnumType) LOGRENDER_TYPE(EnumType)

@@ -508,7 +506,7 @@ hexstring32(std::basic_ostream<_CharT, _Traits>&os)
#define LOGRENDER(Type) \
LOGRENDER_HEADER_BY_PTR(Type) \
{ \
os << hexstring32 << (void*)(value); \
os << hexstring32 << reinterpret_cast<uint32_t>(value); \
if (value) \
os << " -> "#Type"* {" << *value << "}"; \
\
@@ -122,12 +122,12 @@ ENUM2STR_START(BUS_DATA_TYPE)
ENUM2STR_END_and_LOGRENDER(BUS_DATA_TYPE)

ENUM2STR_START(CREATE_DISPOSITION)
ENUM2STR_CASE_DEF(FILE_SUPERSEDE)
ENUM2STR_CASE_DEF(FILE_OPEN)
ENUM2STR_CASE_DEF(FILE_CREATE)
ENUM2STR_CASE_DEF(FILE_OPEN_IF)
ENUM2STR_CASE_DEF(FILE_OVERWRITE)
ENUM2STR_CASE_DEF(FILE_OVERWRITE_IF)
ENUM2STR_CASE(FILE_SUPERSEDE)
ENUM2STR_CASE(FILE_OPEN)
ENUM2STR_CASE(FILE_CREATE)
ENUM2STR_CASE(FILE_OPEN_IF)
ENUM2STR_CASE(FILE_OVERWRITE)
ENUM2STR_CASE(FILE_OVERWRITE_IF)
// ENUM2STR_CASE_DEF(FILE_MAXIMUM_DISPOSITION) Skip, identical to FILE_OVERWRITE_IF
ENUM2STR_END_and_LOGRENDER(CREATE_DISPOSITION)

@@ -239,12 +239,12 @@ ENUM2STR_START(KINTERRUPT_MODE)
ENUM2STR_END_and_LOGRENDER(KINTERRUPT_MODE)

ENUM2STR_START(KIRQL_TYPE)
ENUM2STR_CASE_DEF(PASSIVE_LEVEL)
ENUM2STR_CASE_DEF(APC_LEVEL)
ENUM2STR_CASE_DEF(DISPATCH_LEVEL)
ENUM2STR_CASE_DEF(PROFILE_LEVEL)
ENUM2STR_CASE_DEF(SYNC_LEVEL)
ENUM2STR_CASE_DEF(HIGH_LEVEL)
ENUM2STR_CASE(PASSIVE_LEVEL)
ENUM2STR_CASE(APC_LEVEL)
ENUM2STR_CASE(DISPATCH_LEVEL)
ENUM2STR_CASE(PROFILE_LEVEL)
ENUM2STR_CASE(SYNC_LEVEL)
ENUM2STR_CASE(HIGH_LEVEL)
ENUM2STR_END_and_LOGRENDER(KIRQL_TYPE)

ENUM2STR_START(KWAIT_REASON)

0 comments on commit d9fcc83

Please sign in to comment.