I am trying to debug the crash reporting code using the sample debugrpt - Win 10, 64-bit, MSVC 2015, using the MSVC 2010 tool chain and wxWidgets libs compiled with MSVC 2010, wxWidgets 3.1.0 multi-lib static compile.
Curl is on the path and my local HTTP server has been specified as the target, using its IP address, the rest of the code is the sample as it comes.
The main problem I have run into, is that none of the wxLogMessages show up anywhere, no log window, no message boxes, nothing.
As it is, I am lost trying to identify why the file does not seem to appear on my server, even though the curl command seems to complete without error.
Even single stepping through the code to the bitter end when the app shuts down does not help. And yes, I have set the option to 'Upload the debug, report' and when stepping through the code, I do reach the point where curl is called. OTOH, I am not that familiar with curl, so, with only a long multi-line XML output dump to an invisible string, I am stuck.
AFAIK, i have not disabled any logging anywhere, but who knows ????
Any hints or pointers will most welcome
wxDebugReport Topic is solved
wxDebugReport
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
MSVC Express 2019/2022
wxWidgets 3.2.2
- eranon
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
- Contact:
Re: wxDebugReport
From what I see in the concerned sample, the key function is wxDebugReportUpload::DoProcess() in which you find that wxExecute captures the stderr in an array (wxArrayString) and subsequently allows to see its content through successive wxLogWarning. So, you have to study this page http://docs.wxwidgets.org/3.0/overview_log.html or directly extract/read the content of this array yourself.
At libcurl level, if you want to drive any error to stderr, you would have to enable the CURLOPT_VERBOSE option (and eventually redirect the errors toward a FILE* with the CURLOPT_STDERR option), but with the CLI, it's the "--verbose" option... So, you could add it in the command line invoked by wxExecute.
At libcurl level, if you want to drive any error to stderr, you would have to enable the CURLOPT_VERBOSE option (and eventually redirect the errors toward a FILE* with the CURLOPT_STDERR option), but with the CLI, it's the "--verbose" option... So, you could add it in the command line invoked by wxExecute.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Re: wxDebugReport
Edit:
After more debugging today, I have found that there is log output to my application's log window, but since creating the crash report terminates the application, I never realized it appeared at all.
Still, the upload did not happen, even though the code path I now end up tracking through seems to imply it does - and curl.exe is now found, but because the curl output consists of some 36 lines, most of which I cannot see unless I make sure the log window is big enough from the start. This not really a problem in this case, since I manually initiate the crash for testing, but would not help any user in a real life scenario.
Fortunately, I have also realized that, just before terminating the application, the code does return to my own application into the routine OnServerReply(), where it will be easier to save the data to a file etc, without getting into the wxWidgets source code itself.
In fact, by using wxLogDebug(wxT("%s"), s ); I can force the log message to appear in the IDE's output window and can thus inspect it without having to fiddle with the core source code.
Because of this, I will mark the issue as resolved, at least for myself ..... though, IMHO, it still is not in general.
===============
Going through the debug steps again today, after reading the link you gave with a lot more attention this time, I came across the code in wxWidgets ../generic/dbgrptg.cpp, @ lines 525++:
Which I take as am explanation of why no error/diagnostic messages appear
But it also suggest that this part of the sample was never tested in real life.
And it raises the question of what sort of means are available to report errors or diagnostics at that stage.
One probably would have to modify the source code and replace the calls to wxLogError with calls to wxLogDebug or add more MSW specific call to some other reporting functions. I suppose that ought to be my next steps.
As an alternative to curl, I am also considering using e-mail feedback rather than via HTTP.
After more debugging today, I have found that there is log output to my application's log window, but since creating the crash report terminates the application, I never realized it appeared at all.
Still, the upload did not happen, even though the code path I now end up tracking through seems to imply it does - and curl.exe is now found, but because the curl output consists of some 36 lines, most of which I cannot see unless I make sure the log window is big enough from the start. This not really a problem in this case, since I manually initiate the crash for testing, but would not help any user in a real life scenario.
Fortunately, I have also realized that, just before terminating the application, the code does return to my own application into the routine OnServerReply(), where it will be easier to save the data to a file etc, without getting into the wxWidgets source code itself.
In fact, by using wxLogDebug(wxT("%s"), s ); I can force the log message to appear in the IDE's output window and can thus inspect it without having to fiddle with the core source code.
Because of this, I will mark the issue as resolved, at least for myself ..... though, IMHO, it still is not in general.
===============
Thank you very much for your comments. In tracing through the source, I had seen the calls to wxLogError and was very surprised and dismayed that their output did not appear anywhere.eranon wrote:From what I see in the concerned sample, the key function is wxDebugReportUpload::DoProcess() in which you find that wxExecute captures the stderr in an array (wxArrayString) and subsequently allows to see its content through successive wxLogWarning. So, you have to study this page http://docs.wxwidgets.org/3.0/overview_log.html or directly extract/read the content of this array yourself.
Going through the debug steps again today, after reading the link you gave with a lot more attention this time, I came across the code in wxWidgets ../generic/dbgrptg.cpp, @ lines 525++:
Code: Select all
#ifdef __WXMSW__
// before entering the event loop (from ShowModal()), block the event
// handling for all other windows as this could result in more crashes
wxEventLoop::SetCriticalWindow(&dlg);
wxON_BLOCK_EXIT1( wxEventLoop::SetCriticalWindow,
static_cast<wxWindow *>(NULL) );
#endif // __WXMSW__
But it also suggest that this part of the sample was never tested in real life.
And it raises the question of what sort of means are available to report errors or diagnostics at that stage.
One probably would have to modify the source code and replace the calls to wxLogError with calls to wxLogDebug or add more MSW specific call to some other reporting functions. I suppose that ought to be my next steps.
I will give the --verbose flag a try and see where it leads me, though that too, implies fiddling with the source codeeranon wrote: At libcurl level, if you want to drive any error to stderr, you would have to enable the CURLOPT_VERBOSE option (and eventually redirect the errors toward a FILE* with the CURLOPT_STDERR option), but with the CLI, it's the "--verbose" option... So, you could add it in the command line invoked by wxExecute.
As an alternative to curl, I am also considering using e-mail feedback rather than via HTTP.
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
MSVC Express 2019/2022
wxWidgets 3.2.2
Re: wxDebugReport
Hi,
Are you trying to use libcurl or do wxExecute( "curl", ... );?
Thank you.
Are you trying to use libcurl or do wxExecute( "curl", ... );?
Thank you.
Re: wxDebugReport
For both the sample code and this part of my app. I am using the code as presented in the sample, i.e. wxExecute (... ).
From what I have learned so far, and because I am already using libcurl for other e-mail feedback in the same app, I have decided to go the e-mail route.
I raised the issue here, mainly for my own education.
From what I have learned so far, and because I am already using libcurl for other e-mail feedback in the same app, I have decided to go the e-mail route.
I raised the issue here, mainly for my own education.
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
MSVC Express 2019/2022
wxWidgets 3.2.2
Re: wxDebugReport
Hi,
I don't know about wxExecute() route, but I did use libcurl in one of my projects for uploading the file to the remote server and didn't get any issues with it.
But if you are satisfied with the solution at hand - the better.
Thank you.
I don't know about wxExecute() route, but I did use libcurl in one of my projects for uploading the file to the remote server and didn't get any issues with it.
But if you are satisfied with the solution at hand - the better.
Thank you.