6
A Revitalized Interprocedural Slicing in the Presence of Derived and User Defined Data Types Santosh Kumar Pani Mahamaya Mohanty School of Computer Engineering School of Computer Engineering Kalinga Institute of Industrial Technology Kalinga Institute of Industrial Technology Bhubaneswar, India Bhubaneswar, India e-mail [email protected] e-mail [email protected] Abstract-- We propose an innovative approach for handling dynamic memory, arrays, pointers, structures and union by interprocedural dynamic slicing technique which combines the basic techniques from past and current trends of dynamic interprocedural slicing. At first an improved algorithm for interprocedural dynamic slicing in the presence of derived and user defined data type is given. Secondly the dynamic slices for different derived and user defined data types used in the respective programs are obtained. The proposed extended interprocedural dynamic slicing algorithm is more efficient then the existing algorithm as it gives a detailed idea about the slices that can be obtained for one dimensional pointers, two dimensional pointer, pointer and arrays, dynamic memory allocation, structures and union. The illustrations are given with the programs for the proof of correctness of the proposed algorithm. Keywords: Dynamic slicing, Control Dependence Graph, Interprocedural slicing, ActiveDataSlice, ActiveCallSlice, ActiveControlSlice. I. INTRODUCTION The notion of a program slice, originally introduced by Mark Weiser, is useful in program debugging, testing, program maintenance, complexity measurement, program verification, automatic parallelization, program comprehension, restructuring, downsizing, and parallelization. and program integration. Slicing reduces the program to a minimal form which still produces the same behavior. The reduced program, called a “slice”, is an independent program guaranteed to faithfully represent the original program. A (static) program slice is a part of a program slice defined w.r.t to a given variable X (where X is a simple variable or a data vector) and a statement i, it is the set of all statements that could (potentially, under static analysis) affect the value of X at statement i, where the influence of a faulty statement could result from an improper computational use or predicate use of some other variables at prior statements. Dynamic Slicing is a refinement of static slicing which contains only those statements that affect the slicing criterion. The design of intraslice algorithm is based on computing and updating the data and control dependences at run-time. The same is also an interslice algorithm, but with an additional data structures to handle the interprocedural dependences caused by the calling nodes, the parameter passing mechanisms and return mechanisms. This paper concerns the problem of interprocedural dynamic slicing, where we generate dynamic slices of different derived and user defined data types used in structured program. The rest of the paper is organized as follows. Section 2 is the review of related work. Section 3 is about the basic concepts and definitions. In Section 4 we have presented an improved interprocedural dynamic slicing algorithm. Section 5 gives the analysis of the proposed algorithm. Section 6 concludes the paper. II. REVIEW OF RELATED WORK G.B Mund and R. Mall [3] has presented an efficient interprocedural dynamic slicing algorithm for structured programs as well as computation of intraprocedural dynamic program slices. The differences between their work and ours is, this work is more up-to-date and complete as dynamic slices for pointers, pointer and array, dynamic memory allocation, structures and unions have been obtained. Horwitz and Reps[5] present a survey of the work that has been done on slicing, differencing, and integration of single-procedure and multi-procedure programs as operations on PDGs. Venkatesh[10] presents formal definitions of several types of slices in terms of denotational semantics. He distinguishes three independent dimensions according to which slices can be categorized: static vs. dynamic, backward vs. forward, and closure vs. executable. Gupta and Soffa present a generic algorithm for static slicing and the solution of related dataflow problems (such as determining reaching definitions) that is based on performing a traversal of the control flow graph. The algorithm is parameterized with:(i) the direction in which the CFG should be traversed (backward or forward), (ii) the type of dependences under consideration (data and/or control dependence), (iii) the extent of the search (i.e., should only immediate dependences be taken into account, or transitive dependences as well), and (iv) whether only the dependences that occur along all CFG- paths paths, or dependences that occur along some CFG- path should be taken into account. A slicing criterion is either a set of variables at a certain program point or a set of statements. For slices that take data dependences into account, one may choose between the values of variables 60 978-1-4244-4791-6/10/$25.00 c 2010 IEEE

