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
This commit is contained in:
Vadim Zeitlin
2018-09-20 23:20:10 +02:00
parent d173ccdb96
commit fa1af3405c

View File

@@ -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<long unsigned int>(frame.GetAddress()));
HexProperty(nodeFrame, wxT("address"), wxPtrToUInt(frame.GetAddress()));
wxString module = frame.GetModule();
if ( !module.empty() )