BDEBUGGERNot in LE
Print Topic  Return to Overview  Previous Topic  Next Topic 
Purpose:Calls the internal batch file debugger. This is an extremely powerful command that includes support for breakpoints, bookmarks, syntax coloring, and editing.

 

Format:BDEBUGGER [/A /B /C /E /F /I /K /N /W] batchfilename [parameters]

 

batchfilename

Full name of the batch file to debug.

parameters

parameters for the batch file

 

/A(lias list window)

/I(nactive)

/B(atch variable window)

/K(eep debugger window)

/C(reate new batch file)

/N (do Not hide the debugger window)

/E(nvironment variable window)

/W(atch window)

/F (user-defined Functions window)

 

 

Usage:

 

BDEBUGGER opens a special window in which a batch file can be examined, modified, and executed.

 

The debugger window includes a slider control on the lower left corner of the status bar to control the transparency level of the debugger window.  If the debugger window is at least partially transparent, it will not be hidden while individual commands in the batch file are being executed (see the /N option).

 

The batch debugger window toolbar has a number of icons to control debugging. Each has a tooltip for quick reference:

 

NewCreate a new batch file. If you have an existing file open, you will be prompted to save any changes before it exits.
OpenOpen an existing batch file.
SaveSave the current batch file.
PrintPrint the current batch file.
Copy Copy the highlighted selection to the clipboard.
CutCopy the highlighted selection to the clipboard and delete it from the file.
PasteCopy the contents of the clipboard to the current cursor location.
FindSearch for text.
ReplaceReplace the text with other text.
UndoUndo the last edit.
RedoRestore the last Undo.
Start DebuggingStarts the debugger. The cursor will be placed on the first line.
Stop DebuggingStops the debugger.
Step IntoExecute the current line.
Step OverExecute the current line but turn off the debugger for the duration of a CALL or GOSUB.
Run to BreakpointExecute the batch file, stopping at the next breakpoint.
Toggle BreakpointSets or turns off a breakpoint on the current line.
Clear BreakpointsTurns off all breakpoints.
File PropertiesDisplays information on the current batch file.
Start New ShellStart another copy of TCC (this is useful if you need to perform some tasks while debugging a file.)

 

You can also set a breakpoint by moving the mouse cursor to the left margin of a line and left-clicking. You can only set a breakpoint on an executable line (i.e., not on a blank line, comment, label, etc.),

 

You can get help for the currently selected (highlighted) command / variable / function by pressing Ctrl-F1, or right-clicking the mouse and selecting Help from the context menu.

 

You can change the line to be executed next when in debugging mode with either the "GOTO" dialog or by moving the caret to the line and either right clicking & selecting "Jump to This Line" or by pressing Ctrl-Shift-F11.  Note that if you attempt to jump into or out of a DO loop or IFF block, bad things will happen!

 

The debugger's Watch window allows you to monitor environment variables or to pause execution when a specified condition is met. The Watch window appears at the bottom of the debugger window. Enter the variable name or expression in the left column; the debugger will automatically display the current value in the right column. You can also add a variable to the Watch window by selecting it in the main debugger window, then clicking the right mouse button and selecting "Add to Watch". If the string in the left column is a single argument, it is assumed to be a variable name. Otherwise, it is assumed to be an expression. Expressions can be anything that IF can evaluate; for example:

 

       %i = 3

       ERRORLEVEL GT 12

 

Note that expressions require variable names to be prefixed by a %. If you're entering a single variable argument to monitor, do not use a %.

 

When the value of a monitored variable changes, the Watch window will change its background color (to a light red).

 

Alt-F11 will invoke the Evaluate Expression dialog. Ctrl-F9 will invoke the Evaluate Expression dialog for the current selection, or if no text is selected, for the current line.

 

You can open popup windows to display and/or modify aliases, batch variables, environment variables, and user functions. These windows will "dock" to the outer edges of the debugger window and will move with the debugger window.  The variable windows also have a toolbar, with a couple of additional buttons:

 

Update ListSave a modified list.
Import a FileAdd the contents of a file to the list.

 