[IEEE 2010 IEEE 2nd International Advance Computing Conference (IACC 2010) - Patiala, India (2010.02.19-2010.02.20)] 2010 IEEE 2nd International Advance Computing Conference (IACC)

Embed Size (px)

Citation preview

Page 1: [IEEE 2010 IEEE 2nd International Advance Computing Conference (IACC 2010) - Patiala, India (2010.02.19-2010.02.20)] 2010 IEEE 2nd International Advance Computing Conference (IACC)

A Revitalized Interprocedural Slicing in the Presence of

Derived and User Defined Data Types

Santosh Kumar Pani Mahamaya Mohanty

School of Computer Engineering School of Computer Engineering

Kalinga Institute of Industrial Technology Kalinga Institute of Industrial Technology

Bhubaneswar, India Bhubaneswar, India

e-mail [email protected] e-mail [email protected]

Abstract-- We propose an innovative approach for handling

dynamic memory, arrays, pointers, structures and union by

interprocedural dynamic slicing technique which combines the

basic techniques from past and current trends of dynamic

interprocedural slicing. At first an improved algorithm for

interprocedural dynamic slicing in the presence of derived and

user defined data type is given. Secondly the dynamic slices for

different derived and user defined data types used in the

respective programs are obtained. The proposed extended

interprocedural dynamic slicing algorithm is more efficient then

the existing algorithm as it gives a detailed idea about the slices

that can be obtained for one dimensional pointers, two

dimensional pointer, pointer and arrays, dynamic memory

allocation, structures and union. The illustrations are given with

the programs for the proof of correctness of the proposed

algorithm.

Keywords: Dynamic slicing, Control Dependence Graph,

Interprocedural slicing, ActiveDataSlice, ActiveCallSlice,

ActiveControlSlice.

I. INTRODUCTION

The notion of a program slice, originally introduced by

Mark Weiser, is useful in program debugging, testing, program

maintenance, complexity measurement, program verification,

automatic parallelization, program comprehension, restructuring,

downsizing, and parallelization. and program integration. Slicing

reduces the program to a minimal form which still produces the

same behavior. The reduced program, called a “slice”, is an

independent program guaranteed to faithfully represent the

original program. A (static) program slice is a part of a program

slice defined w.r.t to a given variable X (where X is a simple

variable or a data vector) and a statement i, it is the set of all

statements that could (potentially, under static analysis) affect

the value of X at statement i, where the influence of a faulty

statement could result from an improper computational use or

predicate use of some other variables at prior statements.

Dynamic Slicing is a refinement of static slicing which contains

only those statements that affect the slicing criterion. The design

of intraslice algorithm is based on computing and updating the

data and control dependences at run-time. The same is also an

interslice algorithm, but with an additional data structures to

handle the interprocedural dependences caused by the calling

nodes, the parameter passing mechanisms and return

mechanisms. This paper concerns the problem of

interprocedural dynamic slicing, where we generate

dynamic slices of different derived and user defined data

types used in structured program.

The rest of the paper is organized as follows. Section

2 is the review of related work. Section 3 is about the

basic concepts and definitions. In Section 4 we have

presented an improved interprocedural dynamic slicing

algorithm. Section 5 gives the analysis of the proposed

algorithm. Section 6 concludes the paper.

II. REVIEW OF RELATED WORK

G.B Mund and R. Mall [3] has presented an efficient

interprocedural dynamic slicing algorithm for structured

programs as well as computation of intraprocedural

dynamic program slices. The differences between their

work and ours is, this work is more up-to-date and

complete as dynamic slices for pointers, pointer and

array, dynamic memory allocation, structures and unions

have been obtained. Horwitz and Reps[5] present a

survey of the work that has been done on slicing,

differencing, and integration of single-procedure and

multi-procedure programs as operations on PDGs.

Venkatesh[10] presents formal definitions of several

types of slices in terms of denotational semantics. He

distinguishes three independent dimensions according to

which slices can be categorized: static vs. dynamic,

backward vs. forward, and closure vs. executable. Gupta

and Soffa present a generic algorithm for static slicing

and the solution of related dataflow problems (such as

determining reaching definitions) that is based on

performing a traversal of the control flow graph. The

algorithm is parameterized with:(i) the direction in which

the CFG should be traversed (backward or forward), (ii)

