how to specify settings for CreateBugReport

delphi package - automated exception handling

how to specify settings for CreateBugReport

Postby bottura » Tue Jul 11, 2017 4:14 pm

Hi,
i try to specify specific settings when calling CreateBugReport, but it doesn't work ...

MESettings.ShowPleaseWaitBox := false;
MESettings.ListThreads := false;
MESettings.ShowCpuRegisters := false;
MESettings.ShowStackDump := false;
MESettings.ShowDisAsm := false;
MESettings.ShowRelativeAddrs := true;
MESettings.ShowRelativeLines := true;
MESettings.GeneralNoBugReport := false;
str := MadExcept.CreateBugReport(etNormal, E, nil, 0, 0, 0, nil, false, MESettings);

Could you tell me what is wrong ?

I can only specify settings thru the "madexcept settings" option from the Project menu of Delphi ...

Thanks in advance.
bottura
 
Posts: 7
Joined: Tue Jul 11, 2017 4:10 pm

Re: how to specify settings for CreateBugReport

Postby madshi » Tue Jul 11, 2017 6:07 pm

MESettings() is a function, so I would not advice having dozens of lines calling MESettings() over and over again. My recommendation would be to do something like this:

Code: Select all
var settings : IMESettings;
begin
  settings := MESettings();
  settings.ShowPleaseWaitBox := false;
  ...
  str := madExcept.CreateBugReport(..., settings);

To be honest, though, I'm not sure if changing your code like this will make any practical difference. It's just better (faster) code. In theory I would have expected your code to work. Anyway, can you double check, just to be safe, if changing your code as I suggested helps, before I dig deeper into this?
madshi
Site Admin
 
Posts: 9469
Joined: Sun Mar 21, 2004 5:25 pm

Re: how to specify settings for CreateBugReport

Postby bottura » Wed Jul 12, 2017 7:09 am

I changed my code like this :

madSettings: IMEModuleSettings;

madSettings := MESettings();
madSettings.ListThreads := false;
madSettings.ShowCpuRegisters := false;
madSettings.ShowStackDump := false;
madSettings.ShowDisAsm := false;
madSettings.ShowRelativeAddrs := true;
madSettings.ShowRelativeLines := true;
writeExceptionLog(MadExcept.CreateBugReport(etNormal, E, nil, 0, 0, 0, nil, false, madSettings));

with the same result ...

attached are :
- MoovappsDocumentServer_exception1.log : bugreport when specifying the settings in the code like above
- MoovappsDocumentServer_exception.log : bugreport when specifying the settings thru the project menu option (.mes attached too) = what i'd like to get with the settings in the code ...

Thanks in advance for your help.

PS : we are using the madExcept 4.0 Company Edition (v4.0.16).
Attachments
logs.zip
(5.67 KiB) Downloaded 16 times
bottura
 
Posts: 7
Joined: Tue Jul 11, 2017 4:10 pm

Re: how to specify settings for CreateBugReport

Postby bottura » Wed Jul 12, 2017 7:12 am

another question : must I free madSettings in my code above ?
bottura
 
Posts: 7
Joined: Tue Jul 11, 2017 4:10 pm

Re: how to specify settings for CreateBugReport

Postby madshi » Wed Jul 12, 2017 12:22 pm

Hmmmm... I've just tested this code and it works perfectly for me:

Code: Select all
  try
    integer(nil^) := 0;
  except
    madSettings := MESettings();
    madSettings.ListThreads := false;
    madSettings.ShowCpuRegisters := false;
    madSettings.ShowStackDump := false;
    madSettings.ShowDisAsm := false;
    madSettings.ShowRelativeAddrs := true;
    madSettings.ShowRelativeLines := true;
    FillClipboard(CreateBugReport(etNormal, nil, nil, 0, 0, 0, nil, false, madSettings));
  end;

Can you double check? If it still doesn't work for you, can you please create a little test project and upload it for me?

P.S: You don't have to free madSettings. It's a dynamic interface, so Delphi automatically frees it at the right time, just like dynamic strings, dynamic arrays etc.
madshi
Site Admin
 
Posts: 9469
Joined: Sun Mar 21, 2004 5:25 pm

Re: how to specify settings for CreateBugReport

Postby bottura » Wed Jul 12, 2017 1:21 pm

ok, attached is a small project.

I better see the problem :
- if "enable madexcept" is not checked in the project/madExcept settings, even if i set :
madSettings.ListThreads := false;
in the code, i got the list of the threads in the bugreport ...

then it seems i must check it to be able to specify the settings in the code.
Attachments
testmadexcept.zip
(6.23 KiB) Downloaded 16 times
bottura
 
Posts: 7
Joined: Tue Jul 11, 2017 4:10 pm

Re: how to specify settings for CreateBugReport

Postby madshi » Wed Jul 12, 2017 1:28 pm

Oh, I see. It's unusual that you try to use madExcept functionality without having it "enabled". Why are you doing that? If you don't have madExcept "enabled" then your EXE will also not get the map file information stored into the resource section. So CreateBugReport will not be able to provide function names and line numbers, unless you manually ship with map file with your EXE.

The reason why changing settings in this situation fails is that there are no valid madExcept settings in the project to be found, so the whole MESettings() logic is kinda broken in that situation. I suppose it might be possible to add code to make it work in this specific situation, but to be honest, I think if you don't enable madExcept, then you shouldn't expect it to work.
madshi
Site Admin
 
Posts: 9469
Joined: Sun Mar 21, 2004 5:25 pm

Re: how to specify settings for CreateBugReport

Postby bottura » Wed Jul 12, 2017 1:45 pm

the reason was not to be dependent of the madexcept activation from the IDE.
but with your comment about the map file, it's not pertinent.
I am going to enable it.
Thank you for your support.
bottura
 
Posts: 7
Joined: Tue Jul 11, 2017 4:10 pm

Re: how to specify settings for CreateBugReport

Postby madshi » Wed Jul 12, 2017 1:59 pm

In which way is being "dependent" on the madExcept action from the IDE problematic for you? Maybe I can suggest something to reduce that problem for you?
madshi
Site Admin
 
Posts: 9469
Joined: Sun Mar 21, 2004 5:25 pm

Re: how to specify settings for CreateBugReport

Postby bottura » Wed Jul 12, 2017 2:56 pm

I have just discovered that we encounter the problem as we are using Delphi's command line tools to build the project.
We use madExceptPatch.exe, but the output of CreateBugReport is the same as if madexcept was disabled in the project setting ...
that is to say the MESettings set in the code are not taken into account.
bottura
 
Posts: 7
Joined: Tue Jul 11, 2017 4:10 pm

Re: how to specify settings for CreateBugReport

Postby madshi » Wed Jul 12, 2017 3:34 pm

Hmmm... Is madExcept in the "uses" list in your project (*.dpr) file? Please do this:

1) Create an empty file "madExceptWizard.txt" on your desktop.
2) Do batch compiling including madExceptPatch.exe as you usually do.
3) Zip the txt file and attach it here.
madshi
Site Admin
 
Posts: 9469
Joined: Sun Mar 21, 2004 5:25 pm

Re: how to specify settings for CreateBugReport

Postby bottura » Wed Jul 12, 2017 3:45 pm

sorry, the guy who had configured the batch compiling has just told me he didn't do the patch at the right time :-(
After having corrected it, the bugreport is correct.

Thanks again.
bottura
 
Posts: 7
Joined: Tue Jul 11, 2017 4:10 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 4 guests