Debugging
How do I use the 4D v6/v6.5 debugger?
The 4D v6 or later debugger is described in detail in Chapter 13, Debugging,
of the 4D v6.7 Language Reference Manual. The 4D v6/v6.5/6.7 debugger is
the most advanced debugger in any commercial programming environment on
the market today. Many users are still unaware of some of its most useful
features. These include:
- You can point at any variable or expression for a moment to see a tips-style
popup showing its contents. You can activate the debugger while code is
running by pressing Alt (Windows) or Option (Macintosh) and clicking the
mouse button (left mouse button on Windows) on 4D v6. in 4D v6.5/6.7 you
must use the following key combinations:
- Alt+Shift+Right Click on Windows
- Control+Option+Command+Click on MacOS
- When you execute this action, a pop-up menu listing all the processes
being executed appears. You can then select the process you wish to
trace. A mark is placed next to the process name in the window in
which the user clicked. The processes that were unable to be traced
are shown in gray.
- You can trace a running process at any time from the Process window
in the design environment
- You can trace multiple processes simultaneously, each in a separate
window
- If you hold down the Alt key (Windows) or the Option key (Macintosh)
when choosing No Trace, 4D will resume running and will ignore any subsequent
Trace commands in that process.
- You can drag the program counter (the arrow showing which line is about
to be executed) up or down to change which line will be executed next.
- You can get a variety of useful options by right-clicking (Windows)
or Control- clicking (Macintosh) on most things in the debugger;
- You can set a conditional break point by option-clicking in the left
edge of the watch pane. 4D will present you with a dialog asking you to
enter an expression that returns a Boolean. 4D will then evaluate that
expression when the line with the break point is about to be executed
and will stop if the expression returns true.
- The Tools menu in the Design environment has a Break List option that
opens a Break List window showing all the break points set in the code.
When this window is in front, a new Break List menu appears, which allows
you to click on break points and enable or disable them; delete one or
all break points; and to activate a Catch.
- The Break List menu's Add New Catch command allows you to activate the
debugger whenever any process executes a particular command. Note that
you can instead right-click (control-click on the Macintosh) on the Catch
pane of the Break List window to activate a menu which allows you to choose
a command to catch.
- Any Catches you create in the Break List window can have a condition
associated with their activation. You add such a condition by entering
an expression that returns a Boolean in the right half of the Catch pane
next to the call you want to catch.
How do I prevent 4D crashing?
4th Dimension is a very stable and reliable application, but it is dependent
on a number of systems to do its work. If there are any conflicts in these
systems, 4D may crash.
You should try to simplify 4D's environment as much as possible. Running
other applications at the same time as 4D, or using control panels and extensions
that aren't related to networking (on the Macintosh) increase the likelihood
that you will see a crash. On a Macintosh 4D server, you should turn off
file sharing and virtual memory, since these both slow down the system and
contribute to instability. If you need to share files, either use a separate
computer for this task, or turn file sharing on only when it is needed.
At times, one or more of the files in the 4D folder (the "ACI"
folder in v6/v6.5), located in your Windows or WinNT directory (on the PC)
or inside your Preferences folder (on the Macintosh) may become corrupted.
If you experience crashes, try removing the 4D folder. On Mac, you will
need to enter your ID number for most 4D applications after you do this
and reinstall your Expansion disks for 4D Server (make sure you are reinstalling
server with the same ID number). On the PC, you will need to reinstall your
network components if you are using Client/Server 4D.
Command Removing and
Re-installing NCs on Windows
Command Removing and
Re-installing NCs on Macintosh
You should check that you are using the same versions of 4D client and
server and network components, and that any plug-ins you are using are compatible
with your 4D version and operating system. Note that you should be using
4D v6 or later of any 4D plug-ins.
If you are using 4D v6 or later and your database is converted from 4D
v3 or v1.5 of 4D, you should check whether you have any plug-ins installed
into your structure file and remove them. (See
FAQ on Plug-ins)