From fa1af3405c6977d802ffa476bbd307ccf56ea1f9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Sep 2018 23:20:10 +0200 Subject: [PATCH] Don't truncate addresses under Win64 in wxDebugReport Avoid casting addresses to "long", as it can be smaller than pointer size on some platforms and notably is under Win64. Use wxUIntPtr instead, which is guaranteed to be large enough. See https://github.com/wxWidgets/wxWidgets/pull/940 --- src/common/debugrpt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/debugrpt.cpp b/src/common/debugrpt.cpp index e2b6cc1e50..7bc0ed32cb 100644 --- a/src/common/debugrpt.cpp +++ b/src/common/debugrpt.cpp @@ -88,9 +88,9 @@ protected: // ---------------------------------------------------------------------------- static inline void -HexProperty(wxXmlNode *node, const wxChar *name, unsigned long value) +HexProperty(wxXmlNode *node, const wxChar *name, wxUIntPtr value) { - node->AddAttribute(name, wxString::Format(wxT("%08lx"), value)); + node->AddAttribute(name, wxString::Format(wxT("%#zx"), value)); } static inline void @@ -134,7 +134,7 @@ void XmlStackWalker::OnStackFrame(const wxStackFrame& frame) nodeFrame->AddAttribute(wxT("function"), func); HexProperty(nodeFrame, wxT("offset"), frame.GetOffset()); - HexProperty(nodeFrame, wxT("address"), reinterpret_cast(frame.GetAddress())); + HexProperty(nodeFrame, wxT("address"), wxPtrToUInt(frame.GetAddress())); wxString module = frame.GetModule(); if ( !module.empty() )