the type of dependences under consideration (data and/or

control dependence), (iii) the extent of the search (i.e.,

should only immediate dependences be taken into

account, or transitive dependences as well), and (iv)

whether only the dependences that occur along all CFG-

paths paths, or dependences that occur along some CFG-

path should be taken into account. A slicing criterion is

either a set of variables at a certain program point or a setof statements. For slices that take data dependences into

account, one may choose between the values of variables

60978-1-4244-4791-6/10/$25.00 c©2010 IEEE

Page 2: [IEEE 2010 IEEE 2nd International Advance Computing Conference (IACC 2010) - Patiala, India (2010.02.19-2010.02.20)] 2010 IEEE 2nd International Advance Computing Conference (IACC)

before or after a statement. The main application that Weiser had

in mind for slicing was debugging: if a program computes an

erroneous value for some variable x at some program point, the

bug is likely to be found in the slice with respect to x at that

point. The main use of slicing for debugging was further

explored by Lyle and Weiser [1,2], Choi et al. [7] and Agrawal

et al. [9] .

III. BASIC CONCEPTS AND DEFINITIONS

Here we present some basic concepts, terminologies and

definitions. The basic concepts and definitions are available in

Mund et al.(2000a,2003,2005). Here it is presented for the sake

of completeness.

i.Control Dependence Graph:

The control dependence graph (CDG) G of a program P is a

graph G=(N,E), where each node n�N represents a statement of

the program P. For any pair of nodes x and y, (x,y)�E if node x

is control dependent on node y. ii. (Def(dvar)) :

If dvar is a variable in a program P. A node u of CDG Gp is said

to be a Def(dvar) node if u is definition statement that defines

the variable dvar. iii. (Use(dvar)) :

If dvar is a variable in a program P. A node u of CDG Gp is said

to be a Use(dvar) node if he statement u uses the value of the

variable dvar. iv. (Defvarset(u)):

Let u be a node in the CFG Gp of a program P. The set

DefVarSet(u)={dvar:dvar is a data variable in the program P,

and u is a Def(dvar) node}. v. (Usevarset(u)):

Let u be a node in the CFG Gp of program P. The set

UseVarSet(u)={dvar:dvar is a data variable in the program P,

and u is a Use(dvar) node}. vi. (ActiveControlSlice(s)):

Let s be a test node(predicate statement) in, the CDG Gp of a

program P and UseVarSet(s)={var1,var2,…..vark}.

Before execution of the program P, ActiveControlSlice(s) = Ø.

After each execution of the node s in the actual run of the

program, ActiveControlSlice(s)= {s}UActiveDataSlice(var1)..U.......ActiveDataSlice(vark)…..U…… ActiveControlSlice(t), where t is most recently executed

successor node of s in Gp. If s is a loop control node and the

present execution of the node s corresponds to exit from loop,

then ActiveControlSlice(s)= Ø. vii. (ActiveDataSlice(var))

We have distinguished here the variables into 3 categories i.e

(1) data variable denoted as dvar

(2) address variable(pointer) denoted as avar .

Address variable can be 1-Dimensional or multidimensional

A 1-D pointer (address variable) stores the address of a single

data item.

A 2-D pointer (address variable) stores the address of a 1-D

pointer(address variable)

A n-D pointer (address variable) stores the address of a

(n-1)-D pointer (address variable)

For a 2-D pointer we consider the 2-D pointer as address

variable and 1-D pointer as the data variable

For a n-D pointer we consider the n-D pointer as address

variable and (n-1)-D pointer as the data variable.

We assume an address variable (avar) stores the address

of a data variable (dvar).

Whenever an avar is assigned with the address of a data

variable, the dynamic slices of dereference of address

variable (*avar) is same as that of dvar. It need not be

stored at a separate place .

Whenever an address variable is updated (If storing the

address of an array variable) the *avar must be changed

to the corresponding array member.(As the algorithm is

computing dynamic slices the value of array subscript

must be known at execution time)

(3) Array variable with index i is denoted as arvar[i]

(i) (ActiveDataSlice(dvar)):Let dvar be a data variable in a program P. Before

execution of the program P, ActiveDataSlice(dvar)=Ø.

Let u be a Def(dvar) node, and

