Menu

#285 gexperts delphi6 1-3-20 not working

Closed
closed-fixed
None
5
2022-04-15
2022-03-31
carrchri
No

GExperts Bug Report

Description:
gexperts-1-3-20-experimental-twm-2022-01-30 not working with delphi6.
- There is an assert with access violation borlndmm.dll when opening delphi
- The expertmanager.exe do an assert gexpertsinst is not a valid reference
- I try to debug with sources (tag 1.3.20) : gx_conddefine.inc is missing
(How can I debug with delphi the GExpertsD6.dll ?)

Bug Details:
The bug is reproducible 100% of the time

Steps:
Gexperts
1. Start Delphi from the start menu

Expertmanager
1. Start ExpertManager.exe

Configuration:
OS: Windows 10 (1903) (kernel 10.0.18362 build 2158)
GExperts: GExpertsD6.dll 1.3.18.3442 from 21.02.2021 15:07:36
IDE: ideD602 PRO
ComCtl32: <unknown></unknown>

Discussion

  • Thomas Mueller

    Thomas Mueller - 2022-04-01

    gx_conddefine.inc is located in GExperts\Source\Include

    Unfortunately my Delphi 6 installation is broken, I can no longer start the IDE, but only use the commandline compiler to compile the DLL, so I am unable to debug this.

    To debug you must compile the project with debug information and in Run -> Parameters set the Host Application to delphi32.exe (with full path) optionally, pass the parameters -ns -np
    (no splash screen, no project).
    This will then start a second instance of the IDE.
    Since the problem occurs when starting the IDE, you will need to disable GExperts before you start the first IDE instance and then enable it before you start the debugging process.

    I hope these hints help you to track down and fix the issue. I will gladly accept any patches.

     
  • carrchri

    carrchri - 2022-04-01

    OK. Now I can run.
    But I don't see how to debug. I have no compiled line. (I try to break in initialization of GX_About.pas)

     
    • Thomas Mueller

      Thomas Mueller - 2022-04-02

      Is your IDE configured to load the DLL which you compile? To check this, delete the DLL which was installed with the installer. You will have to set the correct path in the registry for that.

       
      • carrchri

        carrchri - 2022-04-05

        OK, I understand. I must set debug infos.

         
  • carrchri

    carrchri - 2022-04-05

    I see the problem. It is when the cache's files is writted in C:\Users\<>\AppData\Local\Gexperts\Delphi 6\UsesExpertCache. There is a problem with the memory management of delphi (???) and it fails but not at each files. Very strange.
    I try to clear the cached files and with version 1.3.18, I have the same behaviour!

    I found a workaround to correct it (with delphi6; I doesn't have other version to test, but I think it will work on other version)

    I change the TStream_WriteString in u_dzClassUtils :

    function TStream_WriteString(_Stream: TStream; const _s: RawByteString): Integer;
    var
      Len: Integer;
      ErrCode: DWORD;
    //before =>  s: AnsiString;
    begin
    //before =>  s := AnsiString(_s);
      Len := Length(_s); //before => Len := Length({s});
      if Len > 0 then begin
        Result := _Stream.Write(_s[1], Len); //before => Result := _Stream.Write(PAnsistring(s)^, Len);
        if Result <> Len then begin
          ErrCode := GetLastError;
          RaiseLastOSErrorEx(ErrCode,
            Format(_('Error writing string of length %d to stream, wrote only %d bytes: %%1:s (%%0:d)'),
            [Len, Result]));
        end;
      end;
    end;
    

    and the AsLine in GX_UnitExportList : (I saw sometimes the Result is longer as expect and had stranges characters at the end of strings -> like the result was not initialized and was override with a shorter string???)

    function TUnitIdentifier.AsLine: AnsiString;
    begin
      Result := ''; //New
      Result := UNIT_IDENTIFIER_TYPE_CHARS[itUnknown] + AnsiChar(#9) + Long2DecA(FLineNo) + AnsiChar(#9) + FIdentifier;
    end;
    
     

    Last edit: Thomas Mueller 2022-04-08
    • Thomas Mueller

      Thomas Mueller - 2022-04-08

      Now that is embarrassing: It turned out that it isn't my Delphi 6 installation that is broken but GExperts for Delphi 6 was causing an access violation which silently killed the IDE. After disabling GExperts the IDE starts without any problems.

      And you are right: That TStream_WriteString implementation is rather odd and your fix works fine. You forgot to set Result to 0 in the else case though.

      Not sure about that TUnitIdentifier.AsLine change though. Are you sure it is necessary?

       
      • carrchri

        carrchri - 2022-04-11

        I test again the asline with Assert(Result=(UNIT_IDENTIFIER_TYPE_CHARS[itUnknown] + AnsiChar(#9) + Long2DecA(FLineNo) + AnsiChar(#9) + FIdentifier)); and I have no error. I think it was a corruption with TStream_WriteString bug.

         
  • Thomas Mueller

    Thomas Mueller - 2022-04-08

    fixed in revision #3827

     
    • carrchri

      carrchri - 2022-04-11

      OK. But the expertmanager.exe always do an error.

       
      • Thomas Mueller

        Thomas Mueller - 2022-04-15

        Fixed in revision #3838

         
  • Thomas Mueller

    Thomas Mueller - 2022-04-15
    • status: open --> closed-fixed
    • assigned_to: Thomas Mueller
    • Group: New --> Closed
     

Log in to post a comment.