Turbo Debugger Version 5 Users Guide
Turbo Debugger Version 5 Users Guide
Borland"
o
User's Guide
Borland
Turbo Debugger
Borland'rntemational, Inc., 100 Borland Way
P.O. Box 660001, Scotts Valley, CA 95067-0001
Borland may have patents and/or pending patent applications covering subject matter, in this document. The
furnishing of this document does not give you any license to these patents.
COPYRIGHT 1988, 1995 Borland International. All rights reserved. All Borland product names are trademarks or
registered trademarks of Borland International, Inc. Other brand and product names are trademarks or registered
trademarks of their respective holders.
Printed in the U.S.A.
IEORI295
9596979899-9 8 7 6 5 4
HI
Contents
Introduction 1 Preparing programs for debugging . . . . . . . 15
Compiling from the C++ integrated
New features and changes for version 5.x . .2 environment. . . . . . . . . . . . . . . . . . . 16
New features and changes for version 4.x . . . .2 Compiling from Delphi . . . . . . . . . . . . . 16
Hardware requirements. . . . . . . . . . . . . . .2 Compiling from the command line . . . . . . 16
Terminology in this manual. . . . . . . . . . . . .3 Starting Turbo Debugger . . . . . . . . . . . . . 17
Module . . . . . . . . . . . . . . . . . . . . . . . 3 Specifying Turbo Debugger's command-line
Function . . . . . . . . . . . . . . . . . . . . . . . 3 options . . . . . . . . . . . . . . . . . . . . . . . 17
Turbo Debugger . . . . . . . . . . . . . . . . . . 3 Setting command-line options with Turbo
Typographic and icon conventions . . . . . . . . 3 Debugger's icon properties . . . . . . . . . . 18
Using this manual . . . . . . . . . . . . . . . . . .4 Setting command-line options from
Borland's C++ integrated environment. .. 18
Where to now? . . . . . . . . . . . . . . . . . . . .5 Launching Turbo Debugger from Delphi... 18
First-time Turbo Debugger users . . . . . . . . 5 Running Turbo Debugger . . . . . . . . . .... 19
Experienced Turbo Debugger users . . . . . . . 5
Loading your program into the debugger . . . 19
Software registration and technical support . . . 5
Searching for source code. . . . . . . . . . . . . 21
Chapter 1 Specifying program arguments . . . . . . . . . 21
Restarting a debugging session . . . . . . . . . 21
Installing and configuring Just-in-time debugging. . . . . . . . . . . . . . 22
Turbo Debugger 7 Controlling program execution. . . . . . . . . . 23
Installing Turbo Debugger . . . . . . . . . . . . . 7 The Run menu. . . . . . . . . . . . . . . . . . . 23
Run . . . . . . . . . . . . . . . . . . . . . . . . . 24
Configuring Turbo Debugger. . . . . . . . . . . . 7
Go to Cursor. . . . . . . . . . . . . . . . . . . . 24
Turbo Debugger's configuration files. . . . . . .8 Trace Into . . . . . . . . . . . . . . . . . . . . . 24
Searchffig for configuration files. . . . . . . . . 8 Step Over . . . . . . . . . . . . . . . . . . . . . 24
Setting up the Windows video .DLLs . . . . . . .9 Execute To. . . . . . . . . . . . . . . . . . . . . 25
Dual-monitor debugging . . . . . . . . . . . . . . 9 Until Return. . . . . . . . . . . . . . . . . . . . 25
The Options menu . . . . . . . . . . . . . . . . . .9 Animate . . . . . . . . . . . . . . . . . . . . . . 25
The Language command. . . . . . . . . . . . 10 Back Trace. . . . . . . . . . . . . . . . . . . . . 25
Display Options command. . . . . . . . . . . 10 Instruction Trace . . . . . . . . . . . . . . . . . 25
Display Swapping. . . . . . . . . . . . . . . 10 Arguments. . . . . . . . . . . . . . . . . . . . . 26
Integer Format . . . . . . . . . . . . . . . . . 10 Program Reset. . . . . . . . . . . . . . . . . . . 26
Screen Lines . . . . . . . . . . . . . . . . . . . 11 Next Pending Status . . . . . . . . . . . . . . . 26
Tab Size . . . . . . . . . . . . . . . . . . . . . 11 Waitfor Child . . . . . . . . . . . . . . . . . . . 27
Background Delay. . . . . . . . . . . . . . . 11
User Screen Delay . . . . . . . . . . . . . . . 11 Interrupting program execution . . . . . . . . . 27
Path for Source command . . . . . . . . . . . 11 Stopping in Windows code. . . . . . . . . . . . 27
Save Options command. . . . . . . . . . . . . 12 Reverse execution. . . . . . . . . . . . . . . . . . 27
Restore Options command. . . . . . . . . . . 12 The Execution History window
Files installed with Turbo Debugger. . . . . . . 12 SpeedMenu . . . .. . . . . . . . . . . . . . . 28
Inspect . . . . . . . . . . . . . . . . . . . . . 28
Turbo Debugger's executable and
. support files . . . . . . . . . . . . . . . . . . . . 12 Reverse Execute. . . . . . . . . . . . . . . . 28
Full History . . . . . . . . . . . . . . . . . . 29
Turbo Debugger's utilities. . . . . . . . . . . . . 13
The Keystroke Recording pane . . . . . . . . . 29
Specifying utility command-line options. . . 14
The Keystroke Recording pane SpeedMenu. 29
Turbo Debugger's online text files. . . . . . . . 14
Inspect . . . . . . . . . . . . . . . . . . .' . . 29
Keystroke Restore. . . . . . . . . . . . . . . 29
Chapter 2
Program termination . . . . . . . . . . . . . . . . 30
Starting Turbo Debugger and Resetting your program. . . . ./. . . . . . . . . 30
running your program 15 Exiting Turbo Debugger. . . . .. . . . . . . . . 30
Chapter 3 The Get Info text box . . . . . . . . . . . . . . . 43
The Attach command. . . . . . . . . . . . . . . 44
Debugging with Turbo Debug,ger 31 The as Shell command. . . . . . . . . . . . . . 45
Debugging basics. . . . . . . . . . . . . . . 31 Getting help. . . . . . . .'. . . . . . . . . . . . . 46
Discovering a bug . . . . . . . . . . . . . . . . . 31 Online help . . . . . . . . . . . . . . . . . . . . 46
Isolating the bug . . . . . . . . . . . . . . . . . . 32 The status line. . . . . . . . . . . . . . . . . . . 46
Finding the bug. . . . . . . . . . . . . . . . . . . 32
Fixing the bug. . . . . . . . . . . . . . . . . . . 32 Chapter 4
.What Turbo Debugger can do for you . . . . . 33 Setting and using breakpoints 49
Turbo Debugger's user interface. . . . . . . . . 33
Breakpoints defined . . . . . . . . . . . . . 49
Workffigwithmenus . . . . . . . . . . . . . . . 33
Breakpointlocations. . . . . . . . . . . . . . . . 49
Workffig with windows . . . . . . . . . . . . . . 34
Selecting a window . . . . . . . . . . . . . . . 34 Breakpoint conditions. . . . . . . . . . . . . . . 50
Using window panes . . . . . . . . . . . . . . 34 Breakpoint actions. . . . . . . . . . . . . . . . . 50
Moving and resizing windows. . . . ',' . . . 34 The Breakpoints window . . . . . . . . . . . . . 50
Closing and recovering windows. . . . . . . 35 The Breakpoints window SpeedMenu. . . . . 51
SpeedMenus. . . . . . . . . . . . . . . . . . . . . 35 Breakpoint types . . . . . . . . . . . . . . . . . . 51
Turbo Debugger's windows . . . . . . . . . . . 35 Setting simple breakpoints. . . . . . . . . . . . 51
The View menu's windows. . . . . . . . . . . . 35 Setting expression-true breakpoints . . . . . . 52
Breakpoints window . . . . . . . . . . . . . . 35 Setting changed-memory breakpoints . . . . . 54
Stack window. . . . . . . . . '.' . . . . . . . . 36 Setting global breakpoints . . . . . . . . . . . . 55
Log window ... '. . . . . . . . . . . . . . . . 36 Global breakpoint shortcuts . . . . . . . . . . 55
Watches window. . . . . . . . . . . . . . . . . 36 Setting hardware breakpoints . . . . . . . . . . 56
Variables window . . . . . . . . . . . . . . . . 36 Breakpoint actions . . . . .'. . . . . . . . . . . . 56
Module window. . . . . . . . . . . . . . . . . 36 Break . . . . . . . . . . . . . . . . . . . . . . . . . 57
File window. . . . . . . .. . . . . . . . . . .'. 37 Execute . . . . . . . . . . . . . . . . . . . . . . . 57
CPU window. . . . . . . . . . . . . . . . . . . 37 Log . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Dump window. . . . . . . . . . . . . . . . . . 37 Enable group. . . . . . . . . . . . . . . .. . . . 57
Registers window . . . . . . . . . . . . . . . . 37 Disable group. . . . . . . . . . . . . . . . . . . . 57
Numeric Processor window . . . . . . . . . . 37 Setting breakpoint conditions and actions . . . 58
Execution History window. . . . . . . . . . . 37
Creating breakpoint condition sets . . . . . . . 58
Hierarchy window. . . . . . . . . . . . . . . . 38
Windows Messages window. . . . . . . . . . 38 Creating breakpoint action sets . . . . . . . . . 58
Clipboard window. . . . . . . . . . . . . . . . 38 Multiple condition and action sets . . . . . . . 59
Duplicating windows . . . . . . . . . . . . . . 38 The scope of breakpoint expressions . . . . . . 59
Other windows. . . . '.' . . . . . . . . . . .. . 38 Breakpoint groups . . . . . . . . . . . . . . . . . 59
Inspector windows. . . . . . . . . . . . . . . . 38 Creating breakpoint groups . . . . . . . . . . . 60
User screen . . . . . . . . . . . . . . . . . . . . 39 Deleting breakpoint groups . . . . . . . . . . . 60
Turbo Debugger's special features. . . . . . . . 39 Enabling and disabling breakpoint '
Automatic name completion . . . . . . . . . . . 39 groups. . . . . . . . . . . . . . . . ~ . . . . . . 60
Select by typing. . . . . . . . . . . . . . . . . . . 40 Navigating to a breakpoint location . . . . . . . 61
Incrementalmatching . . . . . . . . . . . . . . . 40 Enabling and disabling breakpoints . . . . . . . 61
Keyboard macros .. . . . . . . . . . . . . . . . . 40 Removing breakpoints. . . . . . . . . . . . . . . 61
The Macros menu . . . . . . . . . . . . . . . . 40 Setting breakpoints on C++ templates . . . . . . 61
Create . . . . . . . . . . . . . . " . . . . . . ; 40 Setting breakpoints on threads . . . . . . . . . . 62
Stop Recording. . . . . . . . . . . . . . . . . 41
Remove . . . . . . .'. . . . . . . . . . . . . . 41 The Log window . . . . . . . . . . . . . . . . . . 63
Delete All . . . . . . . . . . . . . . . . . . . . 41 The Log window SpeedMenu. . . . . . . . . . 63
The Clipboard. . . . . . .. . . . . . .'. . . . . . 41 Open Log File . . . . . . . . . . . . . . . . . 63
The Pick dialog box . . . . . . . . . . . . . . . 41 Close Log File . . . . . . . . ;, '. . . . . . . . 64
The Clipboard window. . . . . . . . . . . . . 42 Logging. . . . . . . . . . . . . . . . . . . . . ,64
The Clipboard window SpeedMenu . . . . . 43 Add Comment. . . . . . . . . . . . . . . . .64
Dynamic updating. . . . . . . . . . . . . . . . 43 Erase Log. . . . . . . . .. . . . . . . . . . . 64
Display Windows Info . . . . . . . . . . . . 64
ii
ChapterS Entering byte lists . . . . . . . . . . . . . . . . . 81
Calling functions. . . . . . . . . . . . . . . . . . 82
Examining and modifying data 65 Expressions with side effects . . . . . . . . . . . 82
The Watches window . . . . . . . . . . . . . . . 65 Format specifiers . . . . . . . . . . . . . . . . . . 83
Creating watches . . . . . . . . . . . . . . . . . . 66
Accessing symbols outside the current
The Watches window SpeedMenu . . . . . . . 67
scope .................. '. . . . . . . . . 83
Watch . . . . . . . . . . . . . . . . . . . . . . 67
Edit . . . . . . . . . . . . . . . . . . . . . . . . 67 How Turbo Debugger searches for
Remove . . . . . . . . . . . . . . . . . . . . . 67 symbols . . . . . . . . . . . . . . . . . . . . . . 83
Delete All . . . . . . . . . . . . . . . . . . . . 67 Implied scope for expression evaluation. . . . 84
Inspect . . . . . . . . . . . . . . . . . . . . . . 67 . Scope override syntax. . . . . . . . . . . . . . . 84
Change . . . . . . . . . . . . . . . . . . . . . 67 Overriding scope in C, C++, and assembler
programs. . . . . . . . . . . . . . . . . . . . . 84
The Variables window. . . . . . . . . . . . . '. . 67 Scope override examples using C. . . . . . 85
The Variable window SpeedMenus. . . . . . . 68 Overriding scope in Object Pascal
Inspect . . . . . . . . . . . . . . . . . . . . . . 68 programs. . . . . . . . '. . . . . . . . . . . . . 86
Change . . . . . . . . . . . . . . . . . . . . . 68 Scobe override examples using
Watch . . . . . . . . . . . . . . . . . . . . . . 69 o ject Pascal. . . . . . . . . . . . . . . . . 86
Show . . . . . . . . . . . . . . . . . . . . . . . 69 Scope and DLLs . . . . . . . . . . . . . . . . . . 87
Viewing variables from the Stack window. . . 69
Inspector windows. . . . . . . . . . . . . . . . . 69 Chapter 7
Opening Inspector windows . . . . . . . . . . . 70 Examining disk files 89
Scalar Inspector windows. . . . . . . . . . . . . 70
Pointer Inspector windows . . . . . . . . . . . . 71 Examining program source files . . . . . . . . . 89
C+-: Structure and Union Inspector Loading source files. . . . . . . . . . . . . . . . 90
wmdows . . . . . . . . . . . . . . . . . . . . . . 71 The Module window SpeedMenu . . . . . . . 90
Object Pascal Record Inspector windows. . . . 72 Inspect . . . . . . . . . . . . . . . . . . . . . 90
Array Inspector windows. . . . . . . . . . . . . 72 Watch . . . . . . . . . . . . . . . . . . . . . . 91
Function Inspector windows . . . . . . . . . . . 73 Thread . . . . . . . . . . . . . . . . . . . . . 91
Module . . . . . . . . . . . . . . . . . . . . . 91
The' Inspector window SpeedMenu . . . . . . . 73 File . . . . . . . . . . . . . . . . . . . . . . . . 91
Range .. '.' . . . . . . . . . . . . . . . . . . 73 Previous ...... : . . . . . . . . . . . . . 91
Change . . . . . . . . . . . . . . . . . . . . . 74 Line . . . . . . . . . . . . . . . . . . . . . . . 91
Inspect . . . . . . . . . . . . . . . . . . . . . . 74 Search . . . . . . . . . . . . . . . . . . . . . . 92
Descend . . . . . . . . . . . . . . . . . . . . . 74 Next . . . . . . . . . . . . . . . . . . . . . . . 92
New Expression . . . . . . . . . . . . . . . . 74 Origin . . . . . . . . . . . . . . . . . . . . . . 92
Type Cast . . . . . . . . . . ~ . . . . . . . . . 74 Goto . . . . . . . . . . . . . . . . . . . . . . . 92
The Stack window . . . . . . . . . . . . . . . . . 74 Edit . . . . . . . . . . . . . . . . . . . . . . . 92
The Stack window SpeedMenu . . . . . . . . . 75 Exceptions . . . . . . . . . . . . . . . . . . . 93
Inspect . . . . . . . . . . . . . . . . . . . . . . 75 Examining other disk files. . . . . . . . . . . . . 93
Locals . . . . . . . . . . . . . . . . . . . . . . 75 The File window SpeedMenu . . . . . . . . . . 94
The Evaluate/Modify command . . . . . . . . . 75 Goto . . . . . . . . . . . . . . . . . . . . . . . 94
Evaluating C++ expressions . . . . . . . . . . . 76 Search . . . . . . . . . . . . . . . . . . . . . . 94
Evaluating Object Pascal expressions . . . . . . 77 Next . . . . . . . . . . . . . . . . . . . . . . . 94
Function Return command . . . .. . . . . . . . 78 Display As . . . . . . . . . . . . . . . ; . . . 94
File . . . . . . . . . . . . . . . . . . . . . . . . 95
Chapter 6 Edit . . . . . . . . . . . . . . . . . . . . . . . 95
Evaluating' expressions 79 Chapter 8
Turbo Debugger's expression evaluator . . . . 79
Selecting an evaluator . . . . . . . . . . . . . . . 79
Assembly-level debugging 97
Expression limitations. . . . . . . . . . . . . . . 80 The CPU window. . . . . . . . .. . . . . . . . : 97
Types of expressions. . . . . . . . . . . . . . . . 80 Opening the CPU window . . . . . . . . . . . 98
Specifying hexadecimal values. . . . . . . . . . 80 The Code pane. . .. . . . . . . . . . . . . . . . 99
Specifying memory addresses . . . '. . . . . . . 81 Displaying source code . . . . . . . . . . . . . 99
Entering line numbers. . . . . . . . . . . . . . . 81 Setting breakpoints. . . . . . . ;' . . . . . . . .100
iii
The Code pane SpeedMenu . . . . . . . . . . 100 Specifying the messages to track . . . . . . . .114
Goto . . . : . . . . ; . . . .. . . . . . . . . 100 Specifying a message class to track . . . . . .114
Origin . . . . . . . . . . . . . . . . . . . . . 100 Specifying the message action. . . . . . . . . .115
Follow . . . . . . . . . . . . . . . . . . . . . 100 Breaking on messages . . . . . . . . . . . . . .115
Caller. . . . . . . . . . . . . . . . . . . . . . 100 Logging messages . . . . . . . . . . . . . . . .116
Previous . . . . . . . . . . . . . . . . . . . . 100 Deleting message class and action
Search . . . . . . . . . . . . . . . . . . . . . 100 settings. . . . . . . . . . . . . . . . . . . . . .116
View Source . . . . . . . . . . . . . . . . . 101 Message tracking tips. . .. . . . . . . . . . . .116
Mixed . . . . . . . . . . . . . . . . . . . . . 101 Debugging dynamic-linklibraries . . . . . . . 117
Thread . . . . . . . . . . . . . . . . . . . . . 101 Stepping into DLL code . . . . . ',' . . . . . . . 117
OS Exceptions . . . . . . . . . . . . . . . . 101 Returning from a DLL . . . . . . . . '. . . . . .117
NewEIP . . . . . . . . . . . . . . . . . . . . 102
Accessing DLLs and source-code modules . .118
New CS:IP. . . . . . . . . . . . . . . . . . . 102
Assemble . . . . . . . . . . . . . . . . . . . 102 Changing source modules . . . . . . . . . . .118
I/O . . . . . . . . . . . . . . . . . . . . . . . 102 Changing executable files .. '.' . . . . . . . .119
The Registers pane . . . . . . . . . . . . . . . . 103 Adding DLLs to the DLLs & Programs
list . . . . . . . . . . . . . . . . . . . . . . . . 119
The Registers pane SpeedMenu . ',' . . . . . 103 Stepping over DLLs. . . . . . . . . . . . . .. .119
Increment. . . . . . . . . . . . . . . . . . . 103
Decrement . . . . . . . . . . . . . . . . . . 103 Debugging DLL startup code . . . . . . . . . .120
Zero ... ' . . . . . . . . . . . . . . . . . . . 103 Debugging multithreaded programs . . . . . 121
Change . . . . . . . . . . . . . . . . . . . . 103 The Threads Information pane . . . . . . . . .121
Registers 32-bit. . . . . . . . . ;. . . . . . 103 The Threads List pane. . . . . . . . . . . . . . .122
The Flags pane . . . . . . . . . . . . . . . . . . 103 Threads List pane SpeedMenu. . . . . . . . .122
The Flags pane SpeedMenu. . . . . . . . . . 104 Options. . . . . . . . . . . . . . . . . . . . .122
The Dump pane. . . . . . . . . . . . . . . . . . 104 Make Current . . . . . . . . . . . . . . . . .122
The Dump pane SpeedMenu. . . . . . . . .. 104 Inspect . . . . . . . . . . . . . . . . . . . . .123
Goto . . . . . . . . . . . . . . . . . . . . . . 105 All Threads. . . . . . . . . . . . . . . . . . .123
Search . . . . . . . . . . . . . . . . . . . . . 105 Step . . . . . . . . . . . . . . . . . . . . . . . 123
Next .. " ...... ;' . . . . . . . . . . . . 105 The Threads Detail pane . . . . '. . . . . . . . .123
Change . . . . . . . . . . . . . . . . . . . . 105 Tracking operating-system exceptions . . . . 124
Follow . . . . . . . . . . . . . . . . . . . . . 105 Specifying user-defined exceptions. . . . . . .125
Previous . . . . . . . . . . . . . . . . . . . . 105 Obtaining memory and module lists . . . . . 125
Display As . . . . . . . . . . . . . . . . . . 106 Listing the contents of the global heap .. . . .126
Block . . . . . . . . . . . . . . . . . . . . . . 106 Listing the contents of the local heap. . . . . .127
The Stack pane . . . . . . . . . . . . . . . . . . 106 Listing the Windows modules. . . . . . . . . .127
The Stack pane SpeedMenu . . .. . . . ., . 106
Goto . . . . . . . . ; . . . . . . . . . . . . . 107 Converting memory handles to
Origin . . . . . . . . . . . . . . . . . . . . . 107 addresses . . . . . . . . . . . . . . . . . . . . . 128
Follow . . . . . . . . . . . . . . . . . . . . . 107
Previous. . . . . . . . . . . . . . . . . . . . 107 Chapter 10
Change . . . . . . . . . . . . . . . . . . . . 107 Debugging object-oriented
The Selector pane. . . . . . . . . . . . . . . . . 107 programs 129
The Selector pane SpeedMenu. . . . . . . . .107
Selector . . . . . . . . . . . . . . . . . . . . 108 The Hierarchy window . . . . . . . . . . . . . 129
Examine. . . . . . . . . . . . . . .. . . . . . 108 The Classes pane . . . . . . . . . . . . . . . . . . . 130
The Dump window . . . . . . . . . . . . . . . 108 The Classes pane SpeedMenu . . . . . . . . .130
The Registers window. . . . . . . . . . . . ., 108 Inspect . . . . . . . . . . . . ',' . . . . . . .130
Tree . . . . . . . . . . . . . . . . . . . . '... 130
Chapter 9 The Hierarchy pane. . . . .. . . . . . . . . . .130
The Hierarchy pane SpeedMenu . . . . . . . . 130
Windows debugging features 111 Inspect . . . . . . .. . . . . . . . . . . . . .130
Monitoring window messages. . . . . . . . . 111, Parents . . . . . . . . . . . . . . . . . . . . .130
Specifyillg a wmdow to monitor. . . . . . . . 112 The Parents pane . . . . . . . . . . . . . . . . . . . 131
Specifying a window procedure. . . . . . 113 The Parent pane SpeedMenu. . . . . . . . . .131
Specifying a window handle. . . . . . . . 113 Class Inspector windows . . . . . . . .. . . . 131
Deleting window selections . . . . . . . . . . 113
iv
The Class Inspector window Mouse support (disabling/enabling) . . . . . . 145
SpeedMenus. . . . . . . . . . . . . . . . . . . 132 Remote debugging (-r options) . . . . . . . . .145
Inspect. . . . . . . . . . . . . . . . . . . . . 132 Source code handling (-s options) . . . . . . .146
Hierarchy . . . . . . . . . . . . . . . . . . . 132 Starting directory (-t) . . . . . . . . . . . . . . . 146
Show Inherited. . . . . . . . . . . . . . . . 132 Video hardware handling (-v options). . . . .146
Object Inspector windows. . . . . . . . . . . . 132 Windows crash message checking (-we). . . .147
The Object Inspector window - WindowsDLL checking (-wd) . . . . . . . . . 147
SpeedMenus. . . . . . . . . . . . . . ..... 133 Command-line option summary . . . . . . . . 147
Range . . . . . . . . . . . . . . . . . . . . . 133
Change . . . . . . . . . . . . . . . . . . . . 133 AppendixB
Methods. . . . . . . . . . . . . . . . . . . . 133
Show Inherited. . . . . . . . . . . . . . . . 133 Remote debugging 149
Inspect. . . . . . . . . . . . . . . . . . . . . 133 Hardware and software requirements. . . . . 149
Descend. . . . . . . . . . . . . . . . . . . . 134 Starting the remote debugging session . . . . 150
New Expression . . . . . . . . . . . . . . . 134
Type Cast . . . . . . . . . . . . . . . . . . . 134 Setting up the remote system . . . . . . . . . .150
Hierarchy . . . . . . . . . . . . . . . . . . . 134 Configuring and starting WREMOTE . . . . .150
Serial configuration . . . . . . . . . . . . . . .151
Object Pascal property inspection . . . . . . . 134 LAN configuration . . . . . . . . . . . . . . . .151
Exceptions . . . . . . . . . . . . . . . . . . . . . 135 Saving the communication settings . . . . . .152
C++ exception handling. . . . . . . . . . . . . 135 Starting WREMOTE . . . . . . . . . . . . . . .152
C exception handling . . . . . . . . . . . . . . 136 WREMOTE command-line options ......152
Object Pascal exception handling . . . . . . . 136 Starting and configuring TDW . . . . . . . . .153
Serial configuration . . . . . . . . . . . . . . .153
Chapter 11 LAN configuration . . . . . . . . . . . . . . . .153
Debugging TSRs and device Initiating the remote link . . . . . . . . . . . .154
Automatic file transfer . . . . . . . . . . . . . .154
drivers 137 TDW's remote debugging command-line
What's a TSR? . . . . . . . . . . . . . . . . . . 137 options. . . . . . . . . . . . . . . . . . . . . .155
Debugging a TSR. . . . . . . . . . . . . . . . . 138 Local and remote system names . . . . . .155
What's a device driver? . . . . . . . . . . . . . 140 Remote DOS debugging. . . . . . . . . . . . . 156
Debugging a device driver . . . . . . . . . . . 140 Differences between TDREMOTE and
WREMOTE . . . . . . . . . . . . . . . . . . . . 156
Appendix A Transferring files to the remote system . . . . . 157
Command-line options 143 Troubleshooting.................. 157
Command-line option details . . . . . . . . . . 143 AppendixC
Attaching to a running process . . . . . . . . . 144 Turbo Debugger error messages 159
Loading a specific configuration file (-c) ... 144
Display updating (-d options) . . . . . . . . . 144 TD, TDW, and TD32 messages. . . . . . . . . 159
Getting help(-h-and -? options) . . . . . . . . 145 Status messages . . . . . . . . . . . . . . . . ".. 169
Session restart modes (-j options) . . . . . . . 145 TDREMOTE messages. . . . . . . . . . . . . . 170
Keystroke recording (-k) . . . . . . . . . . . . 145 WREMOTE messages . . . . . . . . . . . . . . 171
Assembler-mode startup (-1) . . . . . . . . . . 145
Index 173
v
Tables
1.1 Turbo Debugger's exerutable and 8.1 CPU window panes . . . . . . . . . . . . . . . . 98
support files . . . . . . . . . . . . . . . . . . . . 12 8.2 CPU window positionillg . . . . ~ . '. . . . . .99
1.2 Turbo Debugger's utilities ...... ' ...... 13 8.3 Mixed command options. . . . . . . . . . . . 101
1.3 Turbo Debugger's online files . . . . . . . . . 14 8.4 I/O commands. . . . . . . . . . . . . . . . . . 102
2.1 Turbo Debugger programs . . . . . . . . . ; . 17 8.5 The CPU Flags . . . . . . . . . . . . . . . . . . 103
2.2 Starting Turbo Debugger . . . . . . . . . . . . 17 8.6 Follow command options . . . .. . .. . . . 105
3.1 Turbo Debugger's debuggmg functions ... 33 8.7 Display As command options. . . . . . . . . 106
3.2 Clipboard item ~es. . . . . . . . . . . . . . . 42 8.8 Block command options . . . . . . . . . . . . 106
3.3 TDW's System Information text box. . . . . . 44 9.1 Wmdow$ Messages wmdow panes . . . . . 112
3.4 Windows NT System Information 9.2 Format of a global heap list . . . . . . . ... 126
text box. . , . . . . . . . . . . '. . . . . . . . . . 44 9;3 Format of a local heap list . . . . . . . . . . . 127
4.1 Breakpomt types . . . . . . . . . . . . . . . .. 51 9.4 Format of a Wmdows module list ...... 128
5.1 Evaluate/Modify dialog box fields ...... 76 A.1 Turbo Debugger's command-line options .147
6.1 Hexadecimal notation . . . . . . . . . . . . . . 81 B.1 WREMOTE command-line options ..... 152
6.2 Segment:Offset address notation; . . . . . . . 81 B.2 TDW's remote debuggmg command-line
6.3 Byte lists . . . .. . . . . . . . . . . . . . . . . . 82 options. . . . . . . . . . . . . . . . . . . . . . . 155
6.4 Expression format specifiers . . . . . . . . . . 83 B.3 TDREMOTE command-line options. . ... 156
Figures
1.1 The Display Options dialog box . . . . . . . . 10 5.7 A Function fuspector window. . . . . . . . . .73
2.1 The Load a New Program to Debug 5.8 The Stack wmdow. . . . . . . . . . . . . . . .. 75
dialog box. . . . . . . . . . . . . . . . . . . . . . 19 5.9 The Evaluate/Modify dialog box. . . . ....76
2.2 The Enter Program Name to Load . 7.1 The Module window . . . . . . . . . . . . . . .89
dialog box. . . . . . . . . . . ., . . . '.' . . . . 20 7.2 The File window. . . . . . . . . . . . . . . . . .93
2.3 The Set Restart Options dialog box. . . . ~ . . 22 7.3 The File window showing hex data. . . . . . .93
2.4 The Execution History wmdow . . . . . . . . 28 8.1 TheCPUwindow . . . . . . . . . . . . . . . . .98
3.1 The Pick dialog box. . . . . . . . . . . . . . . . 41 8.2 The Dump window. . . . . . . . . . . . ... 108
3.2 The Clipboard window . . . . . . . . . . . . . 42 8.3 The Registers window . . . . . . . . . . . . . 109
3.3 The Get Info text box. . . . . . . . . . . . . . . 43 9.1 The Windows Messages window. . . .. . . 112
3.4 The Attach to and Debug a Running 9.2 The Set Message Filter dialog box. . . . . . . 114
Process dialog box. . . . . . . . . . . . . . . . . 45 9.3 The Load Module Source or DLL
3.5 The normal status line . . . . . . . . . . . . . . 47 Symbols dialog box . . . . . . . . . . . . . . . 118
3.6 The status line with Alt pressed. . . . . . . . : 47 9.4 The Threads window . . . . . . . " . . . . . . 121
3.7 The status line with Ctrl pressed . . . ... . . . 47 9.5 The Thread Options dialog box. . . . . . . . 122
4.1 TheBreakpomtswmdow . . . . . . . . . . . . 50 9.6 The Specify Exception Handling
4.2 The Breakpomt Options dialog box . . . . . . 53 dialog box. . . . . . . . . . . . . . . . . . . .". 124
4.3 The Conditions and Actions dialog box. . . . 53 9.7 TDWs Wmdows Information
4.4 The Edit Breakpomt'Groups dialog box. ; . . 60 dialog box. . . . . . . . . . ... . . . . . . . . . 126
4.5 The Log window . . . . . . . . . . . . . . . . . 63 10.1 The Hierarchy window . . . . . . . . . . . . . 129
5.1 The Watches window . . . . . . . . . . . . . . 66 10.2 A Class Inspector window. . . . . . . . . . . 131
5.2 The Variables window . . . . . . . . "...... 68 10.3 An Object Inspector window . . . . . . . .. -133
5.3 A Scalar fuspector window . . . . . . . . . . . 70 10.4 The Specify C and C++ Exception
5.4 A Pointer fuspector wmdow . . . . . . . . .. 71 Handling dialog box. . . . . . . . . . . . . . . 135
5.5 A C Structure and Union Inspector B.1 WRSETUP mam window and Settings
window . . . . . . . . . . . . . . . . . . . . . . . 72 dialog box. . . . . . . . . . . . . . . . . . . . . 151
5.6 A C Array fuspector window. . . . . . . . . . 73
vi
Introduction
Turbo Debugger is a set of tools designed to help you debug the programs you write
with Borland's line of compilers and assemblers. The Turbo Debugger package consists
of a set of executable files, utilities, online text files, example programs, and this manual.
Turbo Debugger lets you debug the programs you're writing for Win16, Win32, and
DOS. When you load your program into Turbo Debugger, you can use the debugger to
control your program's execution and to view different aspects of your program as it
runs. By monitoring your program's output, source code, data structures, and program
values, you can quickly track down the hardest-to-find bugs.
Turbo Debugger uses menus, multiple windows, dialog boxes, and online context-
sensitive help system to provide you with an easy-to-use, interactive debugging
environment. In addition, Turbo Debugger provides a comprehensive set of debugging
features:
Full C, C++, Object Pascal (Delphi), and assembler expression evaluation.
Full program execution control, including program animation.
Low-level access to the CPU registers and system memory.
Complete data inspection capabilities.
Powerful breakpoint and logging facilities.
Windows message tracking, including breakpoints on window messages.
Full object-oriented programming support, including class browsing and object
inspecting.
Reverse execution.
Remote debugging support.
Macro recording of keystrokes to speed up repeated series of commands.
Copying and pasting between windows and dialog boxes.
Incremental matching, automatic name completion, and select-by-typing (to
minimize keyboard entries).
Introduction 1
- Context-sensitive SpeedMenus throughout the product.
Dialog boxes that let you customize the debugger's options.
Hardware requirements
Turbo Debugger's hardware requirements are the same as those of your Borland
language compiler.
Module
This term module refers to what is usually called an object module in C++ and assembler,
and also to what is called a unit in Pascal. .
Function
For readability, this manual uses the term function to refer to assembler, C, and c++
functions; c++ member functions; and to Object Pascal functions, procedures, and
object methods.
Turbo Debugger
In this manual, the term Turbo Debugger refers to the collective set of Turbo Debugger
programs: TD.EXE, TDW.EXE, and TD32.EXE. However, there are times when the text
refers to a specific Turbo Debugger program. In these cases, the term "TDW" refers to
TDW.EXE, "TD32" refers to TD32.EXE, and "TD" refers to TD.EXE.
Introduction 3
This manual also uses the following icons to indicate sections that pertain to specific
Windows operating environments:
Where to now?
The following reading guidelines are proposed to help first-time and experienced Turbo
Debugger users. .
Introduction 5
6 Turbo Debugger User's Guide
Installing and configuring
Turbo Debugger
This chapter describes how to install Turbo Debugger and how to customize its default
options and display settings. Also described in this chapter are the many files that are
installed with the debugger. '
Files ending with .TR, .TRW, and .TR2 extensions contain the session-state settings for
the debuggers. For information on session-state saving, refer to "Restarting a debugging
session" on page 21.
Dual-monitor debugging
Turbo Debugger supports dual-monitor debugging on the following system
configurations:
TD running in DOS
TDW running on Windows 3.1 or Windows 95
TD32 running on Windows 95
NOie Windows NT does not support a dual-monitor setup.
To create a dual-monitor system, you need a color monitor and video adapter, and a
monochrome monitor and video adapter. When you debug with two monitors, Turbo
Debugger appears on the monochrome monitor, and Windows and the program you're
debugging appears on the color monitor. The advantage of this system setup is that you
can see your program's output while you're debugging it with TUrbo Debugger.
If your video adapters can use the Windows 8514 video driver, you can use Turbo
Debugger's DUAL8514.DLL driver to set up dual color monitors for debugging.
Once your hardware setup is complete, use the -do command-line option to load TD or
TDW in dual-monitor mode. If you are debugging with TD32 under Windows 95, use
the -vd command-line option to start Turbo Debugger. For example, the command:
td32 -vd myprog.exe
causes Turbo Debugger to load SVGA32.DLL as the video .DLL, which detects that you
are running Windows 95 with a dual-monitor setup. For more information on
command-line options, see Appendix A.
Display Swapping
You can use the Display Swapping radio buttons to control the way Turbo Debugger
swaps your applications' screens with the debugger' s ~indows.
None Found in TD32 only, this option specifies that no screen-swapping is to take
place. This option provides the fastest and smoothest screen updating when
you're single-stepping through a program and should be used if you're
using dual-monitor debugging. Beware, however, that this option can cause
your display to become corrupted. If this happens, use the Repaint Desktop
on the System menu to repaint the screen. .
Smart Turbo Debugger activates the user screen when it detects that your program
is going to display output and when you step over routines.
Always Turbo Debugger activates the user screen every time your program runs.
Use this option if the Smart option isn't finding all the times the program
writes to the screen. If you choose this option, the screen flickers ev~ry time
you step through your program because Turbo Debugger's screen is
replaced for a short time with the User screen.
Integer Format
The Integer Format radio buttons let you choose the way integers are displayed in
Turbo Debugger.
Screen Lines
Use the Screen Lines radio buttons to select either a 25-line display or a 43- or 50-line
display available with EGA and VGA display adapters.
Tab Size
The Tab Size input box lets you set the number of columns each tab stop occupies. To
see more text in source files that use tab indents, reduce the tab column width. You can
set the tab column width from 1 to 32.
Background Delay
Found only in TD32.EXE, the Background Delay input box lets you specify how often
Turbo Debugger's screens get updated. When you use this setting in conjunction with
the Run IWait for Child command, you can watch the effects of your program through
Turbo Debugger's windows, while your program is running.
DUAL8514.DLL Video .DLL that supports dual-monitor debugging with 8514 monitors.
STB.DLL Video .DLL that supports ~ideo adapters produced by STB.
SVGA.DLL Video .DLL that supports most adapters and monitors.
SVGA32.DLL Video .DLL that supports TD32.EXE in Windows 95 monochrome mode.
TD.EXE Executable program used to debug DOS applications.
TD.PIF .PIF file used to run TD.EXE in a Windows DOS box.
TDDOS.lCO Icon used with TD.EXE.
All of Turbo Debugger's online files are unformatted ASCII files, so you can use your
program editor to access them.
C hap t e r 2, S tar tin 9 T u r boD e bug 9 era n d run n i n 9 you r pro 9 ram 15
'While you're developing C and C++ programs, you might find it best to compile
without compiler optimizations turned on. When certain optimizations are turned on,
the object code produced by the compiler might not exactly match your program source
code; this can make stepping through code confusing. Because of this, you should
compile your program with optimizations turned on only after you've fully debugged
your program.
While TD must be started from the DOS command line, TDW and TD32 can be started
from the Windows locations listed in the following table:
Table 2.2 Starting Turbo Debugger
Windows Open your Borland compiler's group from the Program Manager, and
choose the TOW or T032 icon.
The C++ integrated Choose Tools ITurbo Debugger to debug the program in the active Edit
environment window.
Delphi Choose Tools ITurbo Debugger to debug the applications the active Code
Edit window.
Windows' Program Manager From the Command input box, type TDW or TD32, followed by any
File IRun dialog box command-line options.
Windows File Manager Double-click either the TOW.EXE or T032.EXE executable file icon from
the directory' containing Turbo Debugger.
C hap t e r 2, Star tin 9 T u r boD e bug 9 era n d run n i n 9 you r pro 9 ram 17
TD32 -jp rny_prog rnqrnrnal river
The Files list box displays the files in the currently selected directory. By entering a file
mask into the File Name input box (such as *.EXE), you can specify which files should be
listed. You can also use the File Name input box to change disk drives.
To "walk" through disk directories, double-click the entries listed in the Directories list
box (the .. entry steps you back one directory level). Once you've selected a directory,
choose a file to load from the Files list box. To quickly search for a file, type a file name
into the Files list box. Turbo Debugger's incremental matching feature moves the
highlight bar to the file that begins with the letters you type. Once you've selected a file,
press OK. This action returns you to the Load a New Program to Debug dialog box.
After you've specified a program in the Load a New Program to Debug dialog box,
specify whether or not you want the debugger to run its startup code. If you check the
Execute Startup Code check box, Turbo Debugger runs the program to WinMain (or its
C program equivalent) or Application.CreateO (for Delphi programs) when you load the
program. If you leave this box unchecked, Turbo Debugger will not run any code. when
you load the program.
To support remote debugging, TDW contains a set of radio buttons in the Load a New
Program to Debug dialog box. The Session radio buttons specify whether or not the
program you're debugging is on a local or remote system. If it's located on a remote
system, select the Remote Windows radio button; if it's not on a remote system, select
Local. See Appendix B for complete instructions on remote debugging.
Note Before loading a program into the debugger, be sure to compile your source code into
an executable file (.EXE or .DLL) with full debugging information. Although you can
load programs that don't,have debug information, you will not be able to use the
Module window to view the program's source code. (The debugger cannot reference
The Restore at Restart check boxes specify which debugger settings you want saved to
the session-state file, and the Use Restart Info radio buttons specify when the session-
state file should be loaded.
Because breakpoint line numbers and variable names can change when you edit and
recompile your source code, the Use Restart Info radio buttons give you the following
options for loading the session-state file:
Just-in-time debugging
Windows NT gives TD32 the ability to trap application exceptions, even when TD32 is
not running. If your application encounters an exception, the Windows NT Program
Registry can automatically launch TD32. TD32 then displays the source line where the
exception occurred.
To set up just-in-time debugging, you must specify a debugger in the Windows NT
program registry. Once set up, Windows NT starts the registered debugger in the event
of an application error. This, mechanism lets you connect TD32 to any process that fails.
Windows NT displays an Application Error dialog box when an unhan<:Ued exception
occurs. The dialog box provides an OK button, which you can choose to terminate the
application. However, if you register a debugger in the Windows NT program registry,
the dialog box will also contain a CANCEL button. Choosing CANCEL invokes the
registered debugger.
C hap t e r 2, S tar tin 9 T u r boD e bug ge ran d run n i n 9 you r pro 9 ram 23
Run
[ill The Run command runs your program at full speed. Control returns to Turbo Debugger
when one of the following ev~nts occurs:
Your program terminates.
A breakpoint with a break action is encountered.
You interrupt execution with the program interrupt key.
A program error halts execution.
A C++ or C exception that you have marked is thrown.
Go to Cursor
0J The Go to Cursor command executes your program up to the line containing the cursor
in the current Module window or CPU Code pane. If the current window is a Module
window, the cursor must be on a line of source code.
Trace Into
Known as single-stepping, this command executes a single source line or assembly-level
instruction at a time.
If the current window is a Module window, a single line of source code is.executed; if
it's a CPU window, a single machine instruction is executed. If the current source line
contains a function call, Turbo Debugger traces into the function, provided that it was
compiled with debug information. If the current window is a CPU window, pressing F7
on a CALL instruction steps to the called routine.
When you single-step through machine instructions (using Trace Into in the CPU
window or by pressing Alt+F7), Turbo Debugger treats certain sets of machine
instructions as a single instruction. This causes multiple assembly instructions to be
executed, even though you're single-stepping through the code.
Here is a list of the machine instructions that cause multiple instructions tp be executed
when you are single-stepping at the instruction level:
CALL LOOPNZ
INT LOOPZ
LOOP
Also stepped over are REP, REPNZ, or REPZ followed by CMPS, CMPS, CMPSW,
LODSB, LODSW, MOVS, MOVSB, MOVSW, SCAS, SCASB, SCASW, STOS,
STOSB, ot STOSW.
Turbo Debugger treats C++ class member functions and Object Pascal class methods
just like other functions; F7 traces into the source code if it's available.
Step Over
[ill The Step Over command, like the Trace Into command, executes a single line of source
code or machine instruction at a time. However, if you issue the Step Over command
when the instruction pointer is located at a routine call, Turbo Debugger executes that
routine at full speed, and places you at the statement following the routine call.
Execute To
[I[]lliJ Executes your program until the address you specify in the Enter Code Address to
Execute To dialog box is reached. The address you specify might never be reached if a
breakpoint action is encountered first, or if you interrupt execution.
Until Return
[I[][}]] Executes your program until the current routine returns to its caller. This is useful in two
circumstances: when you've accidentally single-stepped into a routine that you don't
need to debug, or when you've determined that the current routine works to your
satisfaction, and you don't want to slowly step through the rest of it.
Animate
Performs a continuous series of Trace Into commands, updating the screen after each
one. The animate command lets you watch your program's execution in "slow motion,"
and see the values of variables as they change. Press any key to interrupt this command.
After you choose Run I Animate, Turbo Debugger prompts you for a time delay
between successive traces. The time delay is measured in tenths of a second; the default
is 3.
Back Trace
[I[](E] If you're tracing through your program using F7 or Alt+F7, you can use Back Trace to
reverse the direction of program execution. Reverse execution is handy if you trace
beyond the point where you think there might be a bug, and you want to return to that
point.
Using the Back Trace command, you can back-trace a single-step at a time or back-trace
to a specified point that's highlighted in the Execution History window. Although
reverse execution is always available in the CPU window, you can execute source code
in reverse only if Full History is turned On in the Execution History window.
For complete instructions on the Execution History window, see page 28.
Instruction Trace
[I[][TI] The Instruction Trace command executes a single machine instruction. Use this
command when you want to trace into an interrupt, or when you're in a Module
window and you want to trace into a routine that doesn't contain debug information
(for example, a library routine).
Since you will no longer be at the start of a source line, issuing this command usually
places you inside a CPU window.
Program Reset
@ill@' The Program Reset command terminates the program you're running and reloads it
from disk. You might use this command in the following circumstances:
When you've executed past the place where you think there is a bug.
When your program has terminated and you want to run it again.
If you've suspended your application with the program interrupt key and you want-
restart it from the beginning. Make sure, however, that you don't interrupt the
execution of your program if Windows kernel code is executing.
If you want to debug a DLL that's already been loaded. To do so, set the Debug
Startup option in the Load Module Source or DLL Symbols dialog box to Yes for the
DLL you're interested in, and reset your program.
If you choose the Program Reset command while you're in a Module or CPU window,
the Turbo Debugger resets the Instruction Pointer to the beginning of the program.
However, the display is not changed from the location where you issued the Program
Reset command. This behavior makes it easy for you to resume debugging from the
position you were at prior to issuing the Program Reset command.
For example, if you chose Program Reset because you executed a few statements past a
bug, press Ctrl+F2 to reset your program and reposition the cursor up a few lines in your
source file. Pressing F4 will then run to that location.
Note Windows 3.x will free all your application resources only after it receives a WM_QDIT
message. Because of this, make sure you run your program to termination before you
issue the Program Reset command.
Warning! If you reset a dialog application that does not have a parent window, your system might
freeze when Turbo Debugger reloads the application.
Reverse execution
Turbo Debugger's execution history keeps track of each instruction as it's executed,
provided that you're tracing into the code. Using the Execution History window, you
can examine the instructions you've executed and, if you like, return to a point in the
C hap t e r 2, S tar tin 9 T u r boD e bug 9 era n d run n i n 9 you r pro 9 ram 27
program where you think there might be a bug. Turbo Debugger can record about 400
instructions.
Inspect
Takes you to the command highlighted in the Instructions pane. Ifit is a line of source
code, you are shown that fine in the Module window. If there is no source code, the CPU
window opens with the instruction highlighted in the Code pane.
Reverse Execute
@J[ill Reverses program execution to the instruction highlighted in the window, and activates
the Code pane of the CPU window. If you selected a line of source code, you are
returned to the Module window. .
IN INSB OUTSB
OUT INSW OUTSW
Full History
Toggles from On to ,Off. If it's set to On, backtracing is enabled. If it's set to Off,
backtracing is disabled.
Inspect
When you highlight a line in the Keystroke Recording pane and choose Inspect from the
SpeedMenu, Turbo Debugger activates either the Module window or the CPU window
with the cursor positioned on the line where the keystroke occurred.
Keystroke Restore
If you highlight a line in the Keystroke Recording pane, then choose Keystroke Restore,
Turbo Debugger reloads your program and runs it to the highlighted line. This is
especially useful after you execute a Turbo Debugger command that deletes your
execution history.
C hap t e r 2, Star tin 9 T u r boD e bug 9 era n d run n i n 9 you r pro 9 ram 29
Program termination
When your program terminates, Turbo Debugger regains control and displays a
message indicating the exit code that your program returned. After this, issuing any of
the Run menu options causes Turbo Debugger to reload your program.
The program segment registers and stack are usually incorrect after your program has
terminated, so don't examine or modify any program variables after termination.
Debugging basics
The debugging process can be broadly divided into four steps:
1 Discovering a bug
2 Isolating the bug
3 Finding the bug
4 Fixing the bug
These four steps offer a simplified model of an actual debugging session. As a general
rule, it's best to divide your program into discrete sections and debug each section
separately. By verifying the functionality of each section before moving on, you can
debug even the largest and most complicated programs.
Regardless of your personal debugging approach, one thing remains constant: testing
and fixing source code is a part of producing software. As your programming projects
become more complex, you'll reduce the June you spend debugging by developing a
systematic method for testing your software.
Discovering a bug
The first debugging step can be painfully obvious. You run your program and the
computer freezes. However, the presence of a bug might not be so obvious. Your
Selecting a window
Each window that you open is numbered in the upper right comer to allow quick access
to that window. Usually, the Module window is window 1 and the Watches window is
window 2. The window you open next will be window 3; and so on.
You can activate any of the first nine open windows by pressing Alt in combination with
the window number. For example, if you press Alt+2 to make the Watches window
active, any commands you choose will affect that window and the items in it.
The bottom half of the Window menu lists the open windows. To activate a specific
window, open the Window menu and press the window number. If you have more
than nine windows open, the window list will include a Window Pick command;
)choose it to open a menu of all the windows open onscreen.
You can also cycle through the windows onscreen by pressing F6 (or choosing
Window INext). This is handy if an open window's number is covered up and you
don't know which number to press t~ make it active.
SpeedMenus
Each Turbo Debugger window has a special SpeedMenu that contains commands
specific to that window. In addition, individual panes within a window can have
unique SpeedMenus. To access a SpeedMenu in the currently active window (or
window pane), do one of the following:
Press the right mouse button inside the active window (or window pane).
Press Alt+F10 to open the currently active window SpeedMenu.
Press Gtrl and the highlighted letter of the SpeedMenu command to choose that
command (shortcut keys must be enabled for this to be effective).
Breakpoints window
You use the Breakpoint window to set, modify, or delete breakpoints. A breakpoint
defines a location in your program where the debugger can pause the execution of your
program so you can examine its status.
Stack window
The Stack window displays the current state of the program stack. The first function
called is listed on the bottom of window, with each subsequently called function layered
on top.
You can bring up and examine the source code of any function listed in the Stack
window by highlighting it and pressing Ctr/+/. In addition, you can open a Variables
window that displays all local variables and function arguments by highlighting a
function in the Stack window and pressing Ctr/+L. Chapter 5 provides detailed
information on the Stack window.
Log window
The Log window displays the contents of the message log, which contains a scrolling list
of messages and information generated as you work in Turbo Debugger. It tells you
such things as why your program stopped, the results of breakpoints, and the contents
of windows you saved to the log.
You can also use the log window to obtain information about memory usage, modules,
and window messages for your Windows application. For more information on the Log
window, see Chapter 4.
Watches window
The Watches window displays the values of variables and expressions. By entering
expressions into the Watches window, you can track their values as they change during
the program execution. Watches can be easily added to the Watches window by
pressing Ctrl+ Wwhen the cursor is on a variable in the Module window. See Chapter 5
for more about the Watches window.
Variables window
The Variables window displays all the variables within a given scope of your program.
The upper pane of the window lists global variables and the lower pane shows any
variables local to the current function.
This Variables window is helpful when you want to find a routine or symbol whose
name you can't fully remember. By looking in the global Symbol pane, you can quickly
find what you want. Chapter 5 describes the Variables window in more detail.
Module window
The Module window is perhaps the most important window in the debugger, because it
displays the source code for the program module you're currently debugging (this
includes any DLLs your program might call). However, for the source code of a module
to be displayed, the module must be compiled with debug information. Chapter 7
describes the Module window and its commands.
CPU window
The CPU window (described in Chapter 8) displays the current state of the central
processing unit (CPU). This window has six panes showing: the program's
disassembled machine instructions, the contents of the Windows selectors (in TDW.EXE
only), data as hex bytes, the stack as hex words, the CPU registers, and the CPU flags.
The CPU window is useful when you want to watch the exact sequence of instructions
that make up a line of source code, or the bytes that comprise a data structure. This view
is also used when you want to debug Assembler programs.
Dump window
The Dump window displays the raw hexadecimal contents of any area of memory.
(This window is the same as the Dump pane of a CPU window.)
Using the Dump window, you can view memory as characters, hex bytes, words,
doublewords, or any floating-point format. In addition, the SpeedMenu has commands
to let you modify the displayed data and manipulate blocks of memory. See Chapter 8
for more on the Dump window.
Registers window
The Registers window displays the contents of the CPU's registers and flags. This .
window has two panes, a registers pane and a flags pane. You can change the value of
any of the registers or flags through this window's SpeedMenu commands. Chapter 8
provides more information on the Registers window.
Hierarchy window
The Hierarchy window displays a hierarchy tree of all classes used by the current
module. The window has two panes: one for the class list, the other for the class
hierarchy tree. This window shows you the relationship of the classes used by the
current module. Using this window's SpeedMenu commands, you can examine the
data members and member functions (for c++ programs) or fields and methods (for
Object Pascal programs) of any class. See Chapter 10 for more information about using
the Hierarchy window.
Clipboard window
Turbo Debugger's Clipboard is used for clipping and pasting items from one debugger
window to another. The Clipboard window shows the items you have clipped and their
. item types. See page 41 for more information on Turbo Debugger's Clipboard.
Duplicating windows
Use the View IAnother command on the Views menu to duplicate the following three
windows: the Dump window, the File window, and the Module window.
Using the Another command lets you keep track of different areas of assembly code,
different program files, or different areas of memory.
Other windows
In addition to the windows listed on the Views menu, Turbo Debugger also lets you
access Inspector windows and the user screen.
Inspector windows
An Inspector window displays the current value of a selected variable. Open it by
choosing Data IInspect or Inspect from a SpeedMenu. Usually, you close this window
by pressing Esc or clicking the close box with the mouse. If you've opened more than
one Inspector window in succession, as often happens when you examine a complex
da'ta structure, you can remove all the Inspector windows by pressing Alt+F3 or using the
Window IClose command.
You can open an Inspector window to look at an array of items or to examine ,the
contents of a variable or expression. The number of panes in the window depends on
User screen
The user screen shows your program's full output screen. The screen you see is exactly
the same as the one you would see if your program was running directly under
Windows and not under Turbo Debugger.
You can use this screen to check that your program is at the place in your code that you
expect it to be, and to verify that it's displaying what you want on the screen. To switch
to the user screen, choose Window IUser Screen. After viewing the user screen, press
any key to return to the debugger screen.
Alt+FS is the hot key that toggles between the environment and the user screen.
Select by typing
A number of windows lets you st~rt typing a new value or search string without first
choosing a SpeedMenu command. Select by typing usually applies to the most frequently
used SpeedMenu commands, like Goto in a Module wirldow, Search ina File window,
or Change in a Registers window. .
Incremental matching
Turbo Debugger's incremental matching. feature helps you find entries in alphabetical
lists. As you type each letter, the highlight bar moves to the first item starting with the
letters you've just typed. The position of the cursor in the highlighted item indicates
how much of the name you have already typed.
Once an item is selected (highlighted) from a list, you can press Alt+F10 or click the right
mouse button to display the SpeedMenu and choose a command relevant to the
highlighted item. In many lists, you can also just press Enter once you have selected an
item. This acts as a hot key to one of the commonly used local-menu commands.
Keyboard macros
Macros are simply hot keys that you define. You can assign any series of commands and
keystrokes to a single key, and use them whenever you want.
Create
When issued, the Create command starts recording keystrokes to an assigned macro
key. As an alternative, press the Alt+=(Alt+Equal) hot key for Create.
When you choose Create to start recording, you are prompted for a key to assign the
macro to. Respond by typing in a keystroke or combination of keys (for example,
Shift+F9). The message RECORDING will be displayed in the upper right comer of the screen
while you record the macro.
Remove
Displays a dialog box listing all current macros. To delete a macro, select it from the list
and press Enter.
Delete All .
Removes all keystroke macro definitions and restores all keys to their original meaning.
The Clipboard
Turbo Debugger has an extensive copy and paste feature called the Clipboard. With the
Clipboard you can copy and paste between Turbo Debugger windows and dialog
boxes.
The items copied to the Clipboard are dynamic; if an item has an associated value, the
Clipboard updates the value as it changes during your program's execution.
To copy an item into the Clipboard, position the cursor on the item (or highlight it with
the Ins and arrow keys), then press Shift+F3. To paste something into a window or dialog
box from the Clipboard, press Shift+F4 (or use the Clip button in the dialog box) to bring
up the Clipboard's Pick dialog box.
The Pick dialog box contains a list of the items in the Clipboard and a set of radio
buttons that lets you paste the items in different ways: .
Each listing in the Clipboard window begins with the Clipboard item type. The item
type is followed with the Clipboard item, and (if the item is an expression) the item's
value. The following table shows Turbo Debugger's Clipboard item types:
Table 3.2 Clipboard item types
Dynamic updating
The Clipboard dynamically updates the values of any items that can be evaluated, such
as expressions from the Watches window. However, the Freeze command on the
Clipboard window SpeedMenu lets you tum off the dynamic updating for specific
Clipboard items. This lets you use the Clipboard as a large Watches window, where you
can freeze and unfreeze items as you like.
. All System Information text boxes display the following general information:
Mode Memory modes can be large-frame EMS, small-frame EMS, and non-EMS (extended
memory).
Banked The amount in kilobytes of memory above the EMS bank line (eligible to be swapped to
expanded memory if the system is using it).
Not banked The amount in kilobytes of memory below the EMS bank line (not eligible to be swapped
to expanded memory).
Largest The largest contiguous free block of memory, in kilobytes.
Symbols The amount of RAM used to load you program's symbol table.
TDW's System Information text box contains an additional field located under the
Global Memory information. The Hardware field displays either Hardware or Software,
depending on whether or not the TDDEBUG.386 device driver has been installed. For
information on hardware debugging, see page 56.
In addition to the general information previously listed, the Windows NT System
Information text box displays the following memory statistics:
Table 3.4 Windows NT System Information text box
Getting' help
Turbo Debugger offers several ways to obtain help while you're in the middle of a
debugging session:
[ill - You can access an extensive context-sensitive help system by pressing F1. Press F1
again to bring up an index of help topics from which you can select what you need.
-An activity indicator in the upper right comer always displays the current activity.
'For example, if your cursor is in a window, the ,activity indicator reads READY; if there's
a menu visible, it reads MENU;jf you're in a dialog box, it reads PROMPT. Other activity
indicator modes are SIZE/MOVE, MOVE, ERROR, RECORDING, REMOTE, WAIT, RUNNING, HELP, STATUS,
PENDING, and PLAYBACK.
- The status line at the bottom of the screen always offers a quick reference summary of
keystroke commands. The line changes as the context changes and as you press Alt or
etrl. Whenever you are in the menu system, the status line offers a one-line synopsis
of the current menu command.
Online help
Turbo Debugger offers context-sensitive help at the touch of a key. Help is available
anytime you're in a menu or window, or when an error message or prompt is displayed.
Press F1 to bring up a Help screen showing information pertinent to the current context
(window or menu). If you have a mouse, you can also bring up help by clicking F1 on
the status line. Some Help screens contain highlighted keywords that let you get
additional help on that topic. Use the arrow keys to move to any keyword and then
press Enterto get to its screen. Use the Home and End keys to go to the first and last
keywords on the screen, respectively.
You can also access the onscreen help feature by choosing Help from the menu bar
(Alt+H).
To return to a previous Help screen, pressAlt+F1 or choose Previous Topic from the Help
menu. From within the Help system, use PgUp to scroll back through up to 20linked
help screens. (pgDn works only when you're in a group of related screens.) To access the
Help Index, press Shift+F1 (or F1 from within the Help system), or choose Index from the
Help menu. To get help on Help, choose Help I Help on Help. To exit from Help, press
Esc.
If you hold down the Alt key, the commands performed by the Alt-key combinations are
displayed.
Figure 3.6 The status line with Alt pressed
If you hold down the Ctr! key, the commands performed by the Otrl-key combinations are
displayed on the status line. Because this status line shows the keystroke equivalents of
the current SpeedMenu commands, it changes to reflect the current window and pane.
If there are more SpeedMenu commands than can be described on the status line, only
the first keys are shown.
Figure 3.7 The status line withetrl pressed
Whenever you're in a menu or dialog box, the status line displays an explanation of the
current item. For example, if you have highlighted View IRegisters, the status line says
Open a CPU registers window.
Breakpoints defined
Turbo Debugger defines a breakpoint in three ways:
The location in the program where the breakpoint is set.
The condition that allows the breakpoint to activate.
The action that takes place when the breakpoint activates.
Breakpoint locations
A breakpoint is usually set on a specific source line or machine instruction in your
program. When set at a specific location, Turbo Debugger evaluates the breakpoint when
your program's execution encounters the code containing the breakpoint.
Breakpoint conditions
When your program's execution encounters a breakpoint, Turbo Debugger checks the
breakpoint's condition to see if the breakpoint should activate. If the condition evaluates
to true, the breakpoint activates, and its actions are carried out.
The condition of a breakpoint can be any of the following:
Always activate when the breakpoint is encountered.
Activate when an expression evaluates to true.
Activate when a data object changes value.
In addition to the breakpoint condition, a pass count can be specified, requiring that a
breakpoint be encountered a designated number of times before it activates.
When you're deb1Jgging programs written for Windows NT, you can also set
breakpoints that relate to specific program threads. For more on setting breakpoints on
program threads, see the section "Setting breakpoints on threads" on page 62.
Breakpoint actions
When a breakpoint activates, it performs a specified action. A breakpoint's action can be
any of the following:
Pause the program's execution.
Log the value of an expression.
Execute an~expression.
Enable a group of breakpoints.
Disable a group of breakpoints.
The Breakpoints window has two panes. The List pane (on the left) lists th~ addresses of
all currently s~t breakpoints. The Detail pane (on the right) displays the condition and
Breakpoint types
In Turbo Debugger, you can create the following types of breakpoints:
Table 4.1 Breakpoint types
B~~p~t:tW~,> .
Simple breakpoints Always pause your program's execution when they're encountered.
Expression-true breakpoints Pause your program when an expression you enter evaluates to true
(nonzero).
Changed-memory breakpoints Pause your program when a specific location in memory changes
value.
Global breakpoints Expression-true or changed-memory breakpoints that are evaluated
after the execution of each source line or machine instruction is
executed.
Hardware breakpoints Global changed-memory breakpoints that are hardware assisted.
Note You can also set breakpoints on window messages. For a complete description of
message breakpoints, refer to Chapter 9, page 115.
The Breakpoint Options dialog box contains commands that let you modify
breakpoint settings. The Conditions and Actions list box displays the current
settings of the selected breakpoint.
3 To modify a breakpoint's condition and action settings, click the Change button to
open the Conditions and Actions dialog box.
Figure 4.3 The Conditions and Actions dialog box
The Conditions and Actions dialog box lets you customize the conditions under
which a breakpoint is activated, and the actions that take place once the conditions
are met.
3 Select the Expression True radio button.
By default, the breakpoint's condition is set to Always-the breakpoint will activate
each time it is encountered by the program's execution. Clicking the Expression True
radio button specifies that the breakpoint should activate when an expression you
supply becomes true (nonzero).
The area monitored is thus 20 bytes long-an int is 2 bytes and you instructed
Turbo Debugger to monitor ten of them.
Breakpoint actions
The Action radio buttons in the Conditions and Actions dialog box (Figure 4.3) specify
the actions that you want a breakpoint to perform when it activates. Each of the
following actions can be applied to any of the breakpoints you set.
Execute
The Execute button executes an expression that you enter into the Action Expression
input box. For best results, use an expression that changes the value of a variable or data
object.
By "splicing in" a piece of code before a given source line, you can effectively test a
simple bug fix; you don't have to go through the trouble of compiling and linking your
program just to test a minor change to a routine. Keep in mind, however, that you
cannot use this technique to directly modify your compiled program.
Log
The Log button writes the value of an expression to the Log window. Enter the
expression you want evaluated into the Action Expression input box. (For more
information on the Log window, see page 63.)
This command is handy when you want to output a value each time you reach a specific
place in your program (this technique is known as instrumentation). By creating a
breakpoint with a Log action, you can log values each time the breakpoint activates.
For example, you can place a breakpoint at the beginning of a routine and set it to log
the values of the routine arguments. Then, after running the program, you can
determine where the routine was called from, and if it was called with erroneous
arguments. .
Note When you log expressions, be careful of expressions that unexpectedly change the
values of variables or data objects.
Enable group
The Enable Group button causes a breakpoint to reactivate a group of breakpoints that
have been previously disabled. Supply the group integer number to enable in the Action
Expression input box. See page 59 for information on breakpoint groups ..
Disable group
The Disable Group button lets you disable a group of breakpoints. When a group of
breakpoints is disabled, the breakpoints are not erased, they are simply hidden from the
debugging session. Supply the group integer number to disable in the Action
Expression input box.
Breakpoint groups
Turbo Debugger lets you group breakpoints together, allowing you to enable, disable,
or remove breakpoints with a single action. In addition, you can set a group of break-
points on all functions in a module or all member functions in a class with a single
command.
The Group command on the Breakpoints window SpeedMenu activates the Edit
Breakpoint Groups dialog box. Using this dialog box, you can create and modify
breakpoint groups.
Removing breakpoints
You can erase existing breakpoints from either the Breakpoints window SpeedMenu, or
the Breakpoint menu.
The Remove command on the Breakpoint window SpeedMenu erases the breakpoint
currently highlighted in the List pane. Del is the hot key for this command.
The Delete All command, found on both the Breakpoint menu and the Breakpoints
window SpeedMenu, removes all the currently set breakpoints, including global
breakpoints and those set at specific addresses. Use this command with caution; its
effects cannot be reversed.
By default, the Log window can list 50 lines of text. However, you can change the
default using TDWINST.EXE or TDINST32.EXE.
The following debugging actions are tracked by the Log window:
When your program pauses, the program location is recorded in the Log window.
When you use the Log window's Add Comment command, your comment gets
added to the Log window.
When a breakpoint activates that logs an expression, the value of the expression is
written to the Log window.
When you choose the Edit IDump Pane to Log command, the contents of a pane or
window are recorded in the Log window. .
When you use the Display Windows Info command on the Log window SpeedMenu,
the global or local heap information, or the list of program modules is written to the
Log window.
When you set Send to Log Window to Yes from the Windows Messages window, all
window messages sent to that window are copied to the Log window.
Logging
The Logging command enables and disables the writing of events to the Log window.
Use this <;:ommand to control when events are logged. When logging is turned off, the
Log window's title bar displays Paused.
Add Comment
Add Comment lets you insert comments into the Log window. When you choose this
command, a dialog box opens, prompting you for a comment.
Erase Log
Erase Log clears the Log window. This command affects only what's in memory; the log
disk file is not erased by this command.
'Expressions that you enter as watches are listed on the left side of the Watches window,
and their corresponding data types and values appear on the right. The values of items
in compound data objects (such as arrays; structures, and records) appear with their
n.
values between braces ({ The Watches window truncates any expressions or values
that do not fit into the window.
Creating watches
To create a watch, choose one of the following commands:
The Data IAdd Watch command
The Module window SpeedMenu Watch command
The Variable window SpeedMenu Watch command
The Watches window SpeedMenu Watch command
When you choose a command to create a watch, Turbo Debugger opens the Enter
Expression to Watch dialog box. Enter a variable name or expression, and press Enter to
add it to the Watches window.
If the cursor is on a variable in the Module window, that variable is automatically added
to the Watches window when you choose the SpeedMenu Watch command. The same
is true for expressions selected using Ins and the arrow keys.
Unless you use scope override syntax (as described in Chapter 6), Turbo Debugger
evaluates watch expressions with regards to the current instruction pointer. If a watch
expression contains a symbol that isn't accessible from the currently active scope, the
value of the e~pression is undefined, and is,displayed as four question marks (????).
When you enter expressions into the Watches window, you can use variable names that
aren't yet defined; Turbo Debugger lets you set up a watch expression before its scope
becomes active. This is the only situation in Turbo Debugger where you can enter an
expression that can't be immediately evaluated.
Be careful when you enter expressions into the Watches window. If you mistype the
name of a variable, Turbo Debugger won't detect the mistake because it assumes the
variable will become available at a later time during program execution.
When you're tracing inside a C++ member function, you can add the this pointer to the
Watches window. Turbo Debugger knows about the scope and presence of the this
pointer. You can evaluate this and follow it with format specifiers and quantifiers.
Watch
The Watch command prompts you for a variable name or expression to add to the
Watches window. Unless you explicitly enter a scope, Turbo Debugger evaluates the
expression with regards to the current cursor location.
Edit
Edit opens the Edit Watch Expression dialog box, letting you modify the expression
currently highlighted in the Watches window. When you've finished editing the
expression, press Enter or click the OK button.
You can also invoke this command by pressing Enter after you've highlighted the watch
expression you want to change.
Remove
The Remove command removes the currently selected item from the Watches window.
Delete All
Delete All removes all expressions from the Watches window. This command is useful
if you move from one area of your program to another, and the variables you were
watching are no longer relevant.
Inspect
The Inspect command opens an Inspector window that shows the details of the
currently highlighted watch. Thi~ command is useful when the watch expression is a
compound data object, or if the expression is too long to be fully displayed in the
Watches window.
Change
Use the Change command to modify the value of the currently highlighted variable in
the Watches window. When you enter a new value into the Enter New Value dialog
box, Turbo Debugger performs any necessary type conversion, exactly as if the
assignment operator had been used to change the variable.
Global pane
Local pane
Inspect
The Inspect command opens an Inspector window that displays the contents of the
currently highlighted global, local, or static symbol.
If you inspect a global variable whose name matches a local variable's name,
Turbo Debugger displays the value of the global variable, not the local variable. This
behavior is slightly different from the usual behavior of Inspector windows, which
normally display values from the point of view of your current program location. This
difference gives you a convenient way to look at global variables whose names are also
used as local variables.
If you issue the Inspect command on an entry that's a routine name (in the Global pane),
Turbo Debugger activates the Module window and places the cursor on the routine's
source code. If Turbo Debugger can't find the source code, or if the file wasn't compiled
with debug information, a CPU window opens, showing the disassembled instructions.
Change
The Change command opens the Change dialog box so you can modify the value of the
currently highlighted symbol. Turbo Debugger performs any necessary data type
conversion exactly as if the assignment operator for your current language had been
used to change the variable.
You can also access the Change dialog box by choosing the SpeedMenu Inspect
command and typing the new value into the Inspect window.
Show
The Local pane's Show command brings up the Local Display dialog box. The radio
buttons in this dialog box enable you to change the scope of the variables displayed in
the Local pane and the module from which these variables are selected:
Inspector windows
Inspector windows are the best way to view data items because Turbo Debugger
automatically formats Inspector windows according to the type of data it is displaying.
Inspector windows display data differently for scalars (C char or int and Object Pascal
integer or real), pointers, structures, records, arrays, and functions. In addition, there
are special Inspector windows for classes (for a description of class Inspector windows,
see Chapter 10). In the sections that follow, Inspector windows are described as they
appear when you inspect scalar, pointer, structure and union, array, and function data
types.
Inspector windows are especially useful when you want to examine compound data
objects, such as arrays and linked lists. Because you can inspect individual items
displayed in an Inspector window, you can "walk" through compound data objects by
opening an Inspector window on a component of the compound object.
If the variable being inspected is of c++ type ch'ar, the equivalent character is displayed
to the left of the numeric values. If the present value doesn't have a printing character
equivalent, Turbo Debugger displays a backslash(\) followed by the hexadecimal value
that represents the character value.
{ In Object Pascal }
Type
Tarray = array[O .. 91 of Integeri
arrayp = ATarraYi
To see what arrayp points to, use the Range local command on arrayp, and specify a
starting index of 0 and a range of 10. If you had not done this, you would have seen only
the first item in the array.
As an example of using the Array Inspector window, suppose your program contains
the following statement:.
/ / In Ctt
MyCounter[TheGrade)++i
{ In Object Pascal }
count := MyCounter[TheGrade)i
Pressing Ctrl+1 when the cursor is at MyCounter in the Module window opens an
Inspector window that displays the contents of the entire array. However, if you press
Ctrl+1 after selecting the entire array name and index (using Ins and the arrow keys),
Turbo Debugger opens an Inspector window that displays only the single element of
the array.
You can also use the Range SpeedMenu command to show any portion of an array.
Function Inspector windows also give you information about the return type and
calling conventions of the function you're inspecting. The return type is displayed in the
lower pane.
Range
The Range command sets the starting element and number of elements that you want to
view in an array. Use this command when you have a large array and you need to .
examine only a subset of its elements.
Inspect
Inspect opens a new Inspector window listing the highlighted item in the current
Inspector window. Use this command if you're inspecting a compound data object
(such as a linked list), and you want to open a new Inspector window on one of the
items in the object. If the current Inspector window is displaying a function, issuing the
Inspect command activates the Module window, and shows you the source code for
that function.
You can also invoke this command by pressing Enter after highlighting the item you
want to inspect.
To return to the previous Inspector window, press Esc. If you are through inspecting a
data structure and want to remove all the Inspector windows, use the Window IClose
command or its hot key, Alt+F3.
Descend
The Descend command works like the Inspect SpeedMenu command, except that it
replaces the current Inspector window with the new item you want to examine. Using
this command reduces the number of Inspector windows onscreen.
Note When you use Descend to expand a data structure, you can't return to previous views of
the data like you can when you use the Inspect command. Use Descend when you want
to work your way through a complicated data structure, and don't need to return to a
previous view of the data.
New Expression
You can inspect a different expression by selecting the New Expression command. The
data mthe current Inspector window is replaced with the data relating .to the new
expression you enter.
Type Cast
The Type Cast command lets you specify a different data type for an item you want.to
inspect. Typecasting is useful if the Inspector window contains a symbol for which there
is no type information, and when you want to explicitly set the type for untyped
pointers. Page 128 explains how to use the gh2fp and Ih2fp data types.
The Stack window also displays the names of member functions and class methods.
Each class function is prefixed with the name of the class that defines the function; for
example, in C++ it looks like this:
shapes::acircle(174, 360, 7~.0)
In Object Pascal:
shapes.acircle(174, 360, 75.0)
Inspect
The Inspect command opens a Module window and positions the cursor at the active
line in the currently highlighted function. If the highlighted function is atthe top.of the
call stack (the most recently called function), the Module window shows the location of
the current instruction pointer. If the highlighted function is not at the top of the call
stack, the cursor is positioned on the line following the related function call ..
You can also invoke this command by pr~ssing Enter when the highlight bar is
positioned over the desired function.
Locals
The Local command opens a Variables window that shows the symbols that are local to
the current module and to the currently highlighted function.
When a function calls itself recursively, the Stack window shows multiple instances of
the function. By positioning the highlight bar on an instance of that function, you can
use the Locals command to look at the local variables of a particular function call.
Expression You enter expressions to evaluate into the Expression input box. This input box contains a history list of all
the expressions you enter.
Result The Result field displays the result of the expression evaluation.
Data strings that are longer than the width of the Result input box are terminated by an arrow (~). You can
see more of the string by scrolling to the right.
New Value The New Value input box is where you enter a new value for the expression highlighted in the Evaluate
input box. This entry takes effect when you choose the Modify button.
If the expression can't be modified, this box reads <Not available>, and you can't move your cursor into it.
When you evaluate expressions, be careful of language expressions that cause side effects.
See "Expressions with side effects" on page 82 for more information on side effects.
If you're debugging an object-oriented program, the Evaluate/Modify dialog box also
lets you display the C++ member functions and Object Pascal methods of a class
instance. You can use any format specifier with an instance that can be used in
evaluating a record.
point APoint;
You could then enter any of the following expressions in the Evaluate window:
Expression, Possibl~result
APoint.x int 2 (0 x 2)
APoint class point {l,2,274S9}
APoint.MoveTo void ( ) @6B61:0299
APoint.Show int () @6B61:0285
APoint.ShowO intl (0 x 1)
APoint.x int 2 (0 x 2)
APoint class point {l,2,27489}
APoint.MoveTo void ()@6B61:0299
APoint.Show int ( ) @6B61:0299
APoint.ShowO int 1 (0 x 1)
Selecting an evaluator
To select an expression evaluator, choose Options ILanguage to open the Expression
Language dialog box. The four radio buttons in this dialog box let you choose an
expression evaluator for your debugging session:
Source
C
Object Pascal
Assembler
Expression limitations
For the most part, Turbo Debugger supports the full language syntax for C, C++, Object
Pascal, and assembler expressions. However, there are certain language statements and
expressions that are out of ;context while debugging. For example, control structures
such as if/then/else statements ,cannot be entered into the debugger. In addition, data
and function declarations, and expressions that attempt to assign values to more than a
single variable will be flagged as errors. Also be aware that the debugger cannot call
object constructors or destructors. For complete details on language syntax, refer to the
manuals accompanying your Borland language product.
Types of expressions
Although you'll usually use expressions to access the values of program symbols,
calculate values, and change the values of data items, you can also use expressions to:
Specify hexadecimal values
Specify memory addresses
Enter program line numbers
Enter byte lists
Call functions '
Calling functions
You can call functions from expressions exactly as you do in your source code. Turbo
Debugger executes your program code with the function arguments that you supply.
This can be a useful way to quickly test the behavior of a function; simply call the
function with different arguments and check the return values after each call.
If you make specific calls to functions while debugging, be aware that certain functions
can have the side effect of changing program data values. After calling such a function,
you cannot count on your program behaving normally during the rest of your
debugging session. For more information on side effects, see the following section.
Note If you call an Object Pascal function that doesn't use parameters, you must follow the
function name with empty parentheses to indicate to the debugger that you are indeed
making a call to the function. Without the parentheses, Turbo Debugger will return the
address of the function.
Turbo Debugger ignores any format specifier that cannot be applied to the expression's
data type.
Note In addition to a format specifier, you can supply a repeat count to indicate that the
expression relates to repeating data item such as an array or pointer. To specify a repeat
count, follow the expression with a comma, the repeat count, another comma, ~d the
format specifier.
Note ail
To examine or call overloaded member function, enter the name of the function in the
appropriate input box. Turbo Debugger opens the Pick a Symbol Name dialog box, .
which shows a list box of all the functions of that name with their arguments, enabling
you to choose the specific function you want.
The following additional rules apply to the Object Pascal scope override syntax:
If you don't specify a unit, the current unit is assumed.
If you're trying to access a local variable that's no longer in scope, you must use its
procedure or function name as part of the scope override statement.
You can't lise a line number or a file name as part of a Pascal scope override
statement. If you want to use line number syntax, change the expression evaluator to
C with the Options ILanguage command.
When you open the Module window, the title bar displays the name of the currently
loaded module, the name of the current source file, and the cursor's line number.
.Inspect
The Inspect command opens an Inspector window that shows the details of the
program variable at the current cursor position. If the cursor isn't on a variable, you're
prompted to enter an expression to inspect.
You can also use the arrow keys or your mouse to quickly.select an expression or string
of text in the Module window.To use the keyboard, press Ins, and use the left or right
Watch
Watch adds the variable at the current cursor position to the Watches window. Putting a
variable in the Watches window lets you monitor the value of that variable as your
program executes.
If you have selected an expression in the Module window, press Ctrl+W to add the
expression to the Watches window.
Thread
The Thread command, found only in TD32, opens the Pick a Thread dialog box, from
which you can pick a specific program thread to monitor. For more information on
threads, see page 121.
Module
[ill The Module command lets you load a different module into the debugger by picking
the module you want from the Load Module Source or DLL Symbols dialog box.
The Load Module Source or DLL Symbols dialog box is fully described on page 118.
File
File lets you examine another source file that's compiled into the module you're
currently viewing. This command opens the Pick a Source File dialog box, which lists
the source files that contain executable code. When you choose the source file you want
to examine, that file replaces the current file in the Module window.
To view different files simultaneously, use the View IAnother IModule command to
open multiple Module windows.
Files that are included in your program with the C #inc1ude directive (or the Object
Pascal uses directive) are also program source files. If an include file contains executable
lines of code, you can use the File command to load the file into the Module window.
However, if the include file doesn't contain executable code (such as many C header
files), you must use the File window to examine the file.
Previous
The Previous command returns you to the source location you were viewing before you
changed your position. For example, if you use the Goto command to view the source
code at a different address, the Previous command returns you to your original position.
Line
Line positions you at a new line number in the file. The Enter New Line Number dialog
box prompts you for a decimal line number. If you enter a line number after the last line
in the file, you will be positioned at the end of the file.
Next
Next searches for the next instance of the character string you specified with the Search
command. .
Origin
The Origin command positions the cursor at the module and line number containing the
current instruction pointer. If the module you are currently viewing is not the module
that contains the instruction pointer, the Module window will change to show that
module.
This command is useful when you have been examining various places in your code,
and you want to return to the location of the instruction pointer.
Goto
Goto opens the Enter Addressto Position To dialog box, which enables you to view any
address location within your program. Enter the address you want to examine as either
a procedure name or a hexadecimal address. lithe address you enter doesn't have a
corresponding source line, the CPU window opens. See "Types of expressions" on
page 80 for a description of entering addresses.
Note You can also invoke this command by typing into the Module window. This brings up
the Enter Address to Position To dialog box, exactly as if you had chosen the Goto
command.
Edit
When you're debugging a Win32 program with TD32, you can invoke the editor of your
choice using the Edit command. This command is useful if you've found the program
bug, and you want to fix the source code before leaving Turbo Debugger.
Before you can use this command, you must configure TD32 so it knows where to find
your editor:
1 Load the TDINST32.EXE installation program.
2 Choose Options IDirectories to access the Directories dialog box.
Exceptions
If you have implemented C or c++ exception handling in your program, the Exception
command becomes active. For complete details on this command, see page 135.
When you choose View IFile from the menu bar, Turbo Debugger displays the Enter
Name of File to View dialog box. You can type a specific file name to load, or you can
enter a file mask using wildcards characters to get a list of files to choose from.
After you select a file name, the File window opens and displays the file name and
contents.
Figure 7.3 The File window showing hex data
The File window displays files as either ASCII text or as hexadecimal bytes; depending
on the contents of the file. If Turbo Debugger determines that the file contains text, it
displays the file as ASCII; otherwise, the file is displayed as hexadecimal. You can
switch between an ASCII or hexadecimal display using the Display As SpeedMenu
Gata
The Goto command positions the display at a new line number or offset in the file. If
you are viewing the file as ASCII text/enter the new line number to go to. If you are
viewing the file as hexadecimal bytes, enter the offset that you want to move to. If you
enter a linenumber greater than the last line in the file (or an.offset beyond the end of
the file), Turbo Debugger displays the end of the file.
Search
The Search command searches for a character string, starting at the current cursor
position. When you choose this command, the Enter Search String dialog box prompts
you for a search string. If the cursor is positioned over something that looks like a
variable name, the dialog box opens initialized to that name.
If you mark a block in the file using Ins and the arrow keys, that block will be used to
initialize the Search String dialog box.
The search does not wrap around from the end of the file to the beginning. To search the
entire file, first go to the beginning of the file by pressing Ctrl+PgUp.
If the file is displayed in ASCII, you can use DOS wildcards in your search string: a
question mark (?) indicates a match on any single character and an asterisk (*) matches
zero or more characters.
If the file is displayed as hexadecimal bytes, enter a byte list consisting of a series of byte
values or quoted character strings, using the syntax of the selected expression evaluator.
For example, if the language is C++, a byte list consisting of the hex numbers 0408
would be entered as Ox0804. If the language is Object Pascal, the same byte list is entered
as $0804.
You can also invoke this command by typing the string that you want to search for. This
brings up the Search dialog box exactly as if you had specified the Search command.
Next
The Next command searches for the next instance of the character string you specified
with the Search command.
Display As ,
Display As toggles the display between the following two formats:
ASCII displays the file using the printable ASCII character set.
Hex displays the file in hexadecimal format. With this display, each line starts with
the offset from the beginning of the file (shown as a hexadecimal number), followed
File
The File command lets you change the file that's displayed in the File window. This
command lets you view different files without opening duplicate File windows. If you
want to view two different files (or two parts of the same file) simultaneously, choose
View IAnother IFile to open another File window.
Edit
The Edit command is the same as the Module window SpeedMenu Edit command. For
more information, refer to page 92.
Code pane Shows the machine code and disassembled assembly instructions of your executable
program. Source code lines can also be displayed.
Registers pane Shows the contents of the CPU registers.
Flags pane Shows the state of the eight CPU flags.
Dump pane Shows a hexadecimal dump of any memory area accessible by your program. A
variety of display formats is available.
Stack pane Shows the hexadecimal contents of the program stack.
Selector pane Available in TQW only, this pane shows and describes all W~dows 3.x selectors.
From within the Code,Dump, and Stack pane, it's possible to scroll outside the current
protected-mode segment, even though the operating system marks these as invalid
addresses for your program. Because of this, the CPU window displays question marks
for any addresses referenced outside the current protected-mode segment.
Note In the Code, Dump, and Stack panest: press Ctrl+Left and Ctrl+Right to shift the starting
display address of the pane by 1 byte up or down. Using these keystrokes is often faster
than using the Goto command to make small adjustments to the display.
98 T u rb 0 Deb u 9 9 e rU s e r 's G u id e
When you open the CPU window, Turbo Debugger positions the display at the
appropriate Code, Dump, or Stack pane, depending on the window that was active
when you opened the CPU windo~. The following table describes where the cursor is
positioned when you open the CPU window:
Table 8.2 CPU window positioning
;~~rit'Wi~doW>< "G~-q:.p~e
Module window Code Address of item
Breakpoint (nonglobal) Code Breakpoint address
Variable window Dump/Code Address of item
Watches window Dump/Code Address of item
Inspector window Dump/Code Address of item
Stack window Stack Top of stack frame for highlighted item
Other area Code Current instruction pointer location
Once opened, the title bar of the CPU window displays your system's processor type
(8086, 80286, 80386, 80486, or Pentium). In addition, if the highlighted instruction in the
Code pane references a memory location, the memory address and its current contents
are displayed in the title bar of the CPU window. This lets you see both where an
instruction operand points in memory and the value that is about to be-accessed.
Goto
When you choose the Goto command, the Enter Address to Position To dialog box
prompts you for an address to go to. You can examine any address that your program
can access, including addresses in the ROM BIOS, inside DOS, and in the Windows
program.
Origin
The Origin command positions you at the location of the instruction pointer. This
command is useful when you have navigated through the Code pane, and you want to
return to the next instruction to be executed.
Follow
The Follow cominand positions the Code pane at the destination address of the
currently highlighted instruction. Use this command in conjunction with instructions
that cause a transfer of control (such as CALL, JMP, INT), and with conditional jump I
instructions OZ, JNE, LOOP, and so forth). For conditional jumps, the address is shown
as if the jump had occurred. Use the Previous command to return to the origin of the
jump.
Caller
Caller positions you at the instruction that called the current interrupt or subroutine. Be
aware that if the current interrupt routine has pushed data items onto the stack, Turbo
Debugger might not be able to determine where the routine was called from.
Previous
The Previous command restores the Code pane display to the position it had before the
last command that explicitly changed the display (such as Previous, Caller, Origin, and
Follow). The keys do not affect this command.
Search
The Search command searches forward in the code for an expression or byte list that
you supply (see Chapter 6 for information on byte lists).
View Source
The View Source command activates the Module window, showing you the source code
that corresponds to the current disassembled instruction. If there is no corresponding
source code (for example, if you're examining Windows kernel code), this command has
no effect.
Mixed
Mixed toggles between the three ways of displaying disassembled instructions and
related source code:
Table 8.3 Mixed command options
Thread
The Thread command, found only in TD32, lets you choose the thread of execution you
want to debug. When selected, this command opens the Pick a Thread dialog box, from
which you can pick a specific program thread. For more information on threads, see
page 121.
as Exceptions
The as Exceptions command, found only in TD32, lets you choose the operating-system
exceptions you want to handle. For more information on operating-system exceptions,
see page 124.
NewCS:IP
The New CS:IP command changes the location of the instruction pointer to the currently
highlighted line in the Code pane. When you resume program execution, execution
starts at this address. This command is useful when you want to skip certain machine
instructions.
Use this command with extreme care; it is easy to place your system in an unstable state
when you skip over program instructions.
Assemble
The Assemble command assembles an instruction, replacing the instruction at the
currently highlighted location. Use this command when you want to test bug fixes by
making minor changes to assembly instructions.
When you choose Assemble, the Enter Instruction to Assemble dialog box opens,
prompting you for an expression to assemble. For more information on assembling
instructions, refer to "The Asserpbler" section in the online file TD_ASM.TXT.
This command is invoked if you type into the Code pane.
1/0
The I/O command, found only in TDW, reads or writes a value in the CPU's I/O space,
and lets you examine and write to the contents of special I/O registers. This command
gives you access to the 110 space of peripheral device controllers such as serial cards,
disk controllers, and video adapters.
When you choose this command, a menu opens with the following commands:
ill Byte Reads a byte from an I/O port. You are prompted for the I/O port whose value you want
to examine.
Out Byte Writes a byte,to an I/ 0 port. You are prompted for the IIO port to write to and the value
you want to write.
Read Word Reads a word from an I/O port.
Write Word Writes a word to an I/O port.
.Some I/O devices perform an action (such as resetting a status bit or loading a new data
byte into the port) when their ports are read. Because of this, you might disrupt the
normal operation of the device with the use of these commands.
Increment
Increment adds 1 to the value in the currently highlighted register. This lets you test
"off-by-one" bugs by making small adjustments to the register values.
Decrement
Decrement subtracts 1 from the value in the currently highlighted register.
Zero
The Zero command sets the value of the currently highlighted register to O.
Change
Change lets you change the value of the currently highlighted register. When you chose
this command, the Enter New Value dialog box prompts you for a new value. You can
make full use of the expression evaluator to enter new values.
You can also invoke this command by typing the new register value into the Registers
pane.
Registers 32-bit
The Registers 32-bit command, used only by TDW, toggles the register display between
16-bit values and (on systems with 32-bit processors) 32-bit values.
TDW usually displays 16-bit registers, unless you use this command to set the display to
32-bit registers. Toggle this command to Yes if you're debugging a module that uses 32-
bit addressing. Notice that all segment registers will remain as 16-bit values, even when
you toggle on the 32-bit display.
c ,Carry
z Zero
s Sign
0 Overflow
p Parity
a Auxiliary carry
Interrupt enable
d Direction
Search
The Search command searches for a character string or byte list, starting from the
memory address indicated by the cursor.
Next
Next searches for the next instance of the item you previously specified in the Search
command.
Change
The Change command lets you modify the bytes located at the current cursor location. If
the display is ASCII or if the hexadecimal format is Byte, you're prompted for a byte list.
Otherwise, you're prompted for an item of the current display type.
You can invoke this command by typing :into the Dump pane.
Follow
The Follow command opens a menu containing commands that let you examine the
data at near and far pointer addresses. The TD32 menu contains only the commands
. that relate to 32-bit addressing.
Table 8.6 Follow command options
Near Code Interprets the word under the cursor in the Dump pane as an offset into the
segment specified by the CS register. This command activates the Code pane,
and positions it to the near address.
Far Code Interprets the doubleword under the cursor in the Dump pane as a far address
(segment:offset). This command activates the Code pane, and positions it to the
far address.
Offset to Data Lets you follow word-pointer chains (near and offset only). The Dump pane is
set to the offset specified by the word at the current cursor location.
Segment:Offset to Data Lets you follow long pointer chains (far, segment, and offset). The Dump pane is
set to the offset specified by the two words at the current cursor location.
Base Segment: to Data Interpr~ts the word under the cursor as a segment address and positions the
Dump pane to the start of that segment.
Previous
Previous restores the Dump pane position to the address before the last command that
explicitly changed the display address. The arrow keys do not affect this command.
Turbo Debugger maintains a stack of the last five addresses accessed :in the Dump pane,
so you can backtrack through multiple uses of the Follow menu or Goto commands.
, Block
This command brings up a menu that lets you move, clear, and set blocks of memory. In
addition, you can read and write memory blocks to and from files. Use Ins and the arrow
keys to quickly select the block of bytes that you want to work with.
Table 8.8 Block command options
Clear Sets a contiguous block of memory to zero (0). You are prompted for the address and
the number of bytes to clear.
Move Copies a block of memory from one address to another. You are prompted for the
source address, the destination address, and how many bytes to copy.
Set Sets a contiguous block of memory to a sp~cific byte value. You are prompted for the
address of the block, how many bytes to set, and the value to set them to.
Read Reads all or a portion of a file 'into a block of memory. You are prompted for the file
name to read from, for the address to read it into, and for how many bytes to read.
Write Writes a block of memory to a file. You are prompted for the file name to write to, for
the address of the block to write, and for how many bytes to write.
Origin
Origin positions you at the current stack location as indicated by the SS:SP register pair.
Follow
The Follow command positions you at the location in the stack pointed to by the
currently highlighted word. This is useful for following stack-frame threads back to the
calling procedure.
Previous
The Previous command restores the Stack pane position to the address before the last
command that explicitly changed the display address (such as Goto, Origin, and
F~llow). The arrow keys do not affect this command.
Change
Change lets you enter a new word value for the currently highlighted stack word with
the Enter New Value for Unsigned Tnt dialog box.
You can invoke this command by typing the new value for the highlighted stack item.
Examine
. Examine displays the contents,of the memory area referenced by the currently
highlighted selector. When this command is invoked, either the Code pane or the Dump
pane gains focus. If the selector points to a code segment, the contents are displayed in
the Code pane. If the selector contents are data, they're displayed in the Dump pane.
The Dump window is useful when you're in an Inspector window and you want to look
at the raw bytes that make up the object you're inspecting. Choosing the View IDump
command when an Inspector window is active opens a Dump window that's positioned
at the address of the data in the Inspector window.
You can open several Dump windows simultaneously by choosing View IAnother I
Dump.
You can perform the same functions from the SpeedMenu of the Registers window as
you can from the SpeedMenus of the Registers and the Flags panes in the CPU window.
Window Selector pane Lists the windows that you've selected for messages tracking.
Message Class pane Lists the messages and message classes that you're tracking for the highlighted
window in the Window Selection pane.
Message Log pane Displays the window messages received by your program.
Window Proc Choose this when you supply the name of the routine that processes the
window messages (for example WndProc).
Handle Choose this when you supply the name of the window's handle.
Note Before you can access the Set Message Filter dialog box, you must first specify a window
in the Window Selection paile.
To track a single message, choose the Single Message radio button and enter the
message name or message number (an integer) into the Single Message Name input
box. Message names are case sensitive; be sure to match their names exactly.
Although you can set up a single window to track many different message classes and
message names, you can add only one message class or message name at a time. If you
want to track more than a single class or message with a particular window,
Specify a single message class or message name.
2 Choose Add from the Message Class pane SpeedMenu.
3 Append additional message classes or message names to .the window's message-
tracking definition.
Break Pause program execution when the window receives one of the specified
messages.
Log List all specified messages in the Message Log pane of the Windows
Messages window (default).
Breaking on messages
If you want Turbo Debugger to gain control when a specific window message is
received by your program, choose Break as the message action. This setting is known as
a message breakpoint.
The following example shows how to set a message breakpoint on WM_PAINT, which
pauses your program every time the message is sent to the window you've selected in
the Window Selection pane:
Logging messages
If you choose the Log radio button, Turbo Debugger lists the specified window
messages in the Message Log pane of the Windows Messages window. This pane can
list up to 200 messages.
If you're tracking many messages, you might want to write the messages to a me so you
don't overwrite the messages already sent to the Message Log pane. To do so,
Set the Action radio button to Log.
2 Activate the Message Log pane, and set the Send to Log Window SpeedMenu
command to Yes.
3 Open the Log window, using the View I Log command.
4 Choose Open Log File from the Log window SpeedMenu.
For details on logging messages to a me, see "Open Log File" on page 63.
To clear the Message Log pane, choose Erase Log from its SpeedMenu. Messages
already written to the Log window are not affected by this command.
Figure 9.3 The Load Module Source or DLL Symbols dialog box
The Source Modules list box displays all the source modules contained in the currently
loaded executable file. The DLLs & Programs list box displays all the .DLL and .EXE
files that are currently loaded by Windows. (If you're running TDW, the list also
displays all loaded .DRV and .FON files.) CheckShow Full Name Paths to view the
directory and path to your source modules.
A bullet (.) next to a DLL listing indicates that it can be loaded into Turbo Debugger (as
long as the DLL contains symbolic debug information and the source codeis available).
An asterisk (*) next to a module indicates that the module has been successfully loaded
by Turbo Debugger.
Note Because your program might load DLL modules with the LoadLibrary call, the DLLs &
Programs list box might not display all of the.DLL files your program uses. To view
.DLLs loaded with LoadLibrary, be sure to include the .DLL source-code path in the
Option IPath for Source command.
Options
The-Options SpeedMenu command opens the Thread Options dialog box. This dialog
box lets you set options for individual program threads.
Figure 9.5 The Thread Options dialog box
The Freeze check box lets you freeze and thaw individual threads. When you freeze a
thread by checking this box, the thread will not run. To thaw the thread (which enables
it to run), clear the checkbox. For your program to run, there must be at least one thread
that isn't frozen.
Note If you freeze the only thread in your program that processes window messages, your
program and the debugger will hang when you run the program.
The Notify on Termination check box lets you specify whether Turbo Debugger should
notify you when the clU'rently highlighted thread terminates. When this box is checked,
Turbo Debugger generates a message when the thread terminates, and activates a
Module or CPU window that displays the current program location. If you clear the
Notify on Termination check box, Turbo Debugger doesn't pause when the thread
terminates. To set the Notify on Termination status for all threads, use the All Threads
SpeedMenu command.
The Thread Name input box lets you modify the thread name that's generated by Turbo
Debugger. If your program generates many threads, it can be easier to keep track of
them if you specify your own thread names.
Make Current
The Make Current command lets you change the thread currently being processed by
Turbo Debugger. To change the current thread, highlight the thread that you want to
examine in the Threads List pane, and press CtrltM (or choose the Make Current .
Inspect
The Inspect command opens a Module or CPU window that shows the current point of
execution for the highlighted thread. Pressing Enter has the same effect as choosing
Inspect from the SpeedMenu.
All Threads
The All Threads command opens a menu whose commands relate to all program
threads.
The Thaw command unfreezes any currently frozen threads. When you issue this
command, all threads in your program are able to run.
The Freeze command disables all thread execution. When you issue this command, all
threads in your program will be frozen and unable to run. For your program to run, you
must thaw at least one thread using the Options SpeedMenu command (or use the
Thaw command on the All Threads menu to unfreeze all the threads).
The Enable Exit Notification command sets the notify-on-exit status for all program
threads, including threads that have yet to be created. Choosing this command causes
Turbo Debugger to issue a message when any thread terminates. The status of notify-
on-exit is displayed in the Notify field of the Threads Information pane.
The Disable Exit Notification command turns off the notify-on-exit status. This is Turbo
Debugger's default setting. .
Step
The Step command toggles between All and Single:
When set to All (the default), all the threads in your program can run as you step
through your program using F7 or FB. If you're debugging a thread with a low priority,
other threads might execute several statements before the thread you're debugging
executes a single statement. (This can sometimes make it difficult to watch the behavior
of a single thread in your program.)
When the Step command is set to Single, only the thread located at the current
instruction pointer will run as you step. This is different from freezing threads because
different threads can be created and destroyed, and you can step into these threads as
your program's execution dictates.
The Exceptions list box displays all the operating-system exceptions that can be
handled by Turbo Debugger. For each exception in the list, you can specify whether
Turbo Debugger should handle the exception or whether your program's exception-
handling routine should take ~ontrol.
By default, all exceptions generated by the operating system are handled by
Turbo Debugger. This means that whenever your program generates an operating-
system exception, Turbo Debugger pauses your program and activates the Module or
CPU window with the cursor located on the line of code that caused.the exception.
To change the debugger's default exception handling behavior,
053E Either a handle to the memory object, expressed as a 4-digit hex value, orthe word
FREE, indicating a free memory block.
(053D) A memory selector pointing to an entry in the global descriptor table. The selector
isn't displayed if it's the same value as the memory handle.
00002DCOb A hexadecimal number representing the length ofthe segment in bytes.
PDB The allocator of the segment, usually an application or library module. A PDB is a
process descriptor block; it is also known as a program segment prefix (PSP).
(OFID) A handle indicating th~ owner ofa PDB.
OEFD A handle for the memory segment, expressed as a' 4-digit hex value.
TASK The module type. A module can be either a task or a DLL.
GENERIC The module name.
C: \ TPW\GENERIC.EXE The path to the module's executable file.
Parents pane
The Hierarchy window displays the heritage of object-oriented program classes. The
window is composed of two or three panes, depending on whether or not your program
uses multiple inheritance.
Inspect
The Inspect command opens a Class Inspector window for the currently highlighted
class. Alternately, you can press Enter to open a Class Inspector window for the
highlighted class. For adescription of Class Inspector windows, see page 131.
Tree
The Tree command activates the Hierarchy pane, highlighting the currently selected
class.
Inspect
When you choose Inspect (or press Enter), a Class Inspector window opens for the class
that's highlighted in the pane.
Parents
If you're debugging an object-Qriented program that implements classes derived
through multiple inheritance, the Hierarchypane SpeedMenu also contains the Parents
A Class Inspector window is divided horizontally into two panes. The top pane lists the
class' data members and type information, and the bottom pane lists the class' member
functions and their return types.
A Class Inspector window s1,lmmarizes the data members and member functions
contained in a C++ class (or the methods and fields contained in an Object Pascal class);
it doesn't, however, reflect the data of any particular instance. If you want to examine a
member (or method) function's arguments, highlight the member fUnction and press .
Enter. A Function Inspector window opens, displaying the code address for the object's
implementation of the function and the names and types of all its arguments.
If the highlighted data member is a pointer to a class, pressing Enter opens another Class
Inspector window for the highlighted class. (This action is identical to choosing Inspect
Inspect
The Data Member pane's Inspect command opens an Inspector window on the
highlighted data member (or Object Pascal field). If the data member is a pointer to
another class, a Class Inspector window opens for that class .
.The Member Function pane's Inspect command opens 'a Function Inspector window on
the highlighted member function (or Object Pascal class method). To display a member
function's source code, position the cursor over the address of the member function in
the Function Inspector window, and press Enter to activate the Module window.
Hierarchy
The Hierarchy command on each SpeedMenu opens the Hierarchy window, displaying
the currently inspected class. The Hierarchy window is described on page 129.
Show Inherited
The Show Inherited command toggles between Yes and No in each pane of the Class
Inspector window. The default value in each pane is Yes.
When Show Inherited is set to Yes, Turbo Debugger shows either all the C++ data
members or all the C++ member functions of the currently highlighted class, including
all the items that the class inherits (with Object Pascal, Turbo Debugger shows either all
the fields or all the methods of the currently highlighted class, including all the items
that the class inherits). If the toggle is set to No, Turbo Debugger displays only the data
members or member functions defined within the class being inspected.
Type pane
An Object Inspector window contains three panes. The Data Member pane displays the
current values of the object's C++ data members (or Object Pascal fields). The Member
Function pane shows the current values and code addresses of the object's C++ member
functions (or Object Pascal methods). The Type pane displays the data type of the
highlighted C++ data member or member function (or. Object Pascal field or method).
Range
The Range command lets you specify a range of array elements to be displayed. If the
currently highlighted item is not an array or a pointer, the item cannot be accessed.
Change
The Change command, available only from the Data Member pane, lets you modify the
value of the highlighted C++ data member or object Pascal field.
Methods
The Methods command can be toggled between Yes and No; Yes is the default setting.
When set to Yes, Turbo Debugger opens the middle pane of the Object Inspector
window, where C++ member functions (or Object Pascal methods) are summarized.
When Methods is set to No, the middle pane is not displayed. The Methods setting is
carried forward to the next opened Object Inspector window.
Show Inherited
The Show Inherited command is also a Yes/No toggle. When it's set to Yes, all Object
Pascal fields and methods (or C++ data members and member functions) are shown,
whether they are defined within the class being inspected or inherited from a base class.
When the command is set to No, Turbo Debugger displays only those Object Pascal
methods and fields (or C++ data members and member functions) defined within the
class being inspected.
Inspect
The Inspect command (which can be opened from the SpeedMenu or by pressing Enter)
opens an Inspector window on the currently highlighted C++ data member or member
Descend
The Descend command works like the Inspect SpeedMenu command, except that it
replaces the current Inspector window with the new item you want to examine. Using
this command reduces the number of Inspector windows onscreen; however, you can't
return to a previous Inspector .window as you could if you use the In~pect command.
\
New Expression
Use the New Expression command to inspect a different expression. The data in the
current Inspector'window is replaced with the data relating to the new expression you
enter.
Type Cast
The Type Cast command lets you specify a different data type for the currently
highlighted item. This command is useful if your class contains a symbol for which
there is no type information, as well as for explicitly setting the type of pointers.
Hierarchy
The Hierarchy command opens the Hierarchy window, displaying the heritage of the
class being inspected. The Hierarchy window is described on page 129.
None Specifies that Turbo Debugger should not interfere with your program's
exception handling.
Types Lets you specify the exception data types you want to trap with Turbo
Debugger. Enter the data types of the exceptions you want to trap into the
Exception Types input box.
If you want Turbo Debugger to trap exceptions in classes derived from the
ones you enter into the Exception Types input box, check the Derived Classes
checkbox.
All Specifies that you want Turbo Debugger to trap all exceptions generated by
your program.
If, for example, you specify that Turbo Debugger should trap char* exceptions, then
Turbo Debugger will pause whenever program execution encounters a throw (char *)
statement.
If an exception is generated, Turbo Debugger pauses the program with the cursor (not
the IP) placed on the throwO that is responsible for the exception. In this way, Turbo
Debugger notifies the user of the location where the exception occurred. From here,
press FB to step into the catchO function, or press F9 to continue running the program if
you are not interested in this particular C++ exception.
Cexception handling
If your C program implements C exception handling, you can control how Turbo
Debugger handles the exceptions that your program generates.
Using the C Exceptions radio buttons, specify the C exception handling in the following
ways:
None Specifies that Turbo Debugger should not interfere with your program's
exception handling. I
Values Lets you specify the exception values you want to trap with Turbo Debugger.
Enter the numbers of the exceptions you want to trap into the Exception
values input box.
All Specifies that you want Turbo Debugger to trap all exceptions generated by
your program.
What's a TSR?
Terminate and stay resident programs (TSRs) are programs that stay in RAM after you
"exit" the program. Once you exit the program, you can reinvoke the TSR via special hot
keys or from programs that issue special software interrupts. Borland's C and c++
compilers provide a function, geninterrupt, that issues such software interrupts.
TSRs consist of two parts: a transient portion and a resident portion. The transient portion
is responsible for loading the resident portion into RAM and for installing an interrupt
handler that determines how the TSR is invoked. If the TSR is to be invoked through a
software interrupt, the transient portion places the address of the resident portion of the
code in the appropriate interrupt vector. If the TSR is to be invoked through a hot key,
the resident portion must intercept the DOS interrupt handler for keyboard presses.
When the transient portion is finished executing, it invokes a DOS function that allows a
portion of the .EXE file to stay resident in RAM after execution is terminated-hence the
phrase "terminate and stay resident." The transient portion of the TSR knows the size of
the resident portion as well as the resident portion's location in memory, and passes this
information along to DOS. DOS then leaves the specified block of memory alone, but is
free to overwrite the unprotected portion of memory. Thus the resident portion stays in
memory, while the transient portion can be overwritten.
The trick to debugging TSRs is that you want to be able to debug the resident portion as
well as the transient portion. When the .EXE file executes, the only code that is executed
Debugging a TSR
Debugging the transient portion of a TSR is the same as debugging any other file. It's
only when you start to debug the resident portion of your program that anything
. different happens.
Note If you're debugging the keyboard handler of your TSR (INT 9), use the mouse to
navigate through Turbo Debugger. This way, the keyboard handler won't confuse
which keys get trapped. If this doesn't work, try using the remote debugging
capabilities of Turbo Debugger.
Here's how you debug a TSR program:
1 Compile or assemble the TSR with symbolic debug information.
2 Run Turbo Debugger and load the TSR program.
3 Set a breakpoint at the beginning of the resident portion of the TSR.
4 Run the transient portion of your program by choosing Run IRun.
S Debug the transient portion of the program using normal debugging techniques.
6 After the transient portion is fully debugged, exit the TSR; the resident portion of the
TSR program remains installed in RAM.
7 Choose the File IResident command to make Turbo Debugger go resident.
This has nothing to do with making your TSR go memory-resident; the TSR goes
resident when you run it from Turbo Debugger. Once Turbo Debugger is resident,
you can return to DOS and invoke your TSR, which makes its resident portion
exe.cute.
8 At the DOS command line, execute the resident portion of your TSR by pressing its
hot key (or by doing whatever is needed to invoke it), and run through your program
as usual.
9 Exit the TSR program.
The resident portion of the TSR now executes, causing Turbo Debugger to encounter
the breakpoint. When the breakpoint activates, Turbo Debugger pauses the TSR at
the beginning of the resident portion of the program, arid you can debug the resident
code. (To reenter Turbo Debugger fro~ DOS, press Ctrl+Breaktwice.)
A second method of debugging a TSR's resident portion involves executing the TSR
from the DOS command line and using Turbo Debugger's CPU window to debug the
area of RAM containing the TSR:
1 Compile your program with debug information.
2 Use TDSTRIP to strip the symbol table from the program and place it in a .IDS file.
-ar# The -ar option attaches TD32 to process identification number #. The process
will continue to run after the attachment is made.
. -as# The -as option is the same as the -ar option, except that TD32 gains control
when the attachmentis made.
-do The -do option enables dual-monitor debugging. This lets you view your
program's screen on the primary display and Turbo Debugger's on the
secondary one. For more information on dual-monitor debugging, see "Dual-
monitor debugging" on page 9.
-dp The -dp option, used only with TD.EXE, enables screen flipping-Turbo
Debugger is displayed on one screen page and the program you're debugging
is displayed on a second screen page. Screen flipping minimizes the time it
takes to switch between the debugger's screens and your program's. To use
this mode, your display adapter must support multiple screen pages and the
program you're debugging must not use screen paging.
-ds This option, known as screen swapping, maintains separate screen images in
memory for both the debugger and for the program you're debugging. These
images are then" swapped" back and forth from memory as each program
runs.
Although this technique is the most time-consuming method for displaying the
screens, itis the most reliable method. Because of this, display swapping is
turned on by default for all displays.
-ji Don't use the session-state file if you've recompiled your program.
-jn Tum off session-state restoring (do not use the restart file).
-jp Prompt if the program has been recompiled since the session-state file was
created.
-ju Always use the session-state file, even if it's old.
154.
WREMOTE.EXE, the remote debugging driver.
WRSETUP.EXE, the configuration program for WREMOTE.EXE.
D !P.I~:~:~:i~::~I.~~:J~i~:~r.~p.:~~! Iln.HII,1
[gJ .Quit when host quits
Baud rate
Starting .!I.irectory:
o ft600
@192.!!.0
IREMOTE OCOMl.
OCOMJ
o COM.4
Serial configuration
If you're using a serial connection:
1 Click the Serial radio button.
2 Choose the rate of communications by clicking the 'appropriate Baud Rate radio
button. If you're using the higher transmission speeds (38,400 or 115,000 baud), click
the Disable Clock Interrupts check box to help TDW make a reliable connection with
WREMOTE.
3 Choose the communications port that works for your hardware setup by clicking the
appropriate Comm Port radio button.
4 Enter the directory location of your program in the Starting Directory input box.
5 If you want WREMOTE to return control to Windows when you terminate Turbo
Debugger on the local machine, click the Quit When Host Quits check box.
By default, WREMOTE uses a link speed of 19,200 baud, with communications over
COM1.
LAN configuration
If you're using a LAN connection:
1 Click the Network radio button.
2 Specify the remote system name in the Network Remote Name input box.
By default, the remote system name is REMOTE. For information on naming the local
and remote systems, see "Local and remote system names" on page-ISS.
3 Enter the directory location of your program in the Starting Directory input box.
Starting WREMOTE
Once WREMOTE is properly configured, you can load it by clicking the Remote
Debugging icon, by using the Windows File I Run command, or by using the Windows
File Manager. After starting WREMOTE, the mouse cursor on the remote system
displays an hourglass, indicating that it's waiting for you to start TDW at the other end
of the link. (To terminate WREMOTE while it's waiting to establish a connection with
TDW, press Ctrl+Break on the remote machine.)
Serial configuration
When you use a null modem cable to connect the local and remote systems, you must
specify both the communication rate and the serial port that TDW will use for the
connection. To initiate a serial remote debugging session:
1 Start WREMOTE on the remote system (as previously described in this chapter).
2 Start TDW, and choose File I Open to open the Load a New Program to Debug dialog
box.
3 Click the Session button to open the Set Session Parameters dialog box.
4 Click the Serial Remote radio button. (Click the Local radio button if you're not using
remote debugging.)
5 Choose the serial port of the local system by clicking the appropriate Remote Link
Port radio button.
6 Choose the serial communications speed by clicking the appropriate Link Speed
radio button.
7 Choose OK to accept the serial communication settings and return you to the Load a
New Program to Debug dialog box.
Note Although the local and remote systems can use different serial ports for the remote link,
the link speeds of the two systems must match for the serial connection to work.
LAN configuration
To configure TDW for a remote debugging session on a NETBIOS local area network:
1 Start WREMOTE on the remote system (as previously described in this chapter).
Troubleshooting
Here's a list of troubleshooting techniques you can try if you experience problems with
the remote setup:
Check your cable hookups. This is the most common cause of problems.
Check to make sure you're using the correct serial port settings (you must use the
same link speed on both the local and remote systems) or that you're properly
connected to the network.
With serial connections, try successively slower baud rates until you find a speed that
works.
Some hardware and cable combinations don't always work properly at the highest
speed. If the link works only at slower speeds, try a different cable or, if possible,
different computers.
If you can't get the serial connection to work at any speed when you're using TDW,
use WRSETUP to Disable clock interrupts and try running the link at 9,600 baud. If that
works, try successively higher communication speeds.
L)' expected
While evaluating an expression, Turbo Debugger found a left parenthesis without a matching right parenthesis.
L:' expected
While evaluating a C expression, a question mark (?) separating the first two expressions of the ternary operator (? :) was
encountered, but the colon (:) that separates the second and third expressions was not found.
L]' expected
While evaluating an expression, Turbo Debugger found a left bracket ([) without a matching right bracket (]).
This error can also occur when entering an assembler instruction using the built-in assembler. In this case, a left bracket
was encountered that introduced a base or index register memory access, and there was no corresponding right bracket.
All threads frozen
You've tried to run or step your Windows NT program after freezing all program threads. For the program to be able to
run, you must unfreeze at least one thread using the Options command on the Threads window SpeedMenu.
Already logging to a file .
You issued an Open Log File command after having already issued the same command without an intervening Close
Log File command. If you want to log to a different file, first close the current log by issuing the Close Log File command.
Already recording, do you want to abort?
You're already recording a keystroke macro. You can't start recording another keystroke macro until you finish the
current one. Press Yto stop recording the macro, or press N to continue recording.
Ambiguous symbol name
You used a symbol in an expression that does not uniquely identify a C++ member function or Object Pascal method
name. Before the expression can be evaluated, you must pick a valid symbol from the list of member functions or
methods.
Bad configuration file
Turbo Debugger's configuration file is corrupted.
Bad or missing configuration file
You have specified a nonexistent, corrupted, or outdated file name wit!; the -c command-line option.
Can't do this when debugging an attached process
You cannot reset a program (Ctrl+F2) after you have attached to it using TD32's File IAttach command.
Can't execute DOS command processor
You've issued the File IOS Shell command, and Turbo Debugger cannot find COMMAND.COM. Either
COMMAND.COM 6'r the COMSPEC environment variable is corrupted.
Can't find filename.DLL "
This message is generated by Turbo Debugger in two situations:
You're attempting to load a program that requires one or more DLLs into Turbo Debugger, and the debugger can't locate
one of the DLL files. The DLLs with symbol tables required by your executable must be in the same directory as the
program you're debugging.
You are attempting to load TDW, and the program can't find IDWINTHDLL. Either you have an invalid file name or
path in the DebuggerDLL entry in TDW.INI, or TDW can't find TDW.INI.
Either edit the DebuggerDLL entry in TDW.INI to reflect the correct path and file name, or if there is no TDW.INI,move
TDWIN1H.INI to the main Windows directory.
Divide by zero
You entered an expression using a divide (/, div) or modulus operator (mod, %) where the divisor evaluates to zero.
DLL already in list
In the View IModules dialog box, you tried to add a DLL to the DLLs & Programs list, but the DLL was already in the
list.
Error loadingfilename
Turbo Debugger was unable to load the video driver filename. The video driver could be an invalid driver file or it could
be corrupted. For more information on video drivers, refer to the section describing TDWINI.EXE in the online file
TD_UTILS.TXT.
Error/opening file _
Turbo Debugger couldn't open the file that you want to view in the File window. Check to ensure that the file name and
path are correct.
Status messages
Here are the messages you'll see on the Status line of the Get Info text box and in the
Thread Detail pane of the Threads window. These messages describe how
Turbo Debugger gained control from your running process.
Breakpoint at_
Your program encountered a breakpoint that was set to pause your program. The text after "at" is the address of the
breakpoint.
Divide by zero
Your program has executed a divide instruction where the divisor is zero.
TDREMOTE messages
Here's the list of error messages-that can be generated by TDREMOTE.
WREMOTE messages
Here's the list of error messages that can be generated by WREMOTE.
In d ex 173
simple 51 Close command (Window navigating to 100
templates and 61 menu) 38 shifting display 98
threads and 62 Close Log File command (Log viewing invalid 98
TSR programs 138 . window) 64 cursor 99
types 51 code See source code; startup display format 101, 103, 104,
. window messages and Ill, code 106
115 Comm Port radio buttons 151 expressions, searching on 101
Breakpoints wirtdow 35,50-51 command-line options 17,143 flags 103,108
panes 50 See also specific switch See also Registers window
bugs, finding 32 immediate operands 99
changing 26 instruction pointer 99
buttons 42 disabling 143
byte list expressions 81 navigating to 100
help with 145 memory dump 104
integrated environment
c and 18
remote debugging 155
See also Dump window
opening 98
-c command-line option 144 panes 98
setting 26 registers 103,108
C++ programs TDREMOTE 156
See also object-oriented 32-bit display 103
utilities 14 See also Registers window
programs WREMOTE 152
class instances, formatting 76 I/O 102
commands modifying 103
exceptions 135 See also specific command SpeedMenu 100-102
multiple inheritance 130 choosing 33 . title bar display 99
stepping over 25 macros as 40 I
tracing into 24 Create command (Macros) 40
onscreen summary of 46 Ctrl-key shortcuts See hot keys
call stack See stack shortcuts See hot keys
Caller command (CPU current activity, help with 46
compiler I cursor
window) 100 directive (-v) 16 CPU window 99
case sensitivity, overriqing 146 optimizations 90 Module window 89
casting See type conversion compiling 15 running programs to 24
central processing unit See CPU integrated environment customer service 5
window and 16
CGA See video adapters optimizations 16
Change command Condition Expression input D
Breakpoints window 53 box 54 -d command-line options 144
CPU window 103,105,107 Condition radio buttons 53 data
Inspector windows 74 conditional breakpoints See See also Dump pane
Object Inspector window 133 breakpoints examining raw bytes 70
Variables window 68 Conditions and Actions dialog inspecting 69, 108
Watch window 67 box 53 See also Inspector windows
Change dialog box 68 Conditions and Actions list modifying 74,105
Changed Memory Global box 53 monitoring 54
command (Breakpoints configuration files 7-8 types See type conversion
menu) 55 changing default name 12 viewing raw bytes 37
character strings See strings directory paths 146 watching See Watches
characters; nonprinting 83 loading 144 window
Class Inspector window 131-132 overriding 8,143 data objects See object-oriented
SpeedMenu 132 saving options to 12 programs
Classes radio button 60 searching for 8 Debug Startup radio buttons 120
classes See C++ programs; object- control-key shortcuts See hot, debugger boards 56.
oriented programs keys . Debugger See Turbo Debugger
Clipboard command (View conversion See type conversion debugging
menu) 42 coprocessor, numeric 37 16-bitprograms 19
Clipboard window 38, 42 See also Numeric Processor assembly code 14
item types 42 window assembly-level 97
saving 21, 22 copying and pasting 41 defined 31
SpeedMenu 43 CPU window 37 device drivers 140-141
watching expressions 43 addresses DLLs See DLLs
Ind ex 175
Exception command (Module
window) 135
F stepping over 24
viewing in stack 36, 74
exceptions F12 (Windows NT interrupt
CandC++ 135 key) 27 G
operating-~ystem 101,124 fatal errors 159
. specitying 125 features, new 2 Get Info command (File
Exceptions list box 124 File command menu) 43
executable program files See files File window 95 Get Info text box 43-44
Execute Startup Code check Module window 91 gh2fp (typecast symbol) 128
box 20 Viewmenu 93 global breakpoints 50,55
Execute To command (Run File window 37, 93-94 See also breakpoints
menu) 25 SpeedMenu 94-95 . Always action and 55
executing programs See FILELIST.DOC 7 Global check box 55
programs,running files global memory, listing 126
execution history See also File command; File global menus 33
See also reverse execution window See also mentis
deleting 28 configuration See global variables 68
recovering 29 configuration files See also variables
Execution History window 27- display format 94 GlobalAlloc function 126
29,37 executable and support 12 GlobalLock function 127
SpeedMenu 28 changing 119 . GlobalPageLock function 127
exit code, returned to header 91 Go to Cursor command (Run
Windows 170 include statements and 91 menu) 24
exiting Turbo Debugger 30 loading a new module 91 Goto command
expression evaluators 79 moving to specific line CPU window 100, 105, 107
selecting 79 number 91,94 File window 94
Expression input box 76 non-source 93 ModUle window 92
Expression Lang1lage dialog online 14 graphics adapters See video
box 79 opening 19 adapters
response 11 Group command (Breakpoints
expression-true breakpoints 52 searching through 92, 94
Expression True Global window) 59
session-state 21, 145 Group ID input box 60
command (Breakpoints source See source files
menu) 56 utility 12
Expression True radio button 53 viewing 37,89,91,93 H
expressions 79-83 program address 92
addresses 81 -h command-line option 145
flags, CPU 103; 108 handle
byte lists 81 floating-point numbers 37
current IP vs. current casting to far pointer 128
displaying 83 window messages and 113
scope 84 Follow command (CPU
defined 79 hardware
window) 100,105, 107 adapters See video adapters
evaluating 75-77,84 format specifiers 83
format specifiers 83 breakpoints 56
Freeze check box 122 primary and secondary
functions and 82
hexadecimal 80 Full History command . displays 144
inspecting 70 (Execution History requirements 2
See also Inspector windows window) 29 Hardware Breakpoint Options
language evaluators 79 function keys See hot keys dialog box 56
selecting 79 Function Return command (Data header files, viewing 91
line numbers 81 menu) 78 heap 127
repeat counts 83 functions . viewing 126
scope and 84, 85 calling 82 Help 46-47
side effects 76, 82 inspecting 73, 75 Index 46
types 80 See also Inspector windows help
watching 43,65 names, finding 36 command-line options 145
See also Watches window recursive 69, 75 current activity 46
return values and 78 online 46
returning from 25 Help menu 46
Index 177
Load Symbols radio buttons 119 expression format 83 adding debug
LoadLibrary function 119 global handles 126 information '16, 20
Local Display dialog box: 69 global heap 126 changIng 118
localmenrrory, listing 127 local heap 127 compiling 15
Local radio button 153 modifying 106 defined 3
local variables See variables monitoring 54 listing 127
LocalAlloc function 127 usage 44 loading 90,91
Locals cor.nr.nand (Stack viewing 37 scope override and 85
window) 75 menu bar 33 setting breakpoints 59
LockData function 127 menus tracing into 25
Log window 36, 63-64 activating 33 viewing 36
adding cor.nr.nents 63 global 33 110dules radio button 60
logging window Help 46 monitors See hardware; screens
messages 116 local See Speed~enus mouse, disabling/ enabling 145
~acros 40-41 multi-language programs 14
Speed~enu 63-64
writing to disk 63 ()Ptions 9-12 multiple inheritance 130
Loggingcor.nr.nand(Log Run 23-27 multitasking and debugging 27
window) 64 prograrntermination multithread programs,
and 30 debugging 121
System (=) 34 See also threads
M View 35-38
Window 34
machine instructions
message breakpoints N
See also CPU window
back tracing into 29 defined 111 name completion (symbols),
inspecting 28 setting 115 automatic 39
See also Inspector windows 11essage Class radio buttons 114 NETBIOS, remote debugging
interrupts 100 message classes 115 and 150
multiple treated as single 24 monitoring 114 Network Remote Name input
recording 29 removing window message box 151
replacing 102 actions 116 New CS:IP cor.nr.nand (CPU
stepping over 24 message log 36 window) 102
tracing into 24, 25 See also Windows ~essages New EIP cor.nr.nand (CPU
transferring control 100 window window) 102
viewing history 28 messages New Expression cor.nr.nand
watching 37 See also Windows 11essages Inspector windows 74
macros 40 window . Object Inspector window 134
creating 40 error 159-169 Next cor.nr.nand
removing 41 Exception 13 170 See also Search cor.nr.nand
restoring keystrokes 4.1 status 169-170 CPU window 105
saving 12 methods File window 94
11acroscor.nr.nand()ptions evaluating 77 110dule window 92
menu) 40 ~ethods cor.nr.nand (Object
Next Pane cor.nr.nand (Window
11acros menu 40-41 Inspector window) 133 menu) 34
manual Wcrosoft Windows See Next Pending Status command
overview 4 Windows (TD32's Run menu) 26
printing conventions 3 ~edcor.nr.nand(CPU
Next Window cor.nr.nand
using 5 window) 99,101 (Window menu) 34
math coprocessor 37 11odule/Class list box 60 nonprinting characters,
See also Numeric Processor ~odule cor.nr.nand (11odule
displaying' 83
window window) .91 Notify on Termination check
member functions See object- ~odule window 36, 89-93
box 122
oriented programs incorrect source listing 90 null-modem cable, remote
memory opening 90
Speed~enu,90-93
debuggingand 150
allocation 44 null-terminated character
changing values 55 modules
Seealso 110dule window string 71
dump 104, 108
error nrressages 149 numbers
Ind ex 179
I/O 102 Runmenu 23-26 Set Session Parameters dialog
modifying 103 program termination and 30 box 153 .
termination and 30 running programs See programs, settings, default 8, 12
valid address running shortcuts See hot keys
combinations 164 Show command (Variables
viewing 103, 108
Registers 32-bit command (CPU
5 window) 69
Show Inherited command
window) 103 -s command-line options 146 Class Inspector window 132
Registers window 37, 108 Save Options command (Options Object Inspector window .133
reloading programs 26 menu) 12 side effects, expressions 76,82
Relocate Table command 141 Save To input box 12 simple breakpoints 51
remote debugging scalars, inspecting 70 single stepping 24
configuring 20 scope 83-87 continuous 25
DOS applications 156 breakpoint expressions 59 into interrupts 25
hardware and software changing. 84 in reverse 25
requirements 149 DLLsand 87 Size/Move command (Window
loading programs 154 inactive 161 menu) 34
local and remote systems 149 overriding syntax 84 source code
NETBIOS and 150 templates 85 incorrect listing 90
network compatibility 150 watch expressions 66 inspecting 28, 61
null-modem cable 150 Screen Lines radio buttons 11 See also Inspector windows
remote Windows driver 150 screen shots 3 searching for 21
system names 155 screens splicing with breakpoints 57
troubleshooting 157 See also display; hardware stepping over 24
REMOTE indicator 154 display swapping 144 stepping through See Step
Remote Link Port radio dual-monitor debugging 9, Over command
buttons 153 144 tracing into 24
Remove command lines per, setting 11 See also Trace Into
Breakpoints window 61 problems with writing 10 . command
Macros menu 41 resto~ing layout 35 verifying position 39
Watch window 67 screen flipping 144 viewing 89
Windows Message screen swapping 144 program address 92
window 116 swapping 10 source files
Repaint Desktop command -sd command-line option 21 See also files
(System menu) 35 Search command adding debug information 16
resetting programs 26, 30 See also Next command loading 90
program interrupt key 27 CPU window 100,105 viewing 91
Resident command 138 File window 94 Source Modules list box 118
response file 11 Module window 92 Specify C and C++!Exception
Restart Options dialog box 22 secondary display See dual- Handling dialog box 135
Restore at Restart check boxes 22 monitoring debugging Specify Exception Handling
Restore Options command select by typing 40 dialog box 124
(Options menu) 12 selecting text 90 SpeedMenus
Restore Standard command Selector command (CPU accessing 35
(System menu) 35 window) 108 Class Inspector window 132
Result input box 76 selectors 107 Clipboard 43
return values 78 Send to Log Window command command shortcuts 40
breakpoints and 57 (Windows Messages CPU window 100-102
Reverse Execute command window) 116 ' Execution History
(Execution History Session button 20,152 window 28
window) 28 Session radio buttons 20,153 File window 94-95
reverse execution 25,27-29 session-state files 21,145 Hierarchywindow 130,131
ROM, program execution Set Message Filter dialog hot keys in 47
and 161 box 114 Inspector windows 73-74
Run cOminand (Run menu) 24 Set Options command Log window 63-64
execution history and 28 (Breakpoints window) 53 Module window 90-92
Object Inspector window 133
In de x 181
running 19 See also Watches window window panes
as resident 138 Variables command 68 See also windows
starting 17 Variables window 36,67-69 highlight bar 34
utilities 13 modifying local display 69 moving between 34
windows overview 35-39 panes 68 Next Pane command 34
Type Cast command Speed~enu 68-69 Window Pick command
Inspector windows 74 video adapters 3, 9 (Window menu) 34
Object Inspector window 134 EGA and VGA 11 Windows .
type conversion View menu 35-38 crash checking, system 147
memory handle to far View Source command (CPU debugging programs. 111
pointer 128 window) 101 tips 27
typographic conventions 3 Display Windows Info
u w command 125
executing Windows code 27
-w command-line options 147 messages 111
Undo Close command (Window Wait for Child command (TD32's Exception 13 170
menu) 35 Run menu) 23, 27 numeric exit code 170
unions, inspecting 71 Watch command returning to 30
Until Return command (Run ~odule window 91 shortcut keys 19
menu) 25 Variables window 69 switching applications 19
Use Restart Info radio buttons 22 Watch window 67 windows 357 39
User Screen 10 watches Breakpoints 35,50-51
User Screen command (Window creating 66 Class Inspector 131-132
menu) 39 expressions Clipboard 38,42
remote debugging 154 editing 67 CPU 37
User Screen Delay input box 11 scope 66 Dump 37,108
utilities 13 inspecting compound 67 duplicating 38
command-line options 13 freezing in Clipboard 43 Execution History 27-29,37
global vs. local variables 69 File 37, 93-95
v modifying 67
reloading programs 30
Hierarchy 38, 129-131
Inspector 38,69-74
-v command-line options 146 saving 21, 22 layout, saving 12
-v compiler directive 16 this pointer and 66 Log 36,63-64
variables Watches window 36, 65-67 managing 34
See also Variables window opening 66 messages See window
adding watches 69 Speed~enu 67 messages
DLLsand 87 watchpoints 54 ~odule 36, 89~93
evaluatingandmodifying 68, See also breakpoints moving/resizing 34
75-77 wildcards, searching with 92, 94 Next Window command 34
global 68 Window menu 34 . numbering system 34
local vs. 68 window messages Numeric Processor 37
modifying 68 debugging tips 116 panes See window panes
in recursive routines 69 handles and 113 recovering last closed 35
inspecting 68 logging 116 Registers 37
See also Inspector windows to a file 116 saving contents of 63
logging (breakpoints) 57 monitoring 111,112 specifying 113
program termination and 30 classes 114 Stack 36,74-75
scope override 85 processing 113 status line 46
viewing 67 removing selected 113 user screen 39
instack 36 setting breakpoints 115 Variables 36,67-69
watching 36, 65 tracking single 115,116 Watches 36, 65-67
Windows ~essages 38
In d ex 183
184 T u r boD e bug 9 e r Use r 's G u ide
Borland
Copyright 1996 Borland International, Inc. All rights reserved. All Borland product names are trademarks of Borland International,
Inc. Corporate Headquarters: 100 Borland Way, Scotts Valley, CA 95066-3249, (408) 431-1000. Internet: http://www.borland.com
CompuServe: GO BORLAND. Offices in: Australia, Canada, France, Germany, Hong Kong, Japan, Latin America, Mexico,
The Netherlands, Taiwan, and United Kingdom Part # LSM1350WW21773 BaR 8909