CN115756935A - Abnormal fault positioning method, device and equipment of embedded software system - Google Patents
Abnormal fault positioning method, device and equipment of embedded software system Download PDFInfo
- Publication number
- CN115756935A CN115756935A CN202211559768.3A CN202211559768A CN115756935A CN 115756935 A CN115756935 A CN 115756935A CN 202211559768 A CN202211559768 A CN 202211559768A CN 115756935 A CN115756935 A CN 115756935A
- Authority
- CN
- China
- Prior art keywords
- target
- abnormal
- mode
- information
- fault
- 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
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention provides an abnormal fault positioning method, a device and equipment of an embedded software system, wherein the method comprises the following steps: acquiring target information stored in a target stack, wherein the target information is field protection information pressed into the target stack through a watchdog interrupt processing program when the embedded software system has an abnormal fault; determining a target mode of the abnormal fault based on the target information, wherein the target mode comprises an abnormal interruption mode and a non-abnormal interruption mode; and positioning the abnormal fault based on the target mode of the abnormal fault, the target information and the MAP file of the embedded software. According to the scheme, the abnormal fault of the embedded software system in the operation process can be accurately positioned.
Description
Technical Field
The invention relates to the field of embedded type, in particular to an abnormal fault positioning method, device and equipment of an embedded type software system.
Background
When the development of the embedded software system enters an actual testing or using stage, some program errors or bugs still exist, which cause problems such as program dead loop of a position, stack access overflow, interrupt processing errors and the like, and cause the error of the embedded software program to be down.
In order to prevent the phenomenon of program downtime or dead circulation caused by abnormal operation of embedded software, a watchdog circuit is designed on a hardware circuit to solve the problems. However, the watchdog function cannot effectively and timely locate and debug the fault cause, and the stability of the system still has great hidden trouble. Although the embedded abnormal interruption source positioning and monitoring method can acquire detailed abnormal state information, for abnormal faults in a non-interruption mode, such as dead cycles caused by embedded program defects or program confusion caused by data errors, the abnormal state cannot be acquired in an interruption mode. And moreover, no debugging environment provided by tool software exists, so that the positioning of the fault reason of the embedded software is more difficult.
Disclosure of Invention
In view of the above, the present invention is proposed to provide an abnormal fault location method, apparatus and device of an embedded software system that overcome the above problems or at least partially solve the above problems.
In a first aspect, the present invention provides a method for locating an abnormal fault of an embedded software system, including:
acquiring target information stored in a target stack, wherein the target information is field protection information pressed into the target stack through a watchdog interrupt handler when the embedded software system has an abnormal fault;
determining a target mode of the abnormal fault based on the target information, wherein the target mode comprises an abnormal interruption mode and a non-abnormal interruption mode;
and positioning the abnormal fault based on the target mode of the abnormal fault, the target information and the MAP file of the embedded software.
Optionally, before the obtaining the target information stored in the target stack, the method further includes:
operating an embedded software system and a watchdog function;
in the running process of the watchdog function, if the embedded software system is detected to have abnormal faults, triggering the running of a watchdog interrupt processing program;
and in the running process of the watchdog interrupt processing program, current information of N registers is pressed into the target stack to realize the field protection of the abnormal fault, wherein N is a positive integer.
Optionally, before the obtaining the target information stored in the target stack, the method further includes:
acquiring a target stack pointer corresponding to the abnormal fault and stored in a target register;
determining the target stack based on the target stack pointer.
Optionally, the target information includes a target abnormal interrupt number corresponding to the abnormal fault, and the determining, based on the target information, a target mode of the abnormal fault includes:
determining whether an abnormal interrupt vector table of the embedded software system contains the target abnormal interrupt number or not based on the target abnormal interrupt number;
if the target abnormal interrupt number is included in the abnormal interrupt vector table, determining that the target mode of the abnormal fault is the abnormal interrupt mode;
if the target abnormal interrupt number is not included in the abnormal interrupt vector table, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
Optionally, the determining a target pattern of the abnormal fault based on the target information includes:
determining whether the target information contains an interrupt stack pointer address corresponding to a trigger program of the watchdog interrupt processing program;
if the target information contains the interrupt stack pointer address, determining that the target mode of the abnormal fault is the abnormal interrupt mode;
and if the target information does not contain the interrupt stack pointer address, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
Optionally, when the target mode is the abort mode, the locating the abnormal fault based on the target mode of the abnormal fault, the target information, and the MAP file of the embedded software includes:
determining a stack corresponding to a trigger program of the watchdog interrupt processing program based on the target information;
reading abnormal interruption information corresponding to the trigger program from a stack corresponding to the trigger program;
and positioning the trigger program based on the abnormal interruption information and the MAP file.
Optionally, the locating the abnormal fault based on the target mode of the abnormal fault, the target information, and the MAP file of the embedded software includes:
if the target mode is the abnormal interruption mode, determining target address information of the program code corresponding to the abnormal fault from the abnormal interruption information;
and determining abnormal program codes of the target address information by inquiring the MAP file.
Optionally, the locating the abnormal fault based on the target mode of the abnormal fault, the target information, and the MAP file of the embedded software includes:
if the target mode is the non-abnormal interrupt mode, determining target address information of a program code corresponding to the abnormal fault from the target information;
and determining abnormal program codes of the target address information by inquiring the MAP file.
In a second aspect, the present invention further provides an abnormal fault location device for an embedded software system, including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring target information stored in a target stack, and the target information is field protection information pressed into the target stack through a watchdog interrupt processing program when the embedded software system has an abnormal fault;
a mode determining module, configured to determine a target mode of the abnormal fault based on the target information, where the target mode includes an abnormal interruption mode and a non-abnormal interruption mode;
and the positioning module is used for positioning the abnormal fault based on the target mode of the abnormal fault, the target information and the MAP file of the embedded software.
In a third aspect, an embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program that is stored in the memory and is executable on the processor, where the processor implements the steps of the method for locating an abnormal fault in an embedded software system when executing the program.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the above-mentioned method for locating an abnormal fault of an embedded software system.
One or more technical solutions in the embodiments of the present invention have at least the following technical effects or advantages:
according to the scheme provided by the embodiment of the invention, when an embedded software system has an abnormal fault, the field protection information is pressed into the target stack through the watchdog interrupt processing program, when the abnormal fault is positioned, the field protection information pressed into the target stack, namely the target information, is read, and the target mode of the abnormal fault is determined based on the target information, wherein the target mode comprises an abnormal interrupt mode and a non-abnormal interrupt mode, and further, the abnormal fault is positioned based on the target mode of the abnormal fault, the target information and the MAP file of the embedded software. According to the scheme, the target information of the embedded software system under the abnormal fault is acquired through the watchdog interrupt processing program, the target information can represent the running environment of the embedded software system and the state of the running program when the abnormal fault occurs, the abnormal fault can be accurately positioned through the target information, an effective troubleshooting positioning means is further provided for various abnormal faults generated in the software development and software running processes, and the reliability and maintainability of the embedded software design are improved.
Drawings
Various additional advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 shows a flowchart of an abnormal fault location method for an embedded software system according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an abnormal fault locating device of an embedded software system according to an embodiment of the present invention;
fig. 3 shows a schematic diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to better understand the technical solutions, the technical solutions of the embodiments of the present specification are described in detail below with reference to the drawings and specific embodiments, and it should be understood that the specific features of the embodiments and embodiments of the present specification are detailed descriptions of the technical solutions of the embodiments of the present specification, and are not limitations of the technical solutions of the present specification, and the technical features of the embodiments and embodiments of the present specification may be combined with each other without conflict.
As shown in fig. 1, a flowchart of an abnormal fault location method of an embedded software system provided in an embodiment of the present specification may include the following steps:
step S101: acquiring target information stored in a target stack, wherein the target information is field protection information pressed into the target stack through a watchdog interrupt handler when the embedded software system has an abnormal fault;
step S102: determining a target mode of the abnormal fault based on the target information, wherein the target mode comprises an abnormal interruption mode and a non-abnormal interruption mode;
step S103: and positioning the abnormal fault based on the target mode of the abnormal fault, the target information and the MAP file of the embedded software.
The method provided by the embodiment of the specification is suitable for various embedded software systems.
In the running process of the embedded software system, abnormal faults can be caused inevitably. In this embodiment, the abnormal fault may include two types: one type is abnormal interruption of the embedded system, such as program array boundary crossing, stack access overflow, interruption processing error and the like; another type is non-aborts, such as unknown program loops due to embedded software design flaws or other unpredictable factors. Wherein, the embedded software has design defects, such as dead loop caused by problems of the code; for an unknown program loop caused by other unpredictable factors, for example, a loop statement is used for waiting for a certain signal response in the running process of the embedded software, and if the signal response is not triggered all the time or the response is in error, the program is blocked in the waiting loop.
In order to perform positioning analysis on the abnormal fault, in step S101, after the embedded software system has an abnormal fault, the field protection data, i.e., the target information, corresponding to the abnormal fault and stored in the target stack may be read. The target information may include, but is not limited to, an abort number, an interrupt recovery address, a stack pointer address before an interrupt, general register data, and the like.
Specifically, the abort number may be used to represent identification information corresponding to the abnormal fault. The interrupt recovery address can be used to characterize the address information corresponding to the problematic instruction. The stack pointer address before interruption can be used for representing an abnormal interruption stack pointer corresponding to a trigger program of the watchdog interrupt processing program. The register data may be current data of a key register when the exception fault occurs.
In order to obtain the target information, in this embodiment of the present specification, when an abnormal fault occurs, the watchdog interrupt handler is used to push the field protection information corresponding to the abnormal fault into the target stack.
In a specific implementation process, before step S101, the following steps may be further performed in this embodiment of the present disclosure to implement field protection when an abnormal fault occurs: operating an embedded software system and a watchdog function; in the running process of the watchdog function, if the embedded software system is detected to have abnormal faults, triggering the running of a watchdog interrupt processing program; and in the running process of the watchdog interrupt processing program, current information of N registers is pressed into the target stack to realize the field protection of the abnormal fault, wherein N is a positive integer.
In the specific implementation process, the watchdog function can be integrally designed on a hardware platform of an embedded system, such as an STM32H7 series single chip microcomputer, an STM32F series single chip microcomputer, a Xilinx Zynq-7000/7Z020 series FPGA and the like, and the watchdog function is configured. The watchdog function is specifically to check the internal condition of the chip, and once an error occurs, a reset signal can be sent to the chip to prevent the program from generating a dead cycle in the running process and downtime. In this embodiment of the present description, the hardware platform of the embedded system, the specific functions of the watchdog, the reset time, and the like may be selected or set according to actual needs, and are not limited herein.
It should be noted that the watchdog may include multiple types, such as an independent watchdog and a window watchdog, where the window watchdog has an interrupt function, and therefore, in this embodiment of the present specification, the window watchdog may be adopted to implement accurate positioning of the abnormal fault through an interrupt handler of the window watchdog.
After the embedded software system is started, the watchdog function is started, and simultaneously, the abnormal interrupt vector table is initialized. When the embedded software system has an abnormal fault in the running process, the running of a watchdog interrupt processing program is triggered so as to press the field protection information of the abnormal fault into a target stack.
For different abnormal faults, different stacks may be associated, for example, when an abnormal fault a occurs, corresponding field protection information may be pushed into a stack a, and when an abnormal fault B occurs, corresponding field protection information may be pushed into a stack B. Of course, the information corresponding to different exception faults may also be pushed into the same stack, which is not limited herein.
In this embodiment, the field protection information may include current information of N registers, and the N registers and the stacking manner may be determined according to a kernel type of the embedded system. For example, when the processor core is Cortex-M3, 8 registers of xPSR, PC, LR, R12 and R3-R0 can be used as the N registers, and the 8 registers can be automatically pushed into the target stack by hardware. For another example, when the processor core is Cortex-A7, the PC register may be saved to the LR register, note that here the LR register is an LR register specific to the IRQ mode; storing the CPSR register into the SPSR register; and then saving the registers R0-R3 and R12, as well as the LR _ IRQ and the SPSR _ IRQ requires manual stack saving of an IRQ interrupt processing function, so that field protection is completed. After the interrupt processing is finished, the contents of the registers stored in the target stack can be popped up through a POP instruction, and the original values of the registers at the breakpoint of the main program can be restored.
Therefore, the abnormal fault is protected on site through the watchdog interrupt handler, the target information can be stored in the target stack, and further, the target information can be obtained by reading the content in the target stack.
In this embodiment of the present specification, if different field protection information about an abnormal fault is pushed to different stacks, before step S101 is executed, the target stack may be determined by the following steps: acquiring a target stack pointer which is stored in a target register and corresponds to the abnormal fault; determining the target stack based on the target stack pointer.
Specifically, the embedded processor typically uses register R13 as a stack pointer, and thus the target register may be register R13. For each exception fault, there is a respective independent R13, which typically points to the stack dedicated to the exception fault. That is, when different abnormal faults occur, the corresponding field protection information is pushed to different stacks by the watchdog interrupt handler, and different stack pointers are required to be used for indexing. In this embodiment, the target stack may be determined by reading the target stack pointer in the register R13 to perform the indexing.
In step S102, as can be seen from the above description, the abnormal fault in the embodiment of the present disclosure may include two types, namely, an abnormal interrupt and a non-abnormal interrupt, of the embedded system, where a mode of the abnormal fault included in the abnormal interrupt of the embedded system may be an abnormal interrupt mode, and a mode of the abnormal fault included in the non-abnormal interrupt may be a non-abnormal interrupt mode.
In a specific implementation, the target mode of the abnormal fault may be determined in a variety of ways, two of which are described below.
The first mode is as follows:
in this way, the target information includes a target abnormal interrupt number corresponding to the abnormal fault, and the target mode may be determined by: determining whether an abnormal interrupt vector table of the embedded software system contains the target abnormal interrupt number or not based on the target abnormal interrupt number; if the target abnormal interrupt number is included in the abnormal interrupt vector table, determining that the target mode of the abnormal fault is the abnormal interrupt mode; if the target abnormal interrupt number is not included in the abnormal interrupt vector table, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
Specifically, the abort vector table includes all the abort types and the abort number corresponding to each abort type. After the target information is read from the target stack, it can be determined whether the target information contains a target abnormal interrupt number, and if so, it is determined whether the target abnormal interrupt number is contained in the abnormal interrupt vector table by querying the abnormal interrupt vector table. If the abnormal interrupt vector table contains the target abnormal interrupt number, the mode of the current abnormal fault is indicated to be an abnormal interrupt mode, otherwise, the mode of the abnormal fault is a non-abnormal interrupt mode.
Of course, in addition to querying the abnormal interrupt vector table, the abnormal interrupt vector table of the embedded software system may be configured in advance, where the abnormal interrupt vector table may include all the abnormal interrupt faults and the non-abnormal interrupt faults, and each fault is assigned with its own abnormal interrupt number. Then, reading a target abnormal interrupt number from the target stack, obtaining a target abnormal fault corresponding to the target abnormal interrupt number by querying an abnormal fault vector table, and then determining a final target mode through the target abnormal fault. For example, if the target abnormal fault corresponding to the target abnormal interrupt number is a program array boundary crossing fault, and the fault is an abnormal interrupt fault, the target mode is an abnormal interrupt mode. For another example, if the target abnormal fault corresponding to the target abnormal interrupt number is a signal response error in the loop statement, and the fault is a non-abnormal interrupt fault, the target mode is the non-abnormal interrupt mode.
The second mode is as follows:
in this manner, the target mode may be determined by: determining whether the target information contains an interrupt stack pointer address corresponding to a trigger program of the watchdog interrupt processing program; if the target information contains the interrupt stack pointer address, determining that the target mode of the abnormal fault is the abnormal interrupt mode; and if the target information does not contain the interrupt stack pointer address, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
Specifically, for the abnormal fault in the abnormal interrupt mode, if the abnormal fault occurs during the embedded operation process, the abnormal interrupt occurs in the embedded system, and the watchdog enters the watchdog interrupt handler after detecting the abnormal interrupt. That is, an exception fault will generate an interrupt nest (first triggering an exception interrupt, then triggering a watchdog interrupt). Since the field of the program whose execution is suspended is protected by the stack even when the abort occurs, the stack for storing the field information of the abort is also provided for the abort. During the running process of the watchdog interrupt handler, the stack pointer address of the stack corresponding to the abnormal interrupt is pushed into the target stack, that is, the interrupt stack pointer address in the target stack.
Therefore, if the target information contains the interrupt stack pointer address, it indicates that the watchdog interrupt handler is triggered by other abnormal interrupt programs, and the abnormal fault mode is the abnormal interrupt mode.
For the abnormal fault of the non-abnormal interrupt mode, when the abnormal fault occurs, the operation of the watchdog interrupt processing program is directly triggered, so that the target information does not include the interrupt stack pointer address or the interrupt stack pointer address is null.
In summary, whether the target mode of the exception fault is the abort mode or the non-abort mode can be determined by the interrupt stack pointer address.
In step S103, after the target pattern of the abnormal fault is determined, the abnormal fault is positioned in a different manner for different abnormal patterns.
Specifically, when the abnormal fault is in a non-abnormal interrupt mode, the abnormal fault directly triggers the watchdog interrupt handler, and the target information read from the target stack directly corresponds to the main program code or function of the embedded software when the abnormal fault occurs, so that the abnormal fault can be directly traced and positioned through the target information.
When the abnormal fault is in the abnormal interruption mode, the tracing and positioning of the abnormal fault can be specifically performed in the following manner: determining a stack corresponding to a trigger program of the watchdog interrupt processing program based on the target information; reading abnormal interrupt information corresponding to the trigger program from a stack corresponding to the trigger program; and positioning the trigger program based on the abnormal interruption information and the MAP file.
Specifically, when the abnormal fault is in the abnormal interrupt mode, the abnormal fault triggers the abnormal interrupt first and then triggers the watchdog interrupt handler, and then needs to locate a stack corresponding to the abnormal interrupt based on the target information in the target stack, where the stack corresponding to the abnormal interrupt is the stack corresponding to the trigger of the watchdog interrupt handler. And reading field protection information during abnormal interruption, namely abnormal interruption information, from a stack corresponding to the abnormal interruption, wherein the abnormal interruption information stored in the abnormal interruption stack directly corresponds to a main program code or a function of the embedded software when the abnormal fault occurs, so that the abnormal fault can be secondarily positioned by combining the abnormal interruption information and an MAP file.
In the embodiment of the present specification, after information stored in a stack corresponding to a main program code or a function of embedded software is obtained, the obtained information may be stored in a nonvolatile memory or sent to an upper computer for subsequent further analysis and processing.
Further, in the embodiment of the present specification, step S103 may be implemented by: determining target address information of the program code corresponding to the abnormal fault based on the target mode and the target information; determining abnormal program codes of the target address information by inquiring the MAP file; if the target mode is the non-abnormal interrupt mode, determining target address information of a program code corresponding to the abnormal fault from the target information; or if the target mode is the abnormal interruption mode, determining target address information of the program code corresponding to the abnormal fault from the abnormal interruption information.
Specifically, with the above description, when the target mode is the non-abort mode, the target address information can be directly determined from the target information. When the target mode is the abnormal interrupt mode, an interrupt stack pointer address can be determined from the target information, a stack corresponding to the abnormal interrupt is indexed through the interrupt stack pointer address, the abnormal interrupt information stored in the stack is read, and the target address information is determined from the abnormal interrupt information.
It should be noted that the destination address information may include: the location of the current instruction execution, the stack pointer of the last level calling function, etc., determined based on the register information read in the stack. Because the content of each code executed by the system and the corresponding address information are stored in the MAP file, after the target address information is obtained, the operating embedded software program code can be positioned when the abnormal fault occurs by inquiring the MAP file.
Further, in this embodiment of the present specification, information such as function-related parameters and temporary variables corresponding to the occurrence of an abnormal fault may also be determined based on register information read from a stack, and in combination with the obtained information such as the execution position of the current instruction and the stack pointer of the previous-stage call function, each parameter of the system environment and the abnormal code itself at the occurrence of the abnormal fault may be restored. Furthermore, the binary instructions can be translated into assemblies so as to determine what the specifically executed instructions are, and analyze what the program functions run when the system has an abnormal fault, what the corresponding function call relation is, what line of codes are executed in the functions, the current register information and other contents, so that the specific fault reasons can be conveniently analyzed.
In summary, the method provided in the embodiment of the present disclosure detects, in real time, the self-running exception of the running program of the embedded software system and the interrupt exception of the embedded hardware platform through the watchdog function, and interrupts the program through the watchdog, thereby achieving acquisition of the environment parameter of the running program and the information of the program itself under the abnormal fault. When the abnormal fault is non-abnormal interruption, tracing and positioning the abnormal fault directly through information in a target stack corresponding to a watchdog interruption handler; when the abnormal fault is abnormal interruption, the stack corresponding to the abnormal interruption is positioned through the information in the target stack, and then secondary tracing positioning is carried out on the abnormal fault through the information in the stack of the abnormal interruption. Therefore, the scheme provided by the embodiment of the specification can realize the accurate positioning of various abnormal faults, further provide an effective troubleshooting positioning means for various abnormal faults generated in the software development and software operation processes, and improve the reliability and maintainability of the embedded software design.
Based on the same inventive concept, an embodiment of the present specification further provides an abnormal fault location device of an embedded software system, please refer to fig. 2, the device includes:
an obtaining module 201, configured to obtain target information stored in a target stack, where the target information is field protection information that is pressed into the target stack by a watchdog interrupt handler when an abnormal fault occurs in the embedded software system;
a mode determining module 202, configured to determine, based on the target information, a target mode of the abnormal fault, where the target mode includes an abnormal interruption mode and a non-abnormal interruption mode;
and the positioning module 203 is configured to position the abnormal fault based on the target mode of the abnormal fault, the target information, and the MAP file of the embedded software.
Optionally, the apparatus further comprises:
the running module is used for running the embedded software system and the watchdog function;
the trigger module is used for triggering the running of the watchdog interrupt processing program if detecting that the embedded software system has an abnormal fault in the running process of the watchdog function;
and the first processing module is used for pressing the current information of N registers into the target stack to realize the field protection of the abnormal fault in the running process of the watchdog interrupt processing program, wherein N is a positive integer.
Optionally, the apparatus further comprises:
the stack pointer determining module is used for acquiring a target stack pointer which is stored in a target register and corresponds to the abnormal fault;
a stack determination module to determine the target stack based on the target stack pointer.
Optionally, the target information includes a target abnormal interrupt number corresponding to the abnormal fault, and the mode determining module 202 is configured to:
determining whether an abnormal interrupt vector table of the embedded software system contains the target abnormal interrupt number or not based on the target abnormal interrupt number;
if the target abnormal interruption number is included in the abnormal interruption vector table, determining that the target mode of the abnormal fault is the abnormal interruption mode;
if the target abnormal interrupt number is not included in the abnormal interrupt vector table, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
Optionally, the mode determining module 202 is configured to:
determining whether the target information contains an interrupt stack pointer address corresponding to a trigger program of the watchdog interrupt processing program;
if the target information contains the interrupt stack pointer address, determining that the target mode of the abnormal fault is the abnormal interrupt mode;
and if the target information does not contain the interrupt stack pointer address, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
Optionally, when the target mode is the abort mode, the positioning module 203 is configured to:
determining a stack corresponding to a trigger program of the watchdog interrupt processing program based on the target information;
reading abnormal interrupt information corresponding to the trigger program from a stack corresponding to the trigger program;
and positioning the trigger program based on the abnormal interruption information and the MAP file.
Optionally, the positioning module 203 is configured to:
if the target mode is the abnormal interruption mode, determining target address information of the program code corresponding to the abnormal fault from the abnormal interruption information;
and determining abnormal program codes of the target address information by inquiring the MAP file.
Optionally, the positioning module 203 is configured to:
if the target mode is the non-abnormal interrupt mode, determining target address information of a program code corresponding to the abnormal fault from the target information;
and determining abnormal program codes of the target address information by inquiring the MAP file.
With regard to the above-mentioned apparatus, specific functions of each module have been described in detail in the embodiment of the method for locating an abnormal fault of an embedded software system provided in this specification, and a detailed description thereof will not be provided here.
Based on the same inventive concept, an embodiment of the present invention provides an electronic device, shown in fig. 3, including: a memory 304, a processor 302 and a computer program stored on the memory 304 and operable on the processor 302, the processor 302 implementing any of the embodiments of the method for fault location of an embedded software system when executing the program.
Where in fig. 3 a bus architecture (represented by bus 300), bus 300 may include any number of interconnected buses and bridges, bus 300 linking together various circuits including one or more processors, represented by processor 302, and memory, represented by memory 304. The bus 300 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 305 provides an interface between the bus 300 and the receiver 301 and transmitter 303. The receiver 301 and the transmitter 303 may be the same element, i.e., a transceiver, providing a means for communicating with various other apparatus over a transmission medium. The processor 302 is responsible for managing the bus 300 and general processing, and the memory 304 may be used for storing data used by the processor 302 in performing operations.
The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Other examples and implementations are within the scope and spirit of the invention and the following claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hardwired, or a combination of any of these. In addition, each functional unit may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
In the embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be an indirect coupling or communication connection through some interfaces, units or modules, and may be electrical or in other forms.
The units described as separate parts may or may not be physically separate, and the parts serving as the control device may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is substantially or partly contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and various media capable of storing program codes.
The above description is only an example of the present invention, and is not intended to limit the present invention, and it is obvious to those skilled in the art that various modifications and variations can be made in the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims (10)
1. An abnormal fault positioning method of an embedded software system is characterized by comprising the following steps:
acquiring target information stored in a target stack, wherein the target information is field protection information pressed into the target stack through a watchdog interrupt processing program when the embedded software system has an abnormal fault;
determining a target mode of the abnormal fault based on the target information, wherein the target mode comprises an abnormal interruption mode and a non-abnormal interruption mode;
and positioning the abnormal fault based on the target mode of the abnormal fault, the target information and the MAP file of the embedded software.
2. The method of claim 1, wherein prior to said obtaining target information held in a target stack, the method further comprises:
operating an embedded software system and a watchdog function;
in the running process of the watchdog function, if the embedded software system is detected to have abnormal faults, triggering the running of a watchdog interrupt processing program;
and in the running process of the watchdog interrupt processing program, current information of N registers is pressed into the target stack to realize the field protection of the abnormal fault, wherein N is a positive integer.
3. The method of claim 1, wherein prior to said obtaining target information held in a target stack, the method further comprises:
acquiring a target stack pointer which is stored in a target register and corresponds to the abnormal fault;
determining the target stack based on the target stack pointer.
4. The method of claim 1, wherein the target information includes a target abort number corresponding to the abnormal fault, and wherein determining the target pattern of the abnormal fault based on the target information includes:
determining whether an abnormal interrupt vector table of the embedded software system contains the target abnormal interrupt number or not based on the target abnormal interrupt number;
if the target abnormal interruption number is included in the abnormal interruption vector table, determining that the target mode of the abnormal fault is the abnormal interruption mode;
if the target abnormal interrupt number is not included in the abnormal interrupt vector table, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
5. The method of claim 1, wherein said determining a target pattern of said abnormal fault based on said target information comprises:
determining whether the target information contains an interrupt stack pointer address corresponding to a trigger program of the watchdog interrupt processing program;
if the target information contains the interrupt stack pointer address, determining that the target mode of the abnormal fault is the abnormal interrupt mode;
and if the target information does not contain the interrupt stack pointer address, determining that the target mode of the abnormal fault is the non-abnormal interrupt mode.
6. The method of claim 1, wherein locating the abnormal fault based on the target pattern of the abnormal fault, the target information, and a MAP file of the embedded software when the target pattern is the abort pattern comprises:
determining a stack corresponding to a trigger program of the watchdog interrupt processing program based on the target information;
reading abnormal interrupt information corresponding to the trigger program from a stack corresponding to the trigger program;
and positioning the trigger program based on the abnormal interruption information and the MAP file.
7. The method of claim 6, wherein locating the abnormal fault based on the target pattern of the abnormal fault, the target information, and a MAP file of the embedded software comprises:
if the target mode is the abnormal interruption mode, determining target address information of the program code corresponding to the abnormal fault from the abnormal interruption information;
and determining abnormal program codes of the target address information by inquiring the MAP file.
8. The method of claim 1, wherein locating the abnormal fault based on the target pattern of the abnormal fault, the target information, and a MAP file of the embedded software comprises:
if the target mode is the non-abnormal interruption mode, determining target address information of a program code corresponding to the abnormal fault from the target information;
and determining abnormal program codes of the target address information by inquiring the MAP file.
9. An abnormal fault locating device of an embedded software system is characterized by comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring target information stored in a target stack, and the target information is field protection information pressed into the target stack through a watchdog interrupt processing program when the embedded software system has an abnormal fault;
a mode determining module, configured to determine a target mode of the abnormal fault based on the target information, where the target mode includes an abnormal interruption mode and a non-abnormal interruption mode;
and the positioning module is used for positioning the abnormal fault based on the target mode of the abnormal fault, the target information and the MAP file of the embedded software.
10. An electronic device, characterized by a memory, a processor and a computer program stored on the memory and executable on the processor, which when executing a program implements the method according to any of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211559768.3A CN115756935A (en) | 2022-12-06 | 2022-12-06 | Abnormal fault positioning method, device and equipment of embedded software system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211559768.3A CN115756935A (en) | 2022-12-06 | 2022-12-06 | Abnormal fault positioning method, device and equipment of embedded software system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115756935A true CN115756935A (en) | 2023-03-07 |
Family
ID=85343752
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211559768.3A Pending CN115756935A (en) | 2022-12-06 | 2022-12-06 | Abnormal fault positioning method, device and equipment of embedded software system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115756935A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117806870A (en) * | 2024-02-29 | 2024-04-02 | 双一力(宁波)电池有限公司 | Fault code positioning method and related device |
-
2022
- 2022-12-06 CN CN202211559768.3A patent/CN115756935A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117806870A (en) * | 2024-02-29 | 2024-04-02 | 双一力(宁波)电池有限公司 | Fault code positioning method and related device |
CN117806870B (en) * | 2024-02-29 | 2024-05-28 | 双一力(宁波)电池有限公司 | Fault code positioning method and related device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101019210B1 (en) | Test Device of Embedded Software using the emulator and Method thereof | |
US8250543B2 (en) | Software tracing | |
US20070079288A1 (en) | System and method for capturing filtered execution history of executable program code | |
CN109144873B (en) | Linux kernel processing method and device | |
CN106919462B (en) | Method and device for generating fault record of processor | |
CN107111595B (en) | Method, device and system for detecting early boot errors | |
EP3839742A1 (en) | A method for diagnosing power supply failure in a wireless communication device | |
CN115756935A (en) | Abnormal fault positioning method, device and equipment of embedded software system | |
CN118152298A (en) | Memory access detection method and device, electronic equipment and computer storage medium | |
US7415560B2 (en) | Method of automatically monitoring computer system debugging routine | |
CN116521411B (en) | Method, device and medium for detecting program error and resetting embedded device | |
CN116382968B (en) | Fault detection method and device for external equipment | |
CN116756037A (en) | Abnormal code positioning system, method, equipment and computer readable storage medium | |
CN115373923A (en) | 0x7c error positioning method, device and medium | |
CN110096888B (en) | Method and system for accelerating verification and analyzing SMM potential safety hazard | |
CN110399258B (en) | Stability testing method, system and device for server system | |
CN107766251B (en) | Detection method, system and device for loading image and readable storage medium | |
CN105718375A (en) | Restorability testing method of embedded system | |
CN111949430B (en) | Basic input/output system error information recording method, system and terminal based on GPNV | |
CN114253846B (en) | Automatic test abnormality positioning method, device, equipment and readable storage medium | |
CN114356708A (en) | Equipment fault monitoring method, device, equipment and readable storage medium | |
CN118916202A (en) | Data processing method, device, equipment and medium for program run | |
US7065691B2 (en) | Apparatus and method for saving precise system state following exceptions | |
CN105718326A (en) | Restorability testing method of embedded system | |
CN115658578A (en) | Method for realizing protection switching, computer storage medium and terminal |
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 |