Improvement of Transitions and Flow Visualization TFVIS for Exception Handling

It takes much time in debugging process. To find bugs effectively, it’s important to understand the dynamic behavior of programs. To support understanding the dynamic behavior, we developed TFVIS(transitions and flow visualization). It provides visualization of data transitions and data flow of Java programs. But it visualizes only some control structures and expression. Therefore, we newly corresponded to Exception-handling. This improves the usefulness of TFVIS as a tool to support the understanding of the dynamic behavior of programs.


Introduction
In software development, it takes much time in debugging process 1 .To find bugs in a program effectively, it's important to understand the dynamic behavior of the program.But it's difficult since the dynamic behavior of the program is generally invisible 2,3 .
To solve this problem, we developed TFVIS(transitions and flow visualization) 4 , which can visualize the dynamic behavior of Java programs.
It provides visualization of data transitions in each method and flow of the whole program.It has another feature which can show the data transitions with arrows.This makes it easy to follow a defect from the incident.But it's not useful because it visualizes only some control structures and expressions.
We aim at the improvement of the usefulness by corresponding an unsupported structure.This paper focuses on Exception-handling, which is one of features of Java programs and especially corresponds to Try Catch syntax.Figure 2 shows the structure of TFVIS.It consists of Analyzer and Visualizer, and Analyzer consists of Structural Analyzer, Probe File Generator, and Dynamic Analyzer.

TFVIS
Structural Analyzer analyzes the structure of the program and outputs the analysis result as structural P -283 information to the file.The structural information is used for deciding the insert position of probes in Probe File Generator and for generating diagrams in the Visualizer.Further, Structural Analyzer obtains events occurring in each line of the source code.The events are a specific process as a standard of visualization, and each event has a value of an event type.
Based on the structural information, Probe File Generator generates a probe file, which embedded probes in the target source code.The probe outputs information on the behavior at program execution.The probe outputs information on the behavior at program execution.There are several kinds of probes, and Probe File Generator selects probes to be inserted for each event that occurs in each line of the source code.
Dynamic Analyzer analyzes the behavior at the time of execution from the probe file and outputs the analysis result as executional information.
Visualizer visualizes the behavior at the time of program execution based on the structural information and the executional information outputted by the Analyzer.

Improvement of TFVIS
In this section, we describe the improvement of TFVIS for corresponding to Try Catch syntax.We describe the changes of each part to correspond to Try Catch syntax and then show the data flow of TFVIS after the improvement.

Improved points of each division
The improvement to correspond to Try Catch syntax is as below.

. Definition of values of new event types in Structural Analyzer
In Structural Analyzer, we newly define the values of the event types for Try Catch syntax.
The values of the defined event types are the value of the start of the Try block (380), the value of the end of the Try block (382), the value of the start of the Catch block (390), and the value of the end of the Catch block (392).

Definition of new probes for Try Catch syntax in Probe File Generator
In Probe File Generator, we newly defined probes to be inserted for the event of Try Catch syntax.
The probe for the event of the Try block defines as Try Detection Probe.This probe takes as arguments the instance ID, method ID, method execution number, and line number at the time of execution.And, to visualize it, outputs try event ID (380), instance ID, method ID, method execution number, and the line number to the Executional Information File.
In a similar way, the probe for Catch block defines as Catch Detection Probe.In this probe, the arguments are

Insertion of the probes for Try Catch syntax in Probe File Generator
In the Probe File Generator, the newly defined probes are inserted for the event of the Try Catch syntax.
Try Detection Probe is inserted just preceding every line from the start of the Try block to the end of the Try block.At this time, the value of the line number obtained by the probe is the line number of the immediately following statement.Also Catch Detection Probe is inserted immediately following the Catch event.
When a Catch block is executed during Loop, there is such a process as to break out of Loop.To correspond to this, insert a boolean type variable ("isLoop") definition indicating whether it is in a Loop at the start of method.We change Probe File Generator so that "isLoop" becomes true if it is in the Loop, and false otherwise.If "isLoop" is true when an event of the end of Catch block occurs, existing Loop Surroundings Detection Probe and Loop End Detection Probe are executed on the immediately preceding line.

Visualization of events of Try Catch syntax in Visualizer
When an Exception-handling event occurs, a box describing "Catch" in red font is placed in the execution place immediately preceding the data transition diagram.Also, a red arrow that connects the occurrence part of Exception-handling and the execution part is drawn.

Data flow in Analyzer
Figure 3 shows the flow of data in which a program including a Try Catch syntax is applied to TFVIS after the improvement.
By improving of Structural Analyzer, we can obtain events on Try Catch syntax.From Figure 3, we can see that structural information file has value of the start of the Try block (380), the value of the end of the Try block (382), the value of the start of the Catch block (390), and the value of the end of the Catch block (392).
By the events of Try Catch syntax obtained by Structural Analyzer, Probe File Generator inserts the newly defined probes.From Figure 3, we can see that Try Detection Probes are inserted just preceding each statements in Try block, Catch Detection Probe is inserted just following start of Catch block, and an if statement that executes Loop Surroundings Detection Probe and Loop End Detection Probe if it is in a loop.
By executing the probe file in which the probes are embedded by the Dynamic analyzer, we obtain executional information.When Visualizer reads execution information having a Catch event ID, the execution of the event immediately

