Journal of Robotics, Networking and Artificial Life, Vol. 1, No. 2 (September 2014), 111-115

Proposal of a Visualizing Method of Data Transitions toSupport Debugging for Java Programs
Tetsuro Katayama*†, Hiroto Nakamura†, Yoshihiro Kita‡, Hisaaki Yamaba† and Naonobu Okazaki†

Faculty of Engineering, University of Miyazaki, Miyazaki 889-2192, Japan†‡

Security Center, Kanagawa Institute of Technology, Kanagawa 243-0292, Japan*

Corresponding author, E-mail: kat@cs.miyazaki-u.ac.jp
Tel: +81-985-58-7586, Fax: +81-985-58-7586

AbstractIt takes much time to find the cause of a bug in debugging of programs. Finding the cause of a bug needs tocomprehend a flow and data transitions in executing programs. It is difficult to grasp behavior in executing theprograms whose behavior is unexpected by a bug. We propose a visualizing method of data transitions to support
debugging for Java programs in order to improve efficiency of debugging by supporting to find the cause of a bug.
We have implemented TVIS in order to confirm efficiency of the proposed method. The data transitions diagram isthe most characteristic function of TVIS which shows the data transitions in executing programs as a table. It canshow visually abnormal behavior: no data renewed at all, data abnormally renewed, and so on. Because abnormal
behavior is detected in the data transitions diagram at first glance, it is useful for programmers in finding the causeof a bug. This paper shows that the method can support to find the cause of a bug.
Keywords: programming, program slicing, visualization, debug, dynamic analysis, syntax analysis

1. Introduction
It takes much time to find the cause of a bug indebugging of programs [1]. Finding the cause of a bug
needs to comprehend a flow and data transitions inexecuting programs. It is difficult to grasp behavior inexecuting the programs whose behavior is unexpectedby a bug.
Additionally, many programs arecomplicated for including a number of loops andbranches. In particular, unskilled programmers needmore time for this work.
Thin slicing [2] is a technique to find the cause of abug, but sometimes its information is insufficient. Thinslicing is a kind of program slicing [3], and can analyze
data transitions without superfluous information by
restricting abstraction of slice to data transitions only.
However, enough information to find the cause of a bug

cannot be gotten because states and renewals timing ofdata which is not selected as slice are not shown.
This paper proposes a visualizing method of datatransitions to support debugging for Java programs inorder to improve efficiency of debugging by supportingto find the cause of a bug. The method supports tograsp behavior in executing programs because
visualizes renewals and states of each data.
This paper has implemented TVIS which is tool tovisualize data transitions for Java programs to confirm
efficiency of the proposed method. Main functions ofTVIS are the data transitions diagram, the renewal
history table, and the slicing function. In particular, thedata transitions diagram is the most characteristic
function which shows the data transitions in executing
programs as a table. Therefore, the method showsabnormal behavior and data renewals for understanding
behavior of executing programs.

Published by Atlantis Press
Copyright: the authors
111

This paper visualizes the programs which include
a bug in order to confirm that TVIS can support tofind the cause of a bug.

2. Data Transitions
The data transitions in this paper show the flow ofvariable renewals in executing a program. It expresses
when and what value of each variable is renewed.
Programmers can grasp behavior of a program because
they can prefigure the behavior of each variable atarbitrary timing in the program execution by
understanding the data transitions. Hence, finding thecause of a bug becomes easier by comparing thedifference between the behavior which programmers
expect and the actual behavior, if they grasp the datatransitions of the program which includes a bug.
However, it is difficult to grasp data transitions of theprogram which includes a bug. The reason is that theprogram which includes a bug doesn't behave as
programmer's expectation, in addition they doesn’tknow the cause of a bug.

3. Visualization
In order to confirm efficiency of the proposed
method, TVIS (transitions visualization), which is tool
to support debugging, has been implemented. It canvisualize data transitions. Fig.1 shows the process ofvisualizing data transitions. The contents of the process
is as follows.
I.

II.

TVIS
staticallyanalysesstructure
information of the program in order tochoose the point which probes to do dynamic
analysis are inserted in.
TVIS does syntax analysis of the source code
which is visualized and analyses the result of it forinvestigating structure information of the program.
Structure information of a program is information
which includes the following data: locations ofdeclaring variables, locations of renewals, rangesof each variable scope, locations of loops, and soon.
TVIS generates the source code which
includes probes, and then outputs the resultof dynamic analysis of the program byexecuting it.

