Here are some tips and tricks on debugging COBOL applications in the Visual Studio IDE:
- Attach to a Running Process
- See
To attach to a running process and debug.
- Autos Window
- Displays the variables used in the current and in the previous statements and enables you to change their values or add watches to them. To display the window, click
Debug > Windows > Autos.
- Breakpoint-Setting
- Double-click in the left margin of editor next the a line of code, or position the cursor on the line and press
F9. You can also choose
Debug > Toggle Breakpoint or choose
Breakpoint > Insert Breakpoint from the editor context menu.
- Note: Tracepoints are supported only when debugging managed code.
- Breakpoints Window
- Displays a list of all breakpoints and tracepoints set in the code. Double-click on a breakpoint in the window to position the cursor on the line for which it has been added.
- DataTips
- Provide information about the variables in the source code. To display the DataTip for a variable, you can hover it. This works only in break mode when the execution stops and with variables that are used at run time.
- Just-In-Time Debugging
-
Enables just-in-time debugging for when an application causes an error. To enable Just-In-Time Debugging for native COBOL code, click
Tools > Options > Debugging > Just-In-Time Debugging. Check
Micro Focus Native Debugger. Works with native code only.
- Remote Debugging
- You can debug a process running on a remote system if the machines are connected using TCP/IP. See
Remote Debugging.
- Ensure that the local and remote systems are networked using TCP/IP. To connect to the remote machine and debug a program, choose
Project >
projectProperties and go to the
Debug tab. Check
Use remote machine and fill in the IP address of the remote machine.
- Run To Cursor
- Right-click a line of code in the editor and select
Run To Cursor. This starts a debugging session and executes the code till the line on which you positioned the cursor.
- Start Debugging
- Choose
Debug > Start Debugging or, alternatively, press
F5 or
F11.
F5 starts debugging and runs the application until a breakpoint or an error occurs.
F11 starts debugging and breaks on the first statement that can be debugged.
- Stop Debugging
- Choose
Debug > Stop Debugging. You can also click
in the
Debug toolbar.
- Threads Window
- Shows all threads that are running in the process. To display the window, choose
Debug > Windows > Threads.
- Tracepoint-Setting
- Tracepoints are conditional breakpoints. When the debugger hits a tracepoint, it performs an action instead of or before stopping the execution. To set a tracepoint, click on the line of code where you need to set one and choose
Debug > Toggle Tracepoint or from the context menu choose
Breakpoint > Insert Tracepoint and specify the action to perform. Tracepoints are supported only when debugging managed code.
- Variable Windows
- Include windows, such as for example
Autos,
Locals,
Quick Watch,
Watch, for monitoring and editing values and expressions.