Forum Discussion

her123's avatar
New Contributor
11 years ago

AQTime 8.10 in RAD studio now give Access violation

Attempting to profile an application written in Delphi XE3 now gives an access violation with any profiler when loading a form that contains VirtualStringTree 5.2.2.

Has anyone found a solution to this?


7 Replies

  • her123's avatar
    New Contributor
    There seems to be two cases:

    If the RootNodeCount = 1 then an AV occurs.

    When VirtualStringTree.Clear() is called and AV occurs.

  • her123's avatar
    New Contributor
    TBaseVirtualTree.PackArray() where it executes assembler on Win32 is the problem


            PUSH    EBX

            PUSH    EDI

            PUSH    ESI

            MOV     ESI, EDX

            MOV     EDX, -1

            JCXZ    @@Finish               // Empty list?

            INC     EDX                    // init remaining entries counter

            MOV     EDI, ESI               // source and destination point to the list memory

            MOV     EBX, 1                 // use a register instead of immediate operant to check against


            TEST    [ESI], EBX             // do the fastest scan possible to find the first entry

                                           // which must be removed

            JNZ     @@DoMainLoop

            INC     EDX

            ADD     ESI, 4

            DEC     ECX

            JNZ     @@PreScan

            JMP     @@Finish


            MOV     EDI, ESI


            TEST    [ESI], EBX             // odd entry?

            JNE     @@Skip                 // yes, so skip this one

            MOVSD                          // else move the entry to new location

            INC     EDX                    // count the moved entries

            DEC     ECX

            JNZ     @@MainLoop             // do it until all entries are processed

            JMP     @@Finish


            ADD     ESI, 4                 // point to the next entry

            DEC     ECX

            JNZ     @@MainLoop             // do it until all entries are processed


            MOV     EAX, EDX               // prepare return value

            POP     ESI

            POP     EDI

            POP     EBX


    AQTime has problems with this.

    The solution is to modify the conditional define and use the Pascal code that would normally be used for the 64bit build.
  • A bit more testing shows that the problem seems to be the result of using the JCXZ instruction. If the VirtualTree code is changed from

      JCXZ @@Finish

    to the equivalent:

      CMP CX, 0

      JZ @@Finish

    then AQTime can execute it. Why should this be so?
  • aqAnt's avatar
    SmartBear Alumni (Retired)

    Hi All,

    We have analyzed the situation with the JCXZ instruction and found out that there is a problem with AQtime's patcher when it patches the VirtualTrees::TBaseVirtualTree::PackArray method. Unfortunately, we were unable to determine the exact cause of the problem. Normally, AQtime should instrument the code with the instruction just fine. We will continue working on the problem.

    Anyway, to avoid the crash, you should exclude the VirtualTrees::TBaseVirtualTree::PackArray routine from the profiling.