Fig. 1:The process of visualizing data transitions.
TVIS generates the probe file which is inserted
probes in the source code to get information ofrenewals of variables and loops from structure
information. TVIS outputs the result of dynamic
analysis by executing the probe file after
compiling it.
III. TVIS visualizes data transitions by using
the result of dynamic analysis and thestructure information of a program.
The result of dynamic analysis has information ineach process in executing the program: declaration
and renewals of variables, and loop. TVIS analyses
data transitions which occur in each process byusing the result of dynamic analysis, and showsthem on the window.
Main functions of TVIS are the data transitions
diagram, the renewal history table, and the slicing
function. Fig.2 shows an example of the window ofTVIS. The data transitions diagram is on the upper rightof the window, and the renewal history table is on thegreen area, and slices list as the result of the slicing
function is on the blue area. TVIS can support to grasp
behavior of executing programs because it shows datatransitions by using these functions.
The data transitions diagram is the most characteristic
function which shows renewals of each variable and its
timing. It is a table and indicates the number of
iterations of each loop in a lateral direction andindicates the line number of data renewals in a verticaldirection, and shows renewal value of variables in eachloop. It is possible to understand the line and the loop
where each renewal exists by using the data transitions
diagram. For example, the area which is surrounded by
the red frame in Fig.2 shows that Loop1 is repeated four

Published by Atlantis Press
Copyright: the authors
112

Fig. 2: An example of the window of TVIS.
times in the first loop of Loop0. The area which issurrounded by the yellow frame in Fig.2 shows that thevalue of variable asc is assigned into 10 in the third loopof Loop1 in the first loop of Loop0. Hence, the datatransitions diagram can show the flow of renewals ofeach data. Moreover, it is possible to grasp renewals andflow of the whole by using the table form, it is easy tounderstand states of the other data when a suspicious
state occurs.
In addition, TVIS shows the data transitions arrow
which shows relations between each renewal ofvariables as the red arrow on the data transitions
diagram. The relations mean ones between state of avariable and the state of other variables which is used
for the renewal of its state. After a programmer selects astate by clicking a value on the data transitions diagram,
TVIS draws a red arrow from the state which influenced
its renewal to the state which was selected. When asuspicious state occurs, finding the cause of it becomeseasy by using the data transitions arrow.
The renewal history table shows how many renewalsof each variable in executing programs happen and what
its value is after renewals. It indicates the number ofrenewals in a lateral direction and indicates a variablename in a vertical direction. It can show information
about whether abnormalities of values of variables after
renewals and the number of the renewals happen.

In addition, TVIS can perform thin slicing to arbitrarystates of each variable as an ancillary function. Whenthe value on the data transitions diagram or the renewal
history table is clicked, TVIS performs thin slicing, andshows the result of slicing on the blue area of thewindow. TVIS can perform thin slicing at one click, andit becomes easy to perform the slicing to not only thefinal state but also an arbitrary state of each variable byusing the data transitions diagram or the renewal history
table. Therefore, analysis of data transitions can beperformed without superfluous slices.

4. Example
Two programs which include a bug are visualized byadapting them to TVIS, to confirm efficiency of the
proposed method. They are bubble sort programs in
Java and include different bugs.
The bubble sort program in Fig.3 sets a wrongcondition of a loop. The correct loop condition in the5th line in Fig.3 is not "j < data.length-j-1" but "j <data.length-i-1". This mistake that programmers
confuse variables of similar names happens often, butthey hardly notice existence of it. The program has
returned the array which is identical with the originalarray because of this mistake.

Published by Atlantis Press
Copyright: the authors
113

Fig. 3:An example A: Visualizing the program which includes a bug.

Fig. 4:An example B: Visualizing the program which includes another bug.
The data transitions diagram on Fig.3 showsabnormal behavior of exchanging elements of the arrayfrom 9th line to 11th line and Loop1 which starts at the5th line. The area which is surrounded by the red frameshows that all iterations in Loop1 repeated only twotimes and variable j as the loop counter didn't become
more than two. The correct behavior of Loop1 dwindles
the number of iterations of the loop as shown Fig.2.
Hence, we understand that the loop condition of Loop1
is suspicious.
The bubble sort program in Fig.4 contains variables
assigned to a wrong value. The variable which is usedfrom 7th line to 11th line on Fig.4 is not variable i butvariable j. This mistake occurred by merely confusing
variables, but it is hardly noticed because multiple lines
are wrong in succession. The program finishes process
without executing until completion of sorting because ofthis mistake.
The data transitions diagram on Fig.4 showsabnormal behavior to exchange elements of the array.
The area which is surrounded by the red frame showsthat Loop1 repeated four times in the first loop of Loop0
which starts at the 3rd line. Here, if statement at the7th line, was expected to compare all elements of thearray, but it never exchanged them. Hence, weunderstand that if statement at the 7th line is suspicious.
From the above two results of visualization, we haveconfirmed that programmers can get useful information
to find the cause of a bug and grasp behavior of theprogram included the bug by using visualization of datatransitions of TVIS.

