View Issue Details

IDProjectCategoryView StatusLast Update
0003923JEDI VCL02 Installationpublic2006-11-11 06:59
ReporteroutchyAssigned Tooutchy 
PrioritylowSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.30 
Summary0003923: Ability for the installer to create .jdbg files
DescriptionAn option is present in the installer to insert JCL debug data into the JVCL binaries. It could be useful to add an other option to create .jdbg files. The key function is "function ConvertMapFileToJdbgFile(const MapFileName: TFileName): Boolean; overload;" in JclDebug.pas.
Additional InformationIn addition, it was reported several times that the initial feature (inserting JCL debug data into the packages) is not working on some systems. This problem should be reviewed by a developer able to reproduce the problem (I am not).
TagsNo tags attached.

Activities

obones

2006-09-26 00:54

administrator   ~0010178

Any pointers at what and where to look for the map file problem ?
I get it on every single PC here.

outchy

2006-09-26 10:54

administrator   ~0010189

To explain quickly the system: the JCL package (jcldXX.bpl) contains a function that is called by the JVCL installer to create the debug data. This function is located in jcl\source\windows\JclDebug.pas (just look for "JVCL" in this unit and you will find it around line 307 / 1732 for revision 1726). The JVCL installer dynamically loads the first JCL package it finds that exports this function.
The detection is done in jvcl\install\jvclinstall\jvcldata.pas, in the TJVCLData constructor (line 447 for revision 10610). The function pointer is stored in the FJclLinkMapFile field. This imported function is called by TJVCLData.LinkMapFile (line 663).

Here are the steps I suggest you to do:
Close the IDE and install the JCL and the JVCL without checking any MAP stuff. The installation processes should success.

In BDS 2006, open the JVCL installer project (jvcl\install\jvclinstall\jvclinstall.dpr), turn all debugging options on, and place 2 breakpoints: the first breakpoint in the TJVCLData constructor to watch if the FJclLinkMapFile is assigned in the loop (the result of GetProcAddress should not be nil), the second breakpoint to be placed in TJVCLData.LinkMapFile.
There may be a problem if you only have BDS 2006 installed, because the JVCL won't be able to compile packages used by the IDE which is debugging the installer. Changing the BPL output path in the debugged installer options should solve the problem. If you have more than one Borland IDE, you can just debug the installation for an other version.
Launch the installation process and check the MAP options and debug it. I think there should be an exception that would be raised somewhere in the JCL package. You will probably need to recompile this package with debug informations to make the debugging session easier.

obones

2006-09-29 04:25

administrator   ~0010221

Indeed, an exception is raised, Acces violation at address 51F220F1 in module rtl100.bpl, read of address 00000008.

Note that this is with the French version of BDS2006.

I tried to put messge boxes in Jcl100.bpl and it turns out that as soon as one accesses parameters passed to InsertDebugDataIntoExecutableFile, it crashes with the above access violation.

outchy

2006-09-29 08:26

administrator   ~0010257

Thanks,

Are both strings (BinaryFileName and MapFileName) non empty?

You could get more details by adding an exception dialog to the JVCL installer and by modifying this code from JVCLData.pas:

uses Forms;

function TJVCLData.LinkMapFile(const BinaryFileName, MapFileName: string;
  var MapFileSize, JclDebugDataSize: Integer): Boolean;
begin
  try
    Result := Assigned(FJclLinkMapFile) and FJclLinkMapFile(PChar(BinaryFileName),
      PChar(MapFileName), MapFileSize, JclDebugDataSize);
  except
    on E: TObject do
    begin
      Application.HandleException(E);
      Result := False;
    end;
  end;
end;

obones

2006-10-03 01:30

administrator   ~0010276

The access violation occurs as soon as some code tries to access one of the parameters. Furthermore there already is an exception handler and it clearly tells that an access violation occured, reading address 00000008

obones

2006-10-03 02:20

administrator   ~0010277

I modified the code in JCLDebug.pas to this :

var
  LinkerBugUnit: string;
begin
  try
    MessageBox(0, 'Before', '', 0);
    LinkerBugUnit := '';
    Result := InsertDebugDataIntoExecutableFile(ExecutableFileName, MapFileName,
      LinkerBugUnit, MapFileSize, JclDebugDataSize);
    MessageBox(0, 'After', '', 0);
  except
    on E: Exception do
    begin
      MessageBox(0, PChar('jcldebug.pas : ' + E.message), '', 0);
      Result := False;
    end
    else
      MessageBox(0, 'Non VCL exception', '', 0);
  end;

I do get the "before" message, but never see the "after" message. What's even weirder is that none of the exception dialogs popup.
The only except block that works is the one inside the JVCL installer. There is something VERY weird here.

obones

2006-10-03 03:49

administrator   ~0010278

Ok, even simpler. Here is a code that creates the crash:

var
  Tmp: string;
begin
  Tmp := ExecutableFileName;
  MessageBox(0, ExecutableFileName, '', 0);
end;


Now, remove the line where Tmp is assigned, it works, the name is displayed.
This looks like a stack/heap corruption, but I have NO IDEA where it could come from...

outchy

2006-10-13 10:29

administrator   ~0010357

Please check revision 10976
the problem happened when the jclXXX.bpl was the same version as the compiler which built the installer.

obones

2006-10-16 01:55

administrator   ~0010362

Well, replacing LoadLibrary with LoadPackage in JVCLData.pas is a big problem, the installer does not start anymore (EPackageError) in the following situation:

Delphi 7 and BDS 2006 on the same machine.
JCL installed ONLY in BDS 2006

In that situation, Jcl70.bpl does not exist and cannot be loaded. But because LoadPackage triggers an exception, the installer won't even start.
I added a "try..except" construct around it and it now works perfectly.
So the part about the crash in the "link map files" is now fixed.

obones

2006-10-16 01:55

administrator   ~0010363

Put in "Ack" state, this will be dealt with later on.

outchy

2006-10-16 10:52

administrator   ~0010367

Ok, I didn't get this exception raised.

Now, we could work on the main subject of this request.

outchy

2006-11-11 06:59

administrator   ~0010432

Implemented in revision 10997 by Andreas

Issue History

Date Modified Username Field Change
2006-09-25 12:26 outchy New Issue
2006-09-26 00:54 obones Note Added: 0010178
2006-09-26 00:54 obones Status new => feedback
2006-09-26 10:54 outchy Note Added: 0010189
2006-09-29 04:25 obones Note Added: 0010221
2006-09-29 08:26 outchy Note Added: 0010257
2006-10-03 01:30 obones Note Added: 0010276
2006-10-03 02:20 obones Note Added: 0010277
2006-10-03 03:49 obones Note Added: 0010278
2006-10-13 10:29 outchy Note Added: 0010357
2006-10-16 01:55 obones Note Added: 0010362
2006-10-16 01:55 obones Note Added: 0010363
2006-10-16 01:55 obones Status feedback => acknowledged
2006-10-16 10:52 outchy Note Added: 0010367
2006-11-11 06:59 outchy Status acknowledged => resolved
2006-11-11 06:59 outchy Fixed in Version => Daily / SVN
2006-11-11 06:59 outchy Resolution open => fixed
2006-11-11 06:59 outchy Assigned To => outchy
2006-11-11 06:59 outchy Note Added: 0010432