1 Introduction

This article refers to the address: http://

In general, the execution of an assembly language program is represented by a dynamic combination of a series of logical paths. Trying to cover all possible paths during testing is one of the goals of software testing. The related work is called coverage testing. Most of the current testing tools are for high-level languages ​​such as C/C++, and testing tools for assembly language are quite rare. Due to the unstructured nature of assembly language, its implementation program often uses many conditions and unconditional jump instructions, which makes the program structure complicated. According to the general method of assembly language program execution, the execution sequence of the statement can be obtained. If a program contains instructions that do not need to be executed or not executed at all under any circumstances, it is difficult for a typical test method to identify these instructions and give appropriate hints or necessary exclusions. These instructions are called unreachable instructions. To this end, in the process of studying the assembler software test, this paper proposes an algorithm for determining the unreachable instructions of the assembler source program.

2. Determination of unreachable instructions

2.1 Prerequisites proposed by the algorithm

Program block

Definition 1 A program block is a sequence of statements containing a small number of statements. There is only one entry statement and one or more exit statements. Execution can only be entered from the entry statement and exited from the exit statement. For a given program, it can be divided into a series of blocks.

Definition 2 The entry statement refers to: 1) the first statement of the program; 2) the statement that can be transferred to the conditional transfer statement or the unconditional transfer statement; 3) or the statement immediately following the conditional transfer statement.

Definition 3 The exit statement refers to: 1) the statement before the next entry statement; 2) or the termination statement of the program.

2.2 Basic idea of ​​the decision algorithm for unreachable instructions

1) First, all the statement serial numbers of a certain source block that has been divided are stored in a predefined array A;

2) taking the upper limit running program of the initial value that can be recognized in the execution of the block, recording the sequence of the statement executed by the instruction, and storing it in a predefined array A1;

3) The lower limit running program of the initial value that can be recognized in the execution of the block is executed, and the sequence of the statement executed by the instruction is also recorded and stored in a predefined array A2;

4) The program is executed by taking the intermediate value of the initial value that can be recognized in the execution of the block, and the sequence of the statement executed by the instruction is also recorded and stored in a predefined array A3;

5) The three arrays A1, A2, and A3 are respectively compared with the sequence A of the sequence of the source block, and the different items are listed and stored in the arrays B1, B2, and B3;

6) Finally, the three arrays B1, B2, and B3 with different items are compared to find the intersection, and the elements in the intersection are the unreachable instruction statement number.

2.3 Implementation of the decision algorithm for unreachable instructions

The algorithm is implemented as follows:

Void pleonasm( )
{
Int A[n], A1[n], A2[n], A3[n], B1[n], B2[n], B3[n], B[n];
Int I,j,k=0,p=0;
For(i=0;i For(j=0;j If(A[i]!=A1[j])
{ B1[k]=A1[j];
k++;}//Find the instruction serial number that was not executed when the upper limit was executed.
l=len(B1);
k=0;
For(i=0;i For(j=0;j If(A[i]!=A2[j])
{ B2[k]=A2[j];
k++;}// find out the instruction serial number that was not executed when the lower limit was executed.
k=0;
m=len(B2);
For(i=0;i For(j=0;j If(A[i]!=A3[j])
{ B3[k]=A3[j];
k++;}// find out the instruction serial number that was not executed when the intermediate value was executed.
n=len(B3);
For(i=0;i For(j=0;j For(k=0;k If(B1[i]==B2[j]&&B2[j]==B3[k])
{B[p]=B1[i];
P++;
Printf ("unreachable instruction statement number = %d,", B[p]); }
Pringf(" ”);
}

3, algorithm verification

The algorithm is verified below with a simple assembler source.

1) According to the decision algorithm, first store all the statement serial numbers of the source degree block into the array A.
A={1,2,3,4,5,6,7,8,9,10,11,12}

2) Save the sequence number of the statement executed when X=12 (a number greater than 0) into the array A1
A1={1,2,3,4,5,6,7,10,11,12}

3) Save the sequence number of the statement executed when X=-3 (a number less than 0) into the array A2
A2={1,2,3,4,9,10,11,12}

4) Save the sequence number of the statement executed when X=0 (the number equal to 0) into the array A3
A3={1,2,3,4,5,10,11,12}

5) Find the complements B1, B2, B3 of A1, A2, and A3, respectively.
B1= ={8,9},
B2= ={5,6,7,8},
B3= ={6,7,8,9}

6) Find the intersection B of B1, B2, B3
B=B1ΛB2ΛB3={8}

Therefore, it can be concluded that statement 8 is an unreachable instruction, and deletion from the source block does not affect the correctness of the program.

4, algorithm complexity analysis

This algorithm is derived from the program block. The program structure is all sequential structure and simple branch structure. Therefore, the complexity of the traversal process is O(n), and the complexity of the intersection algorithm is O(n2). Because this algorithm only performs two kinds of operations, the integrated complexity of the algorithm is O(n2).

5 Conclusion

This paper discusses an algorithm for determining the unreachable instructions of assembly language programs, and illustrates the implementation of the algorithm and verifies its correctness through a sample program. The work of this paper is necessary to supplement the coverage test more comprehensively and effectively. The next step is to study the efficient coverage test algorithm to improve the coverage of the test.

Windows Tablet

The latest Windows has multiple versions, including Basic, Home, and Ultimate. Windows has developed from a simple GUI to a typical operating system with its own file format and drivers, and has actually become the most user-friendly operating system. Windows has added the Multiple Desktops feature. This function allows users to use multiple desktop environments under the same operating system, that is, users can switch between different desktop environments according to their needs. It can be said that on the tablet platform, the Windows operating system has a good foundation.

Windows Tablet,New Windows Tablet,Tablet Windows

Jingjiang Gisen Technology Co.,Ltd , https://www.gisentech.com