CN117591322A - Abnormality processing method and device, electronic equipment and storage medium - Google Patents

Abnormality processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117591322A
CN117591322A CN202311441776.2A CN202311441776A CN117591322A CN 117591322 A CN117591322 A CN 117591322A CN 202311441776 A CN202311441776 A CN 202311441776A CN 117591322 A CN117591322 A CN 117591322A
Authority
CN
China
Prior art keywords
exception
abnormal
abnormality
memory
record
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
CN202311441776.2A
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.)
China Automotive Innovation Corp
Original Assignee
China Automotive Innovation Corp
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 China Automotive Innovation Corp filed Critical China Automotive Innovation Corp
Priority to CN202311441776.2A priority Critical patent/CN117591322A/en
Publication of CN117591322A publication Critical patent/CN117591322A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0787Storage of error reports, e.g. persistent data storage, storage using memory protection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to an exception handling method, an exception handling device, electronic equipment and a storage medium, wherein the exception handling method comprises the following steps: under the condition that interrupt abnormality information of the self-adaptive platform of the automobile open system architecture is obtained, determining an abnormality process and an abnormality type according to the interrupt abnormality information; under the condition that the abnormality type is user state abnormality, acquiring first interrupt context information corresponding to the interrupt abnormality information based on an abnormality signal processing function corresponding to the abnormal process; generating a first exception record based on the exception signal processing function and the first interrupt context information; and storing the first abnormal record into a first target memory. When the self-adaptive platform of the automobile open system architecture generates system abnormality, the invention can save the abnormality record which is rich in content and easy to understand, so that the self-adaptive platform can capture and process the abnormality in the development, production and application stages, thereby improving the abnormality processing capacity and efficiency of the self-adaptive platform of the automobile open system architecture.

Description