UseVarSet(u)={dvar1,dvar2,..dvark). After each

execution of the node u in the actual run of the program,

ActiveDataSlice(dvar)= {s}UActiveDataSlice(dvar1)U…UActiveDataSlice(dvar

k)UActiveControlSlice(t), where t is most recently

executed successor node of s in Gp.

Let dvar is an union variable and u is a

Def(dvar.member) node. If member is the largest

member of the defined union then

ActiveDataSlice(dvar.member)= {s}UActiveDataSlice(dvar1)U..UActiveDataSlice(dvark)

U ActiveControlSlice(t), where t is most recently

executed successor node of s in Gp, for all member of

the union.

(ii) (ActiveDataSlice(avar)): Let avar be an address variable in a program P.

Before execution of the program P,

ActiveDataSlice(avar)= Ø and

ActiveDataSlice(*avar)= Ø.

Let u be a Def(avar) node ,u can be of the following

forms

(a) avar = &dvar

(b) avar = &arvar[i]+n where n is an unsigned integer

value and i is less than size of the array

(c) avar = avar1+n where n is an integer value

(d) avar = (type*)malloc(unsigned int)

for case(a) ActiveDataSlice(avar)={u}U ActiveControlSlice(t)

ActiveDataSlice(*avar)={u}UActiveDataSlice(dvar)U

ActiveControlSlice(t)

2010 IEEE 2nd International Advance Computing Conference 61

Page 3: [IEEE 2010 IEEE 2nd International Advance Computing Conference (IACC 2010) - Patiala, India (2010.02.19-2010.02.20)] 2010 IEEE 2nd International Advance Computing Conference (IACC)

for case(b) ActiveDataSlice(avar)={u}UActiveControlSlice(t)

ActiveDataSlice(*avar)={u}UActiveDataSlice(arvar[i+n])U ActiveControlSlice(t)

for case(c) ActiveDataSlice(avar)={u}UActiveDataSlice(avar1)U

ActiveControlSlice(t) ActiveDataSlice(*avar)={u}UActiveDataSlice(*(avar1+n))U

ActiveControlSlice(t)

for case(d) ActiveDataSlice(avar)={u}U ActiveControlSlice(t)

ActiveDataSlice(*avar)= Ø viii. (DyanSlice(s,var)):

Let s be a node of the CDG Gp of a program P,and var be a variable in the set DefVarSet(s) U UseVarSet(s). Before

execution of the program P,DyanSlice(s,var)=Ø. After each

execution of the node s in the actual run of the program, the

dynamic slice DyanSlice(s,var) w.r.t the slicing criterion <s,var>

corresponding to the execution of s is updated as DyanSlice(s,var)=ActiveDataSlice(var)UActiveControlSlice(t),

where t is the most recently executed successor node of s in Gp.

do ActiveDataSlice(var)= Ø

ix. (ActiveCallSlice(s)):

Let Gp be the CDG of a multi-procedure program P. Before

execution of the program, ActiveCallSlice(s)= Ø. At an instance

of the actual execution of the program, let Uactive represents the active call node. Then ActiveCallSlice= {Uactive}U ActiveCallSlice U ActiveControlSlice(t),where t is the most

recently executed successor node of {Uactive}in Gp. x. (CallSliceStack):

Let Gp be the CDG of a multi-procedure program P. We use a

stack called CallSliceStack to store a relevant sequence of

ActiveCallStack during an actual run of the program . During

execution of the program the top element of the stack always

represents the ActiveCallSlice. Before execution of each call

node,the ActiveCallSlice corresponding to the execution of the

call node is computed and pushed onto the stack CallSliceStack. xi. (ActiveReturnSlice):

Let Gp be the CDG of a structured multi-procedure program P.

Before each execution of the program P, ActiveReturnSlice = Ø. //A n-Dimensional pointer is one which can store the

address of (n-1)-Dimensional pointer variable. Let x be a RETURN node in Gp and UseVarSet(x)

={var1,var2….vark}. Then, before each execution of the

RETURN node x, ActiveReturnSlice={x} UActiveCallSliceUActiveDataSlice(var1)……U…U…….ActiveD

ataSlice(vark) U ActiveControlSlice(t),where t is the most

