debugrpt sample problems Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

debugrpt sample problems

Post by Widgets »

After trying to use debug reporting & having issues with my own code - which follows the example in samples, I tried the sample project, but it will not run at all under MSVC 2019 IDE. Using any of the report options, it crashes with
Exception thrown at 0x76F341CA (kernel32.dll) in debugrpt.exe:
0xC0000005: Access violation reading location 0x868BF18F.
in src\msw\debughelp.cpp ;ine 584 - wxwidgets 3.1.1

Code: Select all

/* static */
wxDbgHelpDLL::SymbolTag
wxDbgHelpDLL::DereferenceSymbol(wxPSYMBOL_INFO pSym, void **ppData)
{
....
        if ( ::IsBadReadPtr(pData, sizeof(DWORD_PTR *)) ) <<<<<<<<<<<<<<<<<  access violation crash 
?????
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: debugrpt sample problems

Post by ONEEYEMAN »

Hi,
Are you using the precompiled libraries or you build it yourself?
What Windows version you are testing under?
Can you obtain a back trace at the time of the crash? Or this is an assert message?

Finally - can you try with the 3.1.3?

Thank you.
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

All libraries are built by myself, using the same IDE as for the samples
All testing dome under the up-to-date Win 10 OS with an up-to-date MSVC community edition IDE

the full stack trace at the time of the crash below - with the Exception message:

Exception thrown at 0x76F341CA (kernel32.dll) in debugrpt.exe: 0xC0000005: Access violation reading location 0x868BF18F.

Code: Select all

 	kernel32.dll!IsBadReadPtr()	Unknown
>	debugrpt.exe!wxDbgHelpDLL::DereferenceSymbol(_SYMBOL_INFOW * pSym, void * * ppData) Line 584	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 417	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 431	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 431	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 431	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 383	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 431	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 431	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 431	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 431	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpField(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 383	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpUDT(_SYMBOL_INFOW * pSym, void * pVariable, unsigned int level) Line 547	C++
 	debugrpt.exe!wxDbgHelpDLL::DumpSymbol(_SYMBOL_INFOW * pSym, void * pVariable) Line 610	C++
 	debugrpt.exe!wxStackFrame::OnParam(_SYMBOL_INFOW * pSymInfo) Line 121	C++
 	debugrpt.exe!EnumSymbolsProc(_SYMBOL_INFOW * pSymInfo, unsigned long __formal, void * data) Line 146	C++
 	[External Code]	
 	debugrpt.exe!wxDbgHelpDLL::CallSymEnumSymbols(void * hProcess, unsigned __int64 baseOfDll, int(__stdcall*)(_SYMBOL_INFOW *, unsigned long, void *) callback, void * const callbackParam) Line 920	C++
 	debugrpt.exe!wxStackFrame::OnGetParam() Line 172	C++
 	debugrpt.exe!wxStackFrame::GetParamCount() Line 55	C++
 	debugrpt.exe!XmlStackWalker::OnStackFrame(const wxStackFrame & frame) Line 145	C++
 	debugrpt.exe!wxStackWalker::WalkFrom(const _CONTEXT * pCtx, unsigned int skip, unsigned int maxDepth) Line 279	C++
 	debugrpt.exe!wxStackWalker::WalkFrom(const _EXCEPTION_POINTERS * ep, unsigned int skip, unsigned int maxDepth) Line 292	C++
 	debugrpt.exe!wxStackWalker::WalkFromException(unsigned int maxDepth) Line 305	C++
 	debugrpt.exe!wxDebugReport::AddContext(wxDebugReport::Context ctx) Line 492	C++
 	debugrpt.exe!wxDebugReport::AddAll(wxDebugReport::Context context) Line 337	C++
 	debugrpt.exe!MyApp::GenerateReport(wxDebugReport::Context ctx) Line 429	C++
 	debugrpt.exe!MyApp::OnFatalException() Line 415	C++
 	debugrpt.exe!wxGlobalSEHandler(_EXCEPTION_POINTERS * pExcPtrs) Line 93	C++
 	debugrpt.exe!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam) Line 2850	C++
 	[External Code]	
 	debugrpt.exe!bar(const char * p) Line 123	C++
 	debugrpt.exe!foo(int n) Line 138	C++
 	debugrpt.exe!MyFrame::OnReportForCrash(wxCommandEvent & __formal) Line 339	C++
 	debugrpt.exe!wxAppConsoleBase::HandleEvent(wxEvtHandler * handler, void(wxEvtHandler::*)(wxEvent &) func, wxEvent & event) Line 657	C++
 	debugrpt.exe!wxAppConsoleBase::CallEventHandler(wxEvtHandler * handler, wxEventFunctor & functor, wxEvent & event) Line 669	C++
 	debugrpt.exe!wxEvtHandler::ProcessEventIfMatchesId(const wxEventTableEntryBase & entry, wxEvtHandler * handler, wxEvent & event) Line 1396	C++
 	debugrpt.exe!wxEventHashTable::HandleEvent(wxEvent & event, wxEvtHandler * self) Line 1004	C++
 	debugrpt.exe!wxEvtHandler::TryHereOnly(wxEvent & event) Line 1593	C++
 	debugrpt.exe!wxEvtHandler::TryBeforeAndHere(wxEvent & event) Line 3873	C++
 	debugrpt.exe!wxEvtHandler::ProcessEventLocally(wxEvent & event) Line 1526	C++
 	debugrpt.exe!wxEvtHandler::ProcessEvent(wxEvent & event) Line 1499	C++
 	debugrpt.exe!wxWindowBase::TryAfter(wxEvent & event) Line 3456	C++
 	debugrpt.exe!wxEvtHandler::ProcessEvent(wxEvent & event) Line 1512	C++
 	debugrpt.exe!wxEvtHandler::SafelyProcessEvent(wxEvent & event) Line 1617	C++
 	debugrpt.exe!wxWindowBase::HandleWindowEvent(wxEvent & event) Line 1540	C++
 	debugrpt.exe!wxMenuBase::DoProcessEvent(wxMenuBase * menu, wxEvent & event, wxWindow * win) Line 673	C++
 	debugrpt.exe!wxMenuBase::SendEvent(int itemid, int checked) Line 643	C++
 	debugrpt.exe!wxFrameBase::ProcessCommand(wxMenuItem * item) Line 295	C++
 	debugrpt.exe!wxFrame::HandleCommand(unsigned short id, unsigned short cmd, HWND__ * control) Line 798	C++
 	debugrpt.exe!wxFrame::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 855	C++
 	debugrpt.exe!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam) Line 2846	C++
 	[External Code]	
 	debugrpt.exe!wxGUIEventLoop::ProcessMessage(tagMSG * msg) Line 167	C++
 	debugrpt.exe!wxGUIEventLoop::Dispatch() Line 227	C++
 	debugrpt.exe!wxEventLoopManual::ProcessEvents() Line 223	C++
 	debugrpt.exe!wxEventLoopManual::DoRun() Line 268	C++
 	debugrpt.exe!wxEventLoopBase::Run() Line 76	C++
 	debugrpt.exe!wxAppConsoleBase::MainLoop() Line 380	C++
 	debugrpt.exe!wxAppConsoleBase::OnRun() Line 301	C++
 	debugrpt.exe!wxAppBase::OnRun() Line 336	C++
 	debugrpt.exe!wxEntryReal(int & argc, wchar_t * * argv) Line 507	C++
 	debugrpt.exe!wxEntry(int & argc, wchar_t * * argv) Line 184	C++
 	debugrpt.exe!wxEntry(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, char * __formal, int nCmdShow) Line 305	C++
 	debugrpt.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 227	C++
 	[External Code]	
 
