Embedded software stack overflow detection method and device

An embedded software and stack overflow technology, applied in software testing/debugging, error detection/correction, instrumentation, etc., can solve problems such as violating the use process, ignoring consumption, and not reflecting stack usage

Active Publication Date: 2018-02-23
SHANDONG ACAD OF SCI INST OF AUTOMATION
View PDF7 Cites 12 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, we cannot know the stack usage of the C standard library functions and the corresponding runtime library functions such as multiplication and division of large-valued integers, floating-point operations, etc. The data obtained by this static analysis method is not perfect, and this method depends on the specific application and source program implementation, lack of versatility
[0004] Patent document CN201610080939.2 discloses a method suitable for deep detection of multi-task software process stack usage, which triggers the software under test to perform the maximum running path test, and judges the stack usage through the change of the initialization value of the task stack area. This method needs to be developed The maximum operating path can only be determined by personnel analyzing the software under test. At the same time, the software under test is triggered to execute the maximum operating path through special instructions, which violates the normal use process of the product, and ignores the consumption of the stack by interrupts, which cannot reflect the real stack usage.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Embedded software stack overflow detection method and device
  • Embedded software stack overflow detection method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0056] This embodiment provides an embedded software stack overflow detection method, such as figure 1 shown, including the following steps:

[0057] Step 1: dividing the random access memory space of the processor into a stack area, a stack overflow buffer and a global variable area through a link file; and defining a stack overflow buffer array in the stack overflow buffer;

[0058] Step 2: Power on the processor and start the timer;

[0059] Step 3: In the interrupt service routine of the timer, read the data in the stack overflow buffer and the stack area, and calculate the maximum stack usage;

[0060] Step 4: Judging whether the maximum stack usage is greater than the size of the stack area, if so, judging as stack overflow, and proceeding to the next step; if not, returning to step 3;

[0061] Step 5: storing the overflowed context information into the stack overflow buffer array;

[0062] Step 6: Judging whether the maximum stack usage is less than or equal to a pre...

Embodiment 2

[0092] The purpose of this embodiment is to provide a computer device.

[0093] Based on the above purpose, the present embodiment provides a computer device, which is used for embedded software stack overflow detection, including a random access memory, a processor, and a computer program stored on the random access memory and operable on the processor, the processor The following steps are carried out when performing said procedure, comprising:

[0094] receiving the user's space division of the random memory of the processor, the space division divides the random memory into a stack area, a stack overflow buffer and a global variable area, and receives a stack overflow buffer array set on the stack overflow buffer;

[0095] Receive the power-on command and start the timer;

[0096] In the interrupt service program of the timer, read the data of the stack overflow buffer and the stack area, and calculate the maximum stack usage;

[0097] Judging whether the maximum stack u...

Embodiment 3

[0101] The purpose of this embodiment is to provide a computer-readable storage medium.

[0102] Based on the above purpose, the present embodiment provides a computer-readable storage medium, on which a computer program for stack overflow detection of embedded software is stored, and the program is executed by a processor to implement the following steps:

[0103] receiving the user's space division of the random memory of the processor, the space division divides the random memory into a stack area, a stack overflow buffer and a global variable area, and receives a stack overflow buffer array set on the stack overflow buffer;

[0104] Receive the power-on command and start the timer;

[0105] In the interrupt service program of the timer, read the data of the stack overflow buffer and the stack area, and calculate the maximum stack usage;

[0106] Judging whether the maximum stack usage is greater than the size of the stack area, if so, judging that the stack overflows, and p...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses an embedded software stack overflow detection method and a device. The method includes steps of classifying a random memory space of a processor to be a stack zone, a stack overflow buffer zone and a global variable zone through a chained file; defining a stack overflow buffer array at the stack overflow buffer zone; electrifying the processor and starting a timer; readingdata of the stack overflow buffer zone and the stack zone in an interrupted service procedure of the timer, and calculating the maximum stack usage amount; judging if the maximum stack usage amount ismore than the dimension of the stack zone; if it is, judging it is stack overflow; storing the information of overflowed upper and lower texts in the stack overflow buffer array; judging if the maximum stack usage amount is less than or equal to the preset threshold value; if it is, judging the stack overflow position according to the stack overflow buffer array. Through arranging the stack overflow buffer zone, the shallow stack overflow cannot cause the abnormal running of the system, and developers can be assisted to perform the procedure revision.

Description

technical field [0001] The invention is mainly applied in the field of software testing, and is specifically an embedded software stack overflow detection method and device. Background technique [0002] Embedded systems for specific applications generally select MCUs with moderate specifications according to actual needs, and use C language for software development. In the address space of the MCU, RAM is a continuous allocation of linear space, and global variables, heap (Heap), and stack (Stack) are all allocated in this limited linear space. According to actual needs, the embedded system may also use FLASH A section of the code is relocated to run in a section of RAM space to speed up the running speed of the program and improve the real-time performance of the system. But due to limited RAM resources, it is impossible to allocate too large a size for the stack. The stack size setting is too small, the local variable size definition is too large, the interrupt priority...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
CPCG06F11/366
Inventor 马建辉王知学侯冬冬胡代荣孙常青
Owner SHANDONG ACAD OF SCI INST OF AUTOMATION
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products