recently executed successor node of x in Gp.

xii.(Formal(x,var),Actual(x,var)):

Let p1 be a procedure of a program p having multiple

procedures, and x be a calling node to the procedures, and x be a

calling node to the procedure p1. Let f be a formal parameter of

procedure P1 and its corresponding actual parameter at the

calling node to the procedure P1 and its corresponding actual

parameter at the calling node x be a. We define Formal(x,a)=f

and Actual(x,f)=a.

IV.AN IMPROVED ALGORITHM FOR

INTERPROCEDURAL DYNAMIC SLICING

IN PRESENCE OF DERIVED AND USER

DEFINED DATA TYPES.

Step 1. Start

Step 2. At first Control Dependence Graph Gp of

program P is statically constructed .

Step 3. Before each execution of the program

do step 4 to step 7.

Step 4. For each node u of Gp do step 5 to step 6.

Step 5. If u is a test node, then ActiveControlSlice(u) =

Ø.Step 6. For each variable var �DefVarSet(u) U

UseVarSet(u)

do DyanSlice(u,var) = Ø.

Step 7. For each variable var of the program P

CallSliceStack=NULL.

ActiveCallSlice= Ø.

Step 7a. For each data variable dvar of the program

do ActiveDataSlice(var)= Ø.

Step 7b. If arvar is an array variable of size(k)

do ActiveDataSlice(arvar[i])= Ø .

for i= 0 to k-1.

Step 7c. If var is a structure or union variable then

do ActiveDataSlice(var.member) = Ø

for each member declared with structure or union

Step 7d. For each address variable(pointer) ’avar’ of the

program P.

Step 7d(i). If pvar is a 1-Dimensional pointer

do ActiveDataSlice(pvar) = Ø,

ActiveDataSlice(*pvar) = Ø

Step 7d(ii). If avar is a n-Dimensional pointer

do ActiveDataSlice(avar) = Ø,

ActiveDataSlice(*avar) = Ø ,

ActiveDataSlice(*(n-1)avar) = Ø

7d(iii). If avar is a pointer to a 1-Dimensional array

do ActiveDataSlice(avar)= Ø

ActiveDataSlice(**avar)= Ø

7d(iv). If avar is a pointer to a n-Dimensional array

do ActiveDataSlice(avar)= Ø and

ActiveDataSlice(*(n-1)avar)= Ø

(As other indirections don’t have l-value)

Step 8. Run the program P with the given set of input

values and repeat steps 9 to 20 until the program

terminates.

Step 9. Before execution of each call node u do step 10

to step 12

Step 10. Let u be a call node to a procedure Q, update

CallSliceStack and ActiveCallSlice.

Step 11. For actual parameter var in the procedure call

62 2010 IEEE 2nd International Advance Computing Conference

Page 4: [IEEE 2010 IEEE 2nd International Advance Computing Conference (IACC 2010) - Patiala, India (2010.02.19-2010.02.20)] 2010 IEEE 2nd International Advance Computing Conference (IACC)

do ActiveDataSlice(Formal(u,var))=ActiveDataSlice(var)U

ActiveCallSlice.

Step 12.Update ActiveReturnSlice before execution of the return

node.

Step 13. After execution of each node u of the program P do step

13 to step 19 .

Step 13a.If u is a Def(var) node and not a call node then Update

ActiveDataSlice(var).

//var can be a data variable or address variable

Update ActiveDataSlice(var) will be done accordingly

Step 13b. If u is a free(avar) node then

Update ActiveDataSlice(*var)= Ø.

Step 14. If u is a call node to a procedure Q then for every

formal reference parameter var in the procedure Q do

ActiveDataSlice(Actual(u,var))= ActiveDataSlice(var).

Step 15. If u is a Def(var) node then

ActiveDataSlice(var)=ActiveReturnSlice.

Step 16. For every variable var if declared as automatic local in

the procedure Q

do ActiveDataSlice= Ø.

//For local static variable and global variable the

ActiveDataSlice remains unchanged

Step 17. Update CallSliceStack and ActiveCallSlice and Set

ActiveReturnSlice= Ø . Step 18. For every variable var � DefVarSet(u) U UseVarSet(u)