Abnormality processing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of exception handling technologies, and in particular, to an exception handling method, an exception handling device, an electronic device, and a storage medium.
Background
The standard of an adaptive platform of an automobile open system architecture (i.e. an AUTOSAR adaptive platform) does not currently define how to capture and process an exception when a system exception occurs, and the exception debugging mechanism inherent in the operating system has the following defects: the existing abnormal debugging function cannot be started in the production and post-production stage of a product based on the self-adaptive platform of the automobile open system architecture, because the generated abnormal record files can be infinitely increased to consume the disk space of the system, and the application program cannot normally run; in addition, the abnormal information contained in the abnormal record file generated by the existing abnormal debugging mechanism is fixed and unprocessed original information, so that the abnormal information is more obscure and understandable, and the difficulty of post positioning and solving the problem of system abnormality is increased.
Disclosure of Invention
In order to solve the technical problems, the invention discloses an exception handling method, which can save exception records with rich and understandable contents when an exception occurs in an adaptive platform of an automobile open system architecture, so that the adaptive platform of the automobile open system architecture can capture and handle exceptions in the development, production and application stages, thereby improving the exception handling capacity and efficiency of the adaptive platform of the automobile open system architecture.
In order to achieve the above object, the present invention provides an exception handling method, which includes:
under the condition that interrupt abnormality information of the self-adaptive platform of the automobile open system architecture is obtained, determining an abnormality process and an abnormality type according to the interrupt abnormality information;
under the condition that the abnormality type is user state abnormality, acquiring first interrupt context information corresponding to the interrupt abnormality information based on an abnormality signal processing function corresponding to the abnormal process;
generating a first exception record based on the exception signal processing function and the first interrupt context information;
and storing the first abnormal record into a first target memory.
In an alternative embodiment, the method further comprises:
acquiring second interrupt context information corresponding to the interrupt exception information under the condition that the exception type is kernel mode exception;
storing the second interrupt context information into a second target memory; the second target memory is a reserved memory of the kernel space, the reserved memory is a part of the physical memory space larger than a preset address, and the reserved memory is a volatile memory;
reading the second interrupt context information from the second target memory and generating a second exception record based on the second interrupt context information;
Storing the second abnormal record into a third target memory; the third target memory is a nonvolatile memory.
In an alternative embodiment, the generating a first exception record based on the exception signal processing function and the first interrupt context information includes:
processing the first interrupt context information and the register information corresponding to the abnormal thread based on the abnormal signal processing function, and releasing semaphore to the abnormal daemon corresponding to the abnormal process;
and under the condition that the abnormal daemon thread acquires the semaphore, analyzing the semaphore by the abnormal daemon thread to generate the first abnormal record.
In an optional embodiment, the storing the first exception record in the first target memory includes:
storing the first exception record in a reserved memory if the reserved memory is provided and the reserved memory space is sufficient; the reserved memory is a part of the physical memory space which is larger than a preset address, and the reserved memory is a volatile memory;
storing the first exception record in a shared memory under the condition that the reserved memory space is insufficient; the shared memory is a part of physical memory space shared by processes in the self-adaptive platform of the automobile open system architecture, and the shared memory is volatile memory.
In an optional embodiment, after the storing the first exception record in the first target memory, the method further includes:
and acquiring the abnormal record in the first target memory at regular time through an abnormal monitoring thread and sending the abnormal record to the background.
In an optional embodiment, the analyzing, by the exception daemon, the semaphore if the exception daemon acquires the semaphore, to generate the first exception record includes:
acquiring stack content of the abnormal thread, dynamic library information used by the abnormal process and machine codes before and after an abnormal statement;
backtracking a function call chain corresponding to the abnormal thread;
and generating the first exception record based on the semaphore, the stack content, the dynamic library information, the machine code before and after the exception statement and the function call chain.
In an alternative embodiment, after the generating the first exception record based on the semaphore, the stack content, the dynamic library information, the machine code before and after the exception statement, and the function call chain, the method further comprises:
judging whether the abnormal process has a corresponding abnormal exit legacy or not;
If yes, executing the abnormal exit legacy;
otherwise, submitting the exception, exiting the exception process after delay and giving an exception exit code to the exception process.
In an optional embodiment, the tracing back the function call chain corresponding to the abnormal thread includes:
acquiring data stored in a stack pointer register, a stack frame pointer register, a connection register and a program counter of the abnormal thread;
obtaining the address of the abnormal thread stack frame according to the data stored in the stack pointer register, the stack frame pointer register, the connection register and the program counter;
obtaining corresponding function names by inquiring a symbol table according to the addresses of the abnormal thread stack frames, and determining the calling relation among functions;
and determining a function call chain corresponding to the abnormal thread based on the call relation among the functions.
In an optional embodiment, before the reading the second interrupt context information from the second target memory and generating the second exception record based on the second interrupt context information, the method further includes:
acquiring the initial address and the size of the second target memory;
Judging whether the content in the second target memory is valid or not according to the characteristic characters of the second target memory;
if yes, the second interrupt context information is read from the second target memory, and the second abnormal record is generated based on the second interrupt context information.
The invention also provides an exception handling device, which comprises:
the abnormality type determining module is used for determining an abnormality process and an abnormality type according to the interrupt abnormality information under the condition that the interrupt abnormality information of the self-adaptive platform of the automobile open system architecture is acquired;
the first acquisition module is used for acquiring first interrupt context information corresponding to the interrupt exception information based on an exception signal processing function corresponding to the exception process under the condition that the exception type is user state exception;
a first generation module for generating a first exception record based on the exception signal processing function and the first interrupt context information;
and the first storage module is used for storing the first abnormal record into a first target memory.
The invention also provides an electronic device comprising a processor and a memory, wherein at least one instruction or at least one section of program is stored in the memory, and the at least one instruction or the at least one section of program is loaded and executed by the processor so as to realize the exception handling method.
The present invention also provides a computer readable storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by a processor to implement the exception handling method as described above.
The embodiment of the invention has the following beneficial effects:
according to the abnormality processing method disclosed by the invention, when the system abnormality occurs in the self-adaptive platform of the automobile open system architecture, the abnormality record with rich content and easy understanding can be stored, so that the self-adaptive platform of the automobile open system architecture can capture and process the abnormality in the development, production and application stages, and the abnormality processing capacity and efficiency of the self-adaptive platform of the automobile open system architecture are improved.
Drawings
In order to more clearly describe the abnormality processing method, apparatus, electronic device and storage medium of the present invention, the drawings required for the embodiments will be briefly described below, and it will be apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained from these drawings without inventive effort for those skilled in the art.
FIG. 1 is a schematic diagram of a system according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of an exception handling method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an operation stack structure of an ARM processor according to an embodiment of the present invention;
FIG. 4 is an example of assembly code generated by a GCC compiler of an ARM processor according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an exception handling apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, fig. 1 illustrates a system that may be used to implement an embodiment of the present invention, as shown in fig. 1, the system may include at least an adaptive application process, a Platform Health Management (PHM) process, and a kernel, where the PHM process hosts an exception monitor thread and an exception daemon thread, and the platform process and the adaptive application process hosts an exception daemon thread.
The following describes an exception handling method based on the system according to the present invention with reference to fig. 2, and the present embodiment is applied to a kernel of an adaptive platform system of an automobile open system architecture.
Referring to fig. 2, a flowchart of an exception handling method according to an embodiment of the present invention is shown, and the present specification provides the method operation steps described in the examples or the flowcharts, but may include more or less operation steps based on conventional or non-inventive labor. The sequence of steps recited in the embodiments is only one manner of a plurality of execution sequences of steps, does not represent a unique execution sequence, and may be executed in the order of execution of the method shown in the embodiments or the drawings when the system or the server product is actually executed. As shown in fig. 2, the method includes:
S201, under the condition that interrupt abnormality information of the self-adaptive platform of the automobile open system architecture is obtained, determining an abnormality process and an abnormality type according to the interrupt abnormality information;
in the embodiment of the present specification, the interrupt exception information may be an interrupt vector;
specifically, under the condition that an interrupt vector of an adaptive platform of an automobile open system architecture is obtained, calling an interrupt processing program according to the interrupt vector, and determining an abnormal process and an abnormal type based on the interrupt processing program;
in the embodiment of the present specification, the exception types may include user mode exceptions and kernel mode exceptions.
S203, acquiring first interrupt context information corresponding to the interrupt exception information based on an exception signal processing function corresponding to the exception process under the condition that the exception type is user state exception;
in the embodiment of the present specification, when the abnormality type is a user state abnormality, an abnormality signal corresponding to the interrupt abnormality information is generated; the exception signal includes the first interrupt context information; and sending the abnormal signal to the abnormal signal processing function, and acquiring the first interrupt context information based on the abnormal signal processing function.
S205, generating a first exception record based on the exception signal processing function and the first interrupt context information;
in an embodiment of the present disclosure, the generating a first exception record based on the exception signal processing function and the first interrupt context information includes:
processing the first interrupt context information and the register information corresponding to the abnormal thread based on the abnormal signal processing function, and releasing semaphore to the abnormal daemon corresponding to the abnormal process;
under the condition that the abnormal daemon thread acquires the semaphore, analyzing the semaphore by the abnormal daemon thread to generate the first abnormal record;
specifically, the first interrupt context information and the register information corresponding to the abnormal thread are transmitted to the abnormal signal processing function as parameters, the first interrupt context information and the register information corresponding to the abnormal thread are processed based on the abnormal signal processing function, and the semaphore is released to the abnormal daemon corresponding to the abnormal process;
in this embodiment of the present disclosure, the first exception record may include process exit information, information recorded by a legacy hook registered by an application, deadlock and/or dead loop information of a thread, printing information of a kernel mode, watchdog information recorded by an upper layer, information of a process restart, process reset hook execution information registered by an application, abnormal exit information of a thread, and information of a restart time of an adaptive platform of an open system architecture of an automobile;
According to the technical means, when the self-adaptive platform of the automobile open system architecture is abnormal, the embodiment of the specification can generate the corresponding user state abnormal record based on the abnormal signal processing function corresponding to the abnormal process and the user state interrupt context information, and then further send the user state abnormal record to the background, so that the abnormal processing capacity and efficiency of the self-adaptive platform of the automobile open system architecture are improved, and the abnormal record information with rich and understandable content can be provided for positioning in future and solving the problem of system abnormality.
In an embodiment of the present disclosure, when the exception daemon acquires the semaphore, analyzing, by the exception daemon, the semaphore to generate the first exception record includes:
acquiring stack content of the abnormal thread, dynamic library information used by the abnormal process and machine codes before and after an abnormal statement;
backtracking a function call chain corresponding to the abnormal thread;
generating the first exception record based on the semaphore, the stack content, the dynamic library information, machine codes before and after the exception statement, and the function call chain;
In the embodiment of the present specification, the machine code before and after the exception statement may be a 64-byte machine code before and after the exception statement;
according to the technical means, when the self-adaptive platform of the automobile open system architecture is abnormal, the embodiment of the specification can generate the user state abnormal record which is rich and easy to understand through the abnormal daemon corresponding to the abnormal process, and then further send the user state abnormal record to the background, so that the abnormal processing capacity and efficiency of the self-adaptive platform of the automobile open system architecture are improved.
In an embodiment of the present disclosure, after the generating the first exception record based on the semaphore, the stack content, the dynamic library information, the machine code before and after the exception statement, and the function call chain, the method further includes:
judging whether the abnormal process has a corresponding abnormal exit legacy or not;
if yes, executing the abnormal exit legacy;
otherwise, submitting the exception, exiting the exception process after delay and giving an exception exit code to the exception process;
in the embodiment of the specification, the abnormal exit legacy is an information storage mechanism provided by an adaptive platform of an automobile open system architecture before process reset, and the abnormal exit legacy is registered by an application;
In the embodiment of the specification, the abnormal exit legacy is executed by an abnormal exit legacy processing task;
specifically, under the condition that the abnormal process has a corresponding abnormal exit legacy, releasing a semaphore to an abnormal exit legacy processing task based on an abnormal daemon corresponding to the abnormal process, executing the abnormal exit legacy after the abnormal exit legacy processing task receives the semaphore, and then exiting the abnormal process;
according to the technical means, the embodiment of the specification judges whether the abnormal process has the corresponding abnormal exit will after the abnormal record is generated, and saves the information before the abnormal process exits by executing the abnormal exit will, so that the information loss caused by the system abnormality of the self-adaptive platform of the automobile open system architecture is avoided.
In this embodiment of the present disclosure, the tracing back a function call chain corresponding to the abnormal thread includes:
acquiring data stored in a stack pointer register, a stack frame pointer register, a connection register and a program counter of the abnormal thread;
obtaining the address of the abnormal thread stack frame according to the data stored in the stack pointer register, the stack frame pointer register, the connection register and the program counter;
Obtaining corresponding function names by inquiring a symbol table according to the addresses of the abnormal thread stack frames, and determining the calling relation among functions;
determining a function call chain corresponding to the abnormal thread based on the call relation among the functions;
it should be noted that, the function call chain corresponding to the trace back abnormal thread is closely related to a specific processor, and needs to analyze contents such as abnormal type, interrupt context information, operation stack structure, prologue and tail sound of functions respectively for different processors such as ARM series, PPC series, x86 series, MIPS series and the like;
for example, for an ARM processor, the GCC compiler generates the run stack structure shown in FIG. 3. SP is the abnormal field stack pointer register value, FP is the abnormal field stack frame pointer register value; FP [ k ] represents the stack frame pointer register value of push stack when the k-th layer function is called; IP [ k ] represents the stack pointer register value of push stack when the function of the k layer is called; LR [ k ] represents the connection register value of the push stack when the function of the k layer is called, wherein the return address of the call is saved; PC [ k ] represents the program counter value of push stack when the function of the k layer is called, wherein the entry address of the call is saved; the FP shifts 3 positions to the low address direction to obtain the position of the last stack frame, thereby linking the stack frames;
For example, for an ARM processor, FIG. 4 is an example of assembly code generated by the GCC compiler of ARM, with the assembly instructions belonging to the ARM instruction set of 32 bits by default; the function preamble of fig. 4 functions to form a stack frame, and the corresponding function tail functions to tear down the stack frame;
according to the technical means, the embodiment of the specification determines the function call chain corresponding to the abnormal thread by analyzing the abnormal thread stack frame in the operation stack, and generates the abnormal record based on the function call chain corresponding to the abnormal thread, so that the abnormal processing capacity of the self-adaptive platform of the automobile open system architecture is improved, and the abnormal record information with rich content and easy understanding can be provided for positioning in future and solving the problem of system abnormality.
S207, storing the first abnormal record into a first target memory;
in an embodiment of the present disclosure, storing the first exception record in a first target memory includes:
storing the first exception record in a reserved memory if the reserved memory is provided and the reserved memory space is sufficient; the reserved memory is a part of the physical memory space which is larger than a preset address, and the reserved memory is a volatile memory;
Storing the first exception record in a shared memory under the condition that the reserved memory space is insufficient; the shared memory is a part of physical memory space shared by processes in the self-adaptive platform of the automobile open system architecture, and is volatile memory;
in this embodiment of the present disclosure, the preset address may be 0xF8000000, that is, the reserved memory may be a portion of the physical memory space with an address greater than 0xF 8000000;
in the embodiment of the present disclosure, the feature of the reserved memory is that, under the condition of no power failure, the contents in the reserved memory space remain unchanged;
in the embodiment of the present disclosure, the reserved memory is transferred by the application, and the PHM process and the application process map the reserved memory to the user space when powering on;
in the embodiment of the present disclosure, the PHM process is responsible for initializing the feature characters of the reserved memory header; before initializing the reserved memory, judging whether the reserved memory has an abnormal record of the last operation or not; if yes, and keeping the characteristic characters of the memory head intact, and transmitting the abnormal record to a background developer;
in this embodiment of the present disclosure, the shared memory is used to store an exception record of a platform process and an adaptive application process; creating a name corresponding to the shared memory by the PHM process, and mapping the shared memory to the process space by other processes by using the same name;
According to the technical means, the embodiment of the specification stores the user state exception record in the target memory, and further sends the user state exception record in the target memory to the background, so that the exception handling capacity and efficiency of the self-adaptive platform of the automobile open system architecture are improved, and exception record information with rich and easily understood content can be provided for positioning in the future and solving the problem of system exception.
In an embodiment of the present disclosure, after the storing the first exception record in the first target memory, the method further includes:
acquiring an abnormal record in the first target memory at regular time through an abnormal monitoring thread and sending the abnormal record to a background;
in the embodiment of the present specification, the exception monitoring thread is a thread residing in a PHM process;
specifically, the abnormal record in the reserved memory and/or the shared memory is obtained at regular time through the abnormal monitoring thread in the PHM process and sent to the background;
according to the technical means, the user state exception record is sent to the background through the exception monitoring thread, so that the exception handling capacity and efficiency of the self-adaptive platform of the automobile open system architecture are improved, and exception record information with rich content and easy understanding can be provided for positioning in the future and solving the problem of system exception.
In an embodiment of the present specification, the method further includes:
acquiring second interrupt context information corresponding to the interrupt exception information under the condition that the exception type is kernel mode exception;
storing the second interrupt context information into a second target memory; the second target memory is a reserved memory of the kernel space, the reserved memory is a part of the physical memory space larger than a preset address, and the reserved memory is a volatile memory;
reading the second interrupt context information from the second target memory and generating a second exception record based on the second interrupt context information;
storing the second abnormal record into a third target memory; the third target memory is a nonvolatile memory;
in the embodiment of the present specification, the interrupt exception information may be an interrupt vector;
specifically, in the case that the exception type is a kernel mode exception, printing and collecting corresponding second interrupt context information based on an interrupt vector;
in the embodiment of the present specification, the second interrupt context information may be printed by a printk function;
in the embodiment of the present specification, the printk printed content has 8 priority levels, and the level numbers from 0 to 7 are respectively a deadline level (kern_emesg), a warning level (kern_alert), a critical level (kern_crit), an error level (kern_err), a warning level (kern_warn), an attention level (kern_notify), a notification level (kern_info), and a DEBUG level (kern_debug); since the printk printing of the kernel mode exception is of a deadline level, the collection of the second interrupt context information can be achieved by collecting the printk printing contents of the deadline level;
In the embodiment of the present disclosure, the storing of the second interrupt context information in the second target memory is continuous linearly, and the offset of the location where the second interrupt context information printed currently is stored from the start location may be recorded by using a global variable;
in this embodiment of the present disclosure, if the size of the second interrupt context information is greater than the size of the second target memory, printing the second interrupt context information by using a loop printing manner;
in the embodiment of the present disclosure, the mutual exclusion needs to be considered for the read-write operation of the second target memory;
in this embodiment of the present disclosure, after storing the second interrupt context information in the second target memory, the abnormal thread may be exited or the processor may be reset;
in this embodiment of the present disclosure, when the adaptive platform of the open system architecture of the automobile is started next time, the second interrupt context information stored in the second target memory during the last run is read;
in the embodiment of the present disclosure, the reserved memory of the kernel space is a part of the whole reserved memory;
in this embodiment of the present disclosure, the preset address may be 0xF8000000, that is, the reserved memory may be a portion of the physical memory space with an address greater than 0xF 8000000;
In the embodiment of the present disclosure, the feature of the reserved memory is that, under the condition of no power failure, the contents in the reserved memory space remain unchanged;
according to the technical means, in the embodiment of the specification, when kernel mode abnormality occurs in the self-adaptive platform of the automobile open system architecture, kernel mode interrupt context information is stored in the reserved memory of the kernel space, a corresponding kernel mode abnormality record is generated based on the kernel mode interrupt context information, and the kernel mode abnormality record is stored in the nonvolatile memory, so that the abnormality processing capacity and efficiency of the self-adaptive platform of the automobile open system architecture are improved.
In an embodiment of the present disclosure, before the reading the second interrupt context information from the second target memory and generating the second exception record based on the second interrupt context information, the method further includes:
acquiring the initial address and the size of the second target memory;
judging whether the content in the second target memory is valid or not according to the characteristic characters of the second target memory;
if yes, reading the second interrupt context information from the second target memory and generating the second abnormal record based on the second interrupt context information;
In the embodiment of the present disclosure, the function of the feature characters is to determine the validity of the data in the reserved memory, and if the feature characters are destroyed, it indicates that the data in the reserved memory is unreliable;
according to the technical means, the embodiment of the specification can judge whether the content in the reserved memory of the kernel space is valid or not according to the characteristic characters, and read the kernel-state interrupt context information from the reserved memory of the kernel space and generate the corresponding kernel-state exception record under the condition that the content in the reserved memory is valid, so that the accuracy and the reliability of the information in the kernel-state exception record are ensured.
As can be seen from the above embodiment of the exception handling method provided by the present invention, in the case of obtaining the interrupt exception information of the adaptive platform of the open system architecture of the automobile, the embodiment of the present invention determines an exception process and an exception type according to the interrupt exception information; under the condition that the abnormality type is user state abnormality, acquiring first interrupt context information corresponding to the interrupt abnormality information based on an abnormality signal processing function corresponding to the abnormal process; generating a first exception record based on the exception signal processing function and the first interrupt context information; and storing the first abnormal record into a first target memory. By utilizing the technical scheme provided by the embodiment of the specification, when the self-adaptive platform of the automobile open system architecture is abnormal, the abnormality records with rich content and easy understanding can be stored, so that the self-adaptive platform of the automobile open system architecture can capture and process the abnormality in the development, production and application stages, and the abnormality processing capacity and efficiency of the self-adaptive platform of the automobile open system architecture are improved.
The embodiment of the invention also provides an exception handling device, as shown in fig. 5, which is a schematic structural diagram of the exception handling device provided by the embodiment of the invention; specifically, the device comprises:
the anomaly type determining module 510 is configured to determine an anomaly process and an anomaly type according to the interruption anomaly information when the interruption anomaly information of the adaptive platform of the open system architecture of the automobile is obtained;
the first obtaining module 520 is configured to obtain, when the anomaly type is a user-state anomaly, first interrupt context information corresponding to the interrupt anomaly information based on an anomaly signal processing function corresponding to the anomaly process;
a first generation module 530 for generating a first exception record based on the exception signal processing function and the first interrupt context information;
the first storage module 540 is configured to store the first exception record in the first target memory.
In an embodiment of the present disclosure, the apparatus further includes:
the second acquisition module is used for acquiring second interrupt context information corresponding to the interrupt exception information under the condition that the exception type is kernel mode exception;
The second storage module is used for storing the second interrupt context information into a second target memory; the second target memory is a reserved memory of the kernel space, the reserved memory is a part of the physical memory space larger than a preset address, and the reserved memory is a volatile memory;
the second generation module is used for reading the second interrupt context information from the second target memory and generating a second abnormal record based on the second interrupt context information;
the third storage module is used for storing the second abnormal record into a third target memory; the third target memory is a nonvolatile memory.
In the embodiment of the present disclosure, the first generating module 530 includes:
the first processing unit is used for processing the first interrupt context information and the register information corresponding to the abnormal thread based on the abnormal signal processing function and releasing the semaphore to the abnormal daemon corresponding to the abnormal process;
the first generation unit is used for analyzing the semaphore through the abnormal daemon under the condition that the abnormal daemon acquires the semaphore, and generating the first abnormal record.
In the embodiment of the present disclosure, the first storage module 540 includes:
a first storage unit configured to store the first exception record in a reserved memory, in a case where the reserved memory is provided and a space of the reserved memory is sufficient; the reserved memory is a part of the physical memory space which is larger than a preset address, and the reserved memory is a volatile memory;
the second storage unit is used for storing the first abnormal record in the shared memory under the condition that the reserved memory space is insufficient; the shared memory is a part of physical memory space shared by processes in the self-adaptive platform of the automobile open system architecture, and the shared memory is volatile memory.
In an embodiment of the present disclosure, the apparatus further includes:
and the sending module is used for regularly acquiring the abnormal record in the first target memory through the abnormal monitoring thread and sending the abnormal record to the background.
In an embodiment of the present specification, the first generating unit includes:
the first acquisition subunit is used for acquiring stack contents of the abnormal threads, dynamic library information used by the abnormal processes and machine codes before and after the abnormal sentences;
the first analysis subunit is used for backtracking the function call chain corresponding to the abnormal thread;
A first generation subunit, configured to generate the first exception record based on the semaphore, the stack content, the dynamic library information, the machine code before and after the exception statement, and the function call chain;
the first judging subunit is used for judging whether the abnormal process has a corresponding abnormal exit legacy;
the first execution subunit is used for executing the abnormal exit legacy;
the first exit subunit is used for submitting the abnormality, exiting the abnormal process after delay and giving an abnormal exit code to the abnormal process;
the second acquisition subunit is used for acquiring the data stored in the stack pointer register, the stack frame pointer register, the connection register and the program counter of the abnormal thread;
the second analysis subunit is used for obtaining the address of the abnormal thread stack frame according to the data stored in the stack pointer register, the stack frame pointer register, the connection register and the program counter;
the first query subunit is used for obtaining corresponding function names through querying a symbol table according to the address of the abnormal thread stack frame and determining the calling relation among functions;
and the function call chain determining subunit is used for determining the function call chain corresponding to the abnormal thread based on the call relation among the functions.
In an embodiment of the present disclosure, the apparatus further includes:
the third acquisition module is used for acquiring the starting address and the size of the second target memory;
and the first judging module is used for judging whether the content in the second target memory is valid or not according to the characteristic characters of the second target memory.
The embodiment of the invention also provides electronic equipment, which comprises a processor and a memory; the memory stores one or more instructions adapted to be loaded and executed by the processor to implement the exception handling method described in the above method embodiments.
The memory may be used to store software programs and modules that the processor executes to perform various functional applications and data processing by executing the software programs and modules stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for functions, and the like; the storage data area may store data created according to the use of the device, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide access to the memory by the processor.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the internal structure of the electronic device may include, but is not limited to: processor 601, memory 602, and communication interface 603, wherein processor 601, memory 602, and communication interface 603 within the electronic device may be connected by a bus or other means, such as by a bus connection in fig. 6 shown in the present embodiment of the invention.
The processor 601 (or CPU (Central Processing Unit, central processing unit)) is a computing core and a control core of the electronic device. A communication interface 603 for communication between the memory 602 and the processor 601. A Memory 602 (Memory) for storing programs and data. It will be appreciated that the memory herein may be a high speed RAM memory device or a non-volatile memory device, such as at least one magnetic disk memory device; optionally, at least one memory device located remotely from the processor. The memory provides a storage space that stores an operating system of the electronic device, which may include, but is not limited to: windows system (an operating system), linux system (an operating system), etc., which is not limiting in this regard; also stored in the memory space is a computer program (including program code) adapted to be loaded and executed by the processor. In the present embodiment, the processor 601 loads and executes a computer program stored in the memory 602 to implement the exception handling method provided in the above method embodiment.
The embodiment of the invention also provides a computer readable storage medium, which can be arranged in the electronic device to store at least one instruction, at least one section of program, code set or instruction set related to an exception handling method in the method embodiment, and the at least one instruction, the at least one section of program, the code set or instruction set can be loaded and executed by a processor of the electronic device to implement the exception handling method provided in the method embodiment.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that: the foregoing sequence of embodiments of the present invention is for illustration only and does not represent the advantages or disadvantages of the embodiments, and the foregoing description of specific embodiments of the present invention is intended to be within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. Furthermore, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the device and server embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and references to the parts of the description of the method embodiments are only required.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk, an optical disk, or the like.
The above disclosure is only a preferred embodiment of the present invention, and it is needless to say that the scope of the invention is not limited thereto, and therefore, the equivalent changes according to the claims of the present invention still fall within the scope of the present invention.

