Ticket #15138: wx_trunk_15138_20130411_all.patch

File wx_trunk_15138_20130411_all.patch, 77.7 KB (added by suzumizaki, 7 years ago)

Includes include/*.h, src/*.cpp, and samples/except fixes.

  • include/wx/msw/debughlp.h

     
    22// Name:        wx/msw/debughlp.h
    33// Purpose:     wraps dbghelp.h standard file
    44// Author:      Vadim Zeitlin
    5 // Modified by:
     5// Modified by: Suzumizaki-kimitaka 2013-04-10
    66// Created:     2005-01-08 (extracted from msw/crashrpt.cpp)
    77// RCS-ID:      $Id$
    88// Copyright:   (c) 2003-2005 Vadim Zeitlin <vadim@wxwindows.org>
     
    4343
    4444#if wxUSE_DBGHELP
    4545
     46/*
     47
     48The table below shows which functions are exported by dbghelp.dll.
     49On 64 bit Windows, it looks no difference between 32bit dll and
     5064bit one.
     51Vista-64 and Win8-64 looks same, but in fact, "Ex" and "ExW"
     52versions are exist only in Windows 8.
     53
     54Make sure SymGetLineFromAddrW and EnumerateLoadedModulesW DON'T
     55exists.
     56
     57functions | Windows     | XP-32 Vista-64 Win8-64
     58SymEnumSymbolsW            n/a     v       v
     59SymFromAddrW               n/a     v       v
     60SymInitializeW             n/a     v       v
     61
     62SymEnumSymbols              v      v       v
     63SymFromAddr                 v      v       v
     64SymInitialize               v      v       v
     65
     66SymGetLineFromAddrW64      n/a     v       v
     67SymGetLineFromAddr64        v      v       v
     68SymGetLineFromAddrW        n/a    n/a     n/a
     69SymGetLineFromAddr          v      v       v
     70
     71EnumerateLoadedModulesW64  n/a     v       v
     72EnumerateLoadedModules64    v      v       v
     73EnumerateLoadedModulesW    n/a    n/a     n/a
     74EnumerateLoadedModules      v      v       v
     75
     76*/
     77
     78#ifdef UNICODE
     79#define wxPENUMLOADED_MODULES_CALLBACK64 PENUMLOADED_MODULES_CALLBACKW64
     80#define wxPSYMBOL_INFO PSYMBOL_INFOW
     81#define wxSYMBOL_INFO SYMBOL_INFOW
     82#define wxPIMAGEHLP_LINE PIMAGEHLP_LINEW64
     83#define wxIMAGEHLP_LINE IMAGEHLP_LINEW64
     84#define wxPSYM_ENUMERATESYMBOLS_CALLBACK PSYM_ENUMERATESYMBOLS_CALLBACKW
     85#else
     86#define wxPENUMLOADED_MODULES_CALLBACK64 PENUMLOADED_MODULES_CALLBACK64
     87#define wxPSYMBOL_INFO PSYMBOL_INFO
     88#define wxSYMBOL_INFO SYMBOL_INFO
     89#define wxPIMAGEHLP_LINE PIMAGEHLP_LINE64
     90#define wxIMAGEHLP_LINE IMAGEHLP_LINE64
     91#define wxPSYM_ENUMERATESYMBOLS_CALLBACK PSYM_ENUMERATESYMBOLS_CALLBACK
     92#endif
     93
    4694// ----------------------------------------------------------------------------
    4795// wxDbgHelpDLL: dynamically load dbghelp.dll functions
    4896// ----------------------------------------------------------------------------
     
    142190    // function types
    143191    typedef DWORD (WINAPI *SymGetOptions_t)();
    144192    typedef DWORD (WINAPI *SymSetOptions_t)(DWORD);
    145     typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPSTR, BOOL);
    146193    typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME,
    147194                                       LPVOID, PREAD_PROCESS_MEMORY_ROUTINE,
    148195                                       PFUNCTION_TABLE_ACCESS_ROUTINE,
    149196                                       PGET_MODULE_BASE_ROUTINE,
    150197                                       PTRANSLATE_ADDRESS_ROUTINE);
    151     typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO);
    152198    typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD_PTR);
    153199    typedef DWORD_PTR (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD_PTR);
    154     typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD_PTR,
    155                                                 PDWORD, PIMAGEHLP_LINE);
    156200    typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME,
    157201                                           PIMAGEHLP_CONTEXT);
    158     typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR,
    159                                             PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
    160202    typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG,
    161203                                            IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
    162204    typedef BOOL (WINAPI *SymCleanup_t)(HANDLE);
    163     typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
    164205    typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE,
    165206                                               MINIDUMP_TYPE,
    166207                                               CONST PMINIDUMP_EXCEPTION_INFORMATION,
    167208                                               CONST PMINIDUMP_USER_STREAM_INFORMATION,
    168209                                               CONST PMINIDUMP_CALLBACK_INFORMATION);
    169210
     211    typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
     212    typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
     213
     214    typedef BOOL (WINAPI *EnumerateLoadedModules64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
     215    typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPCSTR, BOOL);
     216    typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO);
     217    typedef BOOL (WINAPI *SymGetLineFromAddr64_t)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
     218    typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR,
     219                                            PSYM_ENUMERATESYMBOLS_CALLBACK, const PVOID);
     220
     221    typedef BOOL (WINAPI *EnumerateLoadedModulesW64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
     222    typedef BOOL (WINAPI *SymInitializeW_t)(HANDLE, LPCWSTR, BOOL);
     223    typedef BOOL (WINAPI *SymFromAddrW_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFOW);
     224    typedef BOOL (WINAPI *SymGetLineFromAddrW64_t)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINEW64);
     225    typedef BOOL (WINAPI *SymEnumSymbolsW_t)(HANDLE, ULONG64, PCWSTR,
     226                                             PSYM_ENUMERATESYMBOLS_CALLBACKW, const PVOID);
     227   
     228    static BOOL EnumerateLoadedModulesT(HANDLE, wxPENUMLOADED_MODULES_CALLBACK64, PVOID);
     229    static BOOL SymInitializeT(HANDLE, LPCTSTR, BOOL);
     230    static BOOL SymFromAddrT(HANDLE, DWORD64, PDWORD64, wxPSYMBOL_INFO);
     231    static BOOL SymGetLineFromAddrT(HANDLE, DWORD64, PDWORD, wxPIMAGEHLP_LINE);
     232    static BOOL SymEnumSymbolsT(HANDLE, ULONG64, PCTSTR, wxPSYM_ENUMERATESYMBOLS_CALLBACK, const PVOID);
     233
    170234    // The macro called by wxDO_FOR_ALL_SYM_FUNCS() below takes 2 arguments:
    171235    // the name of the function in the program code, which never has "64"
    172236    // suffix, and the name of the function in the DLL which can have "64"
     
    175239    #define wxSYM_CALL(what, name)  what(name, name)
    176240#if defined(_M_AMD64)
    177241    #define wxSYM_CALL_64(what, name)  what(name, name ## 64)
    178 
    179242    // Also undo all the "helpful" definitions done by imagehlp.h that map 32
    180243    // bit functions to 64 bit ones, we don't need this as we do it ourselves.
    181244    #undef StackWalk
     
    187250    #define wxSYM_CALL_64(what, name)  what(name, name)
    188251#endif
    189252
    190     #define wxDO_FOR_ALL_SYM_FUNCS(what)                                      \
    191         wxSYM_CALL_64(what, StackWalk);                                       \
    192         wxSYM_CALL_64(what, SymFunctionTableAccess);                          \
    193         wxSYM_CALL_64(what, SymGetModuleBase);                                \
    194         wxSYM_CALL_64(what, SymGetLineFromAddr);                              \
    195         wxSYM_CALL_64(what, EnumerateLoadedModules);                          \
    196                                                                               \
    197         wxSYM_CALL(what, SymGetOptions);                                      \
    198         wxSYM_CALL(what, SymSetOptions);                                      \
    199         wxSYM_CALL(what, SymInitialize);                                      \
    200         wxSYM_CALL(what, SymFromAddr);                                        \
    201         wxSYM_CALL(what, SymSetContext);                                      \
    202         wxSYM_CALL(what, SymEnumSymbols);                                     \
    203         wxSYM_CALL(what, SymGetTypeInfo);                                     \
    204         wxSYM_CALL(what, SymCleanup);                                         \
     253    #define wxSYM_CALL_ALWAYS_W(what, name)  what(name ## W, name ## W)
     254
     255    #define wxSYM_CALL_ALTERNATIVES(what, name)                \
     256        what(name, name);                                      \
     257        what(name ## 64, name ## 64);                          \
     258        what(name ## W64, name ## W64)
     259
     260    #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what)       \
     261        wxSYM_CALL_64(what, StackWalk);                        \
     262        wxSYM_CALL_64(what, SymFunctionTableAccess);           \
     263        wxSYM_CALL_64(what, SymGetModuleBase);                 \
     264                                                               \
     265        wxSYM_CALL(what, SymGetOptions);                       \
     266        wxSYM_CALL(what, SymSetOptions);                       \
     267        wxSYM_CALL(what, SymSetContext);                       \
     268        wxSYM_CALL(what, SymGetTypeInfo);                      \
     269        wxSYM_CALL(what, SymCleanup);                          \
    205270        wxSYM_CALL(what, MiniDumpWriteDump)
    206271
     272    #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what)      \
     273        wxSYM_CALL(what, SymInitialize);                       \
     274        wxSYM_CALL(what, SymFromAddr);                         \
     275        wxSYM_CALL(what, SymEnumSymbols)
     276   
     277    #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what)              \
     278        wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what);         \
     279        wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what)
     280
     281    // Alternation will work when the following functions are not found,
     282    // therefore they are not included in REQUIRED version.
     283    #define wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what)              \
     284        wxSYM_CALL_ALTERNATIVES(what, SymGetLineFromAddr);     \
     285        wxSYM_CALL_ALTERNATIVES(what, EnumerateLoadedModules); \
     286        wxSYM_CALL_ALWAYS_W(what, SymInitialize);              \
     287        wxSYM_CALL_ALWAYS_W(what, SymFromAddr);                \
     288        wxSYM_CALL_ALWAYS_W(what, SymEnumSymbols)
     289
     290    #define wxDO_FOR_ALL_SYM_FUNCS(what)                       \
     291        wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what);                 \
     292        wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what)
     293   
    207294    #define wxDECLARE_SYM_FUNCTION(func, name) static func ## _t func
    208295
    209     wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION);
     296    wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(wxDECLARE_SYM_FUNCTION);
    210297
     298private:
     299    wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(wxDECLARE_SYM_FUNCTION);
     300    wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(wxDECLARE_SYM_FUNCTION);
     301
     302public:
     303
    211304    #undef wxDECLARE_SYM_FUNCTION
    212305
    213306    // load all functions from DLL, return true if ok
     
    220313    static void LogError(const wxChar *func);
    221314
    222315    // return textual representation of the value of given symbol
    223     static wxString DumpSymbol(PSYMBOL_INFO pSymInfo, void *pVariable);
     316    static wxString DumpSymbol(wxPSYMBOL_INFO pSymInfo, void *pVariable);
    224317
    225318    // return the name of the symbol with given type index
    226     static wxString GetSymbolName(PSYMBOL_INFO pSymInfo);
     319    static wxString GetSymbolName(wxPSYMBOL_INFO pSymInfo);
    227320
    228321private:
    229322    // dereference the given symbol, i.e. return symbol which is not a
     
    233326    // dereferenced the symbol
    234327    //
    235328    // return the tag of the dereferenced symbol
    236     static SymbolTag DereferenceSymbol(PSYMBOL_INFO pSymInfo, void **ppData);
     329    static SymbolTag DereferenceSymbol(wxPSYMBOL_INFO pSymInfo, void **ppData);
    237330
    238     static wxString DumpField(PSYMBOL_INFO pSymInfo,
     331    static wxString DumpField(wxPSYMBOL_INFO pSymInfo,
    239332                              void *pVariable,
    240333                              unsigned level);
    241334
    242335    static wxString DumpBaseType(BasicType bt, DWORD64 length, void *pVariable);
    243336
    244     static wxString DumpUDT(PSYMBOL_INFO pSymInfo,
     337    static wxString DumpUDT(wxPSYMBOL_INFO pSymInfo,
    245338                            void *pVariable,
    246339                            unsigned level = 0);
     340
     341    static bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp);
     342    static bool DoInit();
    247343};
    248344
    249345#endif // wxUSE_DBGHELP
  • include/wx/msw/stackwalk.h

     
    22// Name:        wx/msw/stackwalk.h
    33// Purpose:     wxStackWalker for MSW
    44// Author:      Vadim Zeitlin
    5 // Modified by:
     5// Modified by: Suzumizaki-kimitaka 2013-04-09
    66// Created:     2005-01-08
    77// RCS-ID:      $Id$
    88// Copyright:   (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
     
    2020
    2121// and these in dbghelp.h
    2222struct _SYMBOL_INFO;
     23struct _SYMBOL_INFOW;
    2324
    2425// ----------------------------------------------------------------------------
    2526// wxStackFrame
     
    5354    GetParam(size_t n, wxString *type, wxString *name, wxString *value) const;
    5455
    5556    // callback used by OnGetParam(), don't call directly
    56     void OnParam(_SYMBOL_INFO *pSymInfo);
     57#ifdef UNICODE
     58    void OnParam(_SYMBOL_INFOW * pSymInfo);
     59#else
     60    void OnParam(_SYMBOL_INFO * pSymInfo);
     61#endif
    5762
    5863protected:
    5964    virtual void OnGetName();
  • samples/except/except.bkl

     
    66    <include file="../../build/bakefiles/common_samples.bkl"/>
    77
    88    <exe id="except" template="wx_sample" template_append="wx_append">
    9         <sources>except.cpp</sources>
     9        <sources>except.cpp except_utf8.cpp</sources>
     10        <headers>except_utf8.h</headers>
    1011        <wx-lib>core</wx-lib>
    1112        <wx-lib>base</wx-lib>
    1213    </exe>
  • samples/except/except.cpp

     
    22// Name:        samples/except/except.cpp
    33// Purpose:     shows how C++ exceptions can be used in wxWidgets
    44// Author:      Vadim Zeitlin
    5 // Modified by:
     5// Modified by: Suzumizaki-kimitaka 2013-04-08
    66// Created:     2003-09-17
    77// RCS-ID:      $Id$
    88// Copyright:   (c) 2003-2005 Vadim Zeitlin
     
    4848    #include "wx/thread.h"
    4949#endif
    5050
     51#include "except_utf8.h"
     52
    5153// ----------------------------------------------------------------------------
    5254// resources
    5355// ----------------------------------------------------------------------------
     
    113115    void OnQuit(wxCommandEvent& event);
    114116    void OnAbout(wxCommandEvent& event);
    115117    void OnDialog(wxCommandEvent& event);
     118    void OnDialogUnicode(wxCommandEvent& event);
    116119
    117120    void OnThrowInt(wxCommandEvent& event);
    118121    void OnThrowString(wxCommandEvent& event);
     
    198201    Except_ShowAssertInThread,
    199202#endif // wxUSE_THREADS
    200203    Except_Dialog,
     204    Except_Dialog_Unicode,
    201205
    202206    Except_Quit = wxID_EXIT,
    203207    Except_About = wxID_ABOUT
     
    215219    EVT_MENU(Except_About, MyFrame::OnAbout)
    216220    EVT_MENU(Except_Dialog, MyFrame::OnDialog)
    217221    EVT_MENU(Except_ThrowInt, MyFrame::OnThrowInt)
     222    EVT_MENU(Except_Dialog_Unicode, MyFrame::OnDialogUnicode)
    218223    EVT_MENU(Except_ThrowString, MyFrame::OnThrowString)
    219224    EVT_MENU(Except_ThrowObject, MyFrame::OnThrowObject)
    220225    EVT_MENU(Except_ThrowUnhandled, MyFrame::OnThrowUnhandled)
     
    349354    // create a menu bar
    350355    wxMenu *menuFile = new wxMenu;
    351356    menuFile->Append(Except_Dialog, wxT("Show &dialog\tCtrl-D"));
     357    menuFile->Append(Except_Dialog_Unicode,
     358                     wxT("Show dialog using &Unicode named class\tCtrl-U"));
    352359    menuFile->AppendSeparator();
    353360    menuFile->Append(Except_ThrowInt, wxT("Throw an &int\tCtrl-I"));
    354361    menuFile->Append(Except_ThrowString, wxT("Throw a &string\tCtrl-S"));
     
    427434    }
    428435}
    429436
     437void MyFrame::OnDialogUnicode(wxCommandEvent& WXUNUSED(event))
     438{
     439#if STACKTRACE_CAN_INCLUDE_UNICODE
     440    try
     441    {
     442        wxDialog* dlg = GenerateDialogUnicode(this);
     443
     444        dlg->ShowModal();
     445    }
     446    catch ( ... )
     447    {
     448        wxLogWarning(wxT("An exception in Unicode Version Dialog"));
     449
     450        Destroy();
     451        throw;
     452    }
     453#else
     454    wxMessageBox(
     455       wxT("Please define STACKTRACE_CAN_INCLUDE_UNICODE as 1 and rebuild."));
     456#endif
     457}
     458
     459
    430460void MyFrame::OnThrowInt(wxCommandEvent& WXUNUSED(event))
    431461{
    432462    throw -17;
     
    546576{
    547577    DoCrash();
    548578}
    549 
  • samples/except/except.dsp

     
    3131MTL=midl.exe
    3232RSC=rc.exe
    3333
    34 !IF  "$(CFG)" == "except - Win32 DLL Release"
     34!IF  "$(CFG)" == "except - Win32 DLL Release"
    3535
    3636# PROP BASE Use_MFC 0
    3737# PROP BASE Use_Debug_Libraries 1
     
    148148# End Source File
    149149# Begin Source File
    150150
     151SOURCE=.\except_utf8.cpp
     152# End Source File
     153# Begin Source File
     154
    151155SOURCE=.\..\..\samples\sample.rc
    152156# End Source File
    153157# End Group
     158# Begin Group "Header Files"
     159
     160# PROP Default_Filter ""
     161# Begin Source File
     162
     163SOURCE=.\except_utf8.h
     164# End Source File
     165# End Group
    154166# End Target
    155167# End Project
    156168
  • samples/except/except_utf8.cpp

     
     1/////////////////////////////////////////////////////////////////////////////
     2// Name:        samples/except/except_utf8.cpp
     3// Purpose:     
     4// Author:      Suzumizaki-kimitaka
     5// Modified by:
     6// Created:     2013-04-11
     7// RCS-ID:     
     8// Copyright:   (C) Suzumizaki-kimitaka
     9// Licence:     wxWindows licence
     10/////////////////////////////////////////////////////////////////////////////
     11
     12/*
     13
     14C++ specification allows non-ASCII named classes, variables, functions, etc.
     15and this file includes Unicode characters for own purpose.
     16
     17Currently this file is saved as UTF-8 with Byte Order Mark.
     18If the BOM doesn't exist, Visual C++ may treat source texts as local not UTF.
     19
     20Old versions of wxMSW can't treat non-ASCII named identifiers inside stack
     21tracing. Because ill versions call wxString::FromAscii with such identifiers
     22and assertion-stop raised by FromAscii throws away the information we really
     23need. Additionally to say, Ill versions used only MBCS functions implemented
     24in dbghelp.dll
     25
     26Try assertion stop and check the dialog shows correctly the names of classes
     27and functions in Unicode.
     28
     29When you uses outdated dbghelp.dll, or MBCS build that not support the class
     30name 'àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€', you can only check avoiding multi assertion stops.
     31
     32*/
     33
     34// ============================================================================
     35// declarations
     36// ============================================================================
     37
     38// ----------------------------------------------------------------------------
     39// headers
     40// ----------------------------------------------------------------------------
     41
     42// For compilers that support precompilation, includes "wx/wx.h".
     43#include "wx/wxprec.h"
     44
     45#ifdef __BORLANDC__
     46    #pragma hdrstop
     47#endif
     48
     49#include "except_utf8.h"
     50#if STACKTRACE_CAN_INCLUDE_UNICODE
     51
     52#ifndef WX_PRECOMP
     53    #include "wx/button.h"
     54    #include "wx/sizer.h"
     55    #include "wx/stattext.h"
     56    #include "wx/dynlib.h"
     57    #include "wx/msgdlg.h"
     58#endif
     59
     60// ----------------------------------------------------------------------------
     61// private classes
     62// ----------------------------------------------------------------------------
     63
     64// named 'Thai language, Japanese, Hindi' only for test purpose
     65class àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€ : public wxDialog
     66{
     67public:
     68    àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€(wxFrame *parent);
     69
     70    // event handlers
     71    void OnShowAssert(wxCommandEvent& event);
     72    void OnThrowObject(wxCommandEvent& event);
     73    void OnInvalidStringFormat(wxCommandEvent& event);
     74    void OnListLoadedModules(wxCommandEvent& event);
     75   
     76    // 'format string includes error'
     77    wxString 曞匏字列の誀り();
     78
     79private:
     80    DECLARE_EVENT_TABLE()
     81};
     82
     83// A trivial exception class
     84class MyException
     85{
     86public:
     87    MyException(const wxString& msg) : m_msg(msg) { }
     88
     89    const wxChar *what() const { return m_msg.c_str(); }
     90
     91private:
     92    wxString m_msg;
     93};
     94
     95// ----------------------------------------------------------------------------
     96// constants
     97// ----------------------------------------------------------------------------
     98
     99// IDs for the controls and the menu commands
     100enum
     101{
     102    // control ids and menu items
     103    Except_utf8_ShowAssert = wxID_HIGHEST,
     104    Except_utf8_ListLoadedModules,
     105    Except_utf8_ThrowObject,
     106    Except_utf8_InvalidStringFormat,
     107};
     108
     109// ----------------------------------------------------------------------------
     110// event tables and other macros for wxWidgets
     111// ----------------------------------------------------------------------------
     112
     113BEGIN_EVENT_TABLE(àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€, wxDialog)
     114    EVT_BUTTON(Except_utf8_ShowAssert, àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnShowAssert)
     115    EVT_BUTTON(Except_utf8_ListLoadedModules, àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnListLoadedModules)
     116    EVT_BUTTON(Except_utf8_ThrowObject, àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnThrowObject)
     117    EVT_BUTTON(Except_utf8_InvalidStringFormat,
     118               àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnInvalidStringFormat)
     119END_EVENT_TABLE()
     120
     121// ============================================================================
     122// àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€ implementation
     123// ============================================================================
     124
     125àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€(wxFrame *parent)
     126        : wxDialog(parent, wxID_ANY, wxString(wxT("Throw exception dialog")))
     127{
     128    wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
     129   
     130    sizerTop->Add(new wxStaticText(this, wxNewId(),
     131        wxT("Welcome. Now you can check whether your stack trace\ncorrectly ")
     132        wxT("shows non-ASCII identifier used as class name.\n\n")
     133        wxT("The name of this dialog class is 'àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€'. ")),
     134                  0, wxCENTRE | wxALL, 5);
     135
     136    sizerTop->Add(new wxButton(this, Except_utf8_ThrowObject, wxT("Throw &object")),
     137                  0, wxCENTRE | wxALL, 5);
     138    sizerTop->Add(new wxButton(this, Except_utf8_ShowAssert,
     139                               wxT("Show &Assert invoked from wxArrayString")),
     140                  0, wxCENTRE | wxALL, 5);
     141    sizerTop->Add(new wxButton(this, Except_utf8_InvalidStringFormat,
     142                               wxT("Call wxString::&Format with bad parameter")),
     143                  0, wxCENTRE | wxALL, 5);
     144    sizerTop->Add(new wxButton(this, Except_utf8_ListLoadedModules,
     145                               wxT("List loaded modules")),
     146                  0, wxCENTRE | wxALL, 5);
     147    sizerTop->Add(new wxButton(this, wxID_CANCEL, wxT("&Cancel")),
     148                  0, wxCENTRE | wxALL, 5);
     149
     150    SetSizerAndFit(sizerTop);
     151}
     152
     153void àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnThrowObject(wxCommandEvent& WXUNUSED(event))
     154{
     155    throw MyException(wxT("Exception thrown from àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€"));
     156}
     157
     158void àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnShowAssert(wxCommandEvent& WXUNUSED(event))
     159{
     160    // provoke an assert from wxArrayString.
     161    // to test stack trace can include non-ASCII named class.
     162    wxArrayString arr;
     163    arr[0];
     164}
     165
     166void àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnListLoadedModules(wxCommandEvent& WXUNUSED(event))
     167{
     168    wxDynamicLibraryDetailsArray list = wxDynamicLibrary::ListLoaded();
     169    wxString s;
     170    for (size_t i=0; i<list.Count(); ++i)
     171    {
     172        s << list[i].GetName() << wxT(" ");
     173        if (list[i].GetVersion().Trim().Trim(false).size())
     174        {
     175            s << list[i].GetVersion() << wxT("\n");
     176        }
     177        else
     178        {
     179            s << wxT("(not versioned)\n");
     180        }
     181    }
     182    wxMessageBox(s, wxT("The modules currently loaded are:"));
     183}
     184
     185
     186wxString àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::曞匏字列の誀り()
     187{
     188    // provoke an assert from wxString::Format.
     189    // currently, assertion faied in wxArgNormalizer<int>::wxArgNormalizer<int>.
     190    return wxString::Format("%s", 1717);
     191}
     192
     193void àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€::OnInvalidStringFormat(wxCommandEvent& WXUNUSED(event))
     194{
     195    // to test stack trace can include non-ASCII named function.
     196    曞匏字列の誀り();
     197}
     198
     199// ============================================================================
     200// global functions implementation
     201// ============================================================================
     202
     203wxDialog* GenerateDialogUnicode(wxFrame* parent)
     204{
     205    return new àž àž²àž©àž²à¹„àž—àž¢æ—¥æœ¬èªžà€¹à€¿à€šà¥à€Šà¥€(parent);
     206}
     207
     208#endif // STACKTRACE_CAN_INCLUDE_UNICODE
     209
  • samples/except/except_utf8.h

     
     1/////////////////////////////////////////////////////////////////////////////
     2// Name:        samples/except/except_utf8.h
     3// Purpose:     check stacktrace works correctly with non-ASCII identifiers
     4// Author:      Suzumizaki-kimitaka
     5// Modified by:
     6// Created:     2013-04-08
     7// RCS-ID:     
     8// Copyright:   (C) Suzumizaki-kimitaka
     9// Licence:     wxWindows licence
     10/////////////////////////////////////////////////////////////////////////////
     11
     12#ifndef STACKTRACE_CAN_INCLUDE_UNICODE
     13#define STACKTRACE_CAN_INCLUDE_UNICODE 1
     14#endif
     15
     16#if STACKTRACE_CAN_INCLUDE_UNICODE
     17
     18#include "wx/dialog.h"
     19#include "wx/frame.h"
     20wxDialog* GenerateDialogUnicode(wxFrame* parent);
     21
     22#endif
     23
  • samples/except/except_vc7.vcproj

     
    286286                        <File
    287287                                RelativePath=".\except.cpp">
    288288                        </File>
     289                        <File
     290                                RelativePath=".\except_utf8.cpp">
     291                        </File>
    289292                </Filter>
    290293                <Filter
     294                        Name="Header Files"
     295                        Filter="h;hpp;hxx;hm;inl;inc;xsd"
     296                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
     297                        <File
     298                                RelativePath=".\except_utf8.h">
     299                        </File>
     300                </Filter>
     301                <Filter
    291302                        Name="Resource Files"
    292303                        Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
    293304                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
  • samples/except/except_vc8.vcproj

     
    421421                                RelativePath=".\except.cpp"
    422422                                >
    423423                        </File>
     424                        <File
     425                                RelativePath=".\except_utf8.cpp"
     426                                >
     427                        </File>
    424428                </Filter>
    425429                <Filter
     430                        Name="Header Files"
     431                        Filter="h;hpp;hxx;hm;inl;inc;xsd"
     432                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
     433                        >
     434                        <File
     435                                RelativePath=".\except_utf8.h"
     436                                >
     437                        </File>
     438                </Filter>
     439                <Filter
    426440                        Name="Resource Files"
    427441                        Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
    428442                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
  • samples/except/except_vc9.vcproj

     
    407407                                RelativePath=".\except.cpp"
    408408                                >
    409409                        </File>
     410                        <File
     411                                RelativePath=".\except_utf8.cpp"
     412                                >
     413                        </File>
    410414                </Filter>
    411415                <Filter
     416                        Name="Header Files"
     417                        Filter="h;hpp;hxx;hm;inl;inc;xsd"
     418                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
     419                        >
     420                        <File
     421                                RelativePath=".\except_utf8.h"
     422                                >
     423                        </File>
     424                </Filter>
     425                <Filter
    412426                        Name="Resource Files"
    413427                        Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
    414428                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
  • samples/except/makefile.bcc

     
    2424WX_RELEASE_NODOT = 29
    2525COMPILER_PREFIX = bcc
    2626OBJS = \
    27         $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
    28 LIBDIRNAME = \
    29         .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
     27        $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
     28LIBDIRNAME = \
     29        .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
    3030SETUPHDIR = \
    3131        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
    3232EXCEPT_CXXFLAGS = $(__RUNTIME_LIBS_7) -I$(BCCDIR)\include $(__DEBUGINFO) \
    33         $(__OPTIMIZEFLAG_2) $(__THREADSFLAG_6) -D__WX$(TOOLKIT)__ \
    34         $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
    35         $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
    36         $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include \
     33        $(__OPTIMIZEFLAG_2) $(__THREADSFLAG_6) -D__WX$(TOOLKIT)__ \
     34        $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
     35        $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
     36        $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include \
    3737        $(____CAIRO_INCLUDEDIR_FILENAMES_p) -I. $(__DLLFLAG_p) -I.\..\..\samples \
    3838        -DNOPCH $(CPPFLAGS) $(CXXFLAGS)
    3939EXCEPT_OBJECTS =  \
    40         $(OBJS)\except_except.obj
     40        $(OBJS)\except_except.obj \
     41        $(OBJS)\except_except_utf8.obj
    4142
    4243### Conditionally set variables: ###
    4344
    44 !if "$(TOOLKIT)" == "GTK"
    45 WIN32_TOOLKIT_LOWERCASE = gtk
    46 !endif
    47 !if "$(TOOLKIT)" == "MSW"
    48 WIN32_TOOLKIT_LOWERCASE = msw
    49 !endif
     45!if "$(TOOLKIT)" == "GTK"
     46WIN32_TOOLKIT_LOWERCASE = gtk
     47!endif
     48!if "$(TOOLKIT)" == "MSW"
     49WIN32_TOOLKIT_LOWERCASE = msw
     50!endif
    5051!if "$(USE_GUI)" == "0"
    5152PORTNAME = base
    5253!endif
    5354!if "$(USE_GUI)" == "1"
    54 PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    55 !endif
    56 !if "$(TOOLKIT)" == "MAC"
    57 WXBASEPORT = _carbon
    58 !endif
    59 !if "$(OFFICIAL_BUILD)" == "1"
    60 COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     55PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    6156!endif
     57!if "$(TOOLKIT)" == "MAC"
     58WXBASEPORT = _carbon
     59!endif
     60!if "$(OFFICIAL_BUILD)" == "1"
     61COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     62!endif
    6263!if "$(BUILD)" == "debug"
    6364WXDEBUGFLAG = d
    6465!endif
     
    8384!if "$(MONOLITHIC)" == "1"
    8485EXTRALIBS_FOR_BASE =   
    8586!endif
    86 !if "$(TOOLKIT)" == "GTK" && "$(TOOLKIT_VERSION)" == "2"
    87 LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib \
    88         gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib \
    89         glib-2.0.lib
    90 !endif
     87!if "$(TOOLKIT)" == "GTK" && "$(TOOLKIT_VERSION)" == "2"
     88LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib \
     89        gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib \
     90        glib-2.0.lib
     91!endif
    9192!if "$(BUILD)" == "debug"
    9293__OPTIMIZEFLAG_2 = -Od
    9394!endif
     
    190191!endif
    191192!if "$(MONOLITHIC)" == "0"
    192193__WXLIB_BASE_p = \
    193         wxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
     194        wxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
    194195!endif
    195196!if "$(MONOLITHIC)" == "1"
    196197__WXLIB_MONO_p = \
     
    249250
    250251$(OBJS)\except.exe: $(EXCEPT_OBJECTS)  $(OBJS)\except_sample.res
    251252        ilink32 -Tpe -q  -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO)  -L$(LIBDIRNAME) -aa $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @&&|
    252         c0w32.obj $(EXCEPT_OBJECTS),$@,, $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,, $(OBJS)\except_sample.res
     253        c0w32.obj $(EXCEPT_OBJECTS),$@,, $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,, $(OBJS)\except_sample.res
    253254|
    254255
    255256$(OBJS)\except_sample.res: .\..\..\samples\sample.rc
    256         brcc32 -32 -r -fo$@ -i$(BCCDIR)\include    -d__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) -i$(SETUPHDIR) -i.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) -i. $(__DLLFLAG_p_1) -i.\..\..\samples -dNOPCH .\..\..\samples\sample.rc
     257        brcc32 -32 -r -fo$@ -i$(BCCDIR)\include    -d__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) -i$(SETUPHDIR) -i.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) -i. $(__DLLFLAG_p_1) -i.\..\..\samples -dNOPCH .\..\..\samples\sample.rc
    257258
    258259$(OBJS)\except_except.obj: .\except.cpp
    259260        $(CXX) -q -c -P -o$@ $(EXCEPT_CXXFLAGS) .\except.cpp
    260261
     262$(OBJS)\except_except_utf8.obj: .\except_utf8.cpp
     263        $(CXX) -q -c -P -o$@ $(EXCEPT_CXXFLAGS) .\except_utf8.cpp
     264
  • samples/except/makefile.gcc

     
    1616WX_RELEASE_NODOT = 29
    1717COMPILER_PREFIX = gcc
    1818OBJS = \
    19         $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
    20 LIBDIRNAME = \
    21         .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
     19        $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
     20LIBDIRNAME = \
     21        .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
    2222SETUPHDIR = \
    2323        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
    2424EXCEPT_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
    25         $(GCCFLAGS) -DHAVE_W32API_H -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
     25        $(GCCFLAGS) -DHAVE_W32API_H -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
    2626        $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
    2727        $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
    2828        $(__MSLU_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include \
    2929        $(____CAIRO_INCLUDEDIR_FILENAMES_p) -W -Wall -I. $(__DLLFLAG_p) \
    3030        -I.\..\..\samples -DNOPCH $(__RTTIFLAG_5) $(__EXCEPTIONSFLAG_6) \
    31         -Wno-ctor-dtor-privacy $(CXXFLAGS_GTK_WINDOWS_GCC) $(CPPFLAGS) $(CXXFLAGS)
     31        -Wno-ctor-dtor-privacy $(CXXFLAGS_GTK_WINDOWS_GCC) $(CPPFLAGS) $(CXXFLAGS)
    3232EXCEPT_OBJECTS =  \
    3333        $(OBJS)\except_sample_rc.o \
    34         $(OBJS)\except_except.o
     34        $(OBJS)\except_except.o \
     35        $(OBJS)\except_except_utf8.o
    3536
    3637### Conditionally set variables: ###
    3738
    38 ifeq ($(TOOLKIT),GTK)
    39 WIN32_TOOLKIT_LOWERCASE = gtk
    40 endif
    41 ifeq ($(TOOLKIT),MSW)
    42 WIN32_TOOLKIT_LOWERCASE = msw
    43 endif
     39ifeq ($(TOOLKIT),GTK)
     40WIN32_TOOLKIT_LOWERCASE = gtk
     41endif
     42ifeq ($(TOOLKIT),MSW)
     43WIN32_TOOLKIT_LOWERCASE = msw
     44endif
    4445ifeq ($(GCC_VERSION),2.95)
    4546GCCFLAGS = -fvtable-thunks
    4647endif
     
    4849PORTNAME = base
    4950endif
    5051ifeq ($(USE_GUI),1)
    51 PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    52 endif
    53 ifeq ($(TOOLKIT),MAC)
    54 WXBASEPORT = _carbon
    55 endif
    56 ifeq ($(OFFICIAL_BUILD),1)
    57 COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     52PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    5853endif
     54ifeq ($(TOOLKIT),MAC)
     55WXBASEPORT = _carbon
     56endif
     57ifeq ($(OFFICIAL_BUILD),1)
     58COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     59endif
    5960ifeq ($(BUILD),debug)
    6061WXDEBUGFLAG = d
    6162endif
     
    8081ifeq ($(MONOLITHIC),1)
    8182EXTRALIBS_FOR_BASE =   
    8283endif
    83 ifeq ($(TOOLKIT),GTK)
    84 CXXFLAGS_GTK_WINDOWS_GCC = -mms-bitfields
    85 endif
    86 ifeq ($(TOOLKIT),GTK)
    87 ifeq ($(TOOLKIT_VERSION),2)
    88 LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib \
    89         gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib \
    90         glib-2.0.lib
    91 endif
    92 endif
     84ifeq ($(TOOLKIT),GTK)
     85CXXFLAGS_GTK_WINDOWS_GCC = -mms-bitfields
     86endif
     87ifeq ($(TOOLKIT),GTK)
     88ifeq ($(TOOLKIT_VERSION),2)
     89LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib \
     90        gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib \
     91        glib-2.0.lib
     92endif
     93endif
    9394ifeq ($(BUILD),debug)
    9495__OPTIMIZEFLAG_2 = -O0
    9596endif
     
    180181endif
    181182ifeq ($(MONOLITHIC),0)
    182183__WXLIB_BASE_p = \
    183         -lwxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
     184        -lwxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
    184185endif
    185186ifeq ($(MONOLITHIC),1)
    186187__WXLIB_MONO_p = \
     
    242243        -if exist $(OBJS)\except.exe del $(OBJS)\except.exe
    243244
    244245$(OBJS)\except.exe: $(EXCEPT_OBJECTS) $(OBJS)\except_sample_rc.o
    245         $(CXX) -o $@ $(EXCEPT_OBJECTS)  $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS)  $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwininet
     246        $(CXX) -o $@ $(EXCEPT_OBJECTS)  $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS)  $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwininet
    246247
    247248$(OBJS)\except_sample_rc.o: ./../../samples/sample.rc
    248         windres --use-temp-file -i$< -o$@    --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_1) --include-dir ./../../samples --define NOPCH
     249        windres --use-temp-file -i$< -o$@    --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_1) --include-dir ./../../samples --define NOPCH
    249250
    250251$(OBJS)\except_except.o: ./except.cpp
    251252        $(CXX) -c -o $@ $(EXCEPT_CXXFLAGS) $(CPPDEPS) $<
    252253
     254$(OBJS)\except_except_utf8.o: ./except_utf8.cpp
     255        $(CXX) -c -o $@ $(EXCEPT_CXXFLAGS) $(CPPDEPS) $<
     256
    253257.PHONY: all clean
    254258
    255259
  • samples/except/Makefile.in

     
    5050EXCEPT_OBJECTS =  \
    5151        $(__except___win32rc) \
    5252        $(__except_os2_lib_res) \
    53         except_except.o
     53        except_except.o \
     54        except_except_utf8.o
    5455
    5556### Conditionally set variables: ###
    5657
     
    182183except_except.o: $(srcdir)/except.cpp
    183184        $(CXXC) -c -o $@ $(EXCEPT_CXXFLAGS) $(srcdir)/except.cpp
    184185
     186except_except_utf8.o: $(srcdir)/except_utf8.cpp
     187        $(CXXC) -c -o $@ $(EXCEPT_CXXFLAGS) $(srcdir)/except_utf8.cpp
    185188
     189
    186190# Include dependency info, if present:
    187191@IF_GNU_MAKE@-include ./.deps/*.d
    188192
  • samples/except/makefile.unx

     
    5353EXCEPT_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) \
    5454        $(CXXFLAGS)
    5555EXCEPT_OBJECTS =  \
    56         except_except.o
     56        except_except.o \
     57        except_except_utf8.o
    5758
    5859### Conditionally set variables: ###
    5960
     
    9394except_except.o: ./except.cpp
    9495        $(CXX) -c -o $@ $(EXCEPT_CXXFLAGS) $(CPPDEPS) $<
    9596
     97except_except_utf8.o: ./except_utf8.cpp
     98        $(CXX) -c -o $@ $(EXCEPT_CXXFLAGS) $(CPPDEPS) $<
     99
    96100.PHONY: all install uninstall clean
    97101
    98102
  • samples/except/makefile.vc

     
    1515WX_RELEASE_NODOT = 29
    1616COMPILER_PREFIX = vc
    1717OBJS = \
    18         $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)$(ARCH_SUFFIX)
     18        $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)$(ARCH_SUFFIX)
    1919LIBDIRNAME = \
    20         .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG)
     20        .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG)
    2121SETUPHDIR = \
    2222        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
    2323EXCEPT_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
    2424        $(__DEBUGINFO_0) /Fd$(OBJS)\except.pdb $(____DEBUGRUNTIME_3_p) \
    2525        $(__OPTIMIZEFLAG_6) /D_CRT_SECURE_NO_DEPRECATE=1 \
    2626        /D_CRT_NON_CONFORMING_SWPRINTFS=1 /D_SCL_SECURE_NO_WARNINGS=1 \
    27         $(__NO_VC_CRTDBG_p) /D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
    28         $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
    29         $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
    30         $(__MSLU_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
    31         $(____CAIRO_INCLUDEDIR_FILENAMES_p) /W4 /I. $(__DLLFLAG_p) /D_WINDOWS \
    32         /I.\..\..\samples /DNOPCH $(__RTTIFLAG_11) $(__EXCEPTIONSFLAG_12) \
    33         $(CPPFLAGS) $(CXXFLAGS)
     27        $(__NO_VC_CRTDBG_p) /D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
     28        $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
     29        $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
     30        $(__MSLU_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
     31        $(____CAIRO_INCLUDEDIR_FILENAMES_p) /W4 /I. $(__DLLFLAG_p) /D_WINDOWS \
     32        /I.\..\..\samples /DNOPCH $(__RTTIFLAG_11) $(__EXCEPTIONSFLAG_12) \
     33        $(CPPFLAGS) $(CXXFLAGS)
    3434EXCEPT_OBJECTS =  \
    35         $(OBJS)\except_except.obj
     35        $(OBJS)\except_except.obj \
     36        $(OBJS)\except_except_utf8.obj
    3637EXCEPT_RESOURCES =  \
    3738        $(OBJS)\except_sample.res
    3839
    3940### Conditionally set variables: ###
    4041
    41 !if "$(TOOLKIT)" == "GTK"
    42 WIN32_TOOLKIT_LOWERCASE = gtk
    43 !endif
    44 !if "$(TOOLKIT)" == "MSW"
    45 WIN32_TOOLKIT_LOWERCASE = msw
    46 !endif
    47 !if "$(TARGET_CPU)" == "AMD64"
    48 ARCH_SUFFIX = _x64
    49 !endif
    50 !if "$(TARGET_CPU)" == "IA64"
    51 ARCH_SUFFIX = _ia64
    52 !endif
    53 !if "$(TARGET_CPU)" == "X64"
    54 ARCH_SUFFIX = _x64
    55 !endif
    56 !if "$(TARGET_CPU)" == "amd64"
    57 ARCH_SUFFIX = _x64
    58 !endif
    59 !if "$(TARGET_CPU)" == "ia64"
    60 ARCH_SUFFIX = _ia64
    61 !endif
    62 !if "$(TARGET_CPU)" == "x64"
    63 ARCH_SUFFIX = _x64
    64 !endif
     42!if "$(TOOLKIT)" == "GTK"
     43WIN32_TOOLKIT_LOWERCASE = gtk
     44!endif
     45!if "$(TOOLKIT)" == "MSW"
     46WIN32_TOOLKIT_LOWERCASE = msw
     47!endif
     48!if "$(TARGET_CPU)" == "AMD64"
     49ARCH_SUFFIX = _x64
     50!endif
     51!if "$(TARGET_CPU)" == "IA64"
     52ARCH_SUFFIX = _ia64
     53!endif
     54!if "$(TARGET_CPU)" == "X64"
     55ARCH_SUFFIX = _x64
     56!endif
     57!if "$(TARGET_CPU)" == "amd64"
     58ARCH_SUFFIX = _x64
     59!endif
     60!if "$(TARGET_CPU)" == "ia64"
     61ARCH_SUFFIX = _ia64
     62!endif
     63!if "$(TARGET_CPU)" == "x64"
     64ARCH_SUFFIX = _x64
     65!endif
    6566!if "$(USE_GUI)" == "0"
    6667PORTNAME = base
    6768!endif
    6869!if "$(USE_GUI)" == "1"
    69 PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    70 !endif
    71 !if "$(TOOLKIT)" == "MAC"
    72 WXBASEPORT = _carbon
    73 !endif
    74 !if "$(OFFICIAL_BUILD)" == "1"
    75 COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     70PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    7671!endif
     72!if "$(TOOLKIT)" == "MAC"
     73WXBASEPORT = _carbon
     74!endif
     75!if "$(OFFICIAL_BUILD)" == "1"
     76COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     77!endif
    7778!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
    7879WXDEBUGFLAG = d
    7980!endif
     
    101102!if "$(TARGET_CPU)" == "IA64"
    102103LINK_TARGET_CPU = /MACHINE:IA64
    103104!endif
    104 !if "$(TARGET_CPU)" == "X64"
    105 LINK_TARGET_CPU = /MACHINE:X64
    106 !endif
     105!if "$(TARGET_CPU)" == "X64"
     106LINK_TARGET_CPU = /MACHINE:X64
     107!endif
    107108!if "$(TARGET_CPU)" == "amd64"
    108109LINK_TARGET_CPU = /MACHINE:X64
    109110!endif
    110111!if "$(TARGET_CPU)" == "ia64"
    111112LINK_TARGET_CPU = /MACHINE:IA64
    112113!endif
    113 !if "$(TARGET_CPU)" == "x64"
    114 LINK_TARGET_CPU = /MACHINE:X64
    115 !endif
     114!if "$(TARGET_CPU)" == "x64"
     115LINK_TARGET_CPU = /MACHINE:X64
     116!endif
    116117!if "$(MONOLITHIC)" == "0"
    117118EXTRALIBS_FOR_BASE =
    118119!endif
    119120!if "$(MONOLITHIC)" == "1"
    120121EXTRALIBS_FOR_BASE =   
    121122!endif
    122 !if "$(TOOLKIT)" == "GTK" && "$(TOOLKIT_VERSION)" == "2"
    123 LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib \
    124         gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib \
    125         glib-2.0.lib
    126 !endif
     123!if "$(TOOLKIT)" == "GTK" && "$(TOOLKIT_VERSION)" == "2"
     124LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib \
     125        gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib \
     126        glib-2.0.lib
     127!endif
    127128!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
    128129__DEBUGINFO_0 = /Zi
    129130!endif
     
    328329!endif
    329330!if "$(MONOLITHIC)" == "0"
    330331__WXLIB_BASE_p = \
    331         wxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
     332        wxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
    332333!endif
    333334!if "$(MONOLITHIC)" == "1"
    334335__WXLIB_MONO_p = \
     
    372373
    373374$(OBJS)\except.exe: $(EXCEPT_OBJECTS) $(OBJS)\except_sample.res
    374375        link /NOLOGO /OUT:$@  $(__DEBUGINFO_1) /pdb:"$(OBJS)\except.pdb" $(__DEBUGINFO_2)  $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
    375         $(EXCEPT_OBJECTS) $(EXCEPT_RESOURCES)  $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib
     376        $(EXCEPT_OBJECTS) $(EXCEPT_RESOURCES)  $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib
    376377<<
    377378
    378379$(OBJS)\except_sample.res: .\..\..\samples\sample.rc
    379         rc /fo$@  /d WIN32 $(____DEBUGRUNTIME_3_p_1) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_1)  /d __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\samples /d NOPCH .\..\..\samples\sample.rc
     380        rc /fo$@  /d WIN32 $(____DEBUGRUNTIME_3_p_1) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_1)  /d __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\samples /d NOPCH .\..\..\samples\sample.rc
    380381
    381382$(OBJS)\except_except.obj: .\except.cpp
    382383        $(CXX) /c /nologo /TP /Fo$@ $(EXCEPT_CXXFLAGS) .\except.cpp
    383384
     385$(OBJS)\except_except_utf8.obj: .\except_utf8.cpp
     386        $(CXX) /c /nologo /TP /Fo$@ $(EXCEPT_CXXFLAGS) .\except_utf8.cpp
     387
  • samples/except/makefile.wat

     
    3131
    3232### Conditionally set variables: ###
    3333
    34 WIN32_TOOLKIT_LOWERCASE =
    35 !ifeq TOOLKIT GTK
    36 WIN32_TOOLKIT_LOWERCASE = gtk
    37 !endif
    38 !ifeq TOOLKIT MSW
    39 WIN32_TOOLKIT_LOWERCASE = msw
    40 !endif
     34WIN32_TOOLKIT_LOWERCASE =
     35!ifeq TOOLKIT GTK
     36WIN32_TOOLKIT_LOWERCASE = gtk
     37!endif
     38!ifeq TOOLKIT MSW
     39WIN32_TOOLKIT_LOWERCASE = msw
     40!endif
    4141PORTNAME =
    4242!ifeq USE_GUI 0
    4343PORTNAME = base
    4444!endif
    4545!ifeq USE_GUI 1
    46 PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    47 !endif
    48 WXBASEPORT =
    49 !ifeq TOOLKIT MAC
    50 WXBASEPORT = _carbon
    51 !endif
    52 COMPILER_VERSION =
    53 !ifeq OFFICIAL_BUILD 1
    54 COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     46PORTNAME = $(WIN32_TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
    5547!endif
     48WXBASEPORT =
     49!ifeq TOOLKIT MAC
     50WXBASEPORT = _carbon
     51!endif
     52COMPILER_VERSION =
     53!ifeq OFFICIAL_BUILD 1
     54COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
     55!endif
    5656WXDEBUGFLAG =
    5757!ifeq BUILD debug
    5858WXDEBUGFLAG = d
     
    8383!ifeq MONOLITHIC 1
    8484EXTRALIBS_FOR_BASE =   
    8585!endif
    86 LIB_GTK =
    87 !ifeq TOOLKIT GTK
    88 !ifeq TOOLKIT_VERSION 2
    89 LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib &
    90         gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib &
    91         glib-2.0.lib
    92 !endif
    93 !endif
     86LIB_GTK =
     87!ifeq TOOLKIT GTK
     88!ifeq TOOLKIT_VERSION 2
     89LIB_GTK = gtk-win32-2.0.lib gdk-win32-2.0.lib pangocairo-1.0.lib &
     90        gdk_pixbuf-2.0.lib cairo.lib pango-1.0.lib gobject-2.0.lib gthread-2.0.lib &
     91        glib-2.0.lib
     92!endif
     93!endif
    9494__DEBUGINFO_0 =
    9595!ifeq BUILD debug
    9696!ifeq DEBUG_INFO default
     
    168168__WXLIB_BASE_p =
    169169!ifeq MONOLITHIC 0
    170170__WXLIB_BASE_p = &
    171         wxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
     171        wxbase$(WXBASEPORT)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
    172172!endif
    173173__WXLIB_MONO_p =
    174174!ifeq MONOLITHIC 1
     
    240240WX_RELEASE_NODOT = 29
    241241COMPILER_PREFIX = wat
    242242OBJS = &
    243         $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
    244 LIBDIRNAME = &
    245         .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
     243        $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
     244LIBDIRNAME = &
     245        .\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
    246246SETUPHDIR = &
    247247        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
    248248EXCEPT_CXXFLAGS = $(__DEBUGINFO_0) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG_5) &
    249         $(__RUNTIME_LIBS_6) -d__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) &
    250         $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) &
    251         $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) &
    252         -i=$(SETUPHDIR) -i=.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -wx &
    253         -wcd=549 -wcd=656 -wcd=657 -wcd=667 -i=. $(__DLLFLAG_p) -i=.\..\..\samples &
    254         -dNOPCH $(__RTTIFLAG_7) $(__EXCEPTIONSFLAG_8) $(CPPFLAGS) $(CXXFLAGS)
     249        $(__RUNTIME_LIBS_6) -d__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) &
     250        $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) &
     251        $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) &
     252        -i=$(SETUPHDIR) -i=.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -wx &
     253        -wcd=549 -wcd=656 -wcd=657 -wcd=667 -i=. $(__DLLFLAG_p) -i=.\..\..\samples &
     254        -dNOPCH $(__RTTIFLAG_7) $(__EXCEPTIONSFLAG_8) $(CPPFLAGS) $(CXXFLAGS)
    255255EXCEPT_OBJECTS =  &
    256         $(OBJS)\except_except.obj
     256        $(OBJS)\except_except.obj &
     257        $(OBJS)\except_except_utf8.obj
    257258
    258259
    259260all : $(OBJS)
     
    279280        @%append $(OBJS)\except.lbc option caseexact
    280281        @%append $(OBJS)\except.lbc  $(__DEBUGINFO_1)  libpath $(LIBDIRNAME) system nt_win ref '_WinMain@16' $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS)
    281282        @for %i in ($(EXCEPT_OBJECTS)) do @%append $(OBJS)\except.lbc file %i
    282         @for %i in ( $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE)  $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib) do @%append $(OBJS)\except.lbc library %i
     283        @for %i in ( $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(LIB_GTK)  wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE)  $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib) do @%append $(OBJS)\except.lbc library %i
    283284        @%append $(OBJS)\except.lbc option resource=$(OBJS)\except_sample.res
    284285        @for %i in () do @%append $(OBJS)\except.lbc option stack=%i
    285286        wlink @$(OBJS)\except.lbc
    286287
    287288$(OBJS)\except_sample.res :  .AUTODEPEND .\..\..\samples\sample.rc
    288         wrc -q -ad -bt=nt -r -fo=$^@    -d__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p)  -i=$(SETUPHDIR) -i=.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -i=. $(__DLLFLAG_p) -i=.\..\..\samples -dNOPCH $<
     289        wrc -q -ad -bt=nt -r -fo=$^@    -d__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p)  -i=$(SETUPHDIR) -i=.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES) -i=. $(__DLLFLAG_p) -i=.\..\..\samples -dNOPCH $<
    289290
    290291$(OBJS)\except_except.obj :  .AUTODEPEND .\except.cpp
    291292        $(CXX) -bt=nt -zq -fo=$^@ $(EXCEPT_CXXFLAGS) $<
    292293
     294$(OBJS)\except_except_utf8.obj :  .AUTODEPEND .\except_utf8.cpp
     295        $(CXX) -bt=nt -zq -fo=$^@ $(EXCEPT_CXXFLAGS) $<
     296
  • src/msw/debughlp.cpp

     
    22// Name:        src/msw/debughlp.cpp
    33// Purpose:     various Win32 debug helpers
    44// Author:      Vadim Zeitlin
    5 // Modified by:
     5// Modified by: Suzumizaki-kimitaka 2013-04-10
    66// Created:     2005-01-08 (extracted from crashrpt.cpp)
    77// RCS-ID:      $Id$
    88// Copyright:   (c) 2003-2005 Vadim Zeitlin <vadim@wxwindows.org>
     
    6363
    6464// load all function we need from the DLL
    6565
    66 static bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp)
     66/* static */
     67bool wxDbgHelpDLL::BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp)
    6768{
    6869    #define LOAD_SYM_FUNCTION(func, name)                                     \
    6970        wxDbgHelpDLL::func = (wxDbgHelpDLL::func ## _t)                       \
     
    7475            return false;                                                     \
    7576        }
    7677
    77     wxDO_FOR_ALL_SYM_FUNCS(LOAD_SYM_FUNCTION);
     78    wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(LOAD_SYM_FUNCTION);
    7879
    7980    #undef LOAD_SYM_FUNCTION
    8081
     82    #define LOAD_SYM_FUNCTION_OPTIONAL(func, name)                            \
     83        if ( dllDbgHelp.HasSymbol(wxT(#name)) )                               \
     84        {                                                                     \
     85            wxDbgHelpDLL::func = (wxDbgHelpDLL::func ## _t)                   \
     86                dllDbgHelp.GetSymbol(wxT(#name));                             \
     87        }
     88   
     89    wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(LOAD_SYM_FUNCTION_OPTIONAL);
     90
     91    #undef LOAD_SYM_FUNCTION_CAN_FAIL
     92
    8193    return true;
    8294}
    8395
    8496// called by Init() if we hadn't done this before
    85 static bool DoInit()
     97/* static */
     98bool wxDbgHelpDLL::DoInit()
    8699{
    87100    wxDynamicLibrary dllDbgHelp(wxT("dbghelp.dll"), wxDL_VERBATIM);
    88101    if ( dllDbgHelp.IsLoaded() )
     
    171184
    172185static inline
    173186bool
    174 DoGetTypeInfo(PSYMBOL_INFO pSym, IMAGEHLP_SYMBOL_TYPE_INFO type, void *rc)
     187DoGetTypeInfo(wxPSYMBOL_INFO pSym, IMAGEHLP_SYMBOL_TYPE_INFO type, void *rc)
    175188{
    176189    return DoGetTypeInfo(pSym->ModBase, pSym->TypeIndex, type, rc);
    177190}
    178191
    179192static inline
    180 wxDbgHelpDLL::BasicType GetBasicType(PSYMBOL_INFO pSym)
     193wxDbgHelpDLL::BasicType GetBasicType(wxPSYMBOL_INFO pSym)
    181194{
    182195    wxDbgHelpDLL::BasicType bt;
    183196    return DoGetTypeInfo(pSym, TI_GET_BASETYPE, &bt)
     
    186199}
    187200
    188201/* static */
    189 wxString wxDbgHelpDLL::GetSymbolName(PSYMBOL_INFO pSym)
     202wxString wxDbgHelpDLL::GetSymbolName(wxPSYMBOL_INFO pSym)
    190203{
    191204    wxString s;
    192205
     
    290303}
    291304
    292305wxString
    293 wxDbgHelpDLL::DumpField(PSYMBOL_INFO pSym, void *pVariable, unsigned level)
     306wxDbgHelpDLL::DumpField(wxPSYMBOL_INFO pSym, void *pVariable, unsigned level)
    294307{
    295308    wxString s;
    296309
     
    337350
    338351
    339352                // now pass to the type representing the type of this member
    340                 SYMBOL_INFO sym = *pSym;
     353                wxSYMBOL_INFO sym = *pSym;
    341354                if ( !DoGetTypeInfo(pSym, TI_GET_TYPEID, &sym.TypeIndex) )
    342355                    break;
    343356
     
    388401}
    389402
    390403/* static */ wxString
    391 wxDbgHelpDLL::DumpUDT(PSYMBOL_INFO pSym, void *pVariable, unsigned level)
     404wxDbgHelpDLL::DumpUDT(wxPSYMBOL_INFO pSym, void *pVariable, unsigned level)
    392405{
    393406    wxString s;
    394407
     
    455468        s << wxT(" {\n");
    456469
    457470        // Iterate through all children
    458         SYMBOL_INFO sym;
     471        wxSYMBOL_INFO sym;
    459472        wxZeroMemory(sym);
    460473        sym.ModBase = pSym->ModBase;
    461474        for ( unsigned i = 0; i < dwChildrenCount; i++ )
     
    487500
    488501/* static */
    489502wxDbgHelpDLL::SymbolTag
    490 wxDbgHelpDLL::DereferenceSymbol(PSYMBOL_INFO pSym, void **ppData)
     503wxDbgHelpDLL::DereferenceSymbol(wxPSYMBOL_INFO pSym, void **ppData)
    491504{
    492505    SymbolTag tag = SYMBOL_TAG_NULL;
    493506    for ( ;; )
     
    524537}
    525538
    526539/* static */ wxString
    527 wxDbgHelpDLL::DumpSymbol(PSYMBOL_INFO pSym, void *pVariable)
     540wxDbgHelpDLL::DumpSymbol(wxPSYMBOL_INFO pSym, void *pVariable)
    528541{
    529542    wxString s;
    530     SYMBOL_INFO symDeref = *pSym;
     543    wxSYMBOL_INFO symDeref = *pSym;
    531544    switch ( DereferenceSymbol(&symDeref, &pVariable) )
    532545    {
    533546        default:
     
    554567}
    555568
    556569// ----------------------------------------------------------------------------
     570// do the best functions and structures
     571// ----------------------------------------------------------------------------
     572
     573struct wxMswEnmLddMdlsHelperStruct
     574{
     575public:
     576    wxMswEnmLddMdlsHelperStruct(wxPENUMLOADED_MODULES_CALLBACK64 ptr, PVOID content)
     577        : m_pointer_to_callback(ptr), m_user_content(content)
     578    { }
     579    wxPENUMLOADED_MODULES_CALLBACK64 m_pointer_to_callback;
     580    PVOID m_user_content;
     581};
     582
     583#ifdef UNICODE
     584
     585static BOOL CALLBACK wxMswEnmLddMdlsCallback1(
     586    PCSTR ModuleName, DWORD64 ModuleBase, ULONG ModuleSize, PVOID UserContext)
     587{
     588    wxMswEnmLddMdlsHelperStruct& alternate =
     589        *(wxMswEnmLddMdlsHelperStruct*)(UserContext);
     590
     591    const wxWCharBuffer buf = wxConvLocal.cMB2WC(ModuleName, wxNO_LEN, NULL);
     592    return (*alternate.m_pointer_to_callback)
     593        (buf.data(), ModuleBase, ModuleSize, alternate.m_user_content);
     594}
     595
     596static BOOL CALLBACK wxMswEnmLddMdlsCallback2(
     597    PCSTR ModuleName, DWORD_PTR ModuleBase, ULONG ModuleSize, PVOID UserContext)
     598{
     599    wxMswEnmLddMdlsHelperStruct& alternate =
     600        *(wxMswEnmLddMdlsHelperStruct*)(UserContext);
     601
     602    const wxWCharBuffer buf = wxConvLocal.cMB2WC(ModuleName, wxNO_LEN, NULL);
     603    return (*alternate.m_pointer_to_callback)
     604        (buf.data(), ModuleBase, ModuleSize, alternate.m_user_content);
     605}
     606
     607#else
     608
     609static BOOL CALLBACK wxMswEnmLddMdlsCallback(
     610    PCSTR ModuleName, DWORD_PTR ModuleBase, ULONG ModuleSize, PVOID UserContext)
     611{
     612    wxMswEnmLddMdlsHelperStruct& alternate =
     613        *(wxMswEnmLddMdlsHelperStruct*)(UserContext);
     614
     615    return (*alternate.m_pointer_to_callback)
     616        (ModuleName, ModuleBase, ModuleSize, alternate.m_user_content);
     617}
     618
     619#endif // UNICODE
     620
     621/* static */
     622BOOL wxDbgHelpDLL::EnumerateLoadedModulesT(
     623    HANDLE handle, wxPENUMLOADED_MODULES_CALLBACK64 callback, PVOID pvoid)
     624{
     625#ifdef UNICODE
     626    if (EnumerateLoadedModulesW64)
     627    {
     628        const BOOL retVal = (*EnumerateLoadedModulesW64)(handle, callback, pvoid);
     629        if (retVal)
     630            return retVal;
     631    }
     632    if (EnumerateLoadedModules64)
     633    {
     634        wxMswEnmLddMdlsHelperStruct p(callback, pvoid);
     635        const BOOL retVal =
     636            (*EnumerateLoadedModules64)
     637                (handle, &wxMswEnmLddMdlsCallback1, (PVOID)(&p));
     638        if (retVal)
     639            return retVal;
     640    }
     641    if (EnumerateLoadedModules)
     642    {
     643        wxMswEnmLddMdlsHelperStruct p(callback, pvoid);
     644        const BOOL retVal =
     645            (*EnumerateLoadedModules)
     646                (handle, &wxMswEnmLddMdlsCallback2, (PVOID)(&p));
     647        if (retVal)
     648            return retVal;
     649    }
     650    return FALSE;
     651#else
     652    if (EnumerateLoadedModules64)
     653    {
     654        const BOOL retVal = (*EnumerateLoadedModules64)(handle, callback, pvoid);
     655        if (retVal)
     656            return retVal;
     657    }
     658    if (EnumerateLoadedModules)
     659    {
     660        wxMswEnmLddMdlsHelperStruct p(callback, pvoid);
     661        const BOOL retVal =
     662            (*EnumerateLoadedModules)
     663                (handle, &wxMswEnmLddMdlsCallback, (PVOID)(&p));
     664        if (retVal)
     665            return retVal;
     666    }
     667    return FALSE;
     668#endif
     669}
     670
     671/* static */
     672BOOL wxDbgHelpDLL::SymInitializeT(HANDLE hProcess, LPCTSTR UserSearchPath, BOOL fInvadeProcess)
     673{
     674#ifdef UNICODE
     675    if (SymInitializeW)
     676    {
     677        const BOOL retVal = (*SymInitializeW)(hProcess, UserSearchPath, fInvadeProcess);
     678        if (retVal)
     679            return retVal;
     680    }
     681    if (SymInitialize)
     682    {
     683        BOOL retVal;
     684        if (UserSearchPath)
     685        {
     686            const wxCharBuffer buf = wxConvLocal.cWC2MB(UserSearchPath, wxNO_LEN, NULL);
     687            retVal = (*SymInitialize)(hProcess, buf.data(), fInvadeProcess);
     688        }
     689        else
     690        {
     691            retVal = (*SymInitialize)(hProcess, NULL, fInvadeProcess);
     692        }
     693        return retVal;
     694    }
     695    return FALSE;
     696#else
     697    if (SymInitialize)
     698    {
     699        return (*SymInitialize)(hProcess, UserSearchPath, fInvadeProcess);
     700    }
     701    return FALSE;
     702#endif
     703}
     704
     705/* static */
     706BOOL wxDbgHelpDLL::SymFromAddrT(HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, wxPSYMBOL_INFO Symbol)
     707{
     708#ifdef UNICODE
     709    if (SymFromAddrW)
     710    {
     711        const BOOL retVal = (*SymFromAddrW)(hProcess, Address, Displacement, Symbol);
     712        if (retVal)
     713            return retVal;
     714    }
     715    if (SymFromAddr)
     716    {
     717        wxScopedPtr<BYTE> symbolBuffer(new BYTE[sizeof(SYMBOL_INFO) + Symbol->MaxNameLen*sizeof(CHAR)]);
     718        PSYMBOL_INFO data = (SYMBOL_INFO*)(symbolBuffer.get());
     719        wxZeroMemory(*data);
     720        data->SizeOfStruct = sizeof(SYMBOL_INFO);
     721        data->MaxNameLen = Symbol->MaxNameLen;
     722        if (! (*SymFromAddr)(hProcess, Address, Displacement, data))
     723        {
     724            return FALSE;
     725        }
     726
     727        // We can't refer data->NameLen. It seems to be unmodified.
     728        const wxWCharBuffer buf = wxConvLocal.cMB2WC(data->Name, wxNO_LEN, NULL);
     729       
     730        Symbol->TypeIndex = data->TypeIndex;
     731        Symbol->Reserved[0] = data->Reserved[0];
     732        Symbol->Reserved[1] = data->Reserved[1];
     733        Symbol->Index = data->Index;
     734        Symbol->Size = data->Size;
     735        Symbol->ModBase = data->ModBase;
     736        Symbol->Flags = data->Flags;
     737        Symbol->Value = data->Value;
     738        Symbol->Address = data->Address;
     739        Symbol->Register = data->Register;
     740        Symbol->Scope = data->Scope;
     741        Symbol->Tag = data->Tag;
     742        Symbol->NameLen = buf.length();
     743        wxStrncpy(Symbol->Name, buf.data(), Symbol->MaxNameLen);
     744        return TRUE;
     745    }
     746    return FALSE;
     747#else
     748    if (SymFromAddr)
     749    {
     750        return (*SymFromAddr)(hProcess, Address, Displacement, Symbol);
     751    }
     752    return FALSE;
     753#endif
     754}
     755
     756/* static */
     757BOOL wxDbgHelpDLL::SymGetLineFromAddrT(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdrDisplacement, wxPIMAGEHLP_LINE Line)
     758{
     759#ifdef UNICODE
     760    if (SymGetLineFromAddrW64)
     761    {
     762        const BOOL retVal = (*SymGetLineFromAddrW64)(hProcess, dwAddr, pdrDisplacement, Line);
     763        if (retVal)
     764            return retVal;
     765        // TODO: seems always fail with GetLastError() returns 487 with 32bit binary on 64 bit Windows.
     766    }
     767    static WCHAR staticBuf[MAX_PATH];
     768    if (SymGetLineFromAddr64)
     769    {
     770        IMAGEHLP_LINE64 LineAlternate;
     771        LineAlternate.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
     772        if ((*SymGetLineFromAddr64)(hProcess, dwAddr, pdrDisplacement, &LineAlternate))
     773        {
     774            const wxWCharBuffer ConvBuf =
     775                wxConvLocal.cMB2WC(LineAlternate.FileName, wxNO_LEN, NULL);
     776            wxStrncpy(staticBuf, ConvBuf.data(), MAX_PATH);
     777            Line->Key = LineAlternate.Key;
     778            Line->LineNumber = LineAlternate.LineNumber;
     779            Line->FileName = staticBuf;
     780            Line->Address = LineAlternate.Address;
     781            return TRUE;
     782        }
     783    }
     784    if (SymGetLineFromAddr)
     785    {
     786        IMAGEHLP_LINE LineAlternate;
     787        LineAlternate.SizeOfStruct = sizeof(IMAGEHLP_LINE);
     788        if ((*SymGetLineFromAddr)(hProcess, dwAddr, pdrDisplacement, &LineAlternate))
     789        {
     790            const wxWCharBuffer ConvBuf =
     791                wxConvLocal.cMB2WC(LineAlternate.FileName, wxNO_LEN, NULL);
     792            wxStrncpy(staticBuf, ConvBuf.data(), MAX_PATH);
     793            Line->Key = LineAlternate.Key;
     794            Line->LineNumber = LineAlternate.LineNumber;
     795            Line->FileName = staticBuf;
     796            Line->Address = LineAlternate.Address;
     797            return TRUE;
     798        }
     799    }
     800    return FALSE;
     801#else
     802    if (SymGetLineFromAddr64)
     803    {
     804        return (*SymGetLineFromAddr64)(hProcess, dwAddr, pdrDisplacement, Line);
     805    }
     806    if (SymGetLineFromAddr)
     807    {
     808        IMAGEHLP_LINE LineAlternate;
     809        LineAlternate.SizeOfStruct = sizeof(IMAGEHLP_LINE);
     810        if ((*SymGetLineFromAddr)(hProcess, dwAddr, pdrDisplacement, &LineAlternate))
     811        {
     812            Line->Key = LineAlternate.Key;
     813            Line->LineNumber = LineAlternate.LineNumber;
     814            Line->FileName = LineAlternate.FileName;
     815            Line->Address = LineAlternate.Address;
     816            return TRUE;
     817        }
     818    }
     819    return FALSE;
     820#endif
     821}
     822
     823struct wxMswSymEnumSymbolsHelperStruct
     824{
     825public:
     826    wxMswSymEnumSymbolsHelperStruct(PSYM_ENUMERATESYMBOLS_CALLBACKW ptr, PVOID content)
     827        : m_pointer_to_callback(ptr), m_user_content(content)
     828    { }
     829    PSYM_ENUMERATESYMBOLS_CALLBACKW m_pointer_to_callback;
     830    PVOID m_user_content;
     831};
     832
     833#ifdef UNICODE
     834
     835static BOOL CALLBACK wxMswSymEnumSymbolsHelperCallback(
     836    PSYMBOL_INFO pSymInfo, ULONG SymbolSize, PVOID UserContext)
     837{
     838    wxMswSymEnumSymbolsHelperStruct& alternate =
     839        *(wxMswSymEnumSymbolsHelperStruct*)(UserContext);
     840    const wxWCharBuffer buf = wxConvLocal.cMB2WC(pSymInfo->Name, pSymInfo->MaxNameLen, NULL);
     841    wxScopedPtr<BYTE> symbolBuffer(new BYTE[sizeof(SYMBOL_INFOW) + buf.length()*sizeof(WCHAR)]);
     842    SYMBOL_INFOW* data = (SYMBOL_INFOW*)(symbolBuffer.get());
     843    data->SizeOfStruct = sizeof(SYMBOL_INFOW);
     844    data->TypeIndex = pSymInfo->TypeIndex;
     845    data->Reserved[0] = pSymInfo->Reserved[0];
     846    data->Reserved[1] = pSymInfo->Reserved[1];
     847    data->Index = pSymInfo->Index;
     848    data->Size = pSymInfo->Size;
     849    data->ModBase = pSymInfo->ModBase;
     850    data->Flags = pSymInfo->Flags;
     851    data->Value = pSymInfo->Value;
     852    data->Address = pSymInfo->Address;
     853    data->Register = pSymInfo->Register;
     854    data->Scope = pSymInfo->Scope;
     855    data->Tag = pSymInfo->Tag;
     856    data->NameLen = pSymInfo->NameLen;
     857    data->MaxNameLen = pSymInfo->MaxNameLen;
     858    wxStrncpy(data->Name, buf.data(), buf.length());
     859    BOOL retVal = (*alternate.m_pointer_to_callback)(data, SymbolSize, alternate.m_user_content);
     860    return retVal;
     861}
     862
     863#endif // UNICODE
     864
     865/* static */
     866BOOL wxDbgHelpDLL::SymEnumSymbolsT(HANDLE hProcess, ULONG64 baseOfDll, PCTSTR Mask,
     867                    wxPSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, const PVOID UserContext)
     868{
     869#ifdef UNICODE
     870    if (SymEnumSymbolsW)
     871    {
     872        const BOOL retVal = (*SymEnumSymbolsW)(hProcess, baseOfDll, Mask, EnumSymbolsCallback, UserContext);
     873        if (retVal)
     874            return retVal;
     875    }
     876    if (SymEnumSymbols)
     877    {
     878        wxMswSymEnumSymbolsHelperStruct p(EnumSymbolsCallback, UserContext);       
     879        const wxCharBuffer buf = wxConvLocal.cWC2MB(Mask ? Mask : L"", wxNO_LEN, NULL);
     880        return (*SymEnumSymbols)(hProcess, baseOfDll, buf.data(),
     881                                 wxMswSymEnumSymbolsHelperCallback, (PVOID)(&p));
     882    }
     883    return FALSE;
     884#else
     885    if (SymEnumSymbols)
     886    {
     887        return (*SymEnumSymbols)(hProcess, baseOfDll, Mask, EnumSymbolsCallback, UserContext);
     888    }
     889    return FALSE;
     890#endif
     891}
     892
     893// ----------------------------------------------------------------------------
    557894// debugging helpers
    558895// ----------------------------------------------------------------------------
    559896
     
    7801117#endif // NDEBUG
    7811118
    7821119#endif // wxUSE_DBGHELP
     1120
  • src/msw/dlmsw.cpp

     
    22// Name:        src/msw/dlmsw.cpp
    33// Purpose:     Win32-specific part of wxDynamicLibrary and related classes
    44// Author:      Vadim Zeitlin
    5 // Modified by:
     5// Modified by: Suzumizaki-kimitaka 2013-04-09
    66// Created:     2005-01-10 (partly extracted from common/dynlib.cpp)
    77// RCS-ID:      $Id$
    88// Copyright:   (c) 1998-2005 Vadim Zeitlin <vadim@wxwindows.org>
     
    8080        wxVersionDLL *verDLL;
    8181    };
    8282
    83     // TODO: fix EnumerateLoadedModules() to use EnumerateLoadedModules64()
    84     #ifdef __WIN64__
    85         typedef DWORD64 DWORD_32_64;
    86     #else
    87         typedef DWORD DWORD_32_64;
    88     #endif
    89 
    9083    static BOOL CALLBACK
    91     EnumModulesProc(PCSTR name, DWORD_32_64 base, ULONG size, void *data);
     84    EnumModulesProc(PCTSTR name, DWORD64 base, ULONG size, PVOID data);
    9285};
    9386
    9487// ============================================================================
     
    116109        #endif // UNICODE/ANSI
    117110
    118111        #define LOAD_VER_FUNCTION(name)                                       \
    119             m_pfn ## name = (name ## _t)m_dll.GetSymbol(wxT(#name SUFFIX));    \
     112            m_pfn ## name = (name ## _t)m_dll.GetSymbol(wxT(#name SUFFIX));   \
    120113        if ( !m_pfn ## name )                                                 \
    121114        {                                                                     \
    122115            m_dll.Unload();                                                   \
     
    175168
    176169/* static */
    177170BOOL CALLBACK
    178 wxDynamicLibraryDetailsCreator::EnumModulesProc(PCSTR name,
    179                                                 DWORD_32_64 base,
     171wxDynamicLibraryDetailsCreator::EnumModulesProc(PCTSTR name,
     172                                                DWORD64 base,
    180173                                                ULONG size,
    181                                                 void *data)
     174                                                PVOID data)
    182175{
    183176    EnumModulesProcParams *params = (EnumModulesProcParams *)data;
    184177
    185178    wxDynamicLibraryDetails *details = new wxDynamicLibraryDetails;
    186179
    187180    // fill in simple properties
     181#ifdef UNICODE
    188182    details->m_name = name;
     183#else
     184    details->m_name = wxString(name, wxConvLocal);
     185#endif
    189186    details->m_address = wxUIntToPtr(base);
    190187    details->m_length = size;
    191188
     
    323320        params.dlls = &dlls;
    324321        params.verDLL = &verDLL;
    325322
    326         // Note that the cast of EnumModulesProc is needed because the type of
    327         // PENUMLOADED_MODULES_CALLBACK changed: in old SDK versions its first
    328         // argument was non-const PSTR while now it's PCSTR. By explicitly
    329         // casting to whatever the currently used headers require we ensure
    330         // that the code compilers in any case.
    331         if ( !wxDbgHelpDLL::EnumerateLoadedModules
     323        if ( !wxDbgHelpDLL::EnumerateLoadedModulesT
    332324                            (
    333325                                ::GetCurrentProcess(),
    334                                 (PENUMLOADED_MODULES_CALLBACK)
    335326                                wxDynamicLibraryDetailsCreator::EnumModulesProc,
    336327                                &params
    337328                            ) )
    338329        {
    339             wxLogLastError(wxT("EnumerateLoadedModules"));
     330            wxLogLastError(wxT("EnumerateLoadedModulesT"));
    340331        }
    341332    }
    342333#endif // wxUSE_DBGHELP
  • src/msw/stackwalk.cpp

     
    22// Name:        src/msw/stackwalk.cpp
    33// Purpose:     wxStackWalker implementation for Win32
    44// Author:      Vadim Zeitlin
    5 // Modified by: Artur Bac 2010-10-01 AMD64 Port
     5// Modified by: Artur Bac 2010-10-01 AMD64 Port,
     6//              Suzumizaki-kimitaka 2013-04-09
    67// Created:     2005-01-08
    78// RCS-ID:      $Id$
    89// Copyright:   (c) 2003-2005 Vadim Zeitlin <vadim@wxwindows.org>
     
    5253
    5354    // get the name of the function for this stack frame entry
    5455    static const size_t MAX_NAME_LEN = 1024;
    55     BYTE symbolBuffer[sizeof(SYMBOL_INFO) + MAX_NAME_LEN];
     56    BYTE symbolBuffer[sizeof(wxSYMBOL_INFO) + MAX_NAME_LEN*sizeof(TCHAR)];
    5657    wxZeroMemory(symbolBuffer);
    5758
    58     PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)symbolBuffer;
    59     pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
     59    wxPSYMBOL_INFO pSymbol = (wxPSYMBOL_INFO)symbolBuffer;
     60    pSymbol->SizeOfStruct = sizeof(wxSYMBOL_INFO);
    6061    pSymbol->MaxNameLen = MAX_NAME_LEN;
    6162
    6263    DWORD64 symDisplacement = 0;
    63     if ( !wxDbgHelpDLL::SymFromAddr
     64    if ( !wxDbgHelpDLL::SymFromAddrT
    6465                        (
    6566                            ::GetCurrentProcess(),
    6667                            GetSymAddr(),
     
    6869                            pSymbol
    6970                        ) )
    7071    {
    71         wxDbgHelpDLL::LogError(wxT("SymFromAddr"));
     72        wxDbgHelpDLL::LogError(wxT("SymFromAddrT"));
    7273        return;
    7374    }
    74 
    75     m_name = wxString::FromAscii(pSymbol->Name);
     75#ifdef UNICODE
     76    m_name = pSymbol->Name;
     77#else
     78    m_name = wxString(pSymbol->Name, wxConvLocal);
     79#endif
    7680    m_offset = symDisplacement;
    7781}
    7882
     
    8488    m_hasLocation = true;
    8589
    8690    // get the source line for this stack frame entry
    87     IMAGEHLP_LINE lineInfo = { sizeof(IMAGEHLP_LINE) };
     91    wxIMAGEHLP_LINE lineInfo = { sizeof(wxIMAGEHLP_LINE) };
    8892    DWORD dwLineDisplacement;
    89     if ( !wxDbgHelpDLL::SymGetLineFromAddr
     93    if ( !wxDbgHelpDLL::SymGetLineFromAddrT
    9094                        (
    9195                            ::GetCurrentProcess(),
    9296                            GetSymAddr(),
     
    96100    {
    97101        // it is normal that we don't have source info for some symbols,
    98102        // notably all the ones from the system DLLs...
    99         //wxDbgHelpDLL::LogError(wxT("SymGetLineFromAddr"));
     103        //wxDbgHelpDLL::LogError(wxT("SymGetLineFromAddr64"));
    100104        return;
    101105    }
    102 
    103     m_filename = wxString::FromAscii(lineInfo.FileName);
     106#ifdef UNICODE
     107    m_filename = lineInfo.FileName;
     108#else
     109    m_filename = wxString(lineInfo.FileName, wxConvLocal);
     110#endif
    104111    m_line = lineInfo.LineNumber;
    105112}
    106113
     
    126133    return true;
    127134}
    128135
    129 void wxStackFrame::OnParam(PSYMBOL_INFO pSymInfo)
     136void wxStackFrame::OnParam(wxPSYMBOL_INFO pSymInfo)
    130137{
    131138    m_paramTypes.Add(wxEmptyString);
    132139
    133     m_paramNames.Add(wxString::FromAscii(pSymInfo->Name));
     140#ifdef UNICODE
     141    m_paramNames.Add(pSymInfo->Name);
     142#else
     143    m_paramNames.Add(wxString(pSymInfo->Name, wxConvLocal));
     144#endif
    134145
    135146    // if symbol information is corrupted and we crash, the exception is going
    136147    // to be ignored when we're called from WalkFromException() because of the
     
    159170}
    160171
    161172BOOL CALLBACK
    162 EnumSymbolsProc(PSYMBOL_INFO pSymInfo, ULONG WXUNUSED(SymSize), PVOID data)
     173EnumSymbolsProc(wxPSYMBOL_INFO pSymInfo, ULONG WXUNUSED(SymSize), PVOID data)
    163174{
    164175    wxStackFrame *frame = static_cast<wxStackFrame *>(data);
    165176
     
    196207        return;
    197208    }
    198209
    199     if ( !wxDbgHelpDLL::SymEnumSymbols
     210    if ( !wxDbgHelpDLL::SymEnumSymbolsT
    200211                        (
    201212                            ::GetCurrentProcess(),
    202213                            NULL,               // DLL base: use current context
     
    205216                            this                // data to pass to it
    206217                        ) )
    207218    {
    208         wxDbgHelpDLL::LogError(wxT("SymEnumSymbols"));
     219        wxDbgHelpDLL::LogError(wxT("SymEnumSymbolsT"));
    209220    }
    210221}
    211222
     
    233244    // below which should be a real handle... so this is what we use
    234245    const HANDLE hProcess = ::GetCurrentProcess();
    235246
    236     if ( !wxDbgHelpDLL::SymInitialize
     247    if ( !wxDbgHelpDLL::SymInitializeT
    237248                        (
    238249                            hProcess,
    239250                            NULL,   // use default symbol search path
    240251                            TRUE    // load symbols for all loaded modules
    241252                        ) )
    242253    {
    243         wxDbgHelpDLL::LogError(wxT("SymInitialize"));
     254        wxDbgHelpDLL::LogError(wxT("SymInitializeT"));
    244255
    245256        return;
    246257    }
     
    383394    return false;
    384395}
    385396
    386 void wxStackFrame::OnParam(_SYMBOL_INFO * WXUNUSED(pSymInfo))
     397void wxStackFrame::OnParam(wxPSYMBOL_INFO WXUNUSED(pSymInfo))
    387398{
    388399}
    389400