Update DyanSlice(u,var).

Step 19. If u is a test node, then

Update ActivecontrolSlice(u).

Step 20. Exit

V. ANALYSIS OF THE PROPOSED ALGORITHM

FOR SLICES.

Example 1::Dynamic Slices for 1-D and 2-D pointers int *iptr,var1,var2 ;

int **piptr ;

1. iptr = &var1;

2. piptr = &iptr ;

3. *iptr =100;

4. write(*iptr);

5. **piptr = 200;

6. write(**piptr);

7. var1=300;

8. write(var1);

9. *iptr=25;

10. *iptr + =10;

11 write(var1);

12. var2=*iptr;

13. write(var2);

14. iptr=&var2;

15. *iptr+ = 20;

16. write(var2);

17. *iptr=125;

18. var1=*iptr+1;

19. write(var1)

After execution of node 1:

ActiveDataSlice(iptr)={1}

DyanSlice(1,iptr)={1} ActiveDataSlice(*iptr)={1}UActiveDataSlice(var1)={1}

DyanSlice(*iptr,1)={1}

After execution of node 2:

ActiveDataSlice(piptr)={2}and Dyanslice(2,piptr)={2} ActiveDataSlice(*piptr)={2}U

ActiveDataSlice(iptr)={1,2}and

Dyanslice(2,*iptr)={1,2} ActiveDataSlice(**piptr)={2} U

ActiveDataSlice(*iptr)={1,2}

After execution of node 3: ActiveDataSlice(*iptr)={3}and DyanSlice(3,*iptr)={3}

ActiveDataSlice(var1)={3}

After execution of node 4:

DyanSlice(4,*iptr)={3}

After execution of node 5: ActiveDataSlice(**piptr)={5}U

ActiveDataSlice(*iptr)={3}={3,5}

DyanSlice(5,**piptr)={3,5}

After execution of node 6:

DyanSlice(6,**piptr)={3,5}

After execution of node 7:

ActiveDataSlice(var1)={7}

ActiveDataSlice(*iptr)=ActiveDataSlice(**piptr)={7}

DyanSlice(7,var1)={7}

After execution of node 8:

DyanSlice(8,var1)={7}

After execution of node 9:

ActiveDataSlice(*iptr)={9}

DyanSlice(9,*iptr)={9}

ActiveDataSlice(**piptr)=ActiveDataSlice(var1)={9}

After execution of node 10: ActiveDataSlice(*iptr)={10} U ActiveDataSlice(*iptr)={10} U {9}={10,9}

Example 2::Dynamic Slices for pointer and array int *ptr int arr[5];

int i;

1.i=1

2.arr[0]=1;

3.arr[1]=2;

4.arr[2]=3;

5.arr[3]=4;

6.arr[4]=5;

7. ptr = &arr[0];

8. ptr = &arr[0] + i;

9. ptr = ptr + i;

10. *ptr = 10;

11. write(ptr);

12. write(arr[i]);

13. write(*ptr);

2010 IEEE 2nd International Advance Computing Conference 63

Page 5: [IEEE 2010 IEEE 2nd International Advance Computing Conference (IACC 2010) - Patiala, India (2010.02.19-2010.02.20)] 2010 IEEE 2nd International Advance Computing Conference (IACC)

After execution of node 1:

ActiveDataSlice(i)={1}

DyanSlice(1,i)={1}

After execution of node 2:

ActiveDataSlice(arr[0])={2}

Dyanslice(2,arr[0])={2}

After execution of node 3:

ActiveDataSlice(arr[1])={3} DyanSlice(3,arr[1])={3}

After execution of node 4:

ActiveDataSlice(arr[2])={4}and DyanSlice(4,arr[2])={4}

After execution of node 5:

ActiveDataSlice(arr[3])={5}and DyanSlice(5,arr[3])={5}

After execution of node 6:

ActiveDataSlice(arr[4])={6}and DyanSlice(6,arr[4])={6}

After execution of node 7:

ActiveDataSlice(ptr)={7},ActiveDataSlice(*ptr)= ActiveDataSlice(arr[0])={7} U {2}={2,7}

DyanSlice(7,ptr)={7}

DyanSlice(7,*ptr)={2,7}

