Applies To:
  • CitectSCADA 4.x

Summary:
Currently there is no Dr Watson available for Windows 95. So if you are getting an exception in Citect under Windows 95 you have no way of capturing detailed information. To get more information on the exception you can either run the 16 bit version of Citect and use DRWATSON.EXE to capture the fault or run 32 bit version of Citect under Windows NT and use DRWTSN32.EXE. The final way is to run Citect with a debugger under Windows 95. The following details how to run Citect under the Microsoft Visual C++ 2.x and 4.x debuggers. You may be able to get similar information by running Citect under other debuggers. 

Solution:
Procedure for capturing exception information using Visual C++ under Windows 95 or Windows NT.
  • Install Visual C++ as per Microsoft instructions
  • Startup Visual C++
  • Open the CITECT32.EXE file so the debugger knows what you want to debug. With Visual C++ 2.x select File Open from the menu. If using Visual C++ 4.x use File Open Workspace. Then select CITECT32.EXE which is normally in the C:\CITECT\BIN\ directory.
  • If you are using a non standard CITECT.INI file you must modify the command line arguments in Visual C++ so it will pass them to Citect when you start it up. So from the menu select Project|Settings Select Debug Tab and then type in the command line arguments in the "Program Arguments:" field:
  • Press F5 to run Citect in Visual C++ 2.x or select Build|Debug]Go in Visual C++ 4.x. You may iconize Visual C++ so it does not get in the way while you reproduce the fault. When you reproduce the fault Visual debugger will catch it and wait for your response.
  • Once you have reproduced the exception make sure the following windows are open in the Visual C debugger. Select from the menu Debug in Visual C++ 2.x or View menu in Visual C++ 4.x select the following items:

    Registers
    Call Stack
    Disassembly

The call stack window will look something like this:

CITECT32! 00468ae1()
CITECT32! 004fc487()
KERNEL32! bff88f75()
KERNEL32! bff88e23()
KERNEL32! bff8783f()
00000008()

Select all the data in the call stack window via the mouse and copy to the clipboard. Then paste into notepad. When you click on the CITECT32! 00468ae1() line in the stack trace window the disassembly window will show the code associated with each function. You should click on the very top line in the call stack as this is the code of most interest. Then select several lines before and after the cursor position and copy to the clipboard and paste into notepad. You should see something like this:

00468ad3 push 00000000
00468ad5 push 00000000
00468ad7 lea eax,dword ptr [ebp-1c]
00468ada push eax
00468adb call dword ptr [0051deb0]
00468ae1 test eax,eax << THIS is the instruction from call stack
00468ae3 je 00468b60
00468ae9 cmp dword ptr [ebp-18],00000012
00468aed jne 00468af8
00468af3 jmp 00468c14
00468af8 xor eax,eax
00468afa mov al,byte ptr [00514754]
00468aff test eax,eax
00468b01 je 00468b33

Now select all the data in the register window and copy to the clipboard and paste into notepad. You should see something link this:

EAX = 008AFD70 EBX = 007A0000 ECX = 80005090
EDX = 00000000 ESI = 815B12D2 EDI = 815B1388
ESP = 008AFD3C EBP = 008AFD8C EIP = 00468AE1
EFL = 00000293 CS = 013F DS = 0147 ES = 0147
SS = 0147 FS = 2B77 GS = 0000

O=0 D=0 I=1 S=1 Z=0 A=1 P=0 C=1

ST(0) = +0.00000000000000000e+0000
ST(1) = +0.00000000000000000e+0000
ST(2) = +0.00000000000000000e+0000
ST(3) = +0.00000000000000000e+0000
ST(4) = +0.00000000000000000e+0000
ST(5) = +0.00000000000000000e+0000
ST(6) = +3.40390000000000014e+0001
ST(7) = +6.80780000000000018e+0003

CTRL = 027F STAT = 0020 TAGS = FFFF IP = 1023B3C1
CS = 013F DO = 008AF6D0 DS = 0147

You have just dumped all information about a single thread running in Citect. Now you need to repeat this procedure for each thread in Citect. From the menu select Debug|Thread. The dialog will show the list of threads with and '*' next to the one in focus. You need to select each thread in turn and repeat the above procedure.

You can make this simpler by disabling some of the threads in Citect by setting the CITECT.INI option:

[kernel]
Win32Threads=0

This will make Citect run a little slower and should not normally be set, however it makes it easier to find problems.

Once you have all the debug information send it to Citect support. Pass along with a description of what you where doing to generate the problem and details of your Computer and PLC hardware. Also state which version of Citect you are running and the date and file size of the CITECT32.EXE file. If it takes a long time to reproduce the fault you may want to check you have Visual C setup correctly. You can generate an exception in Citect by opening up the cicode window in the Citect kernel and typing the command DEBUG("GPF");. This will cause Citect to terminate.

 

Keywords:
 

Attachments