madExcept patched wrong binary file in multi-project group

delphi package - automated exception handling

madExcept patched wrong binary file in multi-project group

Postby ckchen08 » Fri Aug 20, 2010 8:01 am

[madExcept patched wrong binary file in multi-project project group of C++Builder 2010]

I upgrade my C++Builder from 2006 to 2010 today and I noticed that in a project group containing multiple projects, if you build a project without first activate the project first, madExcept will patch wrong binary file. (madExcept will try to patch the binary file from the active project.)

If the wrong binary file is already there, you will not get any warning/error message, but actually the new built binary file is not patched.

This caused me a lot of trouble since my project group contains many projects using madExcept, now I cannot use ‘Build All Projects’ command anymore and have to activate and build projects one by one and is very time consuming.

For example:

1. create a project group containing two projects Project1.exe and Project2.exe
2. execute ‘Clean’ command on Project1.exe
3. double click Project1.exe to set it as active project
4. right click project2.exe and execute ‘Build’ command

You will get the following message from madExcept:

[madExcept] Project1.cpp: Binary not found!

And here is the content in madExceptWizard.txt:

15:32:44-406 ActiveProjectChanged: "F:\Test\Project1.cbproj"
15:32:44-453 ActiveProjectChanged: "F:\Test\Project2.cbproj"
15:32:44-453 ActiveProjectChanged: "F:\Test\Project1.cbproj"
15:32:48-500 BeforeCompile event, isCodeInsight: -
15:32:48-500 [0] module "F:\Test\Unit1.cpp"
15:32:48-500 [1] project group
15:32:48-500 [0] project "F:\Test\Project1.cbproj"; moduleEditor[0]: "F:\Test\Project1.cpp"
15:32:48-500 [1] project "F:\Test\Project2.cbproj"; moduleEditor[0]: "F:\Test\Project2.cpp"
15:32:48-500 New project detected: "F:\Test\Project1.cpp"
15:32:48-500 SetDefaultSettings
15:32:48-500 LoadDefaultSettings:
15:32:48-500 LoadSettingsFromIni(F:\Test\Project1):
[deleted]
15:32:48-640 New project detected: "F:\Test\Project2.cpp"
15:32:48-640 SetDefaultSettings
15:32:48-640 LoadDefaultSettings:
15:32:48-640 LoadSettingsFromIni(F:\Test\Project2):
[deleted]
15:32:48-718 Project closed: "F:\Test\Project2.cbproj"
15:32:48-718 Project closed: "F:\Test\Project1.cpp"
15:32:48-718 BeforeCompile
15:32:48-718 the project file is alright (madListModules)
15:32:48-718 the project file is alright (madListProcesses)
15:32:48-734 the project file is alright (madListHardware)
15:32:48-734 the project file is alright (madIWSupport)
15:32:48-734 the project file is alright (madScreenShot)
15:32:48-734 the project file is alright (madLinkDisAsm)
15:32:48-734 the project file is alright (madExcept)
15:32:51-343 AfterCompile event, succeeded: +, isCodeInsight: -
15:32:51-343 [0] module "F:\Test\Unit1.cpp"
15:32:51-343 [1] project group
15:32:51-343 [0] project "F:\Test\Project1.cbproj"; moduleEditor[0]: "F:\Test\Project1.cpp"
15:32:51-343 [1] project "F:\Test\Project2.cbproj"; moduleEditor[0]: "F:\Test\Project2.cpp"
15:32:51-343 AfterCompile, succeeded: +
15:32:51-343 root: "F:\Test\Project1"
15:32:51-343 isDpk: -
15:32:51-343 binary: "F:\Test\Debug\Project1.exe"
15:32:51-343 map file: "F:\Test\Debug\Project1.map"
15:32:51-343 warning "Binary not found!"
15:32:51-343 AfterCompile done

I already tried version 2.6.0.0 and the latest beta and results are all the same.
ckchen08
 
Posts: 1
Joined: Fri Aug 20, 2010 7:54 am

Postby madshi » Tue Aug 24, 2010 8:42 am

Thanks for the report, I'll have a look at this.
madshi
Site Admin
 
Posts: 9412
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby madshi » Sat Mar 26, 2011 5:26 pm

Hello,

and sorry for the extremely late fix.

Finally here it is:

http://madshi.net/madCollectionBeta.exe (2.6.0.22)

You can also wait for the official version which I plan to release tomorrow.
madshi
Site Admin
 
Posts: 9412
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby Meagle » Tue Oct 25, 2016 2:07 pm

I still have the same problem with the current madCollection 2.8.0.2 and Delphi XE.

Same situation as above:

In the project list I have a project with two configurations RELEASE and DEBUG.
DEBUG is writing to "C:\Projects\Binary\Debug
RELEASE is writing to "C:\Projects\Binary\Release
RELEASE is marked as active configuration in the project list.
Then I've made a build group with the configuration DEBUG.
Now I execute the build group with the configuration DEBUG,
but in the project list the configuration RELEASE is still active.

madExcept now tries to link in the build of RELEASE,
but the DEBUG binary is in a different folder.
So I get the message "Binary not found!"

Is this a bug in Delphi, because it does not switch the active configuration
depending to the one which is just executed in the build group or does
madExcept get no notice of the build group, which configuration is being executed right now?

Oh and btw. is it possible to set the madExcept configuration depending on the build configuration?

Thanks

Output is written to C:\Projects\Binary\Debug\XXXX.dll