After execution of node 8:

ActiveDataSlice(ptr)={8},ActiveDataSlice(*ptr)= ActiveDataSlice(arr[0+i])={8} U {3}={3,8}

DyanSlice(8,ptr)={8} DyanSlice(8,*ptr)={3,8}

After execution of node 9: ActiveDataSlice(ptr)={9} U ActiveDataSlice(ptr)={9} U

{8}={8,9},ActiveDataSlice(*ptr)= ActiveDataSlice(*(ptr+i))= ActiveDataSlice(*(&arr[0]+i))={8} U {3}={3,8}

DyanSlice(9,ptr)={8,9}

DyanSlice(9,*ptr)={3,8}

After execution of node 10:

ActiveDataSlice(*ptr)= ActiveDataSlice(arr[0+i])={10}

DyanSlice(9,*ptr)={3,8}

After execution of node 11:

DyanSlice(11,ptr)={8,9}

After execution of node 12:

DyanSlice(12,arr[i]))= DyanSlice(12,arr[1]))={3}

After execution of node 13:

DyanSlice(13,*ptr)={3,8}

Example 3::Dynamic Slices for Dynamic memory

allocation (for n=2 ) int *p,*q,n,i ;

1. read(n)

2. i=0;

3. p=(int*)malloc(n*size of (int));

4. q=p;

5. while(i<=n)

6. read(*p);

7. write(*p);

8. p++;

9. i=i+1; //End of while

10. free(q)

After execution of node 1:

ActiveDataSlice(n)={1}

DyanSlice(1,n)={1}

After execution of node 2:

ActiveDataSlice(i)={2}

Dyanslice(2,i)={2}

After execution of node 3:

ActiveDataSlice(p)={3} DyanSlice(3,p)={3}

ActiveDataSlice(*p)= {3}

After execution of node 4: ActiveDataSlice(q)={4} U ActiveDataSlice(p)={4} U

{3}={3,4}

ActiveDataSlice(*q)= ActiveDataSlice(*p)= {3}

DyanSlice(4,q)={3,4}

DyanSlice(4,p)={3}

After execution of node 5: ActiveControlSlice(5)={5} U {2} U {1}={1,2,5}

DyanSlice(5,i)={2}

DyanSlice(5,n)={1}