The environment variables window displays any variables changed during debugging in a different color.  (The default is red; you can change it by adding a ChangeRGB=... line to BATCH.BCP with the appropriate   RGB value.)  You can specify variables to exclude from the environment variable window with the DebugVariableExclude variable.  For example, to suppress the display of the processor and user variables:

 

       set DebugVariableExclude=proc*;user*

 

Note that this option doesn't affect the existence of the variables, just whether they're displayed in the environment variable window.

 

If you press Ctrl-C or Ctrl-Break while debugging, you will see the prompt:

 

Cancel batch job filename (Y/N/A/D) :

 

Pressing D will return you to single-step mode in the debugger.  (This allows you to interrupt a run-to-breakpoint without terminating the debugger and batch file.)

 

The default settings for the BDEBUGGER (Batch File Debugger) command  are kept in ASCII text file BATCH.BCP (in the program directory). Only modify the contents of that file if you're positive you know what you're doing. We strongly recommend that you keep a copy of the original, should your modifications prove unworkable or undesirable.

 

The text processing commands available in the batch debugger and variable windows are listed below. The default "hard coded" values used in the BATCH.BCP file are shown in parentheses after each command name. The text commands can be classified into general categories:

 

Onestep        Caret commands

Onestep        View commands

Onestep        Edit commands

Onestep        Mark / Clipboard commands

Onestep        Search commands

Onestep        File commands

Onestep        Bookmark commands

Onestep        Breakpoint commands

Onestep        Expression evaluation commands

 

    

Caret commands

 

Right

(1)

This command will move the caret one character to the right. When the caret is on the last position of the current line it is moved to the first position of the next line.

Shift-Right

(2)

In addition to the caret movement this command will also extend the current selection to the new caret position.

Left

(3)

This command will move the caret one character to the left. When the caret is on the first position of the current line it is moved to the last position of the previous line.

Shift-Left

(4)

In addition to the caret movement, this will also extend the current selection to the new position.

Up

(5)

This command will move the caret one line up. The caret column position will be set as close to its previous column position as possible.

Shift-Up

(6)

In addition to the caret movement this command will also extend the current selection to the new position.

Down

(7)

This command will move the caret one line down. The caret column position will be set as close to it's previous column position as possible. When the caret is on the last line but not on the last column it will be moved to the last column.

Shift-Down

(8)

In addition to the caret movement this command will also extend the current selection to the new position.

End

(9)

This command will move the caret to the end of the line it is currently on. If the caret is already at the end nothing happens.

Shift-End

(10)

In addition to the caret movement this command will also extend the current selection to the new position.

Home

(11)

This command will move the caret to the start of the line it is currently on. If the caret is already at the start nothing happens.

Shift-Home

(12)

In addition to the caret movement this command will also extend the current selection to the new position.

Ctrl-Right

(13)

This command will move in one of the following ways:

 

 

When the caret is located on a delimiter character the caret is moved right until the first non-delimiter and non-white space is found.

 

 

When the caret is located on a non-delimiter character and not on a white space character the caret is moved to the start of the next word.

 

 

When the caret is located on a white space the caret is moved to the start of the next word or the next delimiter depending on what comes first.

 

 

When the caret is located on the last word, delimiters or white-space of the current line the caret is moved to the first word or delimiter of the next line.

Ctrl-Shift-Right

(14)

In addition to the caret movement this command will also extend the current selection to the new caret position.

Ctrl-Left

(15)

This command will move in one of the following ways:

 

 

When the caret is located on a delimiter character and it is preceded by delimiters the caret is moved left to the first delimiter.

 

 

When the caret is located on a delimiter character and it is  not preceded by delimiters the caret is move to the start of  the previous word or delimiters.

 

 

When the caret is located on a non-delimiter character and not on a white-space character the caret is moved to the start of  the current word.

 

 

When the caret is located on a white space the caret is moved to the start of the previous word or the previous delimiters depending on what comes first.

 

 

When the caret is located on the start of the first word, delimiters or white-space of the current line the caret is moved to the start of the last word or delimiters of the previous line.

Ctrl-Shift-Left

(16)

In addition to the caret movement this command will also extend the current selection to the new position.

Ctrl-Home

(17)

This command will move the caret to the beginning of the text. When the caret is already at this location nothing happens.

Ctrl-Shift-Home

(18)

In addition to the caret movement this command will also extend the current selection to the new position.

Ctrl-End

