CN113849395A - Configuration method, dynamic detection method for array subscript border crossing and distributed control system - Google Patents

Configuration method, dynamic detection method for array subscript border crossing and distributed control system Download PDF

Info

Publication number
CN113849395A
CN113849395A CN202110914676.1A CN202110914676A CN113849395A CN 113849395 A CN113849395 A CN 113849395A CN 202110914676 A CN202110914676 A CN 202110914676A CN 113849395 A CN113849395 A CN 113849395A
Authority
CN
China
Prior art keywords
array
subscript
control program
code
memory
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
CN202110914676.1A
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.)
Zhejiang Supcon Technology Co Ltd
Original Assignee
Zhejiang Supcon 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 Zhejiang Supcon Technology Co Ltd filed Critical Zhejiang Supcon Technology Co Ltd
Priority to CN202110914676.1A priority Critical patent/CN113849395A/en
Publication of CN113849395A publication Critical patent/CN113849395A/en
Pending legal-status Critical Current

Links

Images

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/3612Software analysis for verifying properties of programs by runtime analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a configuration method for array subscript border crossing inspection, which comprises the following steps: the ST editor generates a control program written by adopting a structured text language; the ST compiler establishes a corresponding array memory model for each array object in the control program; the ST compiler compiles and converts the control program into C language codes, in the process of compiling and converting, a code segment used for dynamically checking the array subscript border crossing is added aiming at the array elements with non-constant expressions in the subscript, and the C language code address expressions of the array elements are embedded into the code segment; the code segments are realized by adopting a trinocular condition operator; and the C compiler compiles the C language codes containing the code segments into corresponding binary files and downloads the binary files into the target controller, so that the target controller can check whether the array subscript is out of range or not according to the condition expression in the three-target condition operator when running. By the method, whether the memory is out of range or not can be dynamically detected when the control program runs.

Description

