z/OS Debugger - Group home

Concurrent Debug and Code Coverage

  
IBM Debug for z/OS now has the feature to debug and collect code coverage result simultaneously!

To start collecting code coverage while debugging, click the 'Start Code Coverage' button, which can be found on Debug view toolbar.

On the first debug action to Start Code Coverage for a debug session, there will be a popup dialog 'Set Code Coverage Parameters'.
On this dialog, you can specify Test ID or accept the default value, which is the program name appended by a datetime stamp.
You can specify Tags too.

Once code coverage is started

  • source of current context will have code coverage annotation (i.e ruler of executable lines will be colored)
  • 'Start Code Coverage' button will change to 'Stop Code Coverage'


You will see the change in code coverage annotation as you debug your program. Color of hit lines will change from red to green as you do debug steps, such as step-into or step-over et cetera.
The following video snippet shows a debug session, which start code coverage while debugging, and do debug actions such as step into, step over, run to location and resume to a breakpoint.


Not only you can start code coverage collection at any point of the debug session, you can also stop collecting code coverage at any point of the debug session, and start collecting code coverage again! Hence you will have flexibility where you want to collect code coverage result.
You can stop code coverage by clicking the button 'Stop Code Coverage'. When you have stopped collecting code coverage information:

  • The button will change back to 'Start Code Coverage'
  • Code coverage annotation of hit line will not change to green as you execute debug action


In the following video snippet, a debug session which has started code coverage, execute a 'Stop Code Coverage'. After the code coverage collection is stopped, with each debug action, hit lines' code coverage annotation does not change. They stayed being red color. When code coverage is started again, lines hit on subsequent debug actions will again change to green.


Source opened from stack will have code coverage annotation too. So you can check code coverage result on calling program at any point of the debug session . Code coverage annotation will be based on the result collected at that point on the debug session.

Source opened from Module view will have code coverage annotation too. Code coverage annotation will be based on the result collected at that point on the debug session.


The coolest functionality of this feature, is that you can change value of a variable, and if you have started code coverage collection, subsequent debug steps and code coverage result collected will honor the change in variable value. Hence you can divert the branch path taken by the program by changing value of variable that determine the branch path, and collect code coverage result according to the intervene debug session.
The following video snippet shows a debug session of a COBOL program, where the program's variable RETURN-CODE determine if it will enter the block that will call on its error handling program. During the debug session, code coverage has started, and value of RETURN-CODE is changed from +0000 to +0002, which resulted the program to divert the branch path it was originally supposed to take.


By manipulating the value of variable as you debug, and start code coverage, you can inspect the code coverage result collected with the change. You can also emulated error in the program and collect code coverage!