C++: CreateBugReport()

delphi package - automated exception handling
Post Reply
WWebber
Posts: 5
Joined: Sat Nov 05, 2016 3:08 pm

C++: CreateBugReport()

Post by WWebber »

a) I cannot search for the string "CreateBugReport" in this forum.

b) What is the trick to get CreateBugReport() working? I am quite happy with all the other exception handlers but I cannot get CreateBugReport() working to create an error output in the log file. According to the doc I should use this function to create a report. I already tested HandleException() as well, but I do not want an error window shown.

If I use this:

Code: Select all

  CreateBugReport( etNormal,
  		   &Exception("test"),
                   (void*)0x12,
                   0,
                   0,
                   0,
                   NULL,
                   true );
I see a little waiting popup window, so the function is doing something at least.

Is there any workaround for just logging an exception error?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: C++: CreateBugReport()

Post by madshi »

The "CreateBugReport()" function is relatively hard to use because you need to set some of the parameters to "good" values. I'd suggest that you use "madExcept.CreateCrashStackTrace()" instead which internally calls "CreateBugReport()" and makes things much easier for you. However, "CreateCrashStackTrace()" only works inside of a try..except/catch block.

http://help.madshi.net/madExceptUnit.ht ... StackTrace
naozuka
Posts: 4
Joined: Wed Jul 04, 2018 11:40 am

Re: C++: CreateBugReport()

Post by naozuka »

Hi, I'm using Unigui to webdevelopment and I need to integrate with a tool to get exceptions.
Unigui has a method that capture all the exceptions but I don't know how to trace the error.

I tried CreateBugReport but it doesn't point the exactly form that raised the exception.
I changed to CreateCrashStackTrace and it returned fine.
But, if a deploy as a DLL. It doesn't trace.

Trace of Standalone application
0192bacf Project1.exe Data.DB 2896 DatabaseError
0192bb59 Project1.exe Data.DB 2903 DatabaseErrorFmt
0193eb98 Project1.exe Data.DB 11629 DoBindFields
0193ecd1 Project1.exe Data.DB 11658 TDataSet.BindFields
019b34de Project1.exe Data.Win.ADODB 3629 TCustomADODataSet.InternalOpen
0193e0f9 Project1.exe Data.DB 11332 TDataSet.DoInternalOpen
0193e1b2 Project1.exe Data.DB 11361 TDataSet.OpenCursor
019b341f Project1.exe Data.Win.ADODB 3616 TCustomADODataSet.OpenCursor
0193e06d Project1.exe Data.DB 11314 TDataSet.SetActive
0193deb4 Project1.exe Data.DB 11270 TDataSet.Open
005eab9f Project1.exe Form1.cpp 566 TForm1.FormShow

Trace of Isapi application
0315fbe8 SMARamWeb.dll
74d97c02 KERNEL32.DLL BaseThreadInitThunk

Any hints? :(
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: C++: CreateBugReport()

Post by madshi »

I don't really know Unigui. ISAPI is pretty much a nightmare for me because it's hard to setup and get to work, let alone debug.

I'm not really sure why it doesn't work for you. I suppose SMARamWeb.dll is your ISAPI DLL? If so, I'd suggest that you check if there's a resources in there with the path "MAD\EXCEPT". It should be there. If it is, then I don't know what's going wrong. Of course you could try to debug it yourself. In order to do that, copy madExcept.pas and mad.inc into your project folder, then recompile. After that you should be able to set breakpoints.
naozuka
Posts: 4
Joined: Wed Jul 04, 2018 11:40 am

Re: C++: CreateBugReport()

Post by naozuka »

madshi wrote:I don't really know Unigui. ISAPI is pretty much a nightmare for me because it's hard to setup and get to work, let alone debug.

I'm not really sure why it doesn't work for you. I suppose SMARamWeb.dll is your ISAPI DLL? If so, I'd suggest that you check if there's a resources in there with the path "MAD\EXCEPT". It should be there. If it is, then I don't know what's going wrong. Of course you could try to debug it yourself. In order to do that, copy madExcept.pas and mad.inc into your project folder, then recompile. After that you should be able to set breakpoints.
Yes, SmaramWeb.dll is my isapi DLL. There isn't any madexcept resource :(
And I'm using C++ Builder too. There is no way to debug with pas files.
I dont have this file too because I'm testing with the free version.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: C++: CreateBugReport()

Post by madshi »

Ah, BCB. You may have to copy the "#include "madExcept.h"" etc madExcept lines from the *.bpr (?) to your DLL's main *.cpp file. From what I remember, for BCB DLL projects, madExcept might add those lines to the wrong file (don't know how to fix it).
naozuka
Posts: 4
Joined: Wed Jul 04, 2018 11:40 am

Re: C++: CreateBugReport()

Post by naozuka »

I found another solution but I don't know if it's the correct to do.
I deployed .tds and .map files with my dll and now it works. 8)
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: C++: CreateBugReport()

Post by madshi »

You can do that, but it's not "nice" because it means you have to distribute extra files. It shouldn't be necessary.
naozuka
Posts: 4
Joined: Wed Jul 04, 2018 11:40 am

Re: C++: CreateBugReport()

Post by naozuka »

madshi wrote:You can do that, but it's not "nice" because it means you have to distribute extra files. It shouldn't be necessary.
This was an emergency for now. But I'll try to adding the include into the main cpp file.
Thanks for the fast replying!
Post Reply