After execution of node 6: ActiveDataSlice(*p)={6}U{ActiveControlSlice(5)=

{1,2,5,6}

DyanSlice(6,p)={3}

After execution of node 7:

DyanSlice(7,*p)={1,2,5,6}

After execution of node 8: ActiveDataSlice(p)={8}UActiveDataSlice(p) U

ActiveControlSlice(5)={1,2,3,5,8}

DyanSlice(8,p)={1,2,3,5,6,8}

After execution of node 9: ActiveDataSlice(i)={9} U {2} U {1,2,5}={1,2,5,9}

DyanSlice(9,i)={1,2,5,9}

After execution of node 10

ActiveDataSlice(*p)= Ø

Example 4::Dynamic Slices for structureStruct

{ char name;

float price;

int pages;

};Struct book b;

1. read (b.name);

2. read(b.price);

3. read(b.pages);

4. write(b.name);

5. write (b.price);

6. write(b.pages);

After execution of node 1:

ActiveDataSlice(b.name)={1}

DyanSlice(1,b.name)={1}

After execution of node 2:

ActiveDataSlice(b.price)={2}

Dyanslice(2,b.price)={2}

64 2010 IEEE 2nd International Advance Computing Conference

Page 6: [IEEE 2010 IEEE 2nd International Advance Computing Conference (IACC 2010) - Patiala, India (2010.02.19-2010.02.20)] 2010 IEEE 2nd International Advance Computing Conference (IACC)

After execution of node 3:

ActiveDataSlice(b.pages)={3} DyanSlice(3,b.pages)={3}

After execution of node 4:

DyanSlice(4,b.name)={1}

After execution of node 5:

Dyanslice(2,b.price)={2}

After execution of node 6: DyanSlice(3,b.pages)={3}

Example 5::Dynamic Slices for union union result

{ int mark; char grade;

float per;

} res;

1. res.marks=90;

2. write(res.mark);

3. res.grade=’A’;

4. write(res.grade);

5. res.per=85.5;

6. write(res.per);

7. write(res.mark);

8. write(res.grade);

After execution of node 1: ActiveDataSlice(res.mark)={1}

DyanSlice(1,res.mark)={1}

After execution of node 2:

Dyanslice(2,res.mark)={1}

After execution of node 3: ActiveDataSlice(res.grade)={3} DyanSlice(3,res.grade)={3}

After execution of node 4:

DyanSlice(4,res.grade)={3}

After execution of node 5:

ActiveDataSlice(res.per)={5}and Dyanslice(5,res.per)={5}

After execution of node 6:

DyanSlice(6,res.per)={5}

After execution of node 7:

DyanSlice(7,res.mark)={1}U{5}={1,5}

After execution of node 8:

DyanSlice(7,res. grade)={3}U{5}={3,5}

VI. CONCLUSION

This paper presents an interprocedural slicing algorithm that

extends the functionalities of the basic algorithm for

interprocedural dynamic slicing. Here the computing of précised

dynamic slices are shown for the programs that uses derived and

user defined data types. This improved algorithm covers all the

basic concepts of a structured sequential programs. At first the

future work will concentrate in reusing the slicing information

for subsequent slicing where we seed some errors in the program

and then the behaviour of the program is checked against the

correct program, where the program gets tested and their slices

are maintained. Then the program gets debugged. Those slices

will be stored in a linear data structure which can be referred

further to know where an error has been occurred from

the behaviour the program.. Secondly it will be aimed at

meeting the challenges for concurrent object oriented

programming. A more efficient algorithm can be

developed which can give a detailed and clear idea about

how slicing techniques tests and debugs different types

of programs. The future scope of Slicing also lies in

developing a testing tool or slicer to test any given

program.

REFERENCES

[1] M Weiser. Programmers use slices when debugging.

Communications of the ACM, 25(7):446–452, 1982.

[2] M Weiser. Program slicing. IEEE Transactions on Software Engineering, 10(4):352–357, 1984.

[3] G.B. Mund,, RMall. An efficient interprocedural

dynamic slicing method .The Journal of Systems and Software, Elsevier,Vol.79(2006) 791-806.

[4] H.Agrawal and J.R. Horgan. Dynamic program

slicing. In Proceedings of the ACM SIGPLAN’90 Conference on Programming Language Design and

Implementation, pages 246–256, 1990. SIGPLAN Notices

25(6).

[5] S. Horwitz, T.Reps, and D. Binkley. Interprocedural

slicing using dependence graphs. ACM Transactions on

Programming Languages and Systems, 12(1):26–61,

1990.

[6] B. Korel and J. Laski. Dynamic slicing of computer

programs. Journal of Systems and Software, 13:187–

195,1990.

[7]J.-D. Choi, M. Burke, and P. Carini. Efficient flow-

sensitive interprocedural computation of pointer-induced

aliases and side effects. In Conference Record of the

Twentieth ACM Symposium on Principles of Programming Languages, pages 232–245. ACM, 1993.

.[8] S. Horwitz, P. Pfeiffer, and T. Reps. Dependence

analysis for pointer variables. In Proceedings of the ACM 1989 Conference on Programming Language Design and

Implementation, Portland, Oregon, 1989. SIGPLAN

Notices 24(7).

[9] H. Agrawal,.A. DeMillo, and E.H. Spafford.

Dynamic slicing in the presence of unconstrained

pointers. In Proceedings of the ACM Fourth Symposium on Testing, Analysis, and Verification (TAV4), pages 60–

73, 1991.

[10] G.A Venkatesh. The semantic approach to program

slicing. In Proceedings of the ACMSIGPLAN’91

Conference on Programming Language Design and

Implementation, pages 107–119, 1991. SIGPLAN Notices 26(6).

[11] G.B. Mund, R. Mall, S. Sarkar,2002a. An efficient

dynamic program slicing technique. Information and

Software Technology 44(2),123-132.

[12] G.B. Mund, R. Mall, S. Sarkar,2003 . Computation

of intraprocedural dynamic program slices. Information

and Software Technology 44(2),123-132.

2010 IEEE 2nd International Advance Computing Conference 65