debugrpt sample problems

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.
Post Reply
Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 382
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

debugrpt sample problems

Post by Widgets » Sat Apr 25, 2020 7:07 pm

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 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4043
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: debugrpt sample problems

Post by ONEEYEMAN » Sun Apr 26, 2020 12:35 am

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
Super wx Problem Solver
Super wx Problem Solver
Posts: 382
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets » Sun Apr 26, 2020 2:45 am

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 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4043
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: debugrpt sample problems

Post by ONEEYEMAN » Sun Apr 26, 2020 6:02 am

Hi,
Either 3.1.3 or Git master.

Thank you.

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 382
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets » Sun Apr 26, 2020 6:49 pm

3.1.3 (32-bit) debug version shows the same problem, I'm afraid :-(
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

User avatar
doublemax
Moderator
Moderator
Posts: 14769
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: debugrpt sample problems

Post by doublemax » Sun Apr 26, 2020 8:00 pm

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
Super wx Problem Solver
Super wx Problem Solver
Posts: 382
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets » Sun Apr 26, 2020 8:38 pm

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 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 382
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: debugrpt sample problems

Post by Widgets » Wed Apr 29, 2020 7:31 pm

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 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

Post Reply