User Tools

Site Tools


using_the_clarion_debugger.htm
Navigation:  User's Guide and Tutorials > Advanced Topics > The Debugger >====== Using the Clarion Debugger ====== Previous pageReturn to chapter overviewNext page

Overview

Clarion ships a 32-bit debugger for your 32-bit applications. It is a powerful tool for finding and diagnosing errors in your applications. You can examine source code and data as your program executes, and exercise complete control over your program's execution.

This chapter tells you how to:

·Prepare your projects for debugging.

·Start the debugger.

·Customize the debugger's operation to your work environment.

·Monitor your program's execution and check its state at specific points by setting breakpoints and watch expressions.

The Debugging Process

The debugger is very flexible, quite complex, and there are many windows, options, and features available. This overview of the debugging process suggests a general sequence of steps that introduces you to the most important features of the debugger with the least amount of confusion. Keep this sequence in mind as you explore the debugger.

1.Shut down other applications, then start the debugger.

This offers two benefits. First, more system resources are available to your application and the debugger. Second, you won't lose data from other active applications if a system crash occurs during the debugging process.

2.Load only the source files you need to debug.

Each source file you select becomes a child window in the debugger. The fewer source files you select, the less clutter you have on your debugger screen, and the less overhead the debugger must manage.

3.Set Debug Options.

Take a few minutes to read Setting Debugger Options. Several Options such as Custom Font, Stop on dynamic dll load, etc. can make the debugger easier to read and work with.

4.Set a breakpoint.

5.Run your application (the debuggee) with Go or Step commands.

6.Select and arrange the debugger windows.

Many of the debugger windows will be empty until your application stops at a breakpoint. Once your application stops, and the windows are populated, they will be more meaningful and easier to understand and work with. Iconize or close the windows you don't need to see.

7.Set breakpoints, set watch expressions, and change variable values.

8.Run your application with Go or Step commands.

9.Repeat steps 7 and 8 as needed.

10.Exit your application (debuggee).

Preparing Your Projects for Debugging

The Project System lets you set the debug options for your application in the Global Options dialog. To make your executable (.EXE or .DLL) suitable for debugging:

Generate Global Debug Information

1.Create your project file, and make it the current project (the Project System chapter explains how).

2.Choose Project BLTTRIA.jpg Project Options to view the Project Properties dialog.

3.Set the Configuration drop down to Debug

4.Select the Compiling tab, then choose Full from the Debug Mode drop list.

The compiler generates the debug information into the .EXE or .DLL.

5.Optionally check the Add Line Number information to map file box.

Line numbers are automatically available to the Clarion debugger, however, if you are using another debugger, checking this box will make line numbers available to it.

6.Close the Project Properties, and press the Save button on the IDE toolbar to save your project changes.

7.Choose Build BLTTRIA.jpg Set Configuration BLTTRIA.jpg Debug from the IDE Menu.

8.Press the Build Solution button on the toolbar to compile and link the application.

The application now includes the information the debugger needs.

Generate Local Debug Information

You can also turn on debugging information for a single module in the project. This reduces the overhead for the debugger. To do so, follow the steps above for Global Options, except choose None from the Debug Mode drop list. Then follow the steps below:

1.Choose View BLTTRIA.jpg Solution Explorer to view the Solution Explorer dialog.

2.Select only the source module you need to debug, and then press the Properties button.

3.In the Properties Pad, choose Full from the Debug information drop list.

4.Press the Build Soution button on the toolbar to compile and link the application.

This includes debug information for that module only.

Locating Page Faults (GPF)

The debuggers can identify a specific line of code where your program is crashing. Make the debugger the system debugger (see Setting Debugger Options), then run your program. When it crashes, select debug to invoke the debugger to take you to the offending line.

Starting the Debugger from a Popup Menu

When you start the debugger from Windows, you should take steps to set the proper working folder'usually the directory that contains the debuggee. For example, create a Windows shortcut that sets the “Start in” folder.

Or you can use a program like “RegEdit” to make Windows registry entries to start the debugger by right-clicking on the .exe to debug. Here are some example registry entries that start the debugger with the appropriate working directory:

[HKEY_CLASSES_ROOT\exefile\shell\32bit Debugger]

[HKEY_CLASSES_ROOT\exefile\shell\32bit Debugger\command]

@= “Cladbx.exe c:\\Clarion\\bin\\Clarion.red c:\\Clarion\\bin\Claee.ini %1”

[HKEY_CLASSES_ROOT\exefile\shell\Restart Debugger]

[HKEY_CLASSES_ROOT\exefile\shell\Restart Debugger\command]

@= “Cladb.exe /r”

using_the_clarion_debugger.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1