CN109165161A - A kind of analysis method for local variable data contention in C51 LISP program LISP - Google Patents

A kind of analysis method for local variable data contention in C51 LISP program LISP Download PDF

Info

Publication number
CN109165161A
CN109165161A CN201811004121.8A CN201811004121A CN109165161A CN 109165161 A CN109165161 A CN 109165161A CN 201811004121 A CN201811004121 A CN 201811004121A CN 109165161 A CN109165161 A CN 109165161A
Authority
CN
China
Prior art keywords
function
variable
competitive
lisp
local
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811004121.8A
Other languages
Chinese (zh)
Inventor
侯成杰
高猛
滕俊元
李鹏宇
郑小萌
左万娟
于倩
虞砺琨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING SUNWISE INFORMATION TECHNOLOGY Co Ltd
Original Assignee
BEIJING SUNWISE INFORMATION TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING SUNWISE INFORMATION TECHNOLOGY Co Ltd filed Critical BEIJING SUNWISE INFORMATION TECHNOLOGY Co Ltd
Priority to CN201811004121.8A priority Critical patent/CN109165161A/en
Publication of CN109165161A publication Critical patent/CN109165161A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Abstract

The invention discloses a kind of analysis methods for local variable data contention in C51 LISP program LISP, the described method includes: determining the base object model layer functions of C51 LISP program LISP first, then determine competitive function, post analysis competitive function in local competition variable whether there is data contention risk.It determines that base object model layer functions include 3 sub-steps: obtaining function list and variable list, father's function for determining each function and subfunction, determines base object model layer functions;It determines that competitive function includes 2 sub-steps: determining the top layer function of each function, determines competitive function;The data contention risk for determining local competition variable includes 2 sub-steps: determining the write operation to local competitive variables, determines local competition variable with the presence or absence of data contention risk.The method of the present invention has the characteristics that analytic process is simple, accuracy rate is high.

Description

