| Index: src/plugin/PluginDebug.cpp |
| =================================================================== |
| --- a/src/plugin/PluginDebug.cpp |
| +++ b/src/plugin/PluginDebug.cpp |
| @@ -256,3 +256,29 @@ |
| } |
| #endif // ENABLE_DEBUG_RESULT_IGNORED |
| + |
| +namespace |
| +{ |
| + /* |
| + * To convert a pointer to a hexadecimal number, we need an integral type that has the same size as that of the pointer. |
| + */ |
| +#if defined(_WIN64) |
| + typedef long long voidIntegral; |
|
sergei
2015/12/07 11:04:02
what about uint64_t and uint32_t instead of `long
Eric
2015/12/07 13:06:57
Done.
Do not, however, ask me to remove the 'stat
|
| + static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN64: sizeof(long long) is not the same as sizeof(void*)"); |
| +#elif defined(_WIN32) |
| + typedef long voidIntegral; |
| + static_assert(sizeof(void*)==sizeof(voidIntegral),"WIN32: sizeof(long) is not the same as sizeof(void*)"); |
| +#else |
| +#error Must compile with either _WIN32 or _WIN64 |
| +#endif |
| +} |
| + |
| +std::wstring ToHexLiteral(void const* p) |
| +{ |
| + std::wstringstream ss; |
| + ss << L"0x"; |
| + ss.width(sizeof(p) * 2); |
| + ss.fill(L'0'); |
| + ss << std::hex << reinterpret_cast<voidIntegral>(p); |
| + return ss.str(); |
|
sergei
2015/12/07 11:04:02
Do we really need it so complicated? It seems `bas
Oleksandr
2015/12/07 12:00:50
Alternatively there's also StringCbPrintf (aka spr
Eric
2015/12/07 13:06:57
I doesn't do the same thing. The formatting is dif
Eric
2015/12/07 13:06:57
It doesn't save code to use a C-style function tha
Eric
2015/12/15 16:31:16
Actual tracing in new review: https://codereview.a
|
| +} |