|
This document is intended to help you use the free version of the Borland C++ compiler with VIDE. The Borland compiler is a good compiler, but the free version has some deficiencies. VIDE provides a development environment that makes using BCC 5.5 much easier. The free version is also a bit thin on its documentation. This situation has improved, and this document will help any BCC 5.5 user (with or without VIDE) use BCC 5.5 better. There is some important information about BCC 5.5 here that is very difficult to find elsewhere.
The Borland C++ Compiler 5.5 is available at http://www.borland.com/bcppbuilder/freecompiler/. You have to fill out a bunch of web forms, and eventually get to download the compiler. The download is about 8 Megabytes long.
Borland has made some service packs available to update the compiler. The latest full download on the Borland site will include the latest patches, but if you have a previous version of the compiler, you should apply the service packs.
At the same time you download the compiler, you should also down load the debugger, Turbo Debugger, TD32. VIDE supports starting TD32 from inside VIDE. You must use TD to set breakpoints and view the source, but the interaction is as painless as possible.
Borland has also made extra documentation available. Most of what you need is included with the compiler, but documentation on the C and C++ libraries are not included with the free compiler. The most helpful files you need are in B5STD.ZIP found at http://www.borland.com/techpubs/bcppbuilder/v5/updates/std.html. That file is 7.5 MB, but is probably worth the download.
Once you download the compiler, the debugger, and the optional help files, you have to install them. The compiler and debugger downloads are self-extracting installers. It is probably a good idea to install them in the default location: c:\borland\bcc55. Once you've installed the compiler, you need to read the README.TXT file. It tells important details for installation. These details are summarized in this document as well.
The most important thing you need to do is set up two configuration
files on the \bin directory. The Borland instructions don't
make that location clear. Assuming you installed the compiler to the
default locations, you need to create two files. The first,
C:\Borland\BCC55\bin\bcc32.cfg should contain:
-I"c:\Borland\Bcc55\include" -L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The second,
C:\Borland\BCC55\bin\ilink32.cfg should contain:
-L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The purpose of these two files is to allow the compiler to find the standard system include and library files. Note that the Borland README.TXT leaves out the \psdk entry. If you leave that out, then the compiler won't be able to find all the standard Windows API files contained there.
Also note that you can add other entries to these files to change the default behavior of the compiler. For example, you might want to add -wuse- to bcc32.cfg to stop the compiler from issuing warnings about variables that are declared but never used. See the next section on specific switches recommended for VIDE.
In addition to these two configuration files, you need to add the compiler \bin directory to the PATH environment variable. On Windows9x, you edit the file C:\autoexec.bat. Simply add c:\borland\bcc55\bin to the PATH command. On NT, you use the system settings menu off the Start menu to change the PATH in the environment. Note that if you are using VIDE, you will need to have the VIDE directory on your path, too.
The standard Windows header files included with Borland BCC 5.5 (e.g., windows.h) are set up to compile Windows applications for Windows 2000! This is NOT documented anywhere in the help files that come with BCC 5.5. There are some significant differences in some Win32 API calls for Win2K and earlier Win95, Win98, and WinNT 4.0 versions. Code compiled for Win2K (which is the default) will not run correctly on older versions of Windows. Code compiled for older versions will run on Win2K.
You should consider adding the following 2 lines to your C:\Borland\BCC55\win32.cfg file if you want code that works on Windows versions prior to Win2K!
-DWINVER=0x0400 -D_WIN32_WINNT=0x0400
These switches will be added to the compile line by VIDE, but it would be a good idea to include them in your bcc32.cfg file as well.
Note that many switches can be negated by following it with a '-'. For example, '-v-' means no debugging information.
If you want to make any of these switches the default behavior, you can add them to the BCC32.CFG and ILINK32.CFG files in the /bin directory of the Borland command line tools.
VIDE hides most of the details of using the command line tools from you. However, underneath it all, the command line tools are still there. This section explains some of the details of using VIDE with BCC32.
It is essential that you have the two compiler .cfg files set up in the \bin directory. The following files are suggested:
bcc32.cfg
-w -I"c:\Borland\Bcc55\include" -L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The '-w' switch turns on warnings. You might want to refine the with some '-wxxx-' switches to suppress some of the warnings.
ilink32.cfg
-x -L"c:\Borland\Bcc55\lib;c:\Borland\Bcc55\lib\psdk"
The '-x' switch turns off the map file. If you want to supress incremental linking, you can add the '-Gn' switch.
To use VIDE with the Borland compiler, you MUST set the path to the root of the compiler directory in the Options->VIDE dialog. You should set the Compiler root: value to the directory of the Borland compiler (not the \bin directory). If you installed BCC32 to the default directory, then this would be c:\Borland\bcc55. Note that if you've installed BCC32 to a directory with a space in its name, you need to enclose the path in quotation marks here. For example, "c:\Program Files\Borland\bcc55". You should also select Borland BCC as the compiler in the Radio Button list.
Depending on whether you generate GUI or a Console application, the VIDE project file sets some default values. These are visible in the Project->Edit project editor dialog.
The default compiler flags look like: -P -O1 -v-. The -P switch means C++ files, -O1 is optimization for size, and -v- turns off debugging. Remember that you may have already set other switches in the bcc32.cfg file in the Borland compiler directory.
The linker flags line looks like: -v- -Tpe -ap -c -limport32 -l$(BCC32RTLIB). These switches control the linker, and may change depending if you have a Console or GUI app. The last two values are the names of the run time libraries needed. Import32 is always needed, and the other, BCC32RTLIB is the It can be a static or dynamic version, and cw32.lib static version is used by default.
The linker also must include a startup object code file, which varies for GUI ("c0w32.obj") and console apps ("c0x32.obj"). There are also wide-char versions of these two startup libraries. You can override the defaults by changing the value of BCC32STARTUP in the Advanced tab of project editor.
BCC32 comes with 4 runtime libraries. There are single threaded and multithreaded versions, and a static and dynamic version of each. The default library is "cw32.lib", the single-threaded static library. You can use the dynamic version of this library by changing the value of BCC32RTLIB in the advanced tab of the project editor to "cw32i" (no .lib, which is added automatically by VIDE). You also must either add the -D_RTLDLL define from the defines tab, or add the -tWR switch (-tWCR for console apps) to the compiler flags line, and recompile your program. You can do switch to the static multi-threaded library ("cw32mt") or dynamic library ("cw32mti") in a similar fashion.
You may have some projects that require a .DEF file. If you need one, got to the Advanced tab in the project editor You will find the symbol BCC32DEF predefined with no value. Simply edit this entry to add the name of your .DEF file after the =. The file will then be used by ILINK32. See Borland's documentation for more information about using .DEF files.
VIDE allows you to specify libraries to link with on the Linker flags line of the Names tab of the project editor. This line is used for linker flags, and the names of libraries you need to add. You can see the default -limport32 -l$(BCC32RTLIB) when you create a new project. You can add your own library names to this line, preferably before the -limport32 entry. This -l syntax is not part of the Borland command line options, but is converted by VIDE to the form appropriate in the generated Makefile.
Since Turbo Debugger 32 (TD32) is a stand alone debugger, the integration with VIDE is somewhat limited. The main thing you can do is automatically launch TD32 with the debug button on the VIDE tool bar.
If you are building a V application, you will see the TD CPU window when it starts. This is because WinMain is in the V startup code, and not your application code. To view source, you must view a module. Use the TD menu commands View-<Module (or F3) to open the module (source file) with the code you want to debug. Non-V apps should start with the file with main or WinMain already shown.
Once you are running TD32, you use it to view the source code lines, set breakpoints, inspect variables, and all the usual debugging activities. When you find a bug, you then edit the source file with VIDE and recompile. Before you can recompile, you must quit TD32 (Alt-X). If you don't, you will get an error message from the linker.
When you then restart TD32, you should then see the message "Restart info is old, use anyhow?" If you answer "No", then all your old break points will be lost. If you answer yes, the breakpoints will still be there, and they get adjusted to the correct new line numbers if you've edited a file with breakpoints. Unfortunately, TD32 doesn't seem to know how to preserve open module windows.
If you are debugging a new or different project, you should answer "No" to the "Restart info" question the first time.
switch | Switch Description |
+filename | Use alternate configuration file named filename |
@filename | Read compiler options from the response file filename |
-3 | Generate 80386 protected-mode compatible instructions. (Default for 32-bit compiler) |
-4 | Generate 80386/80486 protected-mode compatible instructions. |
-5 | Generate Pentium protected-mode compatible instructions. |
-6 | Generate Pentium Pro protected-mode compatible instructions. |
-a | Default (-a4) data alignment; -a- is byte. |
-an | Align to n. 1=byte, 2=word (2 bytes), 4=double word (default), 8=quad word (8 bytes), 16=paragraph (16 bytes) |
-A | Use only ANSI keywords. (Extensions like the far and near modifier no longer recognized.) |
-A- (Default) | Enable Borland C++ keyword extensions: near, far, huge, asm, cdecl, pascal, interrupt, _export, _ds, _cs, _ss, _es. |
-AK | Use only K&R keywords. |
-AT | Use Borland C++ keywords (Alternately specified by -A-) |
-AU | Use UNIX V keywords. (Extensions like the far and near modifier no longer recognized.) |
-b | Make enums always integer-sized. (Default: -b make enums integer size) |
-B | Compiles assembly and calls TASM or TASM32. If you don't have TASM in your path, checking this option generates an error. Also, old versions of TASM might have problems with 32-bit generated assembler code. |
-c | Compile source files, but does not execute a link command. |
-C | Turn nested comments on. (Default: -C- turn nested comments off.) |
-d | Merge duplicate strings. (Default) |
-Didentifier | Define identifier to the null string. |
-Didentifier=string | Define identifier to string. |
-efilename | Derives the executable program's name from filename by adding the file extension .EXE (the program name is then filename.EXE). filename must immediately follow the -e, with no intervening whitespace. Without this option, the linker derives the .EXE file's name from the name of the first source or object file in the file name list. |
-Efilename | Use filename as the name of the assembler to use. (Default = TASM) |
-f | Emulate floating point. (Default) |
-f- | No Floating Point |
-ff | Fast floating point. (Default) |
-F | Uses fast huge pointers. |
-Ff | Create far variables automatically. |
-Ff=1 | Array variable 'identifier' is near warning. (Default) |
-Fm | Enables all the other -F options (-Fc, -Ff, and -Fs). Use this to quickly port code from other 16-bit compilers. |
-gb | Stop batch compilation after first file with warnings (Default: -gb-). |
-gn | Stop compiling after n messages. (Default: 255.) |
-G | Optimize code for speed. (Default: -G- optimize code for size.) |
-H | Generate and use precompiled headers. It might be called BC32DEF.CSM. |
-H-(Default) | Does not generate and use precompiled headers. |
-Hfilename | Sets the name of the file for precompiled headers |
-H=filename | Set the name of the file for precompiled headers to filename. |
-Hc | Cache precompiled headers. Use with -H, -Hxxx, -Hu, or -Hfilename. This option is useful when compiling more than one precompiled header. |
-Hu | Use but do not generate precompiled headers. |
-in | Make significant identifier length to be n, where n is between 8 and 250. (Default = 250) |
-Ipath | Set search path for directories for include files to path. |
-jb | Stop batch compilation after first file with errors. (default: off) |
-jn | Errors: stop after n messages. (Default = 25) |
-Ja | Expand all template members, including unused members. |
-Jg | Generate definitions for all template instances and merge duplicates. (Default) |
-Jgd | Generate public definitions for all template instances; duplicates result in redefinition errors. |
-Jgx | Generate external references for all template instances. |
-k | Turn on standard stack frame. (Default) |
-k- | Turn off standard stack frame. Generates smaller code, but it can't be easily debugged. |
-K | Default character type unsigned. (Default: -K- default character type signed.) |
-lx | Pass option x to the linker. More than one option can appear after the -l (which is a lowercase L). |
-l-x | Disable option x for linker. |
-Lpath | Set search path for library files. |
-M | Instruct linker to create a full link map. |
-npath | Set the output directory to path. |
-O | Optimize jumps. (Default: on) |
-O1 | Generate smallest possible code. |
-O2 | Generate fastest possible code. |
-Od | Disable all optimizations. |
-Ox | There are a bunch of tiny optimizations, but it is probably only necessary to used -O1 and -O2, so they are not covered here. |
-OS | Pentium instruction scheduling. (Default: off: -O-S) |
-p | Use Pascal calling convention. (This is a lowercase p.) |
-pc | Use C calling convention. (Default same as -pc or -p-) |
-pr | Use fastcall calling convention for passing parameters in registers. |
-ps | Use stdcall calling convention (32-bit compiler only). |
-P | Perform a C++ compile regardless of source file extension. (Default when extension is not specified. This is an uppercase P.) |
-Pext | Perform a C++ compile regardless of source file extension and set the default extension to ext. This option is available because some programmers use .C or another extension as their default extension for C++ code. |
-q | Quiet - suppress compiler banner. |
-r | Use register variables. (Default) |
-rd | Allow only declared register variables to be kept in registers. |
-R | Include browser information in generated .OBJ files. |
-RT | Enable runtime type information. (Default) |
-S | Generate assembler source compiles the named source files and produces assembly language output files (.ASM), but does not assemble. When you use this option, Borland C++ includes the C or C++ source lines as comments in the produced .ASM file. |
-tW | Make the target a Windows .EXE with all functions exportable. (Default) |
-tWC | Make the target a console .EXE. |
-tWD | Make the target a Windows .DLL with all functions exportable. |
-tWM | Make a multithreaded application or DLL. |
-tWR | Target uses the dynamic runtime lib. Can use -D_RTLDLL instead. |
-tWCR | Target uses the dynamic runtime lib for CONSOLE apps. |
-T- | Remove all previous assembler options. |
-Tstring | Pass string as an option to TASM, TASM32, or assembler specified with -E. |
-u | Generate underscores for symbols. (Default) |
-Uname | Undefines any previous definitions of the named identifier name. |
-v | Turn on source debugging. |
-vi | Turn on inline expansion (-vi- turns off inline expansion). |
-V | Create smart C++ virtual tables. (Default) This means the .objs are compatible only with Borland tools. The V0 and V1 can apparently be used with other tools, but why? |
-V0 | Create external C++ virtual tables. |
-V1 | Create public C++ virtual tables. |
-Vmd | Use the smallest representation for member pointers. |
-Vmm | Member pointers support multiple inheritance. |
-Vmp | Honor the declared precision for all member pointer types. |
-Vms | Member pointers support single inheritance. |
-Vmv | Member pointers have no restrictions (most general representation). (Default) |
-Vx | Zero-length empty class member functions. |
-w | Display warnings on. |
-w! | Do not compile to .OBJ if warnings were found. (Note: there is no space between the -w and the !.) |
-wmsg | Enable user define #pragma messages. |
-w-xxx | Disable xxx warning message. |
-wxxx | Enable xxx warning message.
|
-W | Creates a Windows GUI application. (same as -tW) |
-WC | Creates a 32-bit console mode application. (same as -tWC) |
-WD | Creates a GUI DLL with all functions exportable. (same as -tWD) |
-WM | Make a multithreaded application or DLL. (same as -tWM) |
-WU | Generates Unicode application. Uses -txxxx macros in tchar.h. |
-x | Enable exception handling. (Default) |
-xd | Enable destructor cleanup. (Default) |
-xf | Enable fast exception prologs. |
-xp | Enable exception location information. |
-xp | Enable slow exception epilogues. |
-X | Disable compiler autodependency output. (Default: -X- use compiler autodependency output.) |
-y | Line numbers on. |
-zAname | Code class set to name. |
-zBname | BSS class set to name. |
-zCname | Code segment class set to name. |
-zDname | BSS segment set to name. |
-zGname | BSS group set to name. |
-zPname | Code group set to name. |
-zRname | Data segment set to name. |
-zSname | Data group set to name. |
-zTname | Data class set to name. |
-zX* | Use default name for X. For example, -zA assigns the default class name CODE to the code segment class. |
-Z | Enable register load suppression optimization. |
ILINK32 objfiles, exefile, mapfile, libfiles, deffile, resfiles
@xxxx indicates use response file xxxx
switch | Switch Description |
-ax | Specify application type (known x's follow) |
-aa | Generate a protected-mode executable that runs using the 32-bit Windows API |
-ap | Generate a protected-mode executable file that runs in console mode |
-Ao:nnnn | Specify object alignment |
-b:xxxx | Specify image base addr |
-c | Case sensitive linking |
-C | Clear state before linking |
-Dstring | Set image description |
-d | Delay load a .DLL |
-Enn | Max number of errors |
-Gi | Generate import library |
-Gl | Static package |
-Gn | No state files |
-Gpd | Design time only package |
-Gpr | Runtime only package |
-Gt | Fast TLS |
-Gz | Do image checksum |
-GC | Specify image comment string |
-GD | Generate .DRC file |
-GF | Set image flags |
-GS | Set section flags |
-H:xxxx | Specify heap reserve size |
-Hc:xxxx | Specify heap commit size |
-I | Intermediate output dir |
-j | Specify object search paths |
-L | Specify library search paths |
-m | Map file with publics |
-M | Map with mangled names |
-q | Supress banner |
-r | Verbose linking |
-Rr | Replace resources |
-s | Detailed segment map |
-S:xxxx | Specify stack reserve size |
-Sc:xxxx | Specify stack commit size |
-Txx | Display time spent on link |
-Txx | Specify output file type |
-Tpd | Target a Windows .DLL file |
-Tpe | Target a Windows .EXE file |
-Tpp | Generate package |
-Ud.d | Specify image user version |
-v | Full debug information |
-Vd.d | Specify subsystem version |
-w- | Disable all warnings. |
-wxxx | Warning control
|
-x | No map |
The following is an incomplete listing of the main startup and runtime libraries included with BCC32. If you have more details, please send them, and I will include them here.
Turbo Debugger Commands top
Command Line Switches
Command Line Syntax:
TD32 [options] [program [arguments]] -x- = turn option x off
switch | Switch Description |
-as<#> | -ar<#> (NT only) Attach to running process: s=stop, r=run, id = # |
-ae<#> | (NT only) Post-mortem event handle, decimal event handle = # |
-c<file> | Use configuration file <file> |
-h,-? | Display this help screen |
-ji,-jn,-jp,-ju | State restore: i=Ignore old,n=None,p=Prompt old,u=Use old |
-l | Assembler startup |
-p | Use mouse |
-sc | No case checking on symbols |
-sd<dir> | Source file directory <dir> |
-t<dir> | Start with current directory <dir> |
Keyboard Command Shortcuts top
Key | Command |
File Menu | |
Alt-X | Quit |
Edit Menu | |
Shift-F3 | Copy |
Shift-F4 | Paste |
View Menu | |
F3 | Open Module (source file) |
Run Menu | |
F9 | Run |
F4 | Go to cursor |
F7 | Trace into |
F8 | Step over |
Alt-F9 | Execute to... |
Alt-F8 | Until return |
Alt-F4 | Back trace |
Alt-F7 | Instruction trace |
Ctrl-F2 | Program reset |
Breakpoints Menu | |
F2 | Toggle breakpoint... |
Alt-F2 | At breakpoint... |
Data Menu | |
Ctrl-F4 | Evaluate/modify... |
Ctrl-F7 | Add watch... |
Window Menu | |
F5 | Zoom |
F6 | Next |
Tab | Next pane |
Ctrl-F5 | Size/move |
Alt-F3 | Close |
Alt-F6 | Undo close |
Alt-F5 | User screen |
Help Menu | |
Shift-F1 | Help Index |
Alt-F1 | Previous topic |
xx | xx |
xx | xx |
The following list contains all the topics covered by TD help. Those especially relevant to C and C++ programming are presented here.
Arrows - Move to topic | Enter - Go to topic | PgUp - Previous screen | Esc - Exit help |
PgDn- Next screen | F1 - Help index |
Alt-F1 - Previous screen | Ctrl-PgUp - First screen |
Turbo Debugger handles auto-variables by emulating the current language's variable scoping rules. That is, whenever the program is stopped inside a function, the auto-variables for that function are added to or supersede the static and local symbols already known. They can be used in expressions exactly as they would be used in a statement inside the function.
The bottom pane of the Variables window shows the current value for all auto-variables in the active function.
You can set a breakpoint to stop your program at any source line or address. Position the cursor on the desired line and press F2. Press F2 again to clear the breakpoint.
You can also set a breakpoint by clicking the mouse in one of the first two columns of the line that you want to set the breakpoint on. Turbo Debugger's breakpoints perform all the same jobs as the breakpoints, watchpoints, and tracepoints of other debuggers.
A breakpoint can be instructed to perform one of the following actions:
Break Stop your program Log Log the value of variables Execute Execute an expression
You can set a breakpoint to execute on one of the following conditions:
Always Every time it is encountered Expression true Only when an expression is true Changed memory Only when a memory area changes Hardware When a hardware breakpoint occurs
Breakpoints can also be qualified by setting a Pass Count that specifies how many times the breakpoint must be passed over before being activated.
A breakpoint can also be set at a global address, which means that it occurs on every source line or instruction address. This allows you to watch the value of a variable as each line is executed, or to stop when a variable or area of memory changes value.
1.234 4.5e+11Integer constants are decimal unless you use one of the C conventions for overriding the radix:
Format Radix ===================== digits Decimal 0digits Octal 0Xdigits Hexadecimal 0xdigits HexadecimalEnding any integer constant with "l" or "L" makes it into a long constant.
Variables can be changed using the full range of C assignment operators or the increment and decrement operators (++ and --).
A C expression can contain the following elements: Operators, Strings, Variables, Constants
0x1234::0x5678The primary expression operators
() [] . ->have the next highest priority and group from left to right.
The unary operators
* & ! ~ ++ --have priority less than the primary operators but greater than the binary operators and group from right to left.
The binary operators are listed here in decreasing priority. Operators on the same line have the same priority.
highest * / % + - >> << < > <= >= == != & ^ | && lowest ||
The single ternary operator has a priority less than any of the binary operators:
?:The assignment operators all have the same priority below the ternary operator and group from right to left:
= += -= *= /= %= >>= <<= &= ^= |=
If a backslash is followed by any character except one of those listed here, that character is inserted into the string unchanged. This allows the string delimiter double-quote character (") to be entered by typing \".
The following escape sequences can be used:
Sequence Value Character ---------------------------- \a 0x07 Bell \b 0x08 Backspace \f 0x0c Formfeed \n 0x0a Newline (line feed) \r 0x0d Carriage return \t 0x09 Horizontal tab \v 0x0b Vertical tab \\ \ Backslash \xnn nn Hex byte value \nnn nnn Octal byte value
Normally, a variable name obeys the C scoping rules, with auto-variables overriding static variables of the same name, which override globals. You can override this scoping if you wish to access variables in other scopes.
td [options] [program_name [program_args] ]Items enclosed in brackets are optional. "Options" are described below. "Program_name" is the name of the program to debug. If no extension is supplied, .EXE is presumed. "Program_args" are any arguments required by the program being debugged. Do not place debugger options here; they should come before the name of the program being debugged.
Example command lines:
Command Action ======= ====== td Start the debugger with no program, default options td -r prog1 a Start the debugger with -r option, load program "prog1" with one argument "a" td prog2 -x Start the debugger with default options, load "prog2" with one argument "-x".An option consists of a hyphen, followed by one or more letters and a possible text or numeric argument. Options override default configuration settings from the configuration file. To disable an option set in the configuration file, follow the option with another hyphen, for example,
td -p- myprog arg1 arg2
Options on the command line override the corresponding setting in the configuration file.
Up Move up one item Down Move down one item PgUp Move up one pane height PgDn Move down one pane height Ctrl-PgUp Move to first item in list Ctrl-PgDn Move to last item in list Esc Cancel incremental search Enter Select item in list a - z Incremental match on list items
Up Move cursor up one line Down Move cursor down one line Right Move cursor right one character Left Move cursor left one character Ctrl-Right Move right one word Ctrl-Left Move left one word PgUp Move up one page PgDn Move down one page Ctrl-Home Go to top line of window Ctrl-End Go to bottom line of window Ctrl-PgUp Go to first line in file Ctrl-PgDn Go to last line in file Home Go to beginning of current line End Go to end of current lineYou can mark a block of text by pressing Ins, then moving the cursor within the same line. Some prompts use this marked block as their default response entry.
You can also examine data items by pointing to a variable name in a Text or List pane and specifying the Inspect option from the speed menu for that pane. In a Text pane, this command works if the cursor is anywhere within the variable name you wish to inspect. You can also use the Ins key to mark an expression to inspect.
C Pascal AssemblerUse the Options/Language command to select which language is used to interpret expressions you type in. Normally, Turbo Debugger uses the language that you used to write the code at the current program address.
When you display an expression, you can enter an optional format control string that controls how the result is displayed.
c Displays a character or string expression as raw characters. Normally, non-printing character values are displayed as some type of escape or numeric format. This option forces the characters to be displayed using the full IBM display character set. d Displays an integer as a decimal number. f# Displays a floating-point format with the specified number of digits. If you don't supply a number of digits, as many as necessary are used. m Displays a memory-referencing expression as hex bytes. md Displays a memory-referencing expression as decimal bytes. p Displays a raw pointer value, showing segment as a register name if applicable.
F1 Help F2 Toggle Breakpoint F3 View Module F4 Go to Cursor F5 Zoom Window F6 Next Window F7 Trace Into F8 Step Over F9 Run F10 Command menu
The Alt function keys give you access to other
commands you use fairly often.
Alt F1 Last help Alt F2 Breakpoint At Alt F3 Close Window Alt F4 Back trace Alt F5 User Screen Alt F6 Undo Close Alt F7 Instr. Trace Alt F8 Until Return Alt F9 Execute To Alt F10 Speed menu
Normally, it shows the most commonly used function key commands. Press and hold down the Alt key and it shows the commonly used Alt function keys.
The most common way to use Inspectors is to open one by placing the cursor on what you want to inspect and pressing Ctrl-I. After you've examined the data item, press the Esc key to remove the Inspector window.
If you have several Inspectors on the screen, the Window Close command (or its equivalent, the Alt-F3 key) removes them all at once.
Usually the Interrupt key is the Ctrl-Break key combination; you can change this to another key by using the TDINST customization program.
A breakpoint can be instructed to perform one of the following actions:
Break Stop your program Log Log the value of variables Execute Execute an expression
Select one of the following commands to learn more about it:
Create Remove Delete All Stop RecordingYou can use macros to record command sequences that you often repeat, as well as to record commands from the start of a session. This is very useful when you must keep restarting and getting back to a certain place in your program.
System Breakpoints File Data View Window Run Options EditAccess the System menu in the top left corner by pressing Alt-space.
The Repaint desktop command redisplays the entire Turbo Debugger screen. This is useful if screen swapping has been disabled and the debugger screen has become corrupted with output from the program you are debugging.
Use the Options/Display options command to set how screen updating is done.
The Restore Standard command restores the window layout to the way it was when the debugger was first started.
The About command shows the sign-on copyright screen that identifies the version of Turbo Debugger that you are using.
The Open command loads a program to debug from disk. You are prompted for the name of the program to debug. You don't need to supply the .EXE or .COM extension.
You can supply any arguments to the program by specifying them after the program name, just as you would on the DOS command line.
The Change Dir command lets you set a new current drive and/or directory by prompting you for the new drive and/or directory name.
The prompt is initialized to the current drive and directory, so you can also use this command to examine the current drive and directory settings.
The File Get Info command displays a window that shows you the current state of the program you are debugging. This includes:
The Attach command lets you debug a program that is already running and was not started by Turbo Debugger. You supply the process ID of the process that you wish to debug. Turbo debugger then interrupts the process just as if a breakpoint had been encountered.
The Quit command returns control to DOS. Alt-X is the hot key that returns to DOS from any point while Turbo Debugger is running.
The memory for your program image is freed, and any open file handles are closed. If your program has allocated memory blocks from DOS, Turbo Debugger frees these as well.
The Copy command copies the currently highlighted item or position in a window to the clipboard. You can then use the Paste command to put the item somewhere else.
The Paste command copies an item from the clipboard into the current context in a window. You are given a list of clipboard items that are able to be used in the current context. To see the entire contents of the clipboard, use the View/Clipboard main menu command.
The Copy to log command copies the currently highlighted item or position in a window to the Log window.
The Edit Dump Pane to Log command writes the contents of the current pane to the Log window. This can be useful when you want to compare the values of some variables at two different places in the program. You can dump the contents of the Watches window or some Inspectors, then execute some more of your program and compare the values recorded in the log with the current values.
The Breakpoints command opens a Breakpoints window that shows a list of the current breakpoints, their conditions, and what they do when they're triggered. In Turbo Debugger, breakpoints combine the functions of breakpoints, watch points, and trace points.
The CPU command opens a CPU window that shows disassembled instructions, a hex data dump, the CPU registers and flags, and the stack contents You can also patch code using the built-in assembler. If there is already a CPU window on the screen, you are positioned in that window.
The Dump command opens a Dump window showing the contents of an area of memory that you specify. You can view the data as raw hex bytes or in any of the supported number formats, including 32-bit integers and four types of floating-point numbers. This window works the same as the Data pane in a CPU window. This window is useful if you just want to look at an area of memory, and don't care about the rest of the CPU state that the CPU window displays.
The Execution history command opens an Execution history window that shows a list of instruction that can be undone, and a list of keystroke checkpoints that you can recover to. This lets you "go back in time" if you step beyond the location where a problem occurs.
The File command opens a File window that shows the contents of a file that you specify. You are prompted for the file name; you can enter a wildcard specification and select a file from the displayed list. You can also edit the contents of the file in hex or ASCII text. If there is already a File window on the screen, the file you selected is displayed in that window. To open another File window, use the View/Another main menu command.
The Hierarchy command opens an Object Hierarchy window that shows all the Pascal or C++ object types, both in alphabetical order and as a tree showing ancestor/descendant relationships.
The Log command opens a Log window that shows a scrolling log of messages from the following events:
The Clipboard command opens a Clipboard window showing the items copied to the clipboard. You can examine clipboard items, delete them, or open a Window to show you the contents of an item. Use the Edit/Copy command to put text, data and addresses onto the clipboard. Use the Edit/Paste command to place clipboard items into prompts or windows. The type of data copied to the clipboard depends on which window or pane it is clipped from.
The Module command opens a Module window that shows a source file for the module. You can select a module to view from the list of modules in the program. If there is already a Module window on the screen, the module you selected is displayed in that window. If you want to open another Module window, use the View/Another main menu command. F3 is the hot key for this command. The Module window title shows the name of the module you are viewing, the current source file for the module, and the line number that the cursor is on. If the source file has been changed since the module was compiled and linked into your program, the message (modified) appears before the current line number. This warns you that your source file might be out of sync with the program you are debugging and that the cursor might not always appear on the correct line of source code.
The Numeric Processor command opens a Numeric Processor window that shows the contents of the 80x87 stack registers, the control bits, and the status bits. You can modify the floating-point registers and the control and status fields of the numeric processor.
The Registers command opens a window that shows the current contents of the CPU registers and flags. You can examine or change their values. This window works the same as the Register pane in a CPU window. It is useful if you just want to look at the CPU registers, and don't care about the rest of the CPU state displayed in the CPU window.
The Stack command opens a Stack window that shows the currently active calling stack. All functions starting from the call at the start of the program are shown, along with their arguments. From this window, you can also examine the variables inside a particular instance of a function on the stack; this is useful, for example, if you are using a recursive function.
The Variables command opens a Variables window that shows a list of symbols and their values for the current module and function, as well as a list of your program's global symbols and their values.
The Watches command opens a Watches window displaying the value of variables or expressions in your program that you specified using either the Data Add Watch main menu command or the Watch speed menu command in a Module window.
The Trace Into command executes a single instruction or source line. If the current window is not a CPU window, the next source line is executed. If the current window is a CPU window, a single instruction is executed. Some instructions cause the CPU to execute the following instruction as well as the current instruction. Among these are instructions such as loading of segment registers, for example, MOV SS,AX. The F7 key is the hot key that executes this command.
The Step Over command executes a single instruction or source line and skips over any procedure calls. If the current window is not a CPU window, the next source line is executed. If any part of the source line contains function calls, they are executed without stopping. If the current window is a CPU window, a single instruction is executed. If the current instruction is a CALL instruction, the entire subroutine is executed without interruption, and the program stops at the instruction following the CALL instruction. Instructions with a REP, REPNZ, or REPNE prefix are also executed without interruption. The F8 key is the hot key that executes this command.
The Go to Cursor command executes your program until it reaches the currently highlighted source or instruction line. The current window must be a CPU or a Module window so that the location to execute to can be determined. The F4 key is the hot key that executes this command.
The Execute To command executes your program and stops at the specified location in the program. You are prompted for the program address at which to stop. You can enter an address in any of the valid address formats. Alt-F9 is the hot key that executes this command.
The Program Reset command reloads the current program from disk. This command is useful if you've run the program too far during a debugging session and need to restart execution at the start of the program. This command is necessary, since you usually can't restart a program simply by starting execution at the beginning of the program. A full reload from disk reinitializes data items that the program expects to contain a particular value when the program is first started. Ctrl-F2 is the hot key for this command.
The Run Arguments command lets you set or change the command-line arguments for the program you are debugging. Use this command if you are debugging a program that requires one or more command-line arguments, but you entered either no arguments or erroneous ones with the File/Open command.
The Run/Wait for child main menu command lets you specify whether Turbo Debugger waits for the program you are debugging to stop before letting you issue additional commands. If you set it to No, Turbo Debugger lets you issue more commands after you run the program you are debugging. This lets you examine data items in your program while it is executing. However, you can't examine the CPU registers as the program is running - you see their values as of when your program last stopped. Use the Run/Next pending status command to retrieve status information from your program.
The Animate command is a self-repeating Trace Into command. Instructions or source lines are executed continuously until a key is pressed. Turbo Debugger's display changes to reflect the current program state between each trace, which allows you to watch the flow of control in your program. You are prompted for the rate at which to step instructions.
The Run command executes your program continuously until either a breakpoint is encountered, the program is interrupted with the Interrupt key, or the program terminates. The F9 key is the hot key that executes this command.
The Until Return command executes the program being debugged until the current function or procedure returns to its caller. This is useful if you have accidentally issued a Trace Into command when you really wanted to do a Step Over command, or when you have stepped through enough of a function to determine that it is working correctly, and you wish to execute the rest of it without interruption. Alt-F8 is the hot key that executes this command.
The Instruction Trace command executes a single machine instruction. After using the command, you are usually left in a CPU window. Use this command when you want to
The Back trace command undoes the last instruction or source statement. The processor and memory state are restored to the way they were before the instruction or source line was traced over. The Alt-F4 key is the hot key for this command. The history pane of the Execution history window contains a list of saved steps and allows you to control when stepping and tracing information is saved.
The Next pending status command lets you retrieve a status message from a process that is executing asynchronously. If you use the Wait for child command to specify that the program you are debugging can run in the background while Turbo Debugger is running, the status display in the top right corner of the screen changes to say PENDING when a process wants to report something, such as a breakpoint being hit or the process terminating.
The Toggle command sets or clears a breakpoint at the currently highlighted address in a Module window or CPU window Code pane. Your program stops every time it reaches a line where you have set a breakpoint. You can modify the behavior of the breakpoint by opening a Breakpoint window. This lets you set a pass count or a condition that must be true before the breakpoint happens, and also define what to do when the breakpoint is triggered. The F2 key is the hot key that executes this command. You can also click the mouse in the first two columns.
The At command sets a breakpoint at a specific location in your program. You are prompted for the address at which to set the breakpoint and for any options. Alt-F2 is the hot key that executes this command.
The Changed Memory Global command allows you to set a breakpoint that occurs when an area of memory changes value. You are prompted for the memory area to watch. Your program executes more slowly if you set any of these breakpoints. If you are running on an 80386 or later processor, make sure you've installed the hardware device driver supplied on the distribution disk; this speeds up global breakpoints. If you have a hardware debugger board, see if the vendor supplies a device driver that lets it work with Turbo Debugger.
The Expression True Global command allows you to set a breakpoint that occurs when the value of an expression becomes true. You are prompted for the expression that must become true in order for your program to stop. Your program executes more slowly if you set any of these breakpoints.
The Hardware breakpoint command lets you quickly and easily set a general purpose hardware breakpoint. The dialog box lets you set the type of hardware breakpoint, exactly as if you had issued the Hardware options command in the Breakpoint window speed menu.
The Delete All command removes all the breakpoints from your program. Use this command when you want to continue debugging your program but no longer want it to stop at any breakpoint locations you've previously set.
The Inspect command opens an Inspector to show the value of a variable or a memory-referencing expression. You are prompted for the variable or memory-referencing expression to inspect. If the cursor was in a Text pane when you issued this command, the prompt is initialized to contain the variable under the cursor, if any. If you have marked an expression using the Ins key, the prompt is initialized to the marked expression.
The Evaluate/Modify command evaluates an arbitrary expression. Enter an expression followed by an optional format control string that's separated from the expression with a comma (,). The value appears in the middle pane. You can move to this pane to scroll long value displays or error messages. If the result is changeable, you can change the expression's value by moving to the bottom pane (press the Tab key), typing a new value, and pressing Enter. If the cursor was in a Text pane when you issued this command, the prompt is initialized to contain the variable under the cursor, if any. If you have marked an expression using the Ins key, the prompt is initialized to the marked expression.
The Data Add Watch command places an expression or variable on the watch list displayed by the Watches window. If the cursor was in a Text pane when you issue this command, the prompt is initialized to contain the variable under the cursor, if any. If you have marked an expression using the Ins key, the prompt is initialized to the marked expression.
The Data Function return command lets you examine the value that is about to be returned by the current function. You can only issue this command just before the function is about to return to the function that called it.
The Options Language command lets you specify how Turbo Debugger interprets expressions you type in. You can select from one of the languages that Turbo Debugger supports.
The Options Macros command lets you set and clear macros assigned to different keys.
* Alt - (hyphen). * Pressing the key that you are assigning the macro to.Assigning no keystrokes to a key makes it perform no action. To restore a key to its original function, use the Remove command.
The Display options command lets you adjust the appearance of Turbo Debugger's display screen.
The Options Path for Source command lets you set where Turbo Debugger looks for the source files that make up your program. Source files are searched for first where the compiler found them, then in each directory specified by this command or the -sd command line option, then in the current directory, and finally in the directory that contains the program you are debugging.
The Save Options command brings up a dialog that lets you select which part of your current configuration you wish to save to disk and the file name to use.
The Restore Options command loads a configuration file from disk. You must have previously saved the configuration file by using the Save options command or the customization program to create the configuration file. Depending on which option of the Save options command you used, the configuration can contain only macros, only window layouts, or an entire configuration.
Zoom Size/move Undo Close Next Iconize/restore Next Pane Close User screenAt the bottom of the list appears a list of all the windows open on the screen. Select one of these to go directly to that window. Use the View menu commands to create new windows. The F5 key zooms the current window and the F6 key takes you to the next window.
F4 Go to cursor Alt-F7 Instruction trace F7 Trace into Animate F8 Step over Alt-F8 Until return F9 Run Alt-F9 Execute to Alt-F4 Back trace
If you want to force Turbo Debugger or Profiler to look elsewhere for a symbol, you can exert total control over where to look for a symbol name. You can specify a module, a file within a module, and/or a function to search. Where the debugger looks for a variable is known as the "scope" of that variable.
Normally you use pound signs (#) to separate the components of the scope. If it is not ambiguous in the current language, you can use dots (.) instead of #, and also omit the initial pound sign or dot.
The following syntax describes scope overriding, with brackets [] indicating optional items:
[#module [#filename]] #linenum [#variablename]
or
[#module [#filename]] [#funcname] #variablename
If you do not specify a module or file, the current module and file is assumed. For example, #123 refers to line 123 in the current module.
Scope examples:
#module1#myvar "myvar" accessible from module "module1" #myfunc#var1 "var1" accessible from routine "myfunc" module2#99 Line 99 in module "module2" m1#fil2#fun1 "fun1" accessible from file "fil2" included in module "m1"
You can set a breakpoint to stop your program at any source line or address. Position the cursor on the desired line and press F2. Press F2 again to clear the breakpoint.
You can also set a breakpoint by clicking the mouse in one of the first two columns of the line that you want to set the breakpoint on.
Turbo Debugger's breakpoints perform all the same jobs as the breakpoints, watchpoints, and tracepoints of other debuggers.
A breakpoint can be instructed to perform one of the following actions:
Break Stop your program Log Log the value of variables Execute Execute an expressionYou can set a breakpoint to execute on one of the following conditions:
Always Every time it is encountered Expression true Only when an expression is true Changed memory Only when a memory area changes Hardware When a hardware breakpoint occursBreakpoints can also be qualified by setting a Pass Count that specifies how many times the breakpoint must be passed over before being activated.
A breakpoint can also be set at a global address, which means that it occurs on every source line or instruction address. This allows you to watch the value of a variable as each line is executed, or to stop when a variable or area of memory changes value.
This section will list other non-Borland web sites that have additional information about Borland's free command line tools.
Please note that VIDE will remain primarily focused on the GNU MinGW gcc compiler. However, I do plan to continue support for the free Borland BCC 5.5. Remember that VIDE is GPLed, so the code is available for modification.
First, if I've gotten some default behavior wrong, please suggest a reasonable alternative. But remember, I chose the defaults here mainly to simplify typical, simple applications. Advanced users are expected to edit the Project file or makefile to get more options.
If you don't like the layout of this document (like tables might be better), chip in and fix it. I'll fold it back into the standard distribution.
First, the Borland C++ 5.5 compiler is not the main compiler supported by VIDE (gcc is). However, VIDE has supported BCC long enough now that it is very stable. If you have any problems using VIDE with BCC, please report them back to me.
This information was assembled for publicly available sources and is intended merely to help use VIDE with Borland BCC32. There is no guarantee of its accuracy, although it seems to be correct, but may be incomplete.
This program is provided on an "as is" basis, without warranty of any kind. The entire risk as to the quality and performance of the program is borne by you.
Bruce E. Wampler, Ph.D.
E-mail: bruce at objectcentral.com
www.objectcentral.com