A kind of analysis method for local variable data contention in C51 LISP program LISP
Technical field
The present invention relates to a kind of analysis methods for local variable data contention in C51 LISP program LISP, are suitable for C51 language Say the data contention analysis of program.
Background technique
Data contention problem refer in software with different priorities function synchronization to same address date into Row read or write.Data contention problem would potentially result in software and serious error, especially write access conflict occurs, and such is asked Topic discovery is difficult.Software data competition analysis is the current important content tested for high security software. It is for global variable data contention problem in software that industry, which is studied more, at present, and the data contention of local variable belongs to number According to the special case of race problem, research achievement is seldom, also without effective analysis method.
Summary of the invention
Technology of the invention solves the problems, such as: to overcome the shortcomings of existing technology, the invention proposes one kind to be directed to C51 The analysis method of local variable data contention in LISP program LISP can be applied to for the static state point for being write software using C51 language Analysis.
The technical solution of the invention is as follows:
A kind of analysis method for local variable data contention in C51 LISP program LISP, the specific steps are as follows:
(1) it determines not by the base object model layer functions of other function calls: syntactic analysis is carried out to program, obtain function definition List and variable list carry out control flow analysis to program, determine subfunction, the father's function of each function, traverse all functions The function of function in list, no father's function is determined as base object model layer functions;
(2) determination is by the competitive function of different priorities function call: for the basic top layer letter of each of step 1 determination Number, traverses its all subfunction, the top layer function of these subfunctions is the base object model layer functions, base object model layer functions step by step Top layer function is itself, that is, determines the top layer function of each function;
Function in all function lists is traversed, if some function has 2 or more father's functions, and these father's functions Top layer function be not the same function, then the function be competitive function;
(3) determine the data contention risk of competitive variables in competitive function: part is competing in the competitive function determined to step 2 It strives variable and carries out data-flow analysis, it is determined whether there is the assignment operation to local competitive variables, if there is to local competition The assignment operation of variable, and do not include reentrant modifier in function definition, then that there are data is competing for the local competition variable Strive risk.
Assignment operation includes the indirect assignment or indirect addressing assignment to variable.
Further include being analyzed and processed to determining local variable competitive risk, reentrant is increased to competitive function and is repaired Local competition variable-definition is revised as global variable by decorations symbol.
Function defines list and includes function name, starting line number, terminates line number, function return type, parameter column in step 1 Table, modifier.
The position that the function of competitive function defines middle reentrant modifier should be located at the parameter list that defines of function it Before.
Variable list information includes in line number where name variable, types of variables, variable-definition and program to change in step 1 Line number where measuring each reference.
The advantages of the present invention over the prior art are that:
(1) the present invention is based on software control stream analytical technologies to determine competitive function, is determined based on software grammar analysis technique Local variable in competitive function is determined the read-write operation of local variable based on software data flow analytical technology, and combined to letter Number defines the analysis of modifier to determine the local variable in competitive function with the presence or absence of data contention risk, analytic process letter Single, accuracy rate height provides a kind of simple and practical method to carry out the analysis of local variable data contention for C language software;
(2) technical thought used by the method for the present invention can extend to other C language softwares.
Detailed description of the invention
Fig. 1 is the flow chart of the method for the present invention.
Specific embodiment
The present invention is described further with reference to the accompanying drawing.
The present invention is based on software Static Analysis Technologies.Background technique of the invention is the software grammer in Static Analysis Technology Analysis, the analysis of software control flow point and data-flow analysis.The symbol table of software, including function definition can be obtained by syntactic analysis List, variable list etc.;The function calling relationship of software can be obtained by control flow analysis;It can be obtained by data-flow analysis Obtain the read-write operation to local variable in function.The present invention be based on function define list, variable list, function calling relationship, The read-write operation of local variable analyzes local variable data contention problem present in software.
As shown in Figure 1, the present invention is a kind of analysis method for local variable data contention in C51 LISP program LISP, by Syntactic analysis is carried out to software, carries out control flow analysis analysis, the subfunction for determining each function and father's function to software, determining each The top layer function of function determines competitive function, determines that the processes such as local variable data contention risk form.
The technical principle of C51 LISP program LISP local variable data contention are as follows: the local variable of function is in C51 LISP program LISP It is realized by internal storage region.If some function needs repeatedly call in different priorities function, it is necessary to use The local variable used in different priorities function can be defined different sections by reentrant mark display statement, such compiler The internal storage region of address, otherwise all local variables can be defined on the storage inside of the same fixed sector address by compiler Area, so if function where local variable is successively played a game by the function call in different priorities process, and in function There are write operations for portion's variable, it is possible to local variable data contention occur.
As can be seen that the present invention is firstly the need of obtaining the function list and variable list of software from the above process;Secondly It needs to obtain the call relation between software function, and analyzes to obtain based on function list, variable list and function calling relationship Local variable data contention situation.The above problem can analyse skill using software grammar analysis technique, software control flow point by comprehensive Art, data stream analysis techniques solve.
1. determining base object model layer functions
Control flow analysis is carried out to program, the function calling relationship of software is obtained, that is, determines subfunction, the father of each function Function.Analytic process is as follows: if some function, by another function call, another function is exactly father's letter of the function Number;If another function of some function call, another function is exactly the subfunction of the function.All functions are traversed, are not had The function for having father's function is exactly base object model layer functions.
2. determining competitive function
It first determines the top layer function of each function: for each base object model layer functions, traversing its all subfunction (packet step by step The subfunction of enclosed tool function), the top layer function of these subfunctions is the base object model layer functions, the top layer letter of base object model layer functions Number is itself.
It determines competitive function, analytic process is as follows: traversing all functions, if some function has 2 or more Father's function, and the top layer function of these father's functions is not the same function, then the function is competitive function.
3. determining the data contention risk of local competition variable in competitive function
Syntactic analysis is carried out to program, obtains the variable list of software.Variable list can be divided into the overall situation according to scope again Variable and local variable, variable list information include that name variable, types of variables (global or part), variable-definition are expert at Number and program in variable each reference place line number.
Determine local competition variable: if the local variable range of definition, within the scope of competitive function, which is Local competition variable.
Data-flow analysis is carried out to local competition variable in competitive function, it is determined whether have and write to local competitive variables It operates (i.e. assignment operation).
Do not include reentrant modifier if there is the write operation to local competitive variables, and in function definition, then should There are data contention risks for local competition variable.
The present invention is based on software control stream analytical technologies to determine competitive function, is determined and is competed based on software grammar analysis technique Local variable in function is determined the read-write operation of local variable based on software data flow analytical technology, and combines and determine function Adopted modifier is analyzed to determine the local variable in competitive function with the presence or absence of data contention risk, and analytic process is simple, quasi- True rate is high, provides a kind of simple and practical method to carry out the analysis of local variable data contention for C language software.
The content that description in the present invention is not described in detail belongs to the well-known technique of those skilled in the art.

Claims (6)

