From ce4fd7b577cdeb1ceb085cb1380c0df97b6ceef4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 11 Mar 2005 02:55:21 +0000 Subject: [PATCH] added wxDebugReport git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 62 ++++ build/bakefiles/files.bkl | 3 + build/msw/makefile.bcc | 44 +++ build/msw/makefile.gcc | 45 +++ build/msw/makefile.vc | 46 ++- build/msw/makefile.wat | 44 +++ build/msw/wx_base.dsp | 8 + build/msw/wx_core.dsp | 4 + docs/changes.txt | 2 +- include/wx/debugrpt.h | 221 ++++++++++++ samples/debugrpt/debugrpt.bkl | 13 + samples/debugrpt/debugrpt.cpp | 187 ++++++++++ src/common/debugrpt.cpp | 639 ++++++++++++++++++++++++++++++++++ src/generic/dbgrptg.cpp | 488 ++++++++++++++++++++++++++ src/wxWindows.dsp | 12 + 15 files changed, 1816 insertions(+), 2 deletions(-) create mode 100644 include/wx/debugrpt.h create mode 100644 samples/debugrpt/debugrpt.bkl create mode 100644 samples/debugrpt/debugrpt.cpp create mode 100644 src/common/debugrpt.cpp create mode 100644 src/generic/dbgrptg.cpp diff --git a/Makefile.in b/Makefile.in index 6dd428ee4c..e5dbb453e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -236,6 +236,7 @@ ALL_BASE_HEADERS = \ wx/datstrm.h \ wx/dde.h \ wx/debug.h \ + wx/debugrpt.h \ wx/defs.h \ wx/dir.h \ wx/dlimpexp.h \ @@ -350,6 +351,7 @@ ALL_BASE_SOURCES = \ src/common/config.cpp \ src/common/datetime.cpp \ src/common/datstrm.cpp \ + src/common/debugrpt.cpp \ src/common/dircmn.cpp \ src/common/dynarray.cpp \ src/common/dynlib.cpp \ @@ -482,6 +484,7 @@ MONODLL_OBJECTS = \ monodll_config.o \ monodll_datetime.o \ monodll_datstrm.o \ + monodll_debugrpt.o \ monodll_dircmn.o \ monodll_dynarray.o \ monodll_dynlib.o \ @@ -569,6 +572,7 @@ MONOLIB_OBJECTS = \ monolib_config.o \ monolib_datetime.o \ monolib_datstrm.o \ + monolib_debugrpt.o \ monolib_dircmn.o \ monolib_dynarray.o \ monolib_dynlib.o \ @@ -658,6 +662,7 @@ BASEDLL_OBJECTS = \ basedll_config.o \ basedll_datetime.o \ basedll_datstrm.o \ + basedll_debugrpt.o \ basedll_dircmn.o \ basedll_dynarray.o \ basedll_dynlib.o \ @@ -730,6 +735,7 @@ BASELIB_OBJECTS = \ baselib_config.o \ baselib_datetime.o \ baselib_datstrm.o \ + baselib_debugrpt.o \ baselib_dircmn.o \ baselib_dynarray.o \ baselib_dynlib.o \ @@ -2784,6 +2790,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \ monodll_choicdgg.o \ monodll_choicbkg.o \ monodll_dcpsg.o \ + monodll_dbgrptg.o \ monodll_dirctrlg.o \ monodll_dragimgg.o \ monodll_listbkg.o \ @@ -2932,6 +2939,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_choicdgg.o \ monodll_choicbkg.o \ monodll_dcpsg.o \ + monodll_dbgrptg.o \ monodll_dirctrlg.o \ monodll_dragimgg.o \ monodll_listbkg.o \ @@ -4236,6 +4244,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \ monolib_choicdgg.o \ monolib_choicbkg.o \ monolib_dcpsg.o \ + monolib_dbgrptg.o \ monolib_dirctrlg.o \ monolib_dragimgg.o \ monolib_listbkg.o \ @@ -4384,6 +4393,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_choicdgg.o \ monolib_choicbkg.o \ monolib_dcpsg.o \ + monolib_dbgrptg.o \ monolib_dirctrlg.o \ monolib_dragimgg.o \ monolib_listbkg.o \ @@ -5916,6 +5926,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \ coredll_choicdgg.o \ coredll_choicbkg.o \ coredll_dcpsg.o \ + coredll_dbgrptg.o \ coredll_dirctrlg.o \ coredll_dragimgg.o \ coredll_listbkg.o \ @@ -6064,6 +6075,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_choicdgg.o \ coredll_choicbkg.o \ coredll_dcpsg.o \ + coredll_dbgrptg.o \ coredll_dirctrlg.o \ coredll_dragimgg.o \ coredll_listbkg.o \ @@ -7108,6 +7120,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \ corelib_choicdgg.o \ corelib_choicbkg.o \ corelib_dcpsg.o \ + corelib_dbgrptg.o \ corelib_dirctrlg.o \ corelib_dragimgg.o \ corelib_listbkg.o \ @@ -7256,6 +7269,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_choicdgg.o \ corelib_choicbkg.o \ corelib_dcpsg.o \ + corelib_dbgrptg.o \ corelib_dirctrlg.o \ corelib_dragimgg.o \ corelib_listbkg.o \ @@ -9896,6 +9910,9 @@ monodll_datetime.o: $(srcdir)/src/common/datetime.cpp $(MONODLL_ODEP) monodll_datstrm.o: $(srcdir)/src/common/datstrm.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/datstrm.cpp +monodll_debugrpt.o: $(srcdir)/src/common/debugrpt.cpp $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/debugrpt.cpp + monodll_dircmn.o: $(srcdir)/src/common/dircmn.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/dircmn.cpp @@ -13118,6 +13135,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp +@COND_USE_GUI_1@monodll_dbgrptg.o: $(srcdir)/src/generic/dbgrptg.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dbgrptg.cpp + @COND_USE_GUI_1@monodll_dirctrlg.o: $(srcdir)/src/generic/dirctrlg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dirctrlg.cpp @@ -13322,6 +13342,9 @@ monolib_datetime.o: $(srcdir)/src/common/datetime.cpp $(MONOLIB_ODEP) monolib_datstrm.o: $(srcdir)/src/common/datstrm.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/datstrm.cpp +monolib_debugrpt.o: $(srcdir)/src/common/debugrpt.cpp $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/debugrpt.cpp + monolib_dircmn.o: $(srcdir)/src/common/dircmn.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/dircmn.cpp @@ -16544,6 +16567,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp +@COND_USE_GUI_1@monolib_dbgrptg.o: $(srcdir)/src/generic/dbgrptg.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dbgrptg.cpp + @COND_USE_GUI_1@monolib_dirctrlg.o: $(srcdir)/src/generic/dirctrlg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dirctrlg.cpp @@ -16751,6 +16777,9 @@ basedll_datetime.o: $(srcdir)/src/common/datetime.cpp $(BASEDLL_ODEP) basedll_datstrm.o: $(srcdir)/src/common/datstrm.cpp $(BASEDLL_ODEP) $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/datstrm.cpp +basedll_debugrpt.o: $(srcdir)/src/common/debugrpt.cpp $(BASEDLL_ODEP) + $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/debugrpt.cpp + basedll_dircmn.o: $(srcdir)/src/common/dircmn.cpp $(BASEDLL_ODEP) $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/dircmn.cpp @@ -17294,6 +17323,9 @@ baselib_datetime.o: $(srcdir)/src/common/datetime.cpp $(BASELIB_ODEP) baselib_datstrm.o: $(srcdir)/src/common/datstrm.cpp $(BASELIB_ODEP) $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/datstrm.cpp +baselib_debugrpt.o: $(srcdir)/src/common/debugrpt.cpp $(BASELIB_ODEP) + $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/debugrpt.cpp + baselib_dircmn.o: $(srcdir)/src/common/dircmn.cpp $(BASELIB_ODEP) $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/dircmn.cpp @@ -20366,6 +20398,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@coredll_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp +@COND_USE_GUI_1@coredll_dbgrptg.o: $(srcdir)/src/generic/dbgrptg.cpp $(COREDLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dbgrptg.cpp + @COND_USE_GUI_1@coredll_dirctrlg.o: $(srcdir)/src/generic/dirctrlg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dirctrlg.cpp @@ -22862,6 +22897,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@corelib_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp +@COND_USE_GUI_1@corelib_dbgrptg.o: $(srcdir)/src/generic/dbgrptg.cpp $(CORELIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dbgrptg.cpp + @COND_USE_GUI_1@corelib_dirctrlg.o: $(srcdir)/src/generic/dirctrlg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dirctrlg.cpp @@ -24408,6 +24446,10 @@ SAMPLES_DIST: ALL_GUI_DIST cp $(SAMPDIR)/listctrl/*.xpm $(DISTDIR)/samples/listctrl cp $(SAMPDIR)/listctrl/bitmaps/*.xpm $(DISTDIR)/samples/listctrl/bitmaps + mkdir $(DISTDIR)/samples/mediaplayer + cp $(SAMPDIR)/mediaplayer/Makefile.in $(DISTDIR)/samples/mediaplayer + cp $(SAMPDIR)/mediaplayer/*.cpp $(DISTDIR)/samples/mediaplayer + mkdir $(DISTDIR)/samples/mdi mkdir $(DISTDIR)/samples/mdi/bitmaps cp $(SAMPDIR)/mdi/Makefile.in $(DISTDIR)/samples/mdi @@ -24495,6 +24537,11 @@ SAMPLES_DIST: ALL_GUI_DIST cp $(SAMPDIR)/png/*.h $(DISTDIR)/samples/png cp $(SAMPDIR)/png/*.png $(DISTDIR)/samples/png + mkdir $(DISTDIR)/samples/popup + cp $(SAMPDIR)/popup/Makefile.in $(DISTDIR)/samples/popup + cp $(SAMPDIR)/popup/makefile.unx $(DISTDIR)/samples/popup + cp $(SAMPDIR)/popup/*.cpp $(DISTDIR)/samples/popup + mkdir $(DISTDIR)/samples/printing cp $(SAMPDIR)/printing/Makefile.in $(DISTDIR)/samples/printing cp $(SAMPDIR)/printing/makefile.unx $(DISTDIR)/samples/printing @@ -24638,6 +24685,10 @@ SAMPLES_DIST: ALL_GUI_DIST cp $(SAMPDIR)/validate/*.h $(DISTDIR)/samples/validate cp $(SAMPDIR)/validate/*.xpm $(DISTDIR)/samples/validate + mkdir $(DISTDIR)/samples/vscroll + cp $(SAMPDIR)/vscroll/Makefile.in $(DISTDIR)/samples/vscroll + cp $(SAMPDIR)/vscroll/*.cpp $(DISTDIR)/samples/vscroll + mkdir $(DISTDIR)/samples/wizard cp $(SAMPDIR)/wizard/Makefile.in $(DISTDIR)/samples/wizard cp $(SAMPDIR)/wizard/makefile.unx $(DISTDIR)/samples/wizard @@ -24652,6 +24703,17 @@ SAMPLES_DIST: ALL_GUI_DIST cp $(SAMPDIR)/widgets/*.rc $(DISTDIR)/samples/widgets cp $(SAMPDIR)/widgets/icons/*.xpm $(DISTDIR)/samples/widgets/icons + mkdir $(DISTDIR)/samples/xrc + mkdir $(DISTDIR)/samples/xrc/rc + cp $(SAMPDIR)/xrc/Makefile.in $(DISTDIR)/samples/xrc + cp $(SAMPDIR)/xrc/*.cpp $(DISTDIR)/samples/xrc + cp $(SAMPDIR)/xrc/*.h $(DISTDIR)/samples/xrc + cp $(SAMPDIR)/xrc/*.rc $(DISTDIR)/samples/xrc + cp $(SAMPDIR)/xrc/rc/*.xpm $(DISTDIR)/samples/widgets/rc + cp $(SAMPDIR)/xrc/rc/*.xrc $(DISTDIR)/samples/widgets/rc + cp $(SAMPDIR)/xrc/rc/*.gif $(DISTDIR)/samples/widgets/rc + cp $(SAMPDIR)/xrc/rc/*.ico $(DISTDIR)/samples/widgets/rc + UTILS_DIST: ALL_GUI_DIST mkdir $(DISTDIR)/utils cp $(UTILSDIR)/Makefile.in $(DISTDIR)/utils diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index bbee781352..ec33a89bd6 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -260,6 +260,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/config.cpp src/common/datetime.cpp src/common/datstrm.cpp + src/common/debugrpt.cpp src/common/dircmn.cpp src/common/dynarray.cpp src/common/dynlib.cpp @@ -336,6 +337,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/datstrm.h wx/dde.h wx/debug.h + wx/debugrpt.h wx/defs.h wx/dir.h wx/dlimpexp.h @@ -575,6 +577,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/choicdgg.cpp src/generic/choicbkg.cpp src/generic/dcpsg.cpp + src/generic/dbgrptg.cpp src/generic/dirctrlg.cpp src/generic/dragimgg.cpp src/generic/listbkg.cpp diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 8651dd0f90..1cccf100d8 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -203,6 +203,7 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_config.obj \ $(OBJS)\monodll_datetime.obj \ $(OBJS)\monodll_datstrm.obj \ + $(OBJS)\monodll_debugrpt.obj \ $(OBJS)\monodll_dircmn.obj \ $(OBJS)\monodll_dynarray.obj \ $(OBJS)\monodll_dynlib.obj \ @@ -308,6 +309,7 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_config.obj \ $(OBJS)\monolib_datetime.obj \ $(OBJS)\monolib_datstrm.obj \ + $(OBJS)\monolib_debugrpt.obj \ $(OBJS)\monolib_dircmn.obj \ $(OBJS)\monolib_dynarray.obj \ $(OBJS)\monolib_dynlib.obj \ @@ -414,6 +416,7 @@ BASEDLL_OBJECTS = \ $(OBJS)\basedll_config.obj \ $(OBJS)\basedll_datetime.obj \ $(OBJS)\basedll_datstrm.obj \ + $(OBJS)\basedll_debugrpt.obj \ $(OBJS)\basedll_dircmn.obj \ $(OBJS)\basedll_dynarray.obj \ $(OBJS)\basedll_dynlib.obj \ @@ -505,6 +508,7 @@ BASELIB_OBJECTS = \ $(OBJS)\baselib_config.obj \ $(OBJS)\baselib_datetime.obj \ $(OBJS)\baselib_datstrm.obj \ + $(OBJS)\baselib_debugrpt.obj \ $(OBJS)\baselib_dircmn.obj \ $(OBJS)\baselib_dynarray.obj \ $(OBJS)\baselib_dynlib.obj \ @@ -1227,6 +1231,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ $(OBJS)\monodll_dcpsg.obj \ + $(OBJS)\monodll_dbgrptg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ $(OBJS)\monodll_listbkg.obj \ @@ -1423,6 +1428,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ $(OBJS)\monodll_dcpsg.obj \ + $(OBJS)\monodll_dbgrptg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ $(OBJS)\monodll_listbkg.obj \ @@ -1733,6 +1739,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ $(OBJS)\monolib_dcpsg.obj \ + $(OBJS)\monolib_dbgrptg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ $(OBJS)\monolib_listbkg.obj \ @@ -1929,6 +1936,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ $(OBJS)\monolib_dcpsg.obj \ + $(OBJS)\monolib_dbgrptg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ $(OBJS)\monolib_listbkg.obj \ @@ -2181,6 +2189,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ $(OBJS)\coredll_dcpsg.obj \ + $(OBJS)\coredll_dbgrptg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ $(OBJS)\coredll_listbkg.obj \ @@ -2377,6 +2386,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ $(OBJS)\coredll_dcpsg.obj \ + $(OBJS)\coredll_dbgrptg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ $(OBJS)\coredll_listbkg.obj \ @@ -2576,6 +2586,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ $(OBJS)\corelib_dcpsg.obj \ + $(OBJS)\corelib_dbgrptg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ $(OBJS)\corelib_listbkg.obj \ @@ -2772,6 +2783,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ $(OBJS)\corelib_dcpsg.obj \ + $(OBJS)\corelib_dbgrptg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ $(OBJS)\corelib_listbkg.obj \ @@ -3808,6 +3820,9 @@ $(OBJS)\monodll_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\monodll_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +$(OBJS)\monodll_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** + $(OBJS)\monodll_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -5290,6 +5305,11 @@ $(OBJS)\monodll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -5479,6 +5499,9 @@ $(OBJS)\monolib_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\monolib_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +$(OBJS)\monolib_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** + $(OBJS)\monolib_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -6961,6 +6984,11 @@ $(OBJS)\monolib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -7153,6 +7181,9 @@ $(OBJS)\basedll_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\basedll_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $** +$(OBJS)\basedll_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $** + $(OBJS)\basedll_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $** @@ -7387,6 +7418,9 @@ $(OBJS)\baselib_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\baselib_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $** +$(OBJS)\baselib_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $** + $(OBJS)\baselib_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $** @@ -8725,6 +8759,11 @@ $(OBJS)\coredll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** @@ -9859,6 +9898,11 @@ $(OBJS)\corelib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 5d4d2c3d0c..ac933e4ae3 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -187,6 +187,7 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_config.o \ $(OBJS)\monodll_datetime.o \ $(OBJS)\monodll_datstrm.o \ + $(OBJS)\monodll_debugrpt.o \ $(OBJS)\monodll_dircmn.o \ $(OBJS)\monodll_dynarray.o \ $(OBJS)\monodll_dynlib.o \ @@ -292,6 +293,7 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_config.o \ $(OBJS)\monolib_datetime.o \ $(OBJS)\monolib_datstrm.o \ + $(OBJS)\monolib_debugrpt.o \ $(OBJS)\monolib_dircmn.o \ $(OBJS)\monolib_dynarray.o \ $(OBJS)\monolib_dynlib.o \ @@ -398,6 +400,7 @@ BASEDLL_OBJECTS = \ $(OBJS)\basedll_config.o \ $(OBJS)\basedll_datetime.o \ $(OBJS)\basedll_datstrm.o \ + $(OBJS)\basedll_debugrpt.o \ $(OBJS)\basedll_dircmn.o \ $(OBJS)\basedll_dynarray.o \ $(OBJS)\basedll_dynlib.o \ @@ -488,6 +491,7 @@ BASELIB_OBJECTS = \ $(OBJS)\baselib_config.o \ $(OBJS)\baselib_datetime.o \ $(OBJS)\baselib_datstrm.o \ + $(OBJS)\baselib_debugrpt.o \ $(OBJS)\baselib_dircmn.o \ $(OBJS)\baselib_dynarray.o \ $(OBJS)\baselib_dynlib.o \ @@ -1230,6 +1234,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choicdgg.o \ $(OBJS)\monodll_choicbkg.o \ $(OBJS)\monodll_dcpsg.o \ + $(OBJS)\monodll_dbgrptg.o \ $(OBJS)\monodll_dirctrlg.o \ $(OBJS)\monodll_dragimgg.o \ $(OBJS)\monodll_listbkg.o \ @@ -1428,6 +1433,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choicdgg.o \ $(OBJS)\monodll_choicbkg.o \ $(OBJS)\monodll_dcpsg.o \ + $(OBJS)\monodll_dbgrptg.o \ $(OBJS)\monodll_dirctrlg.o \ $(OBJS)\monodll_dragimgg.o \ $(OBJS)\monodll_listbkg.o \ @@ -1742,6 +1748,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choicdgg.o \ $(OBJS)\monolib_choicbkg.o \ $(OBJS)\monolib_dcpsg.o \ + $(OBJS)\monolib_dbgrptg.o \ $(OBJS)\monolib_dirctrlg.o \ $(OBJS)\monolib_dragimgg.o \ $(OBJS)\monolib_listbkg.o \ @@ -1940,6 +1947,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choicdgg.o \ $(OBJS)\monolib_choicbkg.o \ $(OBJS)\monolib_dcpsg.o \ + $(OBJS)\monolib_dbgrptg.o \ $(OBJS)\monolib_dirctrlg.o \ $(OBJS)\monolib_dragimgg.o \ $(OBJS)\monolib_listbkg.o \ @@ -2206,6 +2214,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choicdgg.o \ $(OBJS)\coredll_choicbkg.o \ $(OBJS)\coredll_dcpsg.o \ + $(OBJS)\coredll_dbgrptg.o \ $(OBJS)\coredll_dirctrlg.o \ $(OBJS)\coredll_dragimgg.o \ $(OBJS)\coredll_listbkg.o \ @@ -2404,6 +2413,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choicdgg.o \ $(OBJS)\coredll_choicbkg.o \ $(OBJS)\coredll_dcpsg.o \ + $(OBJS)\coredll_dbgrptg.o \ $(OBJS)\coredll_dirctrlg.o \ $(OBJS)\coredll_dragimgg.o \ $(OBJS)\coredll_listbkg.o \ @@ -2609,6 +2619,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choicdgg.o \ $(OBJS)\corelib_choicbkg.o \ $(OBJS)\corelib_dcpsg.o \ + $(OBJS)\corelib_dbgrptg.o \ $(OBJS)\corelib_dirctrlg.o \ $(OBJS)\corelib_dragimgg.o \ $(OBJS)\corelib_listbkg.o \ @@ -2807,6 +2818,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choicdgg.o \ $(OBJS)\corelib_choicbkg.o \ $(OBJS)\corelib_dcpsg.o \ + $(OBJS)\corelib_dbgrptg.o \ $(OBJS)\corelib_dirctrlg.o \ $(OBJS)\corelib_dragimgg.o \ $(OBJS)\corelib_listbkg.o \ @@ -3880,6 +3892,9 @@ $(OBJS)\monodll_datetime.o: ../../src/common/datetime.cpp $(OBJS)\monodll_datstrm.o: ../../src/common/datstrm.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $< +$(OBJS)\monodll_debugrpt.o: ../../src/common/debugrpt.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $< + $(OBJS)\monodll_dircmn.o: ../../src/common/dircmn.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $< @@ -5462,6 +5477,11 @@ $(OBJS)\monodll_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_dbgrptg.o: ../../src/generic/dbgrptg.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_dirctrlg.o: ../../src/generic/dirctrlg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $< @@ -5651,6 +5671,9 @@ $(OBJS)\monolib_datetime.o: ../../src/common/datetime.cpp $(OBJS)\monolib_datstrm.o: ../../src/common/datstrm.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $< +$(OBJS)\monolib_debugrpt.o: ../../src/common/debugrpt.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $< + $(OBJS)\monolib_dircmn.o: ../../src/common/dircmn.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $< @@ -7233,6 +7256,11 @@ $(OBJS)\monolib_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_dbgrptg.o: ../../src/generic/dbgrptg.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_dirctrlg.o: ../../src/generic/dirctrlg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $< @@ -7425,6 +7453,9 @@ $(OBJS)\basedll_datetime.o: ../../src/common/datetime.cpp $(OBJS)\basedll_datstrm.o: ../../src/common/datstrm.cpp $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $< +$(OBJS)\basedll_debugrpt.o: ../../src/common/debugrpt.cpp + $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $< + $(OBJS)\basedll_dircmn.o: ../../src/common/dircmn.cpp $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $< @@ -7659,6 +7690,9 @@ $(OBJS)\baselib_datetime.o: ../../src/common/datetime.cpp $(OBJS)\baselib_datstrm.o: ../../src/common/datstrm.cpp $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $< +$(OBJS)\baselib_debugrpt.o: ../../src/common/debugrpt.cpp + $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $< + $(OBJS)\baselib_dircmn.o: ../../src/common/dircmn.cpp $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $< @@ -9097,6 +9131,11 @@ $(OBJS)\coredll_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_dbgrptg.o: ../../src/generic/dbgrptg.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\coredll_dirctrlg.o: ../../src/generic/dirctrlg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $< @@ -10331,6 +10370,11 @@ $(OBJS)\corelib_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_dbgrptg.o: ../../src/generic/dbgrptg.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\corelib_dirctrlg.o: ../../src/generic/dirctrlg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $< @@ -11023,3 +11067,4 @@ $(OBJS)\gllib_glcanvas.o: ../../src/msw/glcanvas.cpp .PHONY: all clean setup_h samples build_cfg_file + diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 53ba454a73..6ee1d71668 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -206,6 +206,7 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_config.obj \ $(OBJS)\monodll_datetime.obj \ $(OBJS)\monodll_datstrm.obj \ + $(OBJS)\monodll_debugrpt.obj \ $(OBJS)\monodll_dircmn.obj \ $(OBJS)\monodll_dynarray.obj \ $(OBJS)\monodll_dynlib.obj \ @@ -317,6 +318,7 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_config.obj \ $(OBJS)\monolib_datetime.obj \ $(OBJS)\monolib_datstrm.obj \ + $(OBJS)\monolib_debugrpt.obj \ $(OBJS)\monolib_dircmn.obj \ $(OBJS)\monolib_dynarray.obj \ $(OBJS)\monolib_dynlib.obj \ @@ -430,6 +432,7 @@ BASEDLL_OBJECTS = \ $(OBJS)\basedll_config.obj \ $(OBJS)\basedll_datetime.obj \ $(OBJS)\basedll_datstrm.obj \ + $(OBJS)\basedll_debugrpt.obj \ $(OBJS)\basedll_dircmn.obj \ $(OBJS)\basedll_dynarray.obj \ $(OBJS)\basedll_dynlib.obj \ @@ -526,6 +529,7 @@ BASELIB_OBJECTS = \ $(OBJS)\baselib_config.obj \ $(OBJS)\baselib_datetime.obj \ $(OBJS)\baselib_datstrm.obj \ + $(OBJS)\baselib_debugrpt.obj \ $(OBJS)\baselib_dircmn.obj \ $(OBJS)\baselib_dynarray.obj \ $(OBJS)\baselib_dynlib.obj \ @@ -1499,6 +1503,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ $(OBJS)\monodll_dcpsg.obj \ + $(OBJS)\monodll_dbgrptg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ $(OBJS)\monodll_listbkg.obj \ @@ -1695,6 +1700,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ $(OBJS)\monodll_dcpsg.obj \ + $(OBJS)\monodll_dbgrptg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ $(OBJS)\monodll_listbkg.obj \ @@ -2029,6 +2035,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ $(OBJS)\monolib_dcpsg.obj \ + $(OBJS)\monolib_dbgrptg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ $(OBJS)\monolib_listbkg.obj \ @@ -2225,6 +2232,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ $(OBJS)\monolib_dcpsg.obj \ + $(OBJS)\monolib_dbgrptg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ $(OBJS)\monolib_listbkg.obj \ @@ -2624,6 +2632,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ $(OBJS)\coredll_dcpsg.obj \ + $(OBJS)\coredll_dbgrptg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ $(OBJS)\coredll_listbkg.obj \ @@ -2820,6 +2829,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ $(OBJS)\coredll_dcpsg.obj \ + $(OBJS)\coredll_dbgrptg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ $(OBJS)\coredll_listbkg.obj \ @@ -3043,6 +3053,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ $(OBJS)\corelib_dcpsg.obj \ + $(OBJS)\corelib_dbgrptg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ $(OBJS)\corelib_listbkg.obj \ @@ -3239,6 +3250,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ $(OBJS)\corelib_dcpsg.obj \ + $(OBJS)\corelib_dbgrptg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ $(OBJS)\corelib_listbkg.obj \ @@ -3976,7 +3988,7 @@ __RTTIFLAG = /GR __EXCEPTIONSFLAG = !endif !if "$(USE_EXCEPTIONS)" == "1" -__EXCEPTIONSFLAG = /GX +__EXCEPTIONSFLAG = /EHsc !endif !if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0" __NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__ @@ -4735,6 +4747,9 @@ $(OBJS)\monodll_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\monodll_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +$(OBJS)\monodll_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** + $(OBJS)\monodll_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -6217,6 +6232,11 @@ $(OBJS)\monodll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -6406,6 +6426,9 @@ $(OBJS)\monolib_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\monolib_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +$(OBJS)\monolib_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** + $(OBJS)\monolib_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -7888,6 +7911,11 @@ $(OBJS)\monolib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -8080,6 +8108,9 @@ $(OBJS)\basedll_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\basedll_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) $** +$(OBJS)\basedll_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) $** + $(OBJS)\basedll_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) $** @@ -8314,6 +8345,9 @@ $(OBJS)\baselib_datetime.obj: ..\..\src\common\datetime.cpp $(OBJS)\baselib_datstrm.obj: ..\..\src\common\datstrm.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) $** +$(OBJS)\baselib_debugrpt.obj: ..\..\src\common\debugrpt.cpp + $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) $** + $(OBJS)\baselib_dircmn.obj: ..\..\src\common\dircmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) $** @@ -9652,6 +9686,11 @@ $(OBJS)\coredll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** @@ -10786,6 +10825,11 @@ $(OBJS)\corelib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_dbgrptg.obj: ..\..\src\generic\dbgrptg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_dirctrlg.obj: ..\..\src\generic\dirctrlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index 7117312fd7..a944029159 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -348,6 +348,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_choicdgg.obj & $(OBJS)\monodll_choicbkg.obj & $(OBJS)\monodll_dcpsg.obj & + $(OBJS)\monodll_dbgrptg.obj & $(OBJS)\monodll_dirctrlg.obj & $(OBJS)\monodll_dragimgg.obj & $(OBJS)\monodll_listbkg.obj & @@ -546,6 +547,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_choicdgg.obj & $(OBJS)\monodll_choicbkg.obj & $(OBJS)\monodll_dcpsg.obj & + $(OBJS)\monodll_dbgrptg.obj & $(OBJS)\monodll_dirctrlg.obj & $(OBJS)\monodll_dragimgg.obj & $(OBJS)\monodll_listbkg.obj & @@ -864,6 +866,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_choicdgg.obj & $(OBJS)\monolib_choicbkg.obj & $(OBJS)\monolib_dcpsg.obj & + $(OBJS)\monolib_dbgrptg.obj & $(OBJS)\monolib_dirctrlg.obj & $(OBJS)\monolib_dragimgg.obj & $(OBJS)\monolib_listbkg.obj & @@ -1062,6 +1065,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_choicdgg.obj & $(OBJS)\monolib_choicbkg.obj & $(OBJS)\monolib_dcpsg.obj & + $(OBJS)\monolib_dbgrptg.obj & $(OBJS)\monolib_dirctrlg.obj & $(OBJS)\monolib_dragimgg.obj & $(OBJS)\monolib_listbkg.obj & @@ -1335,6 +1339,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_choicdgg.obj & $(OBJS)\coredll_choicbkg.obj & $(OBJS)\coredll_dcpsg.obj & + $(OBJS)\coredll_dbgrptg.obj & $(OBJS)\coredll_dirctrlg.obj & $(OBJS)\coredll_dragimgg.obj & $(OBJS)\coredll_listbkg.obj & @@ -1533,6 +1538,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_choicdgg.obj & $(OBJS)\coredll_choicbkg.obj & $(OBJS)\coredll_dcpsg.obj & + $(OBJS)\coredll_dbgrptg.obj & $(OBJS)\coredll_dirctrlg.obj & $(OBJS)\coredll_dragimgg.obj & $(OBJS)\coredll_listbkg.obj & @@ -1740,6 +1746,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_choicdgg.obj & $(OBJS)\corelib_choicbkg.obj & $(OBJS)\corelib_dcpsg.obj & + $(OBJS)\corelib_dbgrptg.obj & $(OBJS)\corelib_dirctrlg.obj & $(OBJS)\corelib_dragimgg.obj & $(OBJS)\corelib_listbkg.obj & @@ -1938,6 +1945,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_choicdgg.obj & $(OBJS)\corelib_choicbkg.obj & $(OBJS)\corelib_dcpsg.obj & + $(OBJS)\corelib_dbgrptg.obj & $(OBJS)\corelib_dirctrlg.obj & $(OBJS)\corelib_dragimgg.obj & $(OBJS)\corelib_listbkg.obj & @@ -2481,6 +2489,7 @@ MONODLL_OBJECTS = & $(OBJS)\monodll_config.obj & $(OBJS)\monodll_datetime.obj & $(OBJS)\monodll_datstrm.obj & + $(OBJS)\monodll_debugrpt.obj & $(OBJS)\monodll_dircmn.obj & $(OBJS)\monodll_dynarray.obj & $(OBJS)\monodll_dynlib.obj & @@ -2588,6 +2597,7 @@ MONOLIB_OBJECTS = & $(OBJS)\monolib_config.obj & $(OBJS)\monolib_datetime.obj & $(OBJS)\monolib_datstrm.obj & + $(OBJS)\monolib_debugrpt.obj & $(OBJS)\monolib_dircmn.obj & $(OBJS)\monolib_dynarray.obj & $(OBJS)\monolib_dynlib.obj & @@ -2695,6 +2705,7 @@ BASEDLL_OBJECTS = & $(OBJS)\basedll_config.obj & $(OBJS)\basedll_datetime.obj & $(OBJS)\basedll_datstrm.obj & + $(OBJS)\basedll_debugrpt.obj & $(OBJS)\basedll_dircmn.obj & $(OBJS)\basedll_dynarray.obj & $(OBJS)\basedll_dynlib.obj & @@ -2787,6 +2798,7 @@ BASELIB_OBJECTS = & $(OBJS)\baselib_config.obj & $(OBJS)\baselib_datetime.obj & $(OBJS)\baselib_datstrm.obj & + $(OBJS)\baselib_debugrpt.obj & $(OBJS)\baselib_dircmn.obj & $(OBJS)\baselib_dynarray.obj & $(OBJS)\baselib_dynlib.obj & @@ -4101,6 +4113,9 @@ $(OBJS)\monodll_datetime.obj : .AUTODEPEND ..\..\src\common\datetime.cpp $(OBJS)\monodll_datstrm.obj : .AUTODEPEND ..\..\src\common\datstrm.cpp $(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +$(OBJS)\monodll_debugrpt.obj : .AUTODEPEND ..\..\src\common\debugrpt.cpp + $(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< + $(OBJS)\monodll_dircmn.obj : .AUTODEPEND ..\..\src\common\dircmn.cpp $(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -5683,6 +5698,11 @@ $(OBJS)\monodll_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monodll_dbgrptg.obj : .AUTODEPEND ..\..\src\generic\dbgrptg.cpp + $(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monodll_dirctrlg.obj : .AUTODEPEND ..\..\src\generic\dirctrlg.cpp $(CXX) -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -5872,6 +5892,9 @@ $(OBJS)\monolib_datetime.obj : .AUTODEPEND ..\..\src\common\datetime.cpp $(OBJS)\monolib_datstrm.obj : .AUTODEPEND ..\..\src\common\datstrm.cpp $(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +$(OBJS)\monolib_debugrpt.obj : .AUTODEPEND ..\..\src\common\debugrpt.cpp + $(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< + $(OBJS)\monolib_dircmn.obj : .AUTODEPEND ..\..\src\common\dircmn.cpp $(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -7454,6 +7477,11 @@ $(OBJS)\monolib_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monolib_dbgrptg.obj : .AUTODEPEND ..\..\src\generic\dbgrptg.cpp + $(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monolib_dirctrlg.obj : .AUTODEPEND ..\..\src\generic\dirctrlg.cpp $(CXX) -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -7646,6 +7674,9 @@ $(OBJS)\basedll_datetime.obj : .AUTODEPEND ..\..\src\common\datetime.cpp $(OBJS)\basedll_datstrm.obj : .AUTODEPEND ..\..\src\common\datstrm.cpp $(CXX) -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $< +$(OBJS)\basedll_debugrpt.obj : .AUTODEPEND ..\..\src\common\debugrpt.cpp + $(CXX) -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $< + $(OBJS)\basedll_dircmn.obj : .AUTODEPEND ..\..\src\common\dircmn.cpp $(CXX) -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $< @@ -7880,6 +7911,9 @@ $(OBJS)\baselib_datetime.obj : .AUTODEPEND ..\..\src\common\datetime.cpp $(OBJS)\baselib_datstrm.obj : .AUTODEPEND ..\..\src\common\datstrm.cpp $(CXX) -zq -fo=$^@ $(BASELIB_CXXFLAGS) $< +$(OBJS)\baselib_debugrpt.obj : .AUTODEPEND ..\..\src\common\debugrpt.cpp + $(CXX) -zq -fo=$^@ $(BASELIB_CXXFLAGS) $< + $(OBJS)\baselib_dircmn.obj : .AUTODEPEND ..\..\src\common\dircmn.cpp $(CXX) -zq -fo=$^@ $(BASELIB_CXXFLAGS) $< @@ -9318,6 +9352,11 @@ $(OBJS)\coredll_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\coredll_dbgrptg.obj : .AUTODEPEND ..\..\src\generic\dbgrptg.cpp + $(CXX) -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\coredll_dirctrlg.obj : .AUTODEPEND ..\..\src\generic\dirctrlg.cpp $(CXX) -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -10552,6 +10591,11 @@ $(OBJS)\corelib_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\corelib_dbgrptg.obj : .AUTODEPEND ..\..\src\generic\dbgrptg.cpp + $(CXX) -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\corelib_dirctrlg.obj : .AUTODEPEND ..\..\src\generic\dirctrlg.cpp $(CXX) -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< diff --git a/build/msw/wx_base.dsp b/build/msw/wx_base.dsp index a8818d1dde..046d6560e7 100644 --- a/build/msw/wx_base.dsp +++ b/build/msw/wx_base.dsp @@ -480,6 +480,10 @@ SOURCE=..\..\src\common\datstrm.cpp # End Source File # Begin Source File +SOURCE=..\..\src\common\debugrpt.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\common\dircmn.cpp # End Source File # Begin Source File @@ -1141,6 +1145,10 @@ SOURCE=..\..\include\wx\debug.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\debugrpt.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\defs.h # End Source File # Begin Source File diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 7b29699579..2a9ebe63a6 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -4081,6 +4081,10 @@ SOURCE=..\..\src\generic\colrdlgg.cpp # End Source File # Begin Source File +SOURCE=..\..\src\generic\dbgrptg.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\generic\dcpsg.cpp # End Source File # Begin Source File diff --git a/docs/changes.txt b/docs/changes.txt index 4302f8ca01..902aadfe4d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -9,7 +9,7 @@ All: - wxURI::GetUser() only returns the user name now, use GetUserInfo() to get user and password as in 2.5.4; wxURI::GetPassword() added -- added wx_dynamic_cast() macro +- added wxDebugReport class All (GUI): diff --git a/include/wx/debugrpt.h b/include/wx/debugrpt.h new file mode 100644 index 0000000000..b193fc550f --- /dev/null +++ b/include/wx/debugrpt.h @@ -0,0 +1,221 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/debugrpt.h +// Purpose: declaration of wxDebugReport class +// Author: Vadim Zeitlin +// Created: 2005-01-17 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DEBUGRPT_H_ +#define _WX_DEBUGRPT_H_ + +#include "wx/defs.h" + +#if wxUSE_DEBUGREPORT + +class WXDLLIMPEXP_XML wxXmlNode; + +// ---------------------------------------------------------------------------- +// wxDebugReport: generate a debug report, processing is done in derived class +// ---------------------------------------------------------------------------- + +class wxDebugReport +{ +public: + // this is used for the functions which may report either the current state + // or the state during the last (fatal) exception + enum Context { Context_Curent, Context_Exception }; + + + // ctor creates a temporary directory where we create the files which will + // be included in the report, use IsOk() to check for errors + wxDebugReport(); + + // dtor normally destroys the temporary directory created in the ctor (with + // all the files it contains), call Reset() to prevent this from happening + virtual ~wxDebugReport(); + + // return the name of the directory used for this report + const wxString& GetDirectory() const { return m_dir; } + + // return true if the object was successfully initialized + bool IsOk() const { return !GetDirectory().empty(); } + + // reset the directory name we use, the object can't be used any more after + // this as it becomes invalid/uninitialized + void Reset() { m_dir.clear(); } + + + // add another file to the report: the file must already exist, its name is + // relative to GetDirectory() + // + // description is shown to the user in the report summary + virtual void AddFile(const wxString& name, const wxString& description); + + // add an XML file containing the current or exception context and the + // stack trace + bool AddCurrentContext() { return AddContext(Context_Curent); } + bool AddExceptionContext() { return AddContext(Context_Exception); } + virtual bool AddContext(Context ctx); + +#if wxUSE_CRASHREPORT + // add a file with crash report + bool AddCurrentDump() { return AddDump(Context_Curent); } + bool AddExceptionDump() { return AddDump(Context_Exception); } + virtual bool AddDump(Context ctx); +#endif // wxUSE_CRASHREPORT + + // add all available information to the report + void AddAll(Context context = Context_Exception); + + + // process this report: the base class simply notifies the user that the + // report has been generated, this is usually not enough -- instead you + // should override this method to do something more useful to you + bool Process(); + + // get the name used as base name for various files, by default + // wxApp::GetName() + virtual wxString GetReportName() const; + + // get the files in this report + size_t GetFilesCount() const { return m_files.GetCount(); } + bool GetFile(size_t n, wxString *name, wxString *desc) const; + + // remove the file from report: this is used by wxDebugReportPreview to + // allow the user to remove files potentially containing private + // information from the report + void RemoveFile(const wxString& name); + +protected: + // used by AddContext() + virtual bool DoAddSystemInfo(wxXmlNode *nodeSystemInfo); + virtual bool DoAddLoadedModules(wxXmlNode *nodeModules); + virtual bool DoAddExceptionInfo(wxXmlNode *nodeContext); + virtual void DoAddCustomContext(wxXmlNode * WXUNUSED(nodeRoot)) { } + + // used by Process() + virtual bool DoProcess(); + +private: + // name of the report directory + wxString m_dir; + + // the arrays of files in this report and their descriptions + wxArrayString m_files, + m_descriptions; +}; + +#if wxUSE_ZIPSTREAM + +// ---------------------------------------------------------------------------- +// wxDebugReportCompress: compress all files of this debug report in a .ZIP +// ---------------------------------------------------------------------------- + +class wxDebugReportCompress : public wxDebugReport +{ +public: + wxDebugReportCompress() { } + + // returns the full path of the compressed file (empty if creation failed) + const wxString& GetCompressedFileName() const { return m_zipfile; } + +protected: + virtual bool DoProcess(); + +private: + // full path to the ZIP file we created + wxString m_zipfile; +}; + +// ---------------------------------------------------------------------------- +// wxDebugReportUploader: uploads compressed file using HTTP POST request +// ---------------------------------------------------------------------------- + +class wxDebugReportUpload : public wxDebugReportCompress +{ +public: + // this class will upload the compressed file created by its base class to + // an HTML multipart/form-data form at the specified address + // + // the URL is the base address, input is the name of the "type=file" + // control on the form used for the file name and action is the value of + // the form action field + wxDebugReportUpload(const wxString& url, + const wxString& input, + const wxString& action, + const wxString& curl = _T("curl")); + +protected: + virtual bool DoProcess(); + + // this function may be overridden in a derived class to show the output + // from curl: this may be an HTML page or anything else that the server + // returned + // + // return value becomes the return value of Process() + virtual bool OnServerReply(const wxArrayString& WXUNUSED(reply)) + { + return true; + } + +private: + // the full URL to use with HTTP POST request + wxString m_uploadURL; + + // the name of the input field containing the file name in the form at + // above URL + wxString m_inputField; + + // the curl command (by default it is just "curl" but could be full path to + // curl or a wrapper script with curl-compatible syntax) + wxString m_curlCmd; +}; + +#endif // wxUSE_ZIPSTREAM + + +// ---------------------------------------------------------------------------- +// wxDebugReportPreview: presents the debug report to the user and allows him +// to veto report entirely or remove some parts of it +// ---------------------------------------------------------------------------- + +class wxDebugReportPreview +{ +public: + // ctor is trivial + wxDebugReportPreview() { } + + // present the report to the user and allow him to modify it by removing + // some or all of the files and, potentially, adding some notes + // + // return true if the report should be processed or false if the user chose + // to cancel report generation or removed all files from it + virtual bool Show(wxDebugReport& dbgrpt) const = 0; + + // dtor is trivial as well but should be virtual for a base class + virtual ~wxDebugReportPreview() { } +}; + +#if wxUSE_GUI + +// ---------------------------------------------------------------------------- +// wxDebugReportPreviewStd: standard debug report preview window +// ---------------------------------------------------------------------------- + +class wxDebugReportPreviewStd : public wxDebugReportPreview +{ +public: + wxDebugReportPreviewStd() { } + + virtual bool Show(wxDebugReport& dbgrpt) const; +}; + +#endif // wxUSE_GUI + +#endif // wxUSE_DEBUGREPORT + +#endif // _WX_DEBUGRPT_H_ + diff --git a/samples/debugrpt/debugrpt.bkl b/samples/debugrpt/debugrpt.bkl new file mode 100644 index 0000000000..5382033415 --- /dev/null +++ b/samples/debugrpt/debugrpt.bkl @@ -0,0 +1,13 @@ + + + + + + + + debugrpt.cpp + core + base + xml + + diff --git a/samples/debugrpt/debugrpt.cpp b/samples/debugrpt/debugrpt.cpp new file mode 100644 index 0000000000..1cec0dfa13 --- /dev/null +++ b/samples/debugrpt/debugrpt.cpp @@ -0,0 +1,187 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: debugrpt.cpp +// Purpose: minimal sample showing wxDebugReport and related classes +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-20 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Vadim Zeitlin +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/app.h" +#include "wx/datetime.h" +#include "wx/ffile.h" +#include "wx/filename.h" +#include "wx/dynlib.h" +#include "wx/debugrpt.h" + +#include "wx/msgdlg.h" + +#if !wxUSE_DEBUGREPORT + #error "This sample can't be built without wxUSE_DEBUGREPORT" +#endif // wxUSE_DEBUGREPORT + +// ---------------------------------------------------------------------------- +// custom debug reporting class +// ---------------------------------------------------------------------------- + +// this is your custom debug reporter, you will probably want to parse the XML +// document in OnServerReply() instead of just dumping it as I do +class MyDebugReport : public wxDebugReportUpload +{ +public: + MyDebugReport() : wxDebugReportUpload + ( + _T("http://iml2.hitchcock.org/intranet/crashes/wxtest"), + _T("report:file"), + _T("action") + ) + { + } + +protected: + virtual bool OnServerReply(const wxArrayString& reply) + { + if ( reply.IsEmpty() ) + { + wxLogError(_T("Didn't receive the expected server reply.")); + return false; + } + + wxString s(_T("Server replied:\n")); + + const size_t count = reply.GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + s << _T('\t') << reply[n] << _T('\n'); + } + + wxLogMessage(_T("%s"), s.c_str()); + + return true; + } +}; + +// ---------------------------------------------------------------------------- +// helper functions +// ---------------------------------------------------------------------------- + +// just some functions to get a slightly deeper stack trace +static void bar(const wxChar *p) +{ + char *pc = 0; + *pc = *p; + + printf("bar: %s\n", p); +} + +void baz(const wxString& s) +{ + printf("baz: %s\n", s.c_str()); +} + +void foo(int n) +{ + if ( n % 2 ) + baz(wxT("odd")); + else + bar(wxT("even")); +} + +// ---------------------------------------------------------------------------- +// application class +// ---------------------------------------------------------------------------- + +// this is a usual application class modified to work with debug reporter +// +// basically just 2 things are necessary: call wxHandleFatalExceptions() as +// early as possible and override OnFatalException() to create the report there +class MyApp : public wxApp +{ +public: + virtual bool OnInit() + { + wxHandleFatalExceptions(); + + if ( !wxApp::OnInit() ) + return false; + + return true; + } + + virtual int OnRun() + { + // a real program would be presumably be a bit harder to crash than + // just pressing "yes" in a dialog... but this is just an example + switch ( wxMessageBox + ( + _T("Generate report for crash (or just current context)?"), + _T("wxDebugReport Test"), + wxYES_NO | wxCANCEL + ) ) + { + case wxYES: + // this call is going to crash + foo(32); + foo(17); + break; + + case wxNO: + // example of manually generated report, this could be also + // used in wxApp::OnAssert() + GenerateReport(wxDebugReport::Context_Curent); + break; + + case wxCANCEL: + break; + } + + return 0; + } + + virtual void OnFatalException() + { + GenerateReport(wxDebugReport::Context_Exception); + } + + void GenerateReport(wxDebugReport::Context ctx) + { + MyDebugReport report; + + // add all standard files: currently this means just a minidump and an + // XML file with system info and stack trace + report.AddAll(ctx); + + // you can also call report.AddFile(...) with your own log files, files + // created using wxRegKey::Export() and so on, here we just add a test + // file containing the date of the crash + wxFileName fn(report.GetDirectory(), _T("timestamp.my")); + wxFFile file(fn.GetFullPath(), _T("w")); + if ( file.IsOpened() ) + { + wxDateTime dt = wxDateTime::Now(); + file.Write(dt.FormatISODate() + _T(' ') + dt.FormatISOTime()); + file.Close(); + } + + report.AddFile(fn.GetFullName(), _T("timestamp of this report")); + + // calling Show() is not mandatory, but is more polite + if ( wxDebugReportPreviewStd().Show(report) ) + { + if ( report.Process() ) + { + // report successfully uploaded + } + } + //else: user cancelled the report + } +}; + +IMPLEMENT_APP(MyApp) + diff --git a/src/common/debugrpt.cpp b/src/common/debugrpt.cpp new file mode 100644 index 0000000000..10597eb4eb --- /dev/null +++ b/src/common/debugrpt.cpp @@ -0,0 +1,639 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/debugrpt.cpp +// Purpose: wxDebugReport and related classes implementation +// Author: Vadim Zeitlin +// Modified by: +// Created: 2005-01-17 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Vadim Zeitlin +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/log.h" + #include "wx/intl.h" +#endif // WX_PRECOMP + +#if wxUSE_DEBUGREPORT + +#include "wx/debugrpt.h" + +#include "wx/filename.h" +#include "wx/dir.h" +#include "wx/dynlib.h" + +#include "wx/xml/xml.h" + +#if wxUSE_STACKWALKER + #include "wx/stackwalk.h" +#endif + +#if wxUSE_CRASHREPORT + #include "wx/msw/crashrpt.h" +#endif + +#if wxUSE_ZIPSTREAM + #include "wx/wfstream.h" + #include "wx/zipstrm.h" +#endif // wxUSE_ZIPSTREAM + +#if wxUSE_STACKWALKER + +// ---------------------------------------------------------------------------- +// XmlStackWalker: stack walker specialization which dumps stack in XML +// ---------------------------------------------------------------------------- + +class XmlStackWalker : public wxStackWalker +{ +public: + XmlStackWalker(wxXmlNode *nodeStack) + { + m_isOk = false; + m_nodeStack = nodeStack; + } + + bool IsOk() const { return m_isOk; } + +protected: + virtual void OnStackFrame(const wxStackFrame& frame); + + wxXmlNode *m_nodeStack; + bool m_isOk; +}; + +#endif // wxUSE_STACKWALKER + +// ---------------------------------------------------------------------------- +// local functions +// ---------------------------------------------------------------------------- + +static inline void +HexProperty(wxXmlNode *node, const wxChar *name, unsigned long value) +{ + node->AddProperty(name, wxString::Format(_T("%08x"), value)); +} + +static inline void +NumProperty(wxXmlNode *node, const wxChar *name, unsigned long value) +{ + node->AddProperty(name, wxString::Format(_T("%lu"), value)); +} + +static inline void +TextElement(wxXmlNode *node, const wxChar *name, const wxString& value) +{ + wxXmlNode *nodeChild = new wxXmlNode(wxXML_ELEMENT_NODE, name); + node->AddChild(nodeChild); + nodeChild->AddChild(new wxXmlNode(wxXML_TEXT_NODE, _T(""), value)); +} + +static inline void +HexElement(wxXmlNode *node, const wxChar *name, unsigned long value) +{ + TextElement(node, name, wxString::Format(_T("%08x"), value)); +} + +#if wxUSE_STACKWALKER + +// ============================================================================ +// XmlStackWalker implementation +// ============================================================================ + +void XmlStackWalker::OnStackFrame(const wxStackFrame& frame) +{ + m_isOk = true; + + wxXmlNode *nodeFrame = new wxXmlNode(wxXML_ELEMENT_NODE, _T("frame")); + m_nodeStack->AddChild(nodeFrame); + + NumProperty(nodeFrame, _T("level"), frame.GetLevel()); + wxString func = frame.GetName(); + if ( !func.empty() ) + { + nodeFrame->AddProperty(_T("function"), func); + HexProperty(nodeFrame, _T("offset"), frame.GetOffset()); + } + + if ( frame.HasSourceLocation() ) + { + nodeFrame->AddProperty(_T("file"), frame.GetFileName()); + NumProperty(nodeFrame, _T("line"), frame.GetLine()); + } + + const size_t nParams = frame.GetParamCount(); + if ( nParams ) + { + wxXmlNode *nodeParams = new wxXmlNode(wxXML_ELEMENT_NODE, _T("parameters")); + nodeFrame->AddChild(nodeParams); + + for ( size_t n = 0; n < nParams; n++ ) + { + wxXmlNode * + nodeParam = new wxXmlNode(wxXML_ELEMENT_NODE, _T("parameter")); + nodeParams->AddChild(nodeParam); + + NumProperty(nodeParam, _T("number"), n); + + wxString type, name, value; + if ( !frame.GetParam(n, &type, &name, &value) ) + continue; + + if ( !type.empty() ) + TextElement(nodeParam, _T("type"), type); + + if ( !name.empty() ) + TextElement(nodeParam, _T("name"), name); + + if ( !value.empty() ) + TextElement(nodeParam, _T("value"), value); + } + } +} + +#endif // wxUSE_STACKWALKER + +// ============================================================================ +// wxDebugReport implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// initialization and cleanup +// ---------------------------------------------------------------------------- + +wxDebugReport::wxDebugReport() +{ + // get a temporary directory name + wxString appname(wxTheApp ? wxTheApp->GetAppName() : _T("wx")); + + // we can't use CreateTempFileName() because it creates a file, not a + // directory, so do our best to create a unique name ourselves + // + // of course, this doesn't protect us against malicious users... + wxFileName fn; + fn.AssignTempFileName(appname); + m_dir.Printf(_T("%s%c%s_dbgrpt-%lu-%s"), + fn.GetPath(), wxFILE_SEP_PATH, appname.c_str(), + wxGetProcessId(), + wxDateTime::Now().Format(_T("%Y%m%dT%H%M%S")).c_str()); + + // as we are going to save the process state there use restrictive + // permissions + if ( !wxMkdir(m_dir, 0700) ) + { + wxLogSysError(_("Failed to create directory \"%s\""), m_dir.c_str()); + wxLogError(_("Debug report couldn't be created.")); + + Reset(); + } +} + +wxDebugReport::~wxDebugReport() +{ + if ( !m_dir.empty() ) + { + // remove all files in this directory + wxDir dir(m_dir); + wxString file; + for ( bool cont = dir.GetFirst(&file); cont; cont = dir.GetNext(&file) ) + { + if ( wxRemove(wxFileName(m_dir, file).GetFullPath()) != 0 ) + { + wxLogSysError(_("Failed to remove debug report file \"%s\""), + file.c_str()); + m_dir.clear(); + break; + } + } + } + + if ( !m_dir.empty() ) + { + if ( wxRmDir(m_dir) != 0 ) + { + wxLogSysError(_("Failed to clean up debug report directory \"%s\""), + m_dir.c_str()); + } + } +} + +// ---------------------------------------------------------------------------- +// various helpers +// ---------------------------------------------------------------------------- + +wxString wxDebugReport::GetReportName() const +{ + return wxString(wxTheApp ? wxTheApp->GetAppName() : _T("wx")); +} + +void wxDebugReport::AddFile(const wxString& name, const wxString& description) +{ + m_files.Add(name); + m_descriptions.Add(description); +} + +void wxDebugReport::RemoveFile(const wxString& name) +{ + const int n = m_files.Index(name); + wxCHECK_RET( n != wxNOT_FOUND, _T("No such file in wxDebugReport") ); + + m_files.RemoveAt(n); + m_descriptions.RemoveAt(n); + + wxRemove(wxFileName(GetDirectory(), name).GetFullPath()); +} + +bool wxDebugReport::GetFile(size_t n, wxString *name, wxString *desc) const +{ + if ( n >= m_files.GetCount() ) + return false; + + if ( name ) + *name = m_files[n]; + if ( desc ) + *desc = m_descriptions[n]; + + return true; +} + +void wxDebugReport::AddAll(Context context) +{ +#if wxUSE_STACKWALKER + AddContext(context); +#endif // wxUSE_STACKWALKER + +#if wxUSE_CRASHREPORT + AddDump(context); +#endif // wxUSE_CRASHREPORT +} + +// ---------------------------------------------------------------------------- +// adding basic text information about current context +// ---------------------------------------------------------------------------- + +#if wxUSE_STACKWALKER + +bool wxDebugReport::DoAddSystemInfo(wxXmlNode *nodeSystemInfo) +{ + nodeSystemInfo->AddProperty(_T("description"), wxGetOsDescription()); + + return true; +} + +bool wxDebugReport::DoAddLoadedModules(wxXmlNode *nodeModules) +{ + wxDynamicLibraryDetailsArray modules(wxDynamicLibrary::ListLoaded()); + const size_t count = modules.GetCount(); + if ( !count ) + return false; + + for ( size_t n = 0; n < count; n++ ) + { + const wxDynamicLibraryDetails& info = modules[n]; + + wxXmlNode *nodeModule = new wxXmlNode(wxXML_ELEMENT_NODE, _T("module")); + nodeModules->AddChild(nodeModule); + + wxString path = info.GetPath(); + if ( path.empty() ) + path = info.GetName(); + if ( !path.empty() ) + nodeModule->AddProperty(_T("path"), path); + + void *addr; + size_t len; + if ( info.GetAddress(&addr, &len) ) + { + HexProperty(nodeModule, _T("address"), (unsigned long)addr); + HexProperty(nodeModule, _T("size"), len); + } + + wxString ver = info.GetVersion(); + if ( !ver.empty() ) + { + nodeModule->AddProperty(_T("version"), ver); + } + } + + return true; +} + +bool wxDebugReport::DoAddExceptionInfo(wxXmlNode *nodeContext) +{ +#if wxUSE_CRASHREPORT + wxCrashContext c; + if ( !c.code ) + return false; + + wxXmlNode *nodeExc = new wxXmlNode(wxXML_ELEMENT_NODE, _T("exception")); + nodeContext->AddChild(nodeExc); + + HexProperty(nodeExc, _T("code"), c.code); + nodeExc->AddProperty(_T("name"), c.GetExceptionString()); + HexProperty(nodeExc, _T("address"), (unsigned long)c.addr); + +#ifdef __INTEL__ + wxXmlNode *nodeRegs = new wxXmlNode(wxXML_ELEMENT_NODE, _T("registers")); + nodeContext->AddChild(nodeRegs); + HexElement(nodeRegs, _T("eax"), c.regs.eax); + HexElement(nodeRegs, _T("ebx"), c.regs.ebx); + HexElement(nodeRegs, _T("ecx"), c.regs.edx); + HexElement(nodeRegs, _T("edx"), c.regs.edx); + HexElement(nodeRegs, _T("esi"), c.regs.esi); + HexElement(nodeRegs, _T("edi"), c.regs.edi); + + HexElement(nodeRegs, _T("ebp"), c.regs.ebp); + HexElement(nodeRegs, _T("esp"), c.regs.esp); + HexElement(nodeRegs, _T("eip"), c.regs.eip); + + HexElement(nodeRegs, _T("cs"), c.regs.cs); + HexElement(nodeRegs, _T("ds"), c.regs.ds); + HexElement(nodeRegs, _T("es"), c.regs.es); + HexElement(nodeRegs, _T("fs"), c.regs.fs); + HexElement(nodeRegs, _T("gs"), c.regs.gs); + HexElement(nodeRegs, _T("ss"), c.regs.ss); + + HexElement(nodeRegs, _T("flags"), c.regs.flags); +#endif // __INTEL__ + + return true; +#else // !wxUSE_CRASHREPORT + wxUnusedVar(nodeContext); + + return false; +#endif // wxUSE_CRASHREPORT/!wxUSE_CRASHREPORT +} + +bool wxDebugReport::AddContext(wxDebugReport::Context ctx) +{ + wxCHECK_MSG( IsOk(), false, _T("use IsOk() first") ); + + // create XML dump of current context + wxXmlDocument xmldoc; + wxXmlNode *nodeRoot = new wxXmlNode(wxXML_ELEMENT_NODE, _T("report")); + xmldoc.SetRoot(nodeRoot); + nodeRoot->AddProperty(_T("version"), _T("1.0")); + nodeRoot->AddProperty(_T("kind"), ctx == Context_Curent ? _T("user") + : _T("exception")); + + // add system information + wxXmlNode *nodeSystemInfo = new wxXmlNode(wxXML_ELEMENT_NODE, _T("system")); + if ( DoAddSystemInfo(nodeSystemInfo) ) + nodeRoot->AddChild(nodeSystemInfo); + else + delete nodeSystemInfo; + + // add information about the loaded modules + wxXmlNode *nodeModules = new wxXmlNode(wxXML_ELEMENT_NODE, _T("modules")); + if ( DoAddLoadedModules(nodeModules) ) + nodeRoot->AddChild(nodeModules); + else + delete nodeModules; + + // add CPU context information: this only makes sense for exceptions as our + // current context is not very interesting otherwise + if ( ctx == Context_Exception ) + { + wxXmlNode *nodeContext = new wxXmlNode(wxXML_ELEMENT_NODE, _T("context")); + if ( DoAddExceptionInfo(nodeContext) ) + nodeRoot->AddChild(nodeContext); + else + delete nodeContext; + } + + // add stack traceback +#if wxUSE_STACKWALKER + wxXmlNode *nodeStack = new wxXmlNode(wxXML_ELEMENT_NODE, _T("stack")); + XmlStackWalker sw(nodeStack); + if ( ctx == Context_Exception ) + { + sw.WalkFromException(); + } + else // Context_Curent + { + sw.Walk(); + } + + if ( sw.IsOk() ) + nodeRoot->AddChild(nodeStack); + else + delete nodeStack; +#endif // wxUSE_STACKWALKER + + // finally let the user add any extra information he needs + DoAddCustomContext(nodeRoot); + + + // save the entire context dump in a file + wxFileName fn(m_dir, GetReportName(), _T("xml")); + + if ( !xmldoc.Save(fn.GetFullPath()) ) + return false; + + AddFile(fn.GetFullName(), _("process context description")); + + return true; +} + +#endif // wxUSE_STACKWALKER + +// ---------------------------------------------------------------------------- +// adding core dump +// ---------------------------------------------------------------------------- + +#if wxUSE_CRASHREPORT + +bool wxDebugReport::AddDump(Context ctx) +{ + wxCHECK_MSG( IsOk(), false, _T("use IsOk() first") ); + + wxFileName fn(m_dir, GetReportName(), _T("dmp")); + wxCrashReport::SetFileName(fn.GetFullPath()); + + if ( !(ctx == Context_Exception ? wxCrashReport::Generate() + : wxCrashReport::GenerateNow()) ) + return false; + + AddFile(fn.GetFullName(), _("dump of the process state (binary)")); + + return true; +} + +#endif // wxUSE_CRASHREPORT + +// ---------------------------------------------------------------------------- +// report processing +// ---------------------------------------------------------------------------- + +bool wxDebugReport::Process() +{ + if ( !GetFilesCount() ) + { + wxLogError(_("Debug report generation has failed.")); + + return false; + } + + if ( !DoProcess() ) + { + wxLogError(_("Processing debug report has failed, leaving the files in \"%s\" directory."), + GetDirectory().c_str()); + + Reset(); + + return false; + } + + return true; +} + +bool wxDebugReport::DoProcess() +{ + wxString msg = _("*** A debug report has been generated\n"); + msg += wxString::Format(_("*** It can be found in \"%s\"\n"), + GetDirectory().c_str()); + msg += _("*** And includes the following files:\n"); + + wxString name, desc; + const size_t count = GetFilesCount(); + for ( size_t n = 0; n < count; n++ ) + { + GetFile(n, &name, &desc); + msg += wxString::Format(_("\t%s: %s\n"), name.c_str(), desc.c_str()); + } + + msg += _("\nPlease send this report to the program maintainer, thank you!\n"); + + wxLogMessage(_T("%s"), msg.c_str()); + + // we have to do this or the report would be deleted, and we don't even + // have any way to ask the user if he wants to keep it from here + Reset(); + + return true; +} + +// ============================================================================ +// wxDebugReport-derived classes +// ============================================================================ + +#if wxUSE_ZIPSTREAM + +// ---------------------------------------------------------------------------- +// wxDebugReportCompress +// ---------------------------------------------------------------------------- + +bool wxDebugReportCompress::DoProcess() +{ + const size_t count = GetFilesCount(); + if ( !count ) + return false; + + // create the streams + wxFileName fn(GetDirectory(), GetReportName(), _T("zip")); + wxFFileOutputStream os(fn.GetFullPath(), _T("wb")); + wxZipOutputStream zos(os, 9); + + // add all files to the ZIP one + wxString name, desc; + for ( size_t n = 0; n < count; n++ ) + { + GetFile(n, &name, &desc); + + wxZipEntry *ze = new wxZipEntry(name); + ze->SetComment(desc); + + if ( !zos.PutNextEntry(ze) ) + return false; + + wxFFileInputStream is(wxFileName(fn.GetPath(), name).GetFullPath()); + if ( !is.IsOk() || !zos.Write(is).IsOk() ) + return false; + } + + if ( !zos.Close() ) + return false; + + m_zipfile = fn.GetFullPath(); + + return true; +} + +// ---------------------------------------------------------------------------- +// wxDebugReportUpload +// ---------------------------------------------------------------------------- + +wxDebugReportUpload::wxDebugReportUpload(const wxString& url, + const wxString& input, + const wxString& action, + const wxString& curl) + : m_uploadURL(url), + m_inputField(input), + m_curlCmd(curl) +{ + if ( m_uploadURL.Last() != _T('/') ) + m_uploadURL += _T('/'); + m_uploadURL += action; +} + +bool wxDebugReportUpload::DoProcess() +{ + if ( !wxDebugReportCompress::DoProcess() ) + return false; + + + wxArrayString output, errors; + int rc = wxExecute(wxString::Format + ( + _T("%s -F %s=@%s %s"), + m_curlCmd.c_str(), + m_inputField.c_str(), + GetCompressedFileName().c_str(), + m_uploadURL.c_str() + ), + output, + errors); + if ( rc == -1 ) + { + wxLogError(_("Failed to execute curl, please install it in PATH.")); + } + else if ( rc != 0 ) + { + const size_t count = errors.GetCount(); + if ( count ) + { + for ( size_t n = 0; n < count; n++ ) + { + wxLogWarning(_T("%s"), errors[n].c_str()); + } + } + + wxLogError(_("Failed to upload the debug report (error code %d)."), rc); + } + else // rc == 0 + { + if ( OnServerReply(output) ) + return true; + } + + return false; +} + +#endif // wxUSE_ZIPSTREAM + +#endif // wxUSE_DEBUGREPORT + diff --git a/src/generic/dbgrptg.cpp b/src/generic/dbgrptg.cpp new file mode 100644 index 0000000000..d265f9eb3e --- /dev/null +++ b/src/generic/dbgrptg.cpp @@ -0,0 +1,488 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/generic/dbgrptg.cpp +// Purpose: implementation of wxDebugReportPreviewStd +// Author: Vadim Zeitlin, Andrej Putrin +// Modified by: +// Created: 2005-01-21 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Vadim Zeitlin +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/sizer.h" + #include "wx/checklst.h" + #include "wx/textctrl.h" +#endif // WX_PRECOMP + +#if wxUSE_DEBUGREPORT + +#include "wx/debugrpt.h" + +#include "wx/intl.h" +#include "wx/filename.h" +#include "wx/ffile.h" +#include "wx/mimetype.h" + +#include "wx/statline.h" + +// ---------------------------------------------------------------------------- +// wxDumpPreviewDlg: simple class for showing ASCII preview of dump files +// ---------------------------------------------------------------------------- + +class wxDumpPreviewDlg : public wxDialog +{ +public: + wxDumpPreviewDlg(wxWindow *parent, + const wxString& title, + const wxString& text); + +private: + // the text we show + wxTextCtrl *m_text; + + DECLARE_NO_COPY_CLASS(wxDumpPreviewDlg) +}; + +wxDumpPreviewDlg::wxDumpPreviewDlg(wxWindow *parent, + const wxString& title, + const wxString& text) + : wxDialog(parent, wxID_ANY, title, + wxDefaultPosition, wxDefaultSize, + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) +{ + // create controls + // --------------- + + // use wxTE_RICH2 style to avoid 64kB limit under MSW and display big files + // faster than with wxTE_RICH + m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, + wxPoint(0, 0), wxDefaultSize, + wxTE_MULTILINE | + wxTE_READONLY | + wxTE_NOHIDESEL | + wxTE_RICH2); + m_text->SetValue(text); + + // use fixed-width font + m_text->SetFont(wxFont(12, wxFONTFAMILY_TELETYPE, + wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); + + wxButton *btnClose = new wxButton(this, wxID_CANCEL, _("Close")); + + + // layout them + // ----------- + + wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL), + *sizerBtns = new wxBoxSizer(wxHORIZONTAL); + + sizerBtns->Add(btnClose, 0, 0, 1); + + sizerTop->Add(m_text, 1, wxEXPAND); + sizerTop->Add(sizerBtns, 0, wxALIGN_RIGHT | wxTOP | wxBOTTOM | wxRIGHT, 1); + + // set the sizer &c + // ---------------- + + // make the text window bigger to show more contents of the file + sizerTop->SetItemMinSize(m_text, 600, 300); + SetSizer(sizerTop); + + Layout(); + Fit(); + + m_text->SetFocus(); +} + +// ---------------------------------------------------------------------------- +// wxDumpOpenExternalDlg: choose a command for opening the given file +// ---------------------------------------------------------------------------- + +class wxDumpOpenExternalDlg : public wxDialog +{ +public: + wxDumpOpenExternalDlg(wxWindow *parent, const wxFileName& filename); + + // return the command chosed by user to open this file + const wxString& GetCommand() const { return m_command; } + + wxString m_command; + +private: + void OnBrowse(wxCommandEvent& event); + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDumpOpenExternalDlg) +}; + +BEGIN_EVENT_TABLE(wxDumpOpenExternalDlg, wxDialog) + EVT_BUTTON(wxID_MORE, wxDumpOpenExternalDlg::OnBrowse) +END_EVENT_TABLE() + + +wxDumpOpenExternalDlg::wxDumpOpenExternalDlg(wxWindow *parent, + const wxFileName& filename) + : wxDialog(parent, + wxID_ANY, + wxString::Format + ( + _("Open file \"%s\""), + filename.GetFullPath().c_str() + )) +{ + // create controls + // --------------- + + wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); + sizerTop->Add(new wxStaticText(this, wxID_ANY, + wxString::Format + ( + _("Enter command to open file \"%s\":"), + filename.GetFullName().c_str() + )), + wxSizerFlags().Border()); + + wxSizer *sizerH = new wxBoxSizer(wxHORIZONTAL); + + wxTextCtrl *command = new wxTextCtrl + ( + this, + wxID_ANY, + wxEmptyString, + wxDefaultPosition, + wxSize(250, -1), + 0, + wxTextValidator(wxFILTER_NONE, &m_command) + ); + sizerH->Add(command, + wxSizerFlags(1).Align(wxALIGN_CENTER_VERTICAL)); + wxButton *browse = new wxButton(this, wxID_MORE, wxT(">>"), + wxDefaultPosition, wxDefaultSize, + wxBU_EXACTFIT); + sizerH->Add(browse, + wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL). Border(wxLEFT)); + + sizerTop->Add(sizerH, wxSizerFlags(0).Expand().Border()); + + sizerTop->Add(new wxStaticLine(this), wxSizerFlags().Expand().Border()); + + sizerTop->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), + wxSizerFlags().Align(wxALIGN_RIGHT).Border()); + + // set the sizer &c + // ---------------- + + SetSizer(sizerTop); + + Layout(); + Fit(); + + command->SetFocus(); +} + +void wxDumpOpenExternalDlg::OnBrowse(wxCommandEvent& ) +{ + wxFileName fname(m_command); + wxFileDialog dlg(this, + wxFileSelectorPromptStr, + fname.GetPathWithSep(), + fname.GetFullName() +#ifdef __WXMSW__ + , _("Executable files (*.exe)|*.exe|All files (*.*)|*.*||") +#endif // __WXMSW__ + ); + if ( dlg.ShowModal() == wxID_OK ) + { + m_command = dlg.GetPath(); + TransferDataToWindow(); + } +} + + +// ---------------------------------------------------------------------------- +// wxDebugReportDialog: class showing debug report to the user +// ---------------------------------------------------------------------------- + +class wxDebugReportDialog : public wxDialog +{ +public: + wxDebugReportDialog(wxDebugReport& dbgrpt); + + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + +private: + void OnView(wxCommandEvent& ); + void OnViewUpdate(wxUpdateUIEvent& ); + void OnOpen(wxCommandEvent& ); + + + // small helper: add wxEXPAND and wxALL flags + static wxSizerFlags SizerFlags(int proportion) + { + return wxSizerFlags(proportion).Expand().Border(); + } + + + wxDebugReport& m_dbgrpt; + + wxCheckListBox *m_checklst; + wxTextCtrl *m_notes; + + wxArrayString m_files; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDebugReportDialog) +}; + +// ============================================================================ +// wxDebugReportDialog implementation +// ============================================================================ + +BEGIN_EVENT_TABLE(wxDebugReportDialog, wxDialog) + EVT_BUTTON(wxID_VIEW_DETAILS, wxDebugReportDialog::OnView) + EVT_UPDATE_UI(wxID_VIEW_DETAILS, wxDebugReportDialog::OnViewUpdate) + EVT_BUTTON(wxID_OPEN, wxDebugReportDialog::OnOpen) + EVT_UPDATE_UI(wxID_OPEN, wxDebugReportDialog::OnViewUpdate) +END_EVENT_TABLE() + + +// ---------------------------------------------------------------------------- +// construction +// ---------------------------------------------------------------------------- + +wxDebugReportDialog::wxDebugReportDialog(wxDebugReport& dbgrpt) + : wxDialog(NULL, wxID_ANY, + wxString::Format(_("Debug report \"%s\""), + dbgrpt.GetReportName().c_str()), + wxDefaultPosition, + wxDefaultSize, + wxDEFAULT_DIALOG_STYLE | wxTHICK_FRAME), + m_dbgrpt(dbgrpt) +{ + // upper part of the dialog: explanatory message + wxString msg; + msg << _("A debug report has been generated in the directory\n") + << _T('\n') + << _T(" \"") << dbgrpt.GetDirectory() << _T("\"\n") + << _T('\n') + << _("The report contains the files listed below. If any of these ") + << _("files contain private information,\n") + << _("please uncheck them and they will be removed from the report.\n") + << _T('\n') + << _("If you wish to suppress this debug report completely, please ") + << _("choose the \"Cancel\" button,\n") + << _("but be warned that it may hinder improving the program, so if\n") + << _("at all possible please do continue with the report generation.\n") + << _T('\n') + << _(" Thank you and we're sorry for the inconvenience!\n") + << _T("\n\n"); // just some white space to separate from other stuff + + const wxSizerFlags flagsFixed(SizerFlags(0)); + const wxSizerFlags flagsExpand(SizerFlags(1)); + const wxSizerFlags flagsExpand2(SizerFlags(2)); + + wxSizer *sizerPreview = + new wxStaticBoxSizer(wxVERTICAL, this, _("&Debug report preview:")); + sizerPreview->Add(CreateTextSizer(msg), SizerFlags(0).Centre()); + + // ... and the list of files in this debug report with buttons to view them + wxSizer *sizerFileBtns = new wxBoxSizer(wxVERTICAL); + sizerFileBtns->AddStretchSpacer(1); + sizerFileBtns->Add(new wxButton(this, wxID_VIEW_DETAILS, _T("&View...")), + wxSizerFlags().Border(wxBOTTOM)); + sizerFileBtns->Add(new wxButton(this, wxID_OPEN, _T("&Open...")), + wxSizerFlags().Border(wxTOP)); + sizerFileBtns->AddStretchSpacer(1); + + m_checklst = new wxCheckListBox(this, wxID_ANY); + + wxSizer *sizerFiles = new wxBoxSizer(wxHORIZONTAL); + sizerFiles->Add(m_checklst, flagsExpand); + sizerFiles->Add(sizerFileBtns, flagsFixed); + + sizerPreview->Add(sizerFiles, flagsExpand2); + + + // lower part of the dialog: notes field + wxSizer *sizerNotes = new wxStaticBoxSizer(wxVERTICAL, this, _("&Notes:")); + + msg = _("If you have any additional information pertaining to this bug\n"); + msg << _("report, please enter it here and it will be joined to it:"); + + m_notes = new wxTextCtrl(this, wxID_ANY, wxEmptyString, + wxDefaultPosition, wxDefaultSize, + wxTE_MULTILINE); + + sizerNotes->Add(CreateTextSizer(msg), flagsFixed); + sizerNotes->Add(m_notes, flagsExpand); + + + wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); + sizerTop->Add(sizerPreview, flagsExpand2); + sizerTop->AddSpacer(5); + sizerTop->Add(sizerNotes, flagsExpand); + sizerTop->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), flagsFixed); + + SetSizerAndFit(sizerTop); + Layout(); + CentreOnScreen(); +} + +// ---------------------------------------------------------------------------- +// data exchange +// ---------------------------------------------------------------------------- + +bool wxDebugReportDialog::TransferDataToWindow() +{ + // all files are included in the report by default + const size_t count = m_dbgrpt.GetFilesCount(); + for ( size_t n = 0; n < count; n++ ) + { + wxString name, + desc; + if ( m_dbgrpt.GetFile(n, &name, &desc) ) + { + m_checklst->Append(name + _T(" (") + desc + _T(')')); + m_checklst->Check(n); + + m_files.Add(name); + } + } + + return true; +} + +bool wxDebugReportDialog::TransferDataFromWindow() +{ + // any unchecked files should be removed from the report + const size_t count = m_checklst->GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + if ( !m_checklst->IsChecked(n) ) + { + m_dbgrpt.RemoveFile(m_files[n]); + } + } + + // if the user entered any notes, add them to the report + const wxString notes = m_notes->GetValue(); + if ( !notes.empty() ) + { + // for now it's fixed, could make it configurable in the future... + const wxChar *NOTES_FILE_NAME = _T("notes.txt"); + wxFileName fn(m_dbgrpt.GetDirectory(), NOTES_FILE_NAME); + wxFFile file(fn.GetFullPath(), _T("w")); + if ( file.IsOpened() && file.Write(notes) ) + { + m_dbgrpt.AddFile(NOTES_FILE_NAME, _T("user notes")); + } + } + + return true; +} + +// ---------------------------------------------------------------------------- +// event handlers +// ---------------------------------------------------------------------------- + +void wxDebugReportDialog::OnView(wxCommandEvent& ) +{ + const int sel = m_checklst->GetSelection(); + wxCHECK_RET( sel != -1, _T("invalid selection in OnView()") ); + + wxFileName fn(m_dbgrpt.GetDirectory(), m_files[sel]); + wxString str; + + wxFFile file(fn.GetFullPath()); + if ( file.IsOpened() && file.ReadAll(&str) ) + { + wxDumpPreviewDlg dlg(this, m_files[sel], str); + dlg.ShowModal(); + } +} + +void wxDebugReportDialog::OnOpen(wxCommandEvent& ) +{ + const int sel = m_checklst->GetSelection(); + wxCHECK_RET( sel != -1, _T("invalid selection in OnOpen()") ); + + wxFileName fn(m_dbgrpt.GetDirectory(), m_files[sel]); + + // try to get the command to open this kind of files ourselves + wxString command; + wxFileType * + ft = wxTheMimeTypesManager->GetFileTypeFromExtension(fn.GetExt()); + if ( ft ) + { + command = ft->GetOpenCommand(fn.GetFullPath()); + } + + // if we couldn't, ask the user + if ( command.empty() ) + { + wxDumpOpenExternalDlg dlg(this, fn); + if ( dlg.ShowModal() == wxID_OK ) + { + // get the command chosen by the user and append file name to it + + // if we don't have place marker for file name in the command... + wxString cmd = dlg.GetCommand(); + if ( cmd.find(_T('%')) == wxString::npos ) + { + // ...add it + cmd += _T(" \"%s\""); + } + + command = wxFileType::ExpandCommand(cmd, fn.GetFullPath()); + } + } + + if ( !command.empty() ) + ::wxExecute(command); +} + +void wxDebugReportDialog::OnViewUpdate(wxUpdateUIEvent& event) +{ + int sel = m_checklst->GetSelection(); + if (sel >= 0) + { + wxFileName fn(m_dbgrpt.GetDirectory(), m_files[sel]); + event.Enable(fn.FileExists()); + } + else + event.Enable(false); +} + + +// ============================================================================ +// wxDebugReportPreviewStd implementation +// ============================================================================ + +bool wxDebugReportPreviewStd::Show(wxDebugReport& dbgrpt) const +{ + if ( !dbgrpt.GetFilesCount() ) + return false; + + wxDebugReportDialog dlg(dbgrpt); + + return dlg.ShowModal() == wxID_OK && dbgrpt.GetFilesCount() != 0; +} + +#endif // wxUSE_DEBUGREPORT + diff --git a/src/wxWindows.dsp b/src/wxWindows.dsp index 0021864f8a..a4d8633696 100644 --- a/src/wxWindows.dsp +++ b/src/wxWindows.dsp @@ -401,6 +401,10 @@ SOURCE=.\common\dcbase.cpp # End Source File # Begin Source File +SOURCE=.\common\debugrpt.cpp +# End Source File +# Begin Source File + SOURCE=.\common\dircmn.cpp # End Source File # Begin Source File @@ -918,6 +922,10 @@ SOURCE=.\generic\datectlg.cpp # End Source File # Begin Source File +SOURCE=.\generic\dbgrptg.cpp +# End Source File +# Begin Source File + SOURCE=.\generic\dcpsg.cpp # End Source File # Begin Source File @@ -2139,6 +2147,10 @@ SOURCE=..\include\wx\debug.h # End Source File # Begin Source File +SOURCE=..\include\wx\debugrpt.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\defs.h # End Source File # Begin Source File -- 2.45.2