Configuration method, dynamic detection method for array subscript border crossing and distributed control system
Technical Field
The application belongs to the technical field of industrial control, and particularly relates to a dynamic detection method for crossing boundaries of a configuration method and a numerical group subscript.
Background
A Structured Text (ST) language may be used to write a Control program for a Distributed Control System (DCS) controller. In the configuration process of the DCS system, a control program written by ST language is compiled and converted into a binary file, and then the binary file and the initial value of the data of the program are downloaded to a controller. The process of compiling and converting the control program written in the ST language into the binary file comprises the following steps:
the compiler of the ST allocates a section of continuous memory space for the variable (including an array) according to the size (the array size is the size of a single array element multiplied by the number of the elements of the array) of the variable, wherein the continuous memory space comprises a starting offset address and the size of a storage space;
and converting the program written by the ST language into a C language code, and compiling the C language code into a corresponding binary file through a C compiler corresponding to the controller.
The size of the array object in the ST language is specified by a user when writing an ST program, and in the C code after ST code conversion, the elements of the array are accessed and operated through the initial offset address (pointer) of the array in the memory and the subscript of the array.
Since an out-of-range access to an array may modify the memory values of other addresses in the data area, and thus cause serious consequences, it is necessary to perform an out-of-range check for the subscript operation statement of the array: when the subscript of the array access is a constant expression, such as A [15], B [3,11], A [5+3], the ST compiler can statically detect whether the subscript access of the array is out of bounds through the syntax tree analysis of the ST code; however, when the subscript during the access of the array is a variable, for example, the subscript variable x of the array is accessed to the array element a [ x ], the value of the subscript variable x of the array can be determined only when the subscript variable x runs, and the existing border-crossing check cannot confirm whether the subscript x of the a [ x ] exceeds the limit of the array a, so that the memory border-crossing check and protection are realized.
Disclosure of Invention
Technical problem to be solved
In view of the above-mentioned drawbacks and deficiencies of the prior art, the present application provides a dynamic detection method for crossing a configuration method and array subscript.
(II) technical scheme
In order to achieve the purpose, the technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a configuration method for array subscript out-of-range checking, where the method includes:
the ST editor generates a control program written by adopting a structured text language;
the ST compiler establishes a corresponding array memory model aiming at each array object in the control program, wherein the array memory model comprises array total dimension degrees, element numbers of each dimension and all elements of an array;
the ST compiler compiles and converts the control program into a C language code, in the compiling and converting process, aiming at array elements with non-constant expressions in subscripts, a code segment for dynamically checking the border crossing of the array subscripts is added, and C language code address expressions of the array elements are embedded into the code segment; the code segments are realized by adopting a three-target conditional operator;
and compiling the C language code containing the code segments into a corresponding binary file by the C compiler, and downloading the binary file into a target controller so that the target controller can check whether the array subscript is out of range or not according to a condition expression in the three-target conditional operator when running.
Optionally, the conditional expression determines whether each non-constant expression is out of bounds by a custom CheckInd function, and parameters of the CheckInd function include: the start address ADDR of the array object, dimension number i, and the non-constant index expression IND _ EXPi of the ith dimension.
Optionally, the non-constant subscript expression IND _ EXPi of the ith dimension includes array elements.
Optionally, in the trinocular condition operator:
c language code address expressions of array elements are embedded into the first expression;
the second expression is a preset code block for execution when the subscript crosses the boundary.
Optionally, the execution result of the code block executed when the subscript crosses the boundary is a preset memory address.
Optionally, the code fragment also includes a data type of the array element.
In a second aspect, an embodiment of the present application provides a method for dynamically detecting an array subscript out-of-range in a control program, where the method includes:
the method comprises the steps that a controller receives a control program sent by an engineer station, wherein the control program is obtained through the configuration method for array subscript boundary crossing inspection in any one of the first aspect;
the controller executes the trinocular conditional operation in the control program to check whether the array subscript is out of range.
In a third aspect, an embodiment of the present application provides a distributed control system, including an engineer station and a controller, where the engineer station performs configuration of the distributed control system by using the configuration method for array subscript boundary crossing inspection according to any one of the above first aspects, and the control program performs dynamic inspection of array subscript boundary crossing by using the step of the dynamic detection method for array subscript boundary crossing in the control program according to the above second aspect.
In a fourth aspect, an embodiment of the present application provides a controller, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method for dynamic detection of a set of subscript delimitation in a control program as described above in the second aspect.
In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program, when executed by a processor, implements the steps of the method for dynamically detecting a group index crossing in a control program according to the second aspect.
(III) advantageous effects
The beneficial effect of this application is: the application provides a configuration method for array subscript out-of-range inspection, which comprises the following steps: the ST editor generates a control program written by adopting a structured text language; the ST compiler establishes a corresponding array memory model for each array object in the control program; the ST compiler compiles and converts the control program into C language codes, in the process of compiling and converting, a code segment used for dynamically checking the array subscript border crossing is added aiming at the array elements with non-constant expressions in the subscript, and the C language code address expressions of the array elements are embedded into the code segment; the code segments are realized by adopting a trinocular condition operator; and the C compiler compiles the C language codes containing the code segments into corresponding binary files and downloads the binary files into the target controller, so that the target controller can check whether the array subscript is out of range or not according to the condition expression in the three-target condition operator when running. By the method, whether the memory is out of range or not can be dynamically detected when the control program runs.
Furthermore, when the subscript crosses the boundary, the preset code block is executed, so that the condition that the memory data integrity of other variables in the data area is damaged due to the fact that the factor group is accessed in a boundary crossing mode is avoided, and effective protection of the subscript crossing the boundary is achieved.
Drawings
The application is described with the aid of the following figures:
FIG. 1 is a flow chart illustrating a configuration method for array index out-of-bounds checking in one embodiment of the present application;
FIG. 2 is a diagram illustrating a memory model structure of an array object according to an embodiment of the present application;
FIG. 3 is a diagram illustrating an exemplary structure of a 3 × 4 two-dimensional array in an embodiment of the present application;
FIG. 4 illustrates an exemplary diagram of an array element C code expression template with out-of-bounds detection and protection in one embodiment of the present application;
FIG. 5 is a flowchart illustrating a method for dynamically detecting a numerical index violation in a control program according to another embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a decentralized control system according to a further embodiment of the present application;
fig. 7 is a schematic diagram of a controller according to another embodiment of the present application.
Detailed Description
For the purpose of better explaining the present invention and to facilitate understanding, the present invention will be described in detail by way of specific embodiments with reference to the accompanying drawings. It is to be understood that the following specific examples are illustrative of the invention only and are not to be construed as limiting the invention. In addition, it should be noted that, in the case of no conflict, the embodiments and features in the embodiments in the present application may be combined with each other; for convenience of description, only portions related to the invention are shown in the drawings.
FIG. 1 is a flow chart illustrating a configuration method for array index out-of-bounds checking in one embodiment of the present application. As shown in fig. 1, the method of the present embodiment includes:
s10, the ST editor generates a control program written by adopting a structured text language;
s20, the ST compiler establishes a corresponding array memory model aiming at each array object in the control program, wherein the array memory model comprises the total array dimension number, the element number of each dimension and all the elements of the array;
s30, compiling the control program into a C language code by an ST compiler, adding a code segment for dynamically checking the array subscript border crossing aiming at the array elements with non-constant expressions in the subscript in the compiling and converting process, and embedding the C language code address expressions of the array elements into the code segment; the code segments are realized by adopting a trinocular condition operator;
s40, the C compiler compiles the C language code containing the code segments into a corresponding binary file and downloads the binary file into the target controller, so that the target controller can check whether the array subscript is out of range or not according to the condition expression in the three-target condition operator when running.
The configuration method for array subscript boundary crossing check of the embodiment can dynamically detect whether the memory is boundary crossing or not when the control program runs.
In order to better understand the present invention, the steps in the present embodiment are explained below.
In S10, the control program may be obtained by an engineer performing configuration programming on the control logic configuration software, specifically, the control program written in a structured text language.
In S20, the array memory model includes the total number of dimensions of the array, the number of elements in each dimension, and all elements of the array, fig. 2 shows a schematic diagram of a memory model structure of the array object in an embodiment of the present application, as shown in fig. 2, in a continuous memory allocated to the array object, a first portion is the total size of the array, then the size of each dimension of the array, and finally all elements of the array, and the elements of the multi-dimensional array are linearly expanded from low to high according to addresses. The total number of array dimensions and the number of memory bytes allocated to the size of each dimension are allocated according to the limitations of a specific system, and only the logical model thereof is described here. Fig. 3 is a diagram illustrating an example of a 3 × 4 two-dimensional array memory model structure according to an embodiment of the present application.
In S30, the code segment for dynamic checking of array subscript out-of-range is realized by using a trinocular conditional operator. The trinocular condition operator is: the conditional expression is as follows: a first expression, a second expression. When executing, the conditional expression is calculated first, and then judgment is made. If the value of the conditional expression is true, calculating the value of the first expression, wherein the operation result is the value of the first expression; otherwise, calculating the value of the second expression, wherein the operation result is the value of the second expression.
In this embodiment, whether each non-constant expression is out of bounds is judged by a custom CheckInd function in the conditional expression, and parameters of the CheckInd function include: the start address ADDR of the array object, dimension number i, and the non-constant index expression IND _ EXPi of the ith dimension.
It should be noted that the non-constant index expression IND _ EXPi of the ith dimension may also include array elements.
In the embodiment, a C language code address expression of an array element is embedded in a first expression;
in this embodiment, the second expression is a preset code block for execution when the subscript crosses the boundary. Specifically, the execution result of the code block executed when the subscript crosses the boundary is the preset memory address.
In this embodiment, the code fragment also includes the data type of the array element.
The invention aims to improve the memory allocation mode of the array and add dynamic array subscript check in the running process in the code compiling process to avoid the out-of-range access and operation of the array subscript in the running process.
A specific example is given below.
In the existing method, after the ST statement accessed by the subscript of the array element is converted into the C language code, the C code directly accesses the element of the array in a manner of (array head address + subscript offset). If the subscript offset is not constant, this may result in runtime memory out-of-bounds accesses.
In this example, according to the array dimension information provided by the array object memory model, in the process of ST code compilation conversion, when traversing to an array element node of an ST syntax tree, if there is an irregular expression in a subscript of a current array element node, a converted C code address expression of a common array element is embedded into a code segment for out-of-bounds protection. The code for out-of-range protection can be implemented with the tri-ocular conditional operators of the C language.
FIG. 4 is a diagram illustrating an example of a template of an array element C code expression with boundary crossing detection and protection in one embodiment of the present application, where the protected array element C code expression is transformed into the form shown in FIG. 4.
The code blocks in the expression are explained below.
(1)DataType
Data types of array elements, such as int integer, float. Here for address (pointer) type translation.
(2) checkIndices code Block
The checkins code block is a set of out-of-range checks for each of the very large subscripts, and the form of the C code is shown in equation (1):
(Checklnd(ADDR,DIM_SIZE1,IND_EXP1)&&...Checklnd(ADDR,DIM_SIZEn,IND_EXPn)) (1)
checking the boundary crossing of each non-constant subscript in a checkInds code block, wherein a checkInd function checks the boundary crossing of subscripts according to the memory model shown in FIG. 2, wherein the function parameters are respectively as follows:
ADDR is the initial address of the array object;
DIM _ size represents the number of dimensions (starting from 0);
IND _ EXPi is a non-constant subscript expression for dimension i;
CheckInd (ADDR, DIM _ SIZEi, IND _ EXPi) indicates checking whether the index IND _ EXPi of the DIM _ SIZEi dimension of the array object from which ADDR starts is legal (i.e., the index does not cross-border). The expression for the current array element (code for ArrayElementExp) is only available if all the non-constant indices pass the out-of-bounds check, i.e., the expression of equation (1) is true. Note that IND _ EXPi has the potential to recursively nest the C-code fragments shown in FIG. 4, since IND _ EXPi may contain elements of an array.
(3) ArrayElementExp code block
The code block is a C language expression of array elements converted according to the mode of array object starting address + array first element offset + array element subscript offset. This code segment may recursively nest the C code segment shown in fig. 4, as the index of an array element may also be an array element.
(4) ErrorHandler code block
ErrorHandler is an error handler that will be called when the CheckIndices result fails (value 0). The errorsandler expression may return a secure memory address that may be used for operations when a program runs in error. The error handling program has different processing modes in different applications, and this embodiment is not described herein.
The out-of-range memory access during the operation of the ST program is often caused by programming errors, and is generally difficult to find and test in the programming stage, and errors in the out-of-range memory access during the operation often have serious consequences. The configuration method provided by the embodiment can dynamically detect whether subscript access of the array is out of range or not during operation, and avoid damage caused by out-of-range access of memory data integrity factors of other variables in the data area.
In a second aspect, an embodiment of the present application provides a method for dynamically detecting an array subscript out-of-range in a control program, where fig. 5 is a schematic flow chart of a method for dynamically detecting an array subscript out-of-range in a control program in another embodiment of the present application, and as shown in fig. 5, the method includes:
s100, a controller receives a control program sent by an engineer station, wherein the control program is obtained by any one of the configuration methods for array subscript out-of-range inspection in the first aspect;
s200, when the controller runs, the controller executes the trinocular condition operation in the control program to check whether the array subscript is out of range.
In this embodiment, the controller is responsible for collecting data from the field, executing control logic operation, outputting a control instruction to the input/output device, and performing data interaction with the upper computer operator station.
Further, the method also comprises the following steps:
and S300, accessing the corresponding array element or accessing a preset memory address according to the detection result.
Compared with the existing compile-time static memory boundary crossing detection method, the method for detecting and protecting the boundary crossing operation during the operation of the ST program array element increases the protection of program data in the memory during the program operation.
In a third aspect, an embodiment of the present application provides a distributed control system; fig. 6 is a schematic structural diagram of a distributed control system in another embodiment of the present application, and as shown in fig. 6, the system includes an engineer station and a controller, the engineer station performs configuration of the distributed control system by using any one of the configuration methods for array subscript boundary crossing inspection in the above first aspect, and the control program performs dynamic inspection of array subscript boundary crossing by using the steps of the dynamic detection method for array subscript boundary crossing in the control program according to any one of the above second aspects.
The embodiment discloses a distributed control system, which improves the memory allocation mode of an array in the process of configuration on an engineer station, and adds dynamic array subscript check during running in the process of code compiling, thereby preventing array out-of-range operation during the running of a controller. The array out-of-range detection and protection during the operation can effectively prevent the illegal access of the memory caused by human errors during the writing of the ST program, and avoid the operation errors of the controller caused by the illegal access.
In a fourth aspect, an embodiment of the present application provides a controller, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program when executed by the processor implementing the steps of the method for dynamic detection of a group index crossing in a control program as described above in the second aspect.
Fig. 7 is a schematic diagram of a controller according to another embodiment of the present application.
The controller shown in fig. 7 may include: at least one processor 101, at least one memory 102, at least one network interface 104, and other user interfaces 103. The various components in the controller are coupled together by a bus system 105. It is understood that the bus system 105 is used to enable communications among the components. The bus system 105 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 105 in FIG. 7.
The user interface 103 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, trackball, or touch pad, among others.
It will be appreciated that the memory 102 in this embodiment may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a Read-only memory (ROM), a programmable Read-only memory (PROM), an erasable programmable Read-only memory (erasabprom, EPROM), an electrically erasable programmable Read-only memory (EEPROM), or a flash memory. The volatile memory may be a Random Access Memory (RAM) which functions as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (staticiram, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (syncronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), enhanced synchronous dynamic random access memory (EnhancedSDRAM, ESDRAM), synchronous link dynamic random access memory (synchlink DRAM, SLDRAM), and direct memory bus random access memory (DRRAM). The memory 62 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 102 stores elements, executable units or data structures, or a subset thereof, or an expanded set thereof as follows: an operating system 1021 and application programs 1022.
The operating system 1021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application 622 includes various applications for implementing various application services. Control programs for implementing the methods of embodiments of the present invention may be included in applications 1022.
In the embodiment of the present invention, the processor 101 is configured to execute the method steps provided in the first aspect by calling a program or an instruction stored in the memory 102, which may be specifically a program or an instruction stored in the application 1022.
The method disclosed by the above embodiment of the present invention can be applied to the processor 101, or implemented by the processor 101. The processor 101 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 101. The processor 101 may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software elements in the decoding processor. The software elements may be located in ram, flash, rom, prom, or eprom, registers, among other storage media that are well known in the art. The storage medium is located in the memory 102, and the processor 101 reads the information in the memory 102 and completes the steps of the method in combination with the hardware thereof.
In addition, in combination with the dynamic detection method for detecting the crossing of the subscript of the array in the control program in the above embodiment, an embodiment of the present invention may provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the dynamic detection method for detecting the crossing of the subscript of the array in the control program in any one of the above embodiments are implemented.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. The use of the terms first, second, third and the like are for convenience only and do not denote any order. These words are to be understood as part of the name of the component.
Furthermore, it should be noted that in the description of the present specification, the description of the term "one embodiment", "some embodiments", "examples", "specific examples" or "some examples", etc., means that a specific feature, structure, material or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, the claims should be construed to include preferred embodiments and all changes and modifications that fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the present invention without departing from the spirit or scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention should also include such modifications and variations.

Claims (10)

1. A configuration method for array subscript out-of-range checking, the method comprising:
the ST editor generates a control program written by adopting a structured text language;
the ST compiler establishes a corresponding array memory model aiming at each array object in the control program, wherein the array memory model comprises array total dimension degrees, element numbers of each dimension and all elements of an array;
the ST compiler compiles and converts the control program into a C language code, in the compiling and converting process, aiming at array elements with non-constant expressions in subscripts, a code segment for dynamically checking the border crossing of the array subscripts is added, and C language code address expressions of the array elements are embedded into the code segment; the code segments are realized by adopting a three-target conditional operator;
and compiling the C language code containing the code segments into a corresponding binary file by the C compiler, and downloading the binary file into a target controller so that the target controller can check whether the array subscript is out of range or not according to a condition expression in the three-target conditional operator when running.
2. The method for protecting subscript group violation in a control program according to claim 1, wherein whether each non-constant expression is subscript-violating is determined by a custom CheckInd function in the conditional expression, and parameters of the CheckInd function include: the start address ADDR of the array object, dimension number i, and the non-constant index expression IND _ EXPi of the ith dimension.
3. The method of claim 2, wherein the non-constant index expression IND _ EXPi of dimension i contains array elements.
4. The method for protecting against group index violations in a control program of claim 1, wherein in said trinocular condition operator:
c language code address expressions of array elements are embedded into the first expression;
the second expression is a preset code block for execution when the subscript crosses the boundary.
5. The method according to claim 4, wherein the execution result of the code block executed when the subscript crosses the boundary is a preset memory address.
6. The method of claim 1, wherein the code segment further includes a data type of the array element.
7. A method for dynamically detecting a numerical group subscript boundary crossing in a control program, the method comprising:
the controller receives a control program sent by an engineer station, wherein the control program is obtained by the configuration method for array subscript boundary crossing inspection as claimed in any one of claims 1 to 6;
the controller executes the trinocular conditional operation in the control program to check whether the array subscript is out of range.
8. A distributed control system, comprising an engineer station and a controller, wherein the engineer station configures the distributed control system by using the configuration method for array subscript boundary crossing inspection as set forth in any one of claims 1 to 6, and the control program performs dynamic inspection for array subscript boundary crossing by using the steps of the dynamic detection method for array subscript boundary crossing in the control program as set forth in claim 7.
9. A controller, comprising: memory, processor and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the method for dynamic detection of a cluster subscript violation in a control program as claimed in claim 7 above.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method for dynamic detection of a cluster subscript crossing in a control program as set forth in claim 7 above.
CN202110914676.1A 2021-08-10 2021-08-10 Configuration method, dynamic detection method for array subscript border crossing and distributed control system Pending CN113849395A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110914676.1A CN113849395A (en) 2021-08-10 2021-08-10 Configuration method, dynamic detection method for array subscript border crossing and distributed control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110914676.1A CN113849395A (en) 2021-08-10 2021-08-10 Configuration method, dynamic detection method for array subscript border crossing and distributed control system

Publications (1)

Publication Number Publication Date
CN113849395A true CN113849395A (en) 2021-12-28

Family

ID=78975751

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110914676.1A Pending CN113849395A (en) 2021-08-10 2021-08-10 Configuration method, dynamic detection method for array subscript border crossing and distributed control system

Country Status (1)

Country Link
CN (1) CN113849395A (en)

Similar Documents

Publication Publication Date Title
US11061833B2 (en) Apparatus and method for handling page protection faults in a computing system
JP2810675B2 (en) Debug method
EP3134809B1 (en) Manual refinement of specialized classes
US9274923B2 (en) System and method for stack crawl testing and caching
CN108369520B (en) Protecting basic input/output (BIOS) code
EP0665496A1 (en) Method and apparatus for run-time error checking using dynamic patching
CN110598405B (en) Runtime access control method and computing device
JP2002525707A (en) An accurate method for virtual call inlining
US6519768B1 (en) Instruction translation method
Dodds et al. Compositional verification of compiler optimisations on relaxed memory
Stancu et al. Safe and efficient hybrid memory management for Java
US20030110468A1 (en) Program code generator and program
CN114064114A (en) Dynamic library generation method and device
CN111190604B (en) Android application memory confusion method and device, electronic equipment and medium
CN113849395A (en) Configuration method, dynamic detection method for array subscript border crossing and distributed control system
Cook et al. Model checking boot code from AWS data centers
US11055202B1 (en) Compilation scheme for tagged global variables
CN115167862A (en) Patch method and related equipment
Pitchford Embedded software quality, integration, and testing techniques
Verbeek et al. Highly Automated Formal Proofs over Memory Usage of Assembly Code
Lubkin et al. Automatic equivalency restoration after software patching
Gomes et al. A framework for OS portability: from formal models to low-level code
Lang Improved stack allocation using escape analysis in the KESO multi-JVM
JP2022049190A (en) Analyzer and analysis method
JP2004192604A (en) Device and method for developing embedded software

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