1. a kind of analysis method for local variable data contention in C51 LISP program LISP, which is characterized in that specific steps are such as Under:
(1) it determines not by the base object model layer functions of other function calls: syntactic analysis being carried out to program, function is obtained and defines list And variable list, control flow analysis is carried out to program, subfunction, the father's function of each function is determined, traverses all function lists The function of middle function, no father's function is determined as base object model layer functions;
(2) it determines by the competitive function of different priorities function call: each base object model layer functions determined for step 1, by Grade traverses its all subfunction, and the top layer function of these subfunctions is the base object model layer functions, the top layer of base object model layer functions Function is itself, that is, determines the top layer function of each function;
Function in all function lists is traversed, if some function has 2 or more father's functions, and the top of these father's functions Layer functions are not the same function, then the function is competitive function;
(3) determine the data contention risk of competitive variables in competitive function: local competition becomes in the competitive function determined to step 2 Amount carries out data-flow analysis, it is determined whether there is the assignment operation to local competitive variables, if there is to local competitive variables Assignment operation, and the function definition in do not include reentrant modifier, then there are data contention wind for the local competition variable Danger.
2. a kind of analysis method for local variable data contention in C51 LISP program LISP according to claim 1, special Sign is: assignment operation includes the indirect assignment or indirect addressing assignment to variable.
3. a kind of analysis method for local variable data contention in C51 LISP program LISP according to claim 1, special Sign is: further including being analyzed and processed to determining local variable competitive risk, increases reentrant modification to competitive function Local competition variable-definition is revised as global variable by symbol.
4. a kind of analysis method for local variable data contention in C51 LISP program LISP according to claim 1, special Sign is: in step 1 function define list include function name, starting line number, terminate line number, function return type, parameter list, Modifier.
5. a kind of analysis method for local variable data contention in C51 LISP program LISP according to claim 1, special Sign is: the position that the function of competitive function defines middle reentrant modifier should be located at before the parameter list that function defines.
6. a kind of analysis method for local variable data contention in C51 LISP program LISP according to claim 1, special Sign is: variable list information includes in line number where name variable, types of variables, variable-definition and program to change in step 1 Line number where measuring each reference.
CN201811004121.8A 2018-08-30 2018-08-30 A kind of analysis method for local variable data contention in C51 LISP program LISP Pending CN109165161A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811004121.8A CN109165161A (en) 2018-08-30 2018-08-30 A kind of analysis method for local variable data contention in C51 LISP program LISP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811004121.8A CN109165161A (en) 2018-08-30 2018-08-30 A kind of analysis method for local variable data contention in C51 LISP program LISP

Publications (1)

Publication Number Publication Date
CN109165161A true CN109165161A (en) 2019-01-08

Family

ID=64893473

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811004121.8A Pending CN109165161A (en) 2018-08-30 2018-08-30 A kind of analysis method for local variable data contention in C51 LISP program LISP

Country Status (1)

Country Link
CN (1) CN109165161A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001014173A (en) * 1999-06-29 2001-01-19 Fujitsu Ltd Compiler system and computer readable recording medium for recording compiler
CN101482847A (en) * 2009-01-19 2009-07-15 北京邮电大学 Detection method based on safety bug defect mode
CN102073589A (en) * 2010-12-29 2011-05-25 北京邮电大学 Code static analysis-based data race detecting method and system thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001014173A (en) * 1999-06-29 2001-01-19 Fujitsu Ltd Compiler system and computer readable recording medium for recording compiler
CN101482847A (en) * 2009-01-19 2009-07-15 北京邮电大学 Detection method based on safety bug defect mode
CN102073589A (en) * 2010-12-29 2011-05-25 北京邮电大学 Code static analysis-based data race detecting method and system thereof

Similar Documents

Publication Publication Date Title
DeCamp Toward a generative analysis of a post-creole speech continuum
CN106294152B (en) Using the traversal test device and method of user interface
CN104795077B (en) A kind of consistency detecting method for examining voice annotation quality
Herting et al. The social geography of interstate mobility and persistence
KR950704917A (en) GENERAL ANALYSIS SYSTEM
CN100426376C (en) Estimating and detecting method and system for telephone continuous speech recognition system performance
US6587122B1 (en) Instruction syntax help information
CN110209435A (en) A kind of application preloading method, apparatus
CN109165161A (en) A kind of analysis method for local variable data contention in C51 LISP program LISP
CN108595330A (en) A kind of application testing method and device
CN110058916A (en) A kind of phonetic function jump method, device, equipment and computer storage medium
CN110322871A (en) A kind of sample keyword retrieval method based on acoustics characterization vector
CN103164629B (en) A kind of automatic scoring method of Flash software operative skill
CN110265062A (en) Collection method and device after intelligence based on mood detection is borrowed
CN107544337A (en) A kind of method of system for monitoring loosening part trigger data intelligent classification
CN106029188A (en) Game program, game device and game control method
CN105895083A (en) Information processing method and device
CN112765012A (en) Product on-line periphery correlation module detection system
Wolf et al. Linking Speech and Gesture in Multimodal Instruction Systems
CN106446046A (en) Method for timely and rapidly analyzing records in relational database
CN115512461B (en) Method and device for determining cruising steady state of airplane and computer equipment
CN108204813A (en) The method, apparatus and navigation system of a kind of path computing
CN108647192A (en) A method of generating virtual reality work script with natural language processing technique
CN108286975A (en) The automatic generating method and device and hybrid navigation system of map datum
CN110843869B (en) Automatic analysis method for station yard graph display configuration

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190108