Top
NetCOBOL V11.0 Debugging Guide
FUJITSU Software

2.6.4 Debugger Compatibility with Multithreading

This section describes the scheme of debugger compatibility for debugging multithread programs.

2.6.4.1 Basic operation of the debugging function in multithreading

When multiple threads are running in a process of a debugged program, debugging can be essentially performed on only one thread at a time. The thread on which debugging can be performed is called the implicit thread. Any thread can be debugged by switching the implicit thread to it. The implicit thread can be switched from the Thread List window.

Because the debugger window or dialog box displays information on the implicit thread, multithread programs can be debugged in the same manner as single-thread programs.

System and server applications may have some threads other than COBOL applications threads. It is necessary to use the same actions as with multithread applications when these applications are debugged.

2.6.4.2 Multithread-specific operations of the debugging function

While the debugging function basically works on the implicit thread as if it were a single thread, the following operations are specific only to multithreads:

2.6.4.2.1 Breakpoints

Because a breakpoint is effective for all threads, all threads stop at the specified breakpoint. Moreover, the passage count of each thread is counted. The passage count is initialized to zero by subsequent execution of any procedure after a thread ends, though the passage count is maintained until the time the thread ended.

2.6.4.2.2 Passage count points

Because a passage count is effective for all threads, the number of times a thread passes the passage count point is counted. The passage count is initialized to zero by subsequent execution of any procedures after a thread ends, though the passage count is maintained until the time the thread ended.

To check the passage count when threads other than the implicit thread end, therefore, specify on the [Operation] page in the [Environment] dialog box, a program execution break at thread end.

2.6.4.2.3 Execution

When a program is executed unconditionally, all threads are run simultaneously.

If a program is executed to a target position, the implicit thread is run under specified conditions. All threads other than the implicit thread are run unconditionally at this time.

2.6.4.2.4 Watch data/Watch conditional expression

While watching data shared by threads, the watch data or watch conditional expression function detects successful monitoring when a thread changes the data being monitored.

While watching data not shared by threads, the function also detects successful monitoring, even when the data is changed by another thread.

2.6.4.2.5 Backward trace

The backward trace function can be executed in one of two modes: in one mode the function traces back only the implicit thread, and in another mode the function traces back all threads.

In multithread trace mode, the backward trace function traces threads in order of execution. The thread currently traced is automatically displayed in the Source File window.

You can visually review the flow of control among the threads.

2.6.4.3 Functions to aid in debugging multithreads

The following debug functions help to debug multithread programs efficiently:

2.6.4.3.1 Enable/disable debugging event notifying

Notification of debugging events, such as monitoring and breakpoint halts, can be enabled or disabled for each individual thread.

When debug event notification is disabled for a thread, the thread is run, but interruption events for debugging, such as monitoring and arrival at a breakpoint, will not be notified.

This function can be specified from the Thread List window.

2.6.4.3.2 Suspend/resume

The suspend/resume function limits the action of threads during program execution.

If a thread is suspended, it remains at the current position when the program is run. If a suspended thread is resumed, it comes into operation the next time a program is run.

This function can be specified from the Thread List window.

2.6.4.4 Automating debug operations in a multithread environment

With batch debugging and automatic debugging functions, the debugger can reproduce debugging procedures.

Though these functions can also be used for debugging multithread programs, certain points deserve special notice in reproducing debugging procedures for multithread programs: