From 2547aa7220dee480bb143b13829e472bea37ebd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20P=C3=A9rez?= Date: Tue, 3 Dec 2019 16:02:42 +0000 Subject: [PATCH] Chapter 1 reviewed --- Secciones/motivation.tex | 48 ++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/Secciones/motivation.tex b/Secciones/motivation.tex index b31d284..8dec1d9 100644 --- a/Secciones/motivation.tex +++ b/Secciones/motivation.tex @@ -11,8 +11,15 @@ Program slicing~\cite{Wei81} is a debugging technique that, given a line of code and a set of variables of a program, simplifies such program so that the only parts left of it are those that affect or are affected by the values of the selected variables. +\sergio{Se me hace corta esta definicion y me faltan algunas utilidades del program slicing, por que se usa? Realmente no se usa solo en depuracion. Tiene mas usos, esto ademas da referencias a poner si queremos.} + +\sergio{Carpeta SAC 2017 (paper-poster 3 paginas): ``Program slicing is a technique for program analysis and transformation whose main objective is to extract from a program those statements (the slice) that +influence or are influenced by the values of one or more variables at some point of interest, often called slicing criterion [13, 12, 1, 9]. This technique has been adapted to practically all programming languages, and it has many applications such as debugging [3], program specialization [8], software maintenance [5], code obfuscation [7], etc.".} + +\sergio{Cogeria algo de aqui para hacer una definicion mas completa, ademas ya usamos terminologia de slicing como \textit{slice} y \textit{slicing criterion}.} + \begin{example}[Program slicing in a simple method] - If the left program is sliced on (line 5, variable \texttt{x}), the + \sergio{Consider the code shown below / in Figure XX, containing a simple method written in Java.} If the left program is sliced on (line 5, variable \texttt{x}),\sergio{Si hemos usado ya slice y slicing criterion aqui podemos decir que el slicing criterion es tal y el slice es cual y empezar a usar la terminologia correcta de manera mas natural.} the result would be the program on the right, with the \texttt{if} block removed, as it does not affect the value of \texttt{x}. \label{exa:program-slicing} @@ -40,21 +47,31 @@ void f(int x) { \end{center} \end{example} -Slices are executable programs whose execution produces the same values +Slices are executable programs whose execution produces the same values \sergio{OJO!, cuidao con ese jardin que luego esta el weak slice.} for the specified line and variable as the original program, and they are used to facilitate debugging of large and complex programs, where the control and data flow may not be easily understandable. -Though it may seem a really powerful technique, the whole Java language is not + + +Though it may seem a really powerful technique, the whole Java \sergio{Primera aparicion de Java, mencionar que el ejemplo es Java porque sino parece que te aparece Java out of the blue.} language is not completely covered by it, and that makes it difficult to apply in practical -settings. An area that has been investigated, yet does not have a definitive -solution yet is exception handling. Example~\ref{exa:program-slicing2} -demonstrates how, even using the latest developments in program -slicing~\cite{AllH03}, the sliced version does not include the catch block, and +settings. + +\sergio{Propongo algo asi para conectar program slicing y las exceptions:} + +\sergio{Though it may seem a really powerful technique, the amount of analysis that need to be done to properly obtain a correct slice is very considerable. Many situations of the Java language lead to several scenarios (podriamos poner algun ejemplo de cosas chungas, rollo recursividad, arrays, objetos... para que se vea que no todo tiene una solucion unica ni perfecta, sino que muchas propuestas son mejorables.) that are quite difficult to analyse, which is the reason because there does not exist a universal solution for all the existent problems in the field of program slicing. Conversely, many different approaches are usually proposed to solution the same slicing problem.} + +\sergio{Se que hay mucha verborrea, pero es para hacer la lectura menos agresiva xD.} + +\sergio{Inside all this slicing problems, there is } An area that has been investigated, \sergio{but? (por evitar el yet ... yet)}yet does not have a definitive +solution yet\sergio{,} \deleted{is} exception handling. Example~\ref{exa:program-slicing2} +demonstrates how, even using the latest developments in \sergio{exception handling slicing }program +slicing~\cite{AllH03}, the sliced version does not include the catch block \sergio{this approach is not able to include the catch block in the obtained slice}, and therefore does not produce a correct slice. \begin{example}[Program slicing with exceptions] - If the following program is sliced using Allen and Horwitz's proposal~\cite{AllH03} with respect to (line 17, variable \texttt{a}), the + \added{Consider}\deleted{If} the following program \deleted{is} sliced using Allen and Horwitz's proposal~\cite{AllH03} with respect to (line 17, variable \texttt{a})\added{. As can be appreciated, t}\deleted{, t}he slice is incomplete, as it lacks the \texttt{catch} block from lines 4-6. \label{exa:program-slicing2} \begin{center} @@ -103,7 +120,9 @@ void g(int a) throws Exception { \end{lstlisting} \end{minipage} \end{center} - When the program is executed as \texttt{f(0)}, the execution log would be: \texttt{1, 2, 3, 13, 14, 15, 4, 5, 8, 10, 13, 14, 17}. In the only execution of line \texttt{17}, variable \texttt{a} has value 1 in that line. However, in the slice produced, the execution log is \texttt{1, 2, 3, 13, 14, 15}. The exception thrown in \texttt{g()} is not caught in \texttt{f()}, so it returns with an exception and line \texttt{17} never executes. +\sergio{Captions? para referirnos a ellas por separado como programa original (izquierda) y slice (derecha)?. Indicar en ella el SC en negrita en el codigo o de otro color o algo para destacarlo.} + + When the program is executed as \texttt{f(0)}, the execution log \sergio{hay que decir que esto es la lista de instrucciones que se ejecutan y en el orden en el que lo hacen.} would be: \texttt{1, 2, 3, 13, 14, 15, 4, 5, 8, 10, 13, 14, 17}. In the only execution of line \texttt{17}, variable \texttt{a} has value 1 in that line. However, in the slice produced, the execution log is \texttt{1, 2, 3, 13, 14, 15}. The exception thrown in \texttt{g()} is not caught in \texttt{f()}, so it returns with an exception and line \texttt{17} never executes. The problem in this example is that the \texttt{catch} block in line \texttt{4} is not included, because ---according to the dependency graph shown below--- it does not influence the execution of line \texttt{17}. Two kinds of dependencies among statements are considered: data dependence (a variable is read that may have gotten its value from a given statement) and control dependence (the instruction controls whether another executes). In the graph, the slicing criterion is marked in bold, the nodes that represent the slice are filled in grey, and dependencies are displayed as edges, with control dependencies in black and data dependencies in red. Nodes with a dashed outline represent elements that are not statements of the program. @@ -113,18 +132,19 @@ void g(int a) throws Exception { \end{center} \end{example} -Example~\ref{exa:program-slicing2} showcases an important error in the current slicing procedure for programs that handle errors with exceptions; because the \texttt{catch} block is disregarded. The only way a \texttt{catch} block can be included in the slice is if a statement inside it is needed for another reason. However, Allen and Horwitz did not encounter this problem in their paper~\cite{AllH03}, as the values outputted by method calls are extracted after the \texttt{normal return} and each \texttt{catch}, and in a typical method call with output, the \texttt{catch} is included by default when the outputted value is used. This detail makes the error much smaller, as most \texttt{try-catch} structures are run to obtain a value. +Example~\ref{exa:program-slicing2} showcases an important error in the current slicing procedure for programs that handle errors with exceptions; because the \texttt{catch} block is disregarded. The only way a \texttt{catch} block can be included in the slice is if a statement inside it is needed for another reason. However, Allen and Horwitz did not encounter this problem in their paper~\cite{AllH03}, as the values outputted by method calls are extracted after the \texttt{normal return} and each \texttt{catch}, and in a typical method call with output, the \texttt{catch} is included by default when the outputted value is used. This detail makes the error much smaller, as most \texttt{try-catch} structures are run to obtain a value. \sergio{Anyadir el nodo \textit{out} para que lo que has explicado aqui quede mas comprensible. Viendo que existe el nodo \textit{out}, pero que nadie el SC no lo necesita.} -A notable case where a method that may throw an exception is run and no value is recovered (at least from the point of view of program slicing) is when writing to the filesystem or making connections to servers, such as a database or a webservice to store information. In this case, if no confirmation is outputted signaling whether the storage of information was correct, the \texttt{catch} block will be omitted, and the slicer software will produce an incorrect result. +\added{There is also another }\deleted{A} notable case where a method that may throw an exception is run and no value is recovered (at least from the point of view of program slicing)\added{. It occurs}\deleted{is} when writing to the filesystem or making connections to servers, such as a database or a webservice to store information. In this case, if no confirmation is outputted signaling whether the storage of information was correct, the \texttt{catch} block \deleted{will be}\added{is} omitted, and the slicer software \deleted{will} produce\added{s} an incorrect result. \section{Contributions} -The main contribution of this paper is a complete technique for program slicing programs in the presence of exception handling constructs for Java. This technique extends the previous technique by Allen et al. \cite{AllH03}. It considers all cases considered in that work, but it also provides a solution to cases not considered by them. +The main contribution of this paper\sergio{paper?research?work?} is a +\added{new approach for program slicing with exception handling for Java programs.} \deleted{complete technique for program slicing programs in the presence of exception handling constructs for Java}. \added{Our approach}\deleted{This technique} extends the previous technique \added{proposed} by Allen et al. \cite{AllH03}. It \added{is able to properly slice}\deleted{considers} all cases considered in \deleted{that}\added{their} work, but it also provides a solution to \sergio{some other} cases not \deleted{considered}\added{contemplated} by them. -For the sake of completeness and in order to understand the process that leaded us to this solution, we will present a brief history of program slicing, specifically those changes that have affected exception handling. Furthermore, we provide a summary of the +For the sake of completeness and in order to understand the process that leaded us to this solution, we will present a brief history\sergio{background?} of program slicing \added{terminology}, specifically those changes that have affected exception handling.\sergio{delving deeper in the progress of program slicing techniques related to exception handling.?} Furthermore, we provide a summary of the different contributions each author has made to the field. The rest of the paper is structured as follows: chapter~\ref{cha:background} summarizes the theoretical background required in program slicing and exception handling, chapter~\ref{cha:incremental} will analyze each structure used in exception handling, explore the already available solution and propose a new technique that subsumes all of the existing solutions and provides correct slices for each case. -Chapter~\ref{cha:state-art} provides a bird's eye view of the current state of the art, chapter~\ref{cha:solution} provides a summarized description of the new algorithm with all the changes proposed in chapter~\ref{cha:incremental}, and finally, chapter~\ref{cha:conclusion} summarizes the paper and explores future avenues of work. +Chapter~\ref{cha:state-art} provides a bird's eye view of the current state of the art, chapter~\ref{cha:solution} provides a summarized description of the new algorithm with all the changes proposed in chapter~\ref{cha:incremental}, and finally, chapter~\ref{cha:conclusion} summarizes the paper\sergio{work?} and explores future avenues of work\sergio{possible improvements?}. % vim: set noexpandtab:tabstop=2:shiftwidth=2:softtabstop=2:wrap