Application Example
By the improvement of TFVIS, we confirm that programs including Try Catch syntax can be visualized correctly.As an application example, we show that TFVIS correctly visualizes the method including Try Catch syntax by using "inventory management program" written in Java.
Figure 5 shows a data transition diagram that visualizes the SearchInfo method, including a Try Catch syntax.This method requires "ID" as an argument, and displays instance's "ID", "name", "number of stock", and "unit price".Since there were only 3 instances generated as inventory, and stored in the list.At this time, assuming that the user inputs "ID" 3, it refers to the fourth in the list, and an exception of "IndexOutOfBoundsException" occurs.
From Fig 5, we can see that the box "Catch" in the line referring to the list and a red arrow from the box to the line of Exception-handling which occurred is drawn.From this, it can be seen that the occurrence of Exception-handling is correctly visualized on the data transition diagram.

Discussion
In this research, we aimed to improve the usefulness of TFVIS by corresponding to Try Catch syntax.In this section, we first describe the evaluation of the improvement of TFVIS.Next, we describe relation works.

Evaluation
If the program to be applied contains Try Catch syntax, a compile error occurs and visualization cannot be executed in existing TFVIS.
In order to visualize a program containing a Try Catch syntax, firstly, we improved Structural Analyzer to obtain the events by using newly defined values of event types for the Try Catch syntax.
Secondly, we improved Probe File Generator to insert the newly defined probes which output executional information for Try Catch syntax.
Finally, we improved Visualizer to draw the box written "Catch" in red and red arrow that connects the occurrence part of Exception-handling and the execution part.
TFVIS after the improvement can visualize the program containing Try Catch syntax.From this, it can be said that the usefulness of TFVIS has been improved by corresponding to Try Catch syntax.

Relation works
Breakpoint debugging Breakpoints are one of the most frequently used debugging support approaches 6 .With debugging using breakpoints, program execution can be stopped at arbitrary points.Then, you can refer to the execution status of the program, such as values of each variable at the time of stoppage.
Breakpoint debugging has a problem that it is difficult to select the installation point of the breakpoint.Selection of an appropriate breakpoint location requires user's knowledge and experience 7 .TFVIS is useful in that it can obtain information only by selecting a method having information desired by the user and therefore does not depend on the user's ability.
Moreover, visualization by TFVIS can overlook the flow of the whole program and the flow of method process.By using the data transition line, it is also possible to grasp the dependency relationship between the variables.In comparison with breakpoint Fig. 5. Visualization of SearchInfo method P -286 debugging, these functions are superior in that it is easier to find out how the certain variable is defined.JIVE JIVE 8 (Java Interactive Visualization Environment) is a tool visualizing execution of Java programs.
JIVE has the function of generating UML object diagrams and sequence diagrams from process at the time of program execution.In addition, it supports inquiries by queries, for example, it is possible to make an inquiry such as "Where is the method "func" returning NULL to the return value?".The process found by the inquiry is highlighted on the sequence diagram and helps to grasp the behavior at the time of execution.
When comparing JIVE and TFVIS, JIVE does not have a function to indicate the dependency between variables like data transitions.Inquiries about variable updating are possible, but when examining dependencies such as data transitions, it is necessary to repeat inquiries.Therefore, TFVIS is more effective for tasks such as searching for the cause when a suspicious value is found.

Conclusion
In this research, we aimed to improve the usefulness of TFVIS by corresponding to unsupported structure.TFVIS shows behavior at the time of program execution by data transition and data flow visualization.The visualization of TFVIS makes it easy to grasp the behavior at the time of execution of the program including the defect, and it becomes possible to efficiently specify the defect.
However, there are programs that cannot be visualized with existing TFVIS.The fact that programs containing basic syntax of Java programs cannot be visualized means lacking usefulness.
In this research, we improved TFVIS so that it can visualize a program containing Try Catch syntax.It can be said that the usefulness of TFVIS has been improved by this improvement.
The future issues are shown below.
Correspondence to programs including occurrence of input wait state TFVIS does not have the function of receiving input from the user.Therefore, when a program including occurrence of an input wait state is applied to TFVIS, since the execution of the analysis section is not completed, execution information cannot be obtained and visualization cannot be performed.Implementation of inquiry function TFVIS has no inquiry function.This problem becomes more troublesome as the process of the program to be visualized increases.Therefore, we think that it is necessary to implement the inquiry function so that the user can easily find a process satisfying a specific condition.Support for multithread programs TFVIS cannot visualize multithreaded programs.In multithread programs, process becomes complicated easily because data is exchanged between threads.If we can visualize a complicated process by multithreading, the usefulness of TFVIS will be improved.

Figure 1
Figure 1 shows an example of visualization by TFVIS.TFVIS generates a data transition diagram.It shows the behavior at the time of program execution in detail.It is based on structural information obtained by analyzing the program structure and executional information at the time of execution.The data transition line can visualize data transitions.When the user finds a suspicious value of a variable on the data transition diagram, by using the data transition line, it becomes easy to specify the cause of generating the suspicious value.TFVIS visualizes the flow of the whole program by the execution flow diagram based on the UML sequence diagram.The execution flow diagram shows the usages of a method of each class and relation of a method call.Figure2shows the structure of TFVIS.It consists of Analyzer and Visualizer, and Analyzer consists of Structural Analyzer, Probe File Generator, and Dynamic Analyzer.Structural Analyzer analyzes the structure of the program and outputs the analysis result as structural Structural Analyzer Definition of new probes for Try Catch syntax in Probe File Generator Insertion of the probes for Try Catch syntax in Probe File Generator Visualization of events of Try Catch syntax in Visualizer 3.1.1

Figure 4
Figure 4 shows the flow of visualization when applying a program including Try Catch syntax.Based on the structural information, the data flow diagram and source code on data transition diagram are drawn.Based on the executional information, the data transition diagram is drawn.When Visualizer reads execution information having a Catch event ID, the execution of the event immediately