(19)

This command will move the caret to the end of the text. When the caret is already at this location nothing happens.

Ctrl-Shift-End

(20)

In addition to the caret movement this command will also extend the current selection to the new position.

Ctrl-Tab

(21)

This command will move the caret to the previous tab-stop position. When the caret is located at the start of the line nothing happens.

Ctrl-Shift-Tab

(22)

In addition to the caret movement, this command will also extend the current selection to the new  position.

PgUp

(23)

This command will move the caret one view up when it is located on the top line currently in the view. When the caret is not located on the top line of the view, it will be  moved there.

Shift-PgUp

(24)

In addition to the caret movement this command will also extend the current selection to the new position.

PgDn

(25)

This command will move the caret one view down when it is located on the bottom line currently in the view. When the caret is not located on the bottom line of the view, it will be moved there.

Shift-PgDn

(26)

In addition to the caret movement, this command will also extend the current selection to the new position.

 

View commands

 

Ctrl-Down

(80)

This command will scroll the view one line up. The command will always keep the caret inside the view. When it reaches the bottom of the view, the caret is automatically moved to the next line.

Ctrl-Up

(81)

This command will scroll the view one line down. The command will always keep the caret inside the view. When it reaches the top of the view, the caret is automatically moved to the previous line.

Ctrl-PgDn

(82)

This command will scroll the view one column to the left. The caret is not moved.

Ctrl-PgUp

(83)

This command will scroll the view one column to the right. The caret is not moved.

 

Edit commands

        

Ctrl-Z

(100)

This command will undo the last change made to the edit control contents. You can undo any number of changes made to the control contents up to the maximum number of undo/redo hops.

Ctrl-Y

(101)

This command will redo the last change you have undone. You can re-do any number of changes up to the number of changes undone.

Shift-Del

(103)

This command will remove all characters to the right of the current caret position.

Backspace

(104)

This command will remove the character to  the left of the caret. When the caret is located at the start of the line, the characters right of the caret are appended to the  previous line and the caret is moved to be positioned between the old line contents and the appended characters.

Delete

(105)

This command removes the character to the right of the caret. When there are no characters to the right of the caret, the contents of the next line is appended to the current line.

Alt-Delete

(106)

This command deletes the current line.

Return

(107)

This command will split the current line and create a new line of the characters, if any, right of the caret. The caret is moved to the start of the newly created line.

Alt-U

(108)

This command will convert all lower-case characters of the word under the caret to upper-case characters. If the caret is not located on a word, nothing happens.

Alt-L

(109)

This command will convert all upper-case characters of the word under the caret to lower-case characters. If the caret is not located on a word, nothing happens.

Alt-S

(110)

This command will convert all lower-case characters to upper-case characters and upper-case characters to lower-case characters of the word under the caret. If the caret is not located on a word, nothing happens.

Ctrl-Delete

(113)

When the caret is located on a word, this command will delete all characters in the word right of the caret position.

Ctrl-Backspace

(114)

When the caret is located on a word, this command will delete all characters in the word left of the caret position.

Tab

(115)

This command does one of the two following things:

 

 

When there is a valid text selection, this command will indent the lines covered by the selection right by one tab-stop.

 

 

When there is no text selection, a tab is inserted at the current caret position.

Shift-Tab

(116)

This command does one of the two following things:

 

 

When there is a valid text selection, this command will indent the lines covered by the selection left by one tab-stop.

 

 

When there is no text selection, the caret is moved back to the previous tab-stop position.

Shift-Alt-T

(117)

This command will swap the line on which the caret is located with the previous line. When the caret is located on the first line, nothing will happen.

Shift-Ctrl-U

(118)

When there is a valid selection, this command will convert all lower-case characters in the selection to upper-case characters. If there is no valid selection, nothing happens.

Ctrl-U

(119)

When there is a valid selection, this command will convert all upper-case characters in the selection to lower-case characters. If there is no valid selection, nothing happens.

Ctrl-Alt-U

(120)

When there is a valid selection, this command will convert all lower-case characters in the selection to upper-case characters and all upper-case characters in the selection to lower-case. If there is no valid selection, nothing happens.

Ctrl-D

(121)

This command will insert the system date at the current caret location. The date output is formatted using the user's default format.