The crash happens in

Code: Select all

/* static */
wxDbgHelpDLL::SymbolTag
wxDbgHelpDLL::DereferenceSymbol(wxPSYMBOL_INFO pSym, void **ppData)
{
    SymbolTag tag = SYMBOL_TAG_NULL;
    for ( ;; )
    {
        if ( !DoGetTypeInfo(pSym, TI_GET_SYMTAG, &tag) )
            break;
        if ( tag != SYMBOL_TAG_POINTER_TYPE )
            break;
        ULONG tiNew;
        if ( !DoGetTypeInfo(pSym, TI_GET_TYPEID, &tiNew) ||
                tiNew == pSym->TypeIndex )
            break;
        pSym->TypeIndex = tiNew;
        // remove one level of indirection except for the char strings: we want
        // to dump "char *" and not a single "char" for them
        if ( ppData && *ppData && GetBasicType(pSym) != BASICTYPE_CHAR )
        {
            DWORD_PTR *pData = (DWORD_PTR *)*ppData;
            if ( ::IsBadReadPtr(pData, sizeof(DWORD_PTR *)) )   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            {
                break;
            }
            *ppData = (void *)*pData;
        }
    }
    return tag;
}
When I first ran into the problem with my own code, I thought it might be because not all of the libraries I link against have debug information. So I tried the example - debug version and the problem is very much the same, same place, same message.

3.1.3 - not tried, never even downloaded it - yet, though it might be worth a try.
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: debugrpt sample problems