5. Evaluation
This paper has implemented TVIS which supports
debugging for visualizing data transitions, in order toconfirm efficiency of the proposed method byvisualizing the program which includes bugs. It explains
the difference by comparing the method withconventional methods below.
Dynamic slicing [4] which includes thin slicing is atechnique to analyze behavior in executing a programby extracting processes which relate to generation of a
selected state as slice. We cannot get useful information
if not we appositely decide a condition of slicing,
because slicing cannot show information which is notselected as slice. In case of Fig.3, it is difficult to get

Published by Atlantis Press
Copyright: the authors114

useful information, because slice except initialization
processes is not gotten even if elements of the array are
selected as a condition of slicing. However, TVIS canshow useful information for programmers to grasp
behavior of a program, because it shows the situation ofeach variable and loop by the diagram.
Breakpoint is one of the most frequently usedmethods for debugging [5]. Breakpoint has the problem
which programmers need experience of programming todecide a location of breakpoint. Nevertheless, it is a
useful method of finding the cause of a bug, and also themethod which automatically generates breakpoint hasreported [6]. When programmers found an abnormalprocess, it is difficult to understand correctly thesituation of execution with only information of a point.
TVIS becomes easy to grasp behavior of a program,when programmers found the abnormal process,because TVIS shows them to information of variables orloops which concern it. In a large program, efficiency ofTVIS may lower in comparison with breakpoint,
because information of the diagram is liable to increase.
An applicable range of programs which TVIS canvisualize is small in comparison with the tool [7] which
can visualize a large program by a diagram with a highabstraction level or tool [8] which can visualize
multithreaded programs. TVIS, which generates adiagram of low abstraction level, may make gigantic a
diagram because data to visualize even a program ofmoderate size may become huge [9]. Therefore, thevariety of programs which TVIS can visualize may havea limit. Accordingly, TVIS need reduce spaces to show
information by improving the expression format of thediagram. An applicable range of programs which TVIS
can visualize is enlarged by focusing object to visualize
on only an important object.

6. Conclusion
This paper has proposed the visualizing method ofdata transitions to support debugging for Java programsin order to improve efficiency of debugging by
supporting to find the cause of a bug. We have
implemented TVIS which supports debugging andvisualizes data transitions, in order to show efficiency ofthe proposed method. We visualize programs which
include a bug by using TVIS, and show that TVIS can
support to grasp behavior of executing programs and tofind the cause of a bug.

Visualization of the proposed method can give theinformation which is not gotten by using conventional
methods for analyzing data transitions. The datatransitions diagram can show visually abnormal
behavior: abnormal data renewals and so on. Also, it iseasy to understanding states of other variables whenabnormal behavior is found.
Therefore, the proposed method can support to findthe cause of a bug by visualizing data transitions, andimprove efficiency of debugging for Java programs. The
method reduces time to grasp behavior in executing a
program for programmers by showing data transitions tothem. In particular, it is useful for unskilledprogrammers.
The future issues are as follows.
(1) Improving the format for expressing values ofvariables.
(2) Introducing the localization in visualization.
References
1. Roger S. Pressman, Software Engineering A Practitioner’s
Approach 5thEdition, McGraw-Hill Science (2001).
2. M. Sridharan, S. J. Fink, R. Bodik, Thin slicing, In Proc.
the 2007 ACM SIGPLAN Conference on PLDI (2007),
pp.112-122.
3. Mark Weiser, Programmers Use Slices When Debugging,
Communications of the ACM Vol.25 (1982), pp. 446-452.
4. H Agrawal, JR Horgan, Dynamic Program Slicing,
SIGPLAN Notices, Vol.25, No.6 (1990), pp.246-256.
5. G. C. Murphy et al, How Are Java Software Developers
Using the Eclipse IDE?, IEEE Software, Vol.23, No.4
(2006), pp.76-83.
6. Cheng Zhang et al, Automated Breakpoint Generation forDebugging, JOURNAL OF SOFTWARE, Vol.8, No.3
(2013), pp.603-616.
7. Steven P. Reiss, Guy Eddon, From the Concrete to theAbstract: Visual Representations of Program Execution,DMS 2005 (2005), pp.315-320.
8. Jan Lönnberg et al, Java replay for dependence-baseddebugging, PADTAD '11 (2011), pp.15-25.
9. W. De Pauw et al, Execution patterns in object-oriented
visualization, In Proc. 4th COOTS (1998), pp. 219-234.

Published by Atlantis Press
Copyright: the authors
115