Claims (12)

1. An exception handling method, applied to an automotive open system architecture adaptive platform, comprising:
Under the condition that interrupt abnormality information of the self-adaptive platform of the automobile open system architecture is obtained, determining an abnormality process and an abnormality type according to the interrupt abnormality information;
under the condition that the abnormality type is user state abnormality, acquiring first interrupt context information corresponding to the interrupt abnormality information based on an abnormality signal processing function corresponding to the abnormal process;
generating a first exception record based on the exception signal processing function and the first interrupt context information;
and storing the first abnormal record into a first target memory.
2. The exception handling method according to claim 1, wherein the method further comprises:
acquiring second interrupt context information corresponding to the interrupt exception information under the condition that the exception type is kernel mode exception;
storing the second interrupt context information into a second target memory; the second target memory is a reserved memory of the kernel space, the reserved memory is a part of the physical memory space larger than a preset address, and the reserved memory is a volatile memory;
reading the second interrupt context information from the second target memory and generating a second exception record based on the second interrupt context information;
Storing the second abnormal record into a third target memory; the third target memory is a nonvolatile memory.
3. The exception handling method of claim 1, wherein the generating a first exception record based on the exception signal processing function and the first interrupt context information comprises:
processing the first interrupt context information and the register information corresponding to the abnormal thread based on the abnormal signal processing function, and releasing semaphore to the abnormal daemon corresponding to the abnormal process;
and under the condition that the abnormal daemon thread acquires the semaphore, analyzing the semaphore by the abnormal daemon thread to generate the first abnormal record.
4. The exception handling method of claim 1, wherein storing the first exception record in a first target memory comprises:
storing the first exception record in a reserved memory if the reserved memory is provided and the reserved memory space is sufficient; the reserved memory is a part of the physical memory space which is larger than a preset address, and the reserved memory is a volatile memory;
Storing the first exception record in a shared memory under the condition that the reserved memory space is insufficient; the shared memory is a part of physical memory space shared by processes in the self-adaptive platform of the automobile open system architecture, and the shared memory is volatile memory.
5. The exception handling method of claim 1, wherein after storing the first exception record in the first target memory, the method further comprises:
and acquiring the abnormal record in the first target memory at regular time through an abnormal monitoring thread and sending the abnormal record to the background.
6. The exception handling method of claim 3, wherein the generating the first exception record by analyzing the semaphore by the exception daemon if the semaphore is acquired by the exception daemon comprises:
acquiring stack content of the abnormal thread, dynamic library information used by the abnormal process and machine codes before and after an abnormal statement;
backtracking a function call chain corresponding to the abnormal thread;
and generating the first exception record based on the semaphore, the stack content, the dynamic library information, the machine code before and after the exception statement and the function call chain.
7. The exception handling method of claim 6, wherein after generating the first exception record based on the semaphore, the stack contents, the dynamic library information, the machine code before and after the exception statement, and the function call chain, the method further comprises:
judging whether the abnormal process has a corresponding abnormal exit legacy or not;
if yes, executing the abnormal exit legacy;
otherwise, submitting the exception, exiting the exception process after delay and giving an exception exit code to the exception process.
8. The exception handling method according to claim 6, wherein the backtracking the function call chain corresponding to the exception thread comprises:
acquiring data stored in a stack pointer register, a stack frame pointer register, a connection register and a program counter of the abnormal thread;
obtaining the address of the abnormal thread stack frame according to the data stored in the stack pointer register, the stack frame pointer register, the connection register and the program counter;
obtaining corresponding function names by inquiring a symbol table according to the addresses of the abnormal thread stack frames, and determining the calling relation among functions;
And determining a function call chain corresponding to the abnormal thread based on the call relation among the functions.
9. The exception handling method of claim 2, wherein prior to reading the second interrupt context information from the second target memory and generating a second exception record based on the second interrupt context information, the method further comprises:
acquiring the initial address and the size of the second target memory;
judging whether the content in the second target memory is valid or not according to the characteristic characters of the second target memory;
if yes, the second interrupt context information is read from the second target memory, and the second abnormal record is generated based on the second interrupt context information.
10. An abnormality processing apparatus, comprising:
the abnormality type determining module is used for determining an abnormality process and an abnormality type according to the interrupt abnormality information under the condition that the interrupt abnormality information of the self-adaptive platform of the automobile open system architecture is acquired;
the first acquisition module is used for acquiring first interrupt context information corresponding to the interrupt exception information based on an exception signal processing function corresponding to the exception process under the condition that the exception type is user state exception;
A first generation module for generating a first exception record based on the exception signal processing function and the first interrupt context information;
and the first storage module is used for storing the first abnormal record into a first target memory.
11. An electronic device comprising a processor and a memory, wherein the memory has stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by the processor to implement the exception handling method of any one of claims 1-9.
12. A computer readable storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by a processor to implement the exception handling method of any one of claims 1 to 9.
CN202311441776.2A 2023-10-31 2023-10-31 Abnormality processing method and device, electronic equipment and storage medium Pending CN117591322A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311441776.2A CN117591322A (en) 2023-10-31 2023-10-31 Abnormality processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311441776.2A CN117591322A (en) 2023-10-31 2023-10-31 Abnormality processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117591322A true CN117591322A (en) 2024-02-23