Wizard:
16:03:12-666 BeforeCompile event, isCodeInsight: -
16:03:12-682 ProjectCompileStarted event, Project: "C:\Projects\XXXX.dproj", Mode: Make
16:03:12-683 [0] module "default.htm"
16:03:12-685 [1] project group
16:03:12-692 [0] project "C:\Projects\XXXX.dproj"; moduleEditor[0]: "C:\Projects\XXXX.dpr"
16:03:12-725 current project: "C:\Projects\XXXX.dproj"
16:03:12-727 BeforeCompile
16:03:12-730 extracted unit clause: "madExcept,Forms,Classes,...."
16:03:23-940 ProjectCompileFinished event, Project: "C:\Projects\XXXX.dproj", Result: succeeded
16:03:23-943 [0] module "default.htm"
16:03:23-945 [1] project group
16:03:23-948 [0] project "C:\Projects\XXXX.dproj"; moduleEditor[0]: "C:\Projects\XXXX.dpr"
16:03:23-984 current project: "C:\Projects\XXXX.dproj"
16:03:23-987 AfterCompile, succeeded: +
16:03:23-990 root: "C:\Projects\XXXX"
16:03:23-993 isDpk: -
16:03:23-996 binary: "C:\Projects\Binary\Release\XXXX.dll"
16:03:24-000 map file: "C:\Projects\Binary\Release\XXXX.map"
16:03:24-003 warning "Binary not found!"
16:03:24-008 AfterCompile done
16:03:24-011 AfterCompile event, succeeded: +, isCodeInsight: -
Meagle
 
Posts: 5
Joined: Tue Oct 25, 2016 1:38 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby madshi » Tue Oct 25, 2016 3:17 pm

The log file indicates that Delphi is *probably* reporting a wrong binary path. I'm using "IOTAProject.ProjectOptions.GetTargetName" to get the path from the IDE, and according to the log file it's the wrong one. There's a corner case, though, where if the path returned by Delphi is incomplete (e.g. a relative path), I try to complete the path myself, but I don't think it's likely it would end up being "release" then, it would rather be the project's source code folder instead. So I'm pretty sure that this seems to be a Delphi IDE bug.

Currently there's no way to easily use different madExcept settings at compile time for different build configurations. What would you need this for exactly? Maybe there's an easy workaround.
madshi
Site Admin
 
Posts: 9412
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby Meagle » Wed Oct 26, 2016 6:11 am

Thanks for your reply.

Well, I guess the function GetTargetName actually does return the correct path,
but it's from the selected configuration of the project list only.
It seems compiling using the build-group does not mention this,
but maybe there is another function to get the currently used configuration,
when a build is running via the build group?

If not, then I can't use it in combination with madExcept,
until I switch the configuration in the project list manually,
which makes build groups useless then... :(

And for my other question:
I want, for example, leak checking in the DEBUG configuration but in the RELEASE I don't.
I know, there is a compiler switch, but it gets override when changing the configuration.
Or, for another example, I want to use the email function in DEBUG but in the RELEASE I don't.
However, it is not too urgent, but it would be a nice future feature :)

Thanks
Meagle
 
Posts: 5
Joined: Tue Oct 25, 2016 1:38 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby madshi » Wed Oct 26, 2016 7:25 am

Can you create a small test project with which I can reproduce the problem on my PC, and attach it zipped to this thread?
madshi
Site Admin
 
Posts: 9412
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby Meagle » Wed Oct 26, 2016 8:33 am

Sure, here it is. There is a readme file in it.
Attachments
Projects.zip
Sample
(251.23 KiB) Downloaded 44 times
Meagle
 
Posts: 5
Joined: Tue Oct 25, 2016 1:38 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby madshi » Wed Oct 26, 2016 8:42 am

Thanks, will have a look at this when I find some time. Might take a couple of days, though.
madshi
Site Admin
 
Posts: 9412
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby Meagle » Wed Oct 26, 2016 10:18 am

It is not very urgent, thank you in advance for looking at it.

I wondering if this also happens in later versions of Delphi.
Meagle
 
Posts: 5
Joined: Tue Oct 25, 2016 1:38 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby Meagle » Tue Jan 17, 2017 10:41 am

Could you take a look to this issue yet?
Meagle
 
Posts: 5
Joined: Tue Oct 25, 2016 1:38 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby madshi » Sat Mar 11, 2017 12:06 pm

I'm sorry for the extremely late reply.

I've just double checked this. The IDE tells when a project was compiled, and then I can ask the project configuration for the "target name". This seems to be the active configuration, though, which in your situation is not the one which was just compiled. At this point I'm not sure how to get the correct exe file name/path from the IDE. My current impression is that the IDE communication interface doesn't provide the necessary information to make this work, but it's hard to say because the documentation is pretty weak.

You can have a look yourself, in "Delphi\Sources\ToolsAPI\ToolsAPI.pas". This is where the IDE communication interface is explained. I'm using IOTAProjectOptions.GetTargetName, in the "AfterCompile" event. Not sure what else to do... :(
madshi
Site Admin
 
Posts: 9412
Joined: Sun Mar 21, 2004 5:25 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby FredS » Wed Mar 22, 2017 5:27 am

from MadExcept not included with Build Groups: http://forum.madshi.net/viewtopic.php?f=4&t=28168

adding this to post event fixes the issue and causes no errors:
"$(VCL)\madCollection\madExcept\Tools\madExceptPatch.exe" "$(OUTPUTPATH)" "$(INPUTDIR)\$(INPUTNAME).mes"
FredS
 
Posts: 79
Joined: Mon May 11, 2015 9:42 pm

Re: madExcept patched wrong binary file in multi-project gro

Postby madshi » Wed Mar 22, 2017 9:45 am

Hmmmm... Worth a try if that also fixes this issue.
madshi
Site Admin
 
Posts: 9412
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 2 guests

cron