Post by ONEEYEMAN »

Hi,
Either 3.1.3 or Git master.

Thank you.
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

3.1.3 (32-bit) debug version shows the same problem, I'm afraid :-(
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: debugrpt sample problems

Post by doublemax »

Still works with VS2013, i can't test with VS2017 or VS2019 at the moment. If anyone else can test and confirm this, please open a bug report.

FWIW: If you use VS anyway, i recommend crashrpt, much more powerful: http://crashrpt.sourceforge.net/
Use the source, Luke!
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

same issue with MSVC 2015 & 2017
Will look into crashrpt - had downloaded it some time ago, but never spent the time to test it and replace my existing code. Looks like now is the time to do so ;-)
Thank you all
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

doublemax wrote: Sun Apr 26, 2020 8:00 pm
FWIW: If you use VS anyway, i recommend crashrpt, much more powerful: http://crashrpt.sourceforge.net/
Finally got crashrpt installed, compiled and linked into one of my smallish test programs.
It seems that the project is now abandon-ware and since my work with this code thus far has raised a number of questions, it seems I might as well ask them here:
  1. Has anyone using the crashrpt code found any of the 'fixes' listed on the forum for crashrpt useful and/or necessary?
    particularly https://github.com/QbProg/crashrpt2
  2. While I have been able to actually send and receive crash reports via either e-mail option, they both involve more user interaction than just agreeing to have the report sent out.
    At least in my case, the local e-mail client - Thunderbird - popped up a permission dialog to make sure I was ready to allow the use of the client for this.
    Obviously one would not want to hard-code user names & passwords into an app to be distributed, so the user will have to be instructed to add that information - granted I have not tested all possible combinations - yet.
    Any recommendations or possible solutions/work-arounds?
  3. If one wanted to use HTTP to send & receive the report, what sort of security measures would one need to have active at the receiving end to protect the receiving server against abuse?
TIA
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

FWIW, just an update and to record the bit of progress.
When compiling and debugging the MFCDemo, I have run into an assert issue regarding the hardwired dbghelp dll version when working on Win 10 & the latest MSVC 2019 updates.
The code (from wherever I got it), has 6.1.11 hard coded as the version for dbghelp.dll and whichever copy - have not taken the time to check - MSVC finds and uses conflicts with that hard coded version number and pops up a couple of ATL asserts because of it. (ErrorReportSender.cpp ~ line703++ in my copy). If one continues, it eventually sends out the report.
Currently, only the e-mail version works, although my preference was to use HTTP. Still, even e-mail default to SMAPI because SMTP fails due to an "invalid greeting message'
For now, the best option is to simply save the error report to a local disk. If the report needs to got to some other location, it seems the only way is SMAPI, which implies user interaction and, in my case the local e-mail client.
But at least the report makes it to the specified e-mail address.
Various comments I have come across, imply that delivery via HTTP is no longer working.
In my trials, the remote server reported, but did not accept the data and eventually responded with a response code of '404'
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: debugrpt sample problems

Post by doublemax »

I still use crashrpt 1.4.3 without any issues. However, i'm also using an older VS 2013.

I use the HTTP reporting feature without any additional security measures. The worst thing people could do with it would be to fill my server with fake crash reports.
Use the source, Luke!
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

Any special setup/code required at the server end?
I have copied the PHP file found with the crashRpt code to the server htdocs\crashRpt\
I am working with xampp 7.13.10 on a separate PC on my LAN
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: debugrpt sample problems

Post by doublemax »

Widgets wrote: Mon Jun 22, 2020 6:34 pm Any special setup/code required at the server end?
Not much. I just edited the $file_root variable in the script to point to another directory. The directory must exist and the httpd process must have write access to it.

And then i added a line that sends an email notification to me when a crashreport comes in. But that only works on a "real" server with properly configured sendmail.
Use the source, Luke!
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

does $file_root end up as server home directory relative or a regular Win OS file path?
Neither works for me
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: debugrpt sample problems

Post by doublemax »

Widgets wrote: Mon Jun 22, 2020 7:44 pm does $file_root end up as server home directory relative or a regular Win OS file path?
I don't know if an absolute Windows path should work. I used a path relative to the location of the PHP file.
Use the source, Luke!
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets »

The real problem seems to be, that whichever version I happened to pick fails the Unit tests for SMTP & HTTP delivery, so all of my trials for that sort of result is likely to fail in any case.
As well, I have no real idea how I might debug that part of the project - the crash sender.
Haven't found any information on what information is passed to it on the command line when it is launched and am not sure how deep that will drag me down some 'rabbit hole' ;-)
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Post Reply