Family

ID=89910593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311441776.2A Pending CN117591322A (en) 2023-10-31 2023-10-31 Abnormality processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117591322A (en)

Similar Documents

Publication Publication Date Title
US6959262B2 (en) Diagnostic monitor for use with an operating system and methods therefor
US20080320336A1 (en) System and Method of Client Side Analysis for Identifying Failing RAM After a User Mode or Kernel Mode Exception
US20090172664A1 (en) Adding a profiling agent to a virtual machine to permit performance and memory consumption analysis within unit tests
US20040153635A1 (en) Privileged-based qualification of branch trace store data
US7631224B2 (en) Program, method, and mechanism for taking panic dump
JP2008513900A (en) Method for processing a computer program on a computer system
CN103034577B (en) A kind ofly locate shutdown slow method and device
US20080133975A1 (en) Method for Running a Computer Program on a Computer System
CN115935631A (en) Test system and method for vehicle equipment and storage medium
CN114817187A (en) Log processing method and device
CN116795576A (en) Log printing-based device driver debugging method and device and electronic device
CN110764962A (en) Log processing method and device
CN116450398A (en) Exception backtracking method, device, equipment and medium
CN117591322A (en) Abnormality processing method and device, electronic equipment and storage medium
CN115543759A (en) Log lookup method and device for operating system, electronic device and storage medium
JP2005332030A (en) Controller
JP2007172414A (en) Compact core dump program for built-in equipment and method using compact core dump
CN113590133A (en) Android system injection detection method, device, equipment and computer storage medium
JP4125054B2 (en) Log acquisition method
CN114416413A (en) Serial port storage system and method for operating system crash
CN115061936A (en) Preprocessing method and debugging method of software program
CN116860546A (en) Log storage method, vehicle-mounted equipment, storage medium and chip
JP2006172204A (en) Information processor, information processing method, computer program and storage medium
JPH096709A (en) Method for controlling electronic device with extension slot, and its device and extension medium
CN111651321A (en) Method, device, storage medium and computer equipment for analyzing system event record

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