Shift-Ctrl-D

(122)

This command will insert the system time at the current caret location. The time output is formatted using the user's default format.

Ins

(123)

This command will toggle the current editing mode between overwrite and insert.

                                  

Mark / Clipboard commands

 

Shift-Ctrl-W

(200)

This command will select the word on which the caret is currently located. When the caret is not located on a word, nothing happens.

Ctrl-A

(201)

This command will select all the text.

Shift-Ctrl-L

(203)

This command will select the line on which the caret is currently located.

Ctrl-V

(225)

This command will, when there is text present in the clipboard, paste the clipboard contents at the current position.

Ctrl-C

(226)

This command will, when there is a selection, copy the selected text to the clipboard.

Ctrl-X

(227)

This command will, when there is a selection, copy the selected text to the clipboard and remove the selection from the text.

Shift-Ctrl-C

(229)

This command will copy the line on which the caret is located to the clipboard.

Shift-Ctrl-X

(230)

This command will copy the line on which the caret is located to the clipboard and remove the line from the text.

Alt-C

(232)

This command will, if there is a selection, append the selection to the current clipboard contents. The result is placed on the clipboard again.

Alt-X

(233)

This command will, if there is a selection, append the selection to the current clipboard contents. The result is placed on the clipboard again, and the selection is removed from the text.

 

Search commands

 

Ctrl-F3

(275)

This command will find the next occurrence of the word under the caret. When the next occurrence is found, it is selected.

F3

(277)

This command will find the next occurrence of the current search pattern. When the search pattern is found, it is selected.

Shift-F3

(278)

This command will find the previous occurrence of the current search pattern. When the search pattern is found, it is selected.

Ctrl-]

(279)

This command will find the matching closing bracket if the caret is located on an opening bracket, or the matching open bracket if the caret is located on a closing bracket.

Shift-Ctrl-]

(280)

This command will find the matching closing bracket if the caret is located on an opening bracket, or the matching opening bracket if the caret is located on a closing bracket. In addition the text from the opening bracket up to and including the closing bracket is selected.

Ctrl-G

(300)

This command will show the goto dialog.

Ctrl-F

(301)

This command will show the find dialog.

Ctrl-H

(302)

This command will show the replace dialog.

          

File commands

        

Ctrl-S

(401)

This command will save the control contents using its current name

Shift-Ctrl-Del

(402)

This command will delete all text. If the text has been modified the user will be prompted to save the contents first.

Ctrl-P

(403)

This command will open the printer properties dialog.

        

Bookmark commands

 

Ctrl-F2

(252)

This command will clear the bookmark on the current line if it is set, or set the bookmark if it is cleared.

Shift-Ctrl-F2

(253)

This command will clear all bookmarks.

F2

(254)

This command will place the caret on the next line which has a bookmark set. When there is no next line with a bookmark, the text is searched starting at the first line.

Shift-F2

(255)

This command will place the caret on the previous line which has a bookmark set. When there is no previous line with a bookmark, the text is searched from the last line up again.

 

Breakpoint commands

        

Ctrl-B

(262)

This command will toggle a breakpoint on the current line.

Ctrl-Shift-F9

(263)

This command will clear all breakpoints.

 

Expression evaluation commands

        

Alt-F11

Ctrl-F9

 

Invoke the Evaluate Expression dialog.

Invoke the Evaluate Expression dialog for the current selection. If no text is selected, evaluate the current line.

               

Options:

 

/AStart with the alias window open.

 

/BStart with the batch variables window open.

 

/CIf the specified batch file doesn't exist, create it without prompting.

 

/EStart with the environment variables window open.

 

/FStart with the user-defined functions window open.

 

/ILoad the batch file, but do not start execution

 

/KKeep the batch debugger window open and switch to edit mode after the batch file exits.

 

/NBy default, the debugger window hides itself while the debugged batch file is executing. /N keeps that window visible in the background (the TCC window is brought to the foreground).

 

/WOpen the Watch window when the debugger starts.

 

Topic "bdebugger.htm" last edited 5/12/2008. ©2008  JP Software, Inc.
Keywords: BDEBUGGER,Debugging,Batch Files,Bookmarks,Breakpoint,Syntax Coloring,BATCH.BCP,Batch Debugger