Fault tracing method and device for service system assertion failure event

By obtaining the target data of assertion failure events, determining the assertion failure variable name and function signature, and automatically locating the stub file that causes the assertion failure, the high cost and easy omission problems of assertion failure events in large business systems are solved, and efficient and accurate fault tracing is achieved.

CN120743607AActive Publication Date: 2025-10-03LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202511222127.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-10-03
Estimated Expiration
2045-08-29

AI Technical Summary

Technical Problem

In large-scale distributed storage and network communication business systems, fault tracing of assertion failure events has the problems of high debugging cost, easy omission and difficulty in automation. Existing positioning methods are inefficient and highly complex.

Method used

By obtaining the target data of the assertion failure event, determining the assertion failure variable name, function name and function signature string, splitting and extracting the parameter name, traversing the source code directory to match files, and filtering out the stub file that caused the assertion failure, automatic fault tracing is achieved.

Benefits of technology

It improves the efficiency and accuracy of fault tracing, reduces debugging costs and complexity, shortens fault location time, and improves system reliability and maintenance efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743607A_ABST
    Figure CN120743607A_ABST
Patent Text Reader

Abstract

The invention discloses a fault tracing method and device for an assertion failure event of a service system, and relates to the technical field of computers, and the method comprises the steps: obtaining target data of the assertion failure event generated during the operation of a target service system, determining an assertion failure variable name, a function name to which the assertion failure event belongs and a signature character string of the function to which the assertion failure event belongs based on the target data; splitting and extracting the function signature character string to which the assertion failure event belongs to obtain a parameter name, and determining a formal parameter serial number corresponding to the assertion failure variable name; traversing a target file in a source code root directory in the target service system to match the target file with a function name to which the assertion failure event belongs to obtain a line text; and based on the line text, the parameter name and the formal parameter serial number, the target stub file triggering the assertion failure event is screened out from the stub file directory of the target service system, so that the problems of high debugging cost and easy omission are solved, the fault tracing efficiency and accuracy are improved, and the fault tracing complexity is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for tracing a fault source of an assertion failure event in a business system. Background Art

[0002] In large-scale distributed storage, network communications, and other business systems, modular design is employed, with common modules compiled and tailored separately, or some interfaces stubbed or faked in test environments. Due to the millions of lines of code involved and the complex call relationships between common modules and business modules, assertion failures often occur during runtime when business modules are compiled or tested, often due to stub implementations returning NULL or other invalid values. Current methods for locating these issues include manual code searches and grep (globally search for a regular expression and print, a text search tool) / addr2line-assisted locating. This method relies on extensive experience and manual work. In projects with frequent iterations and large code volumes, manual scripts require constant adjustments and high maintenance costs. The other method uses dynamic debuggers and breakpoint tracking. However, in modular, tailored, stub-driven unit environments, this method often lacks complete initialization, dependent services, and test data, resulting in the inability to launch a usable running instance. Even if it does work, it requires manual setting of complex conditional breakpoints before and after assertions and repeated replication of the error scenario, resulting in low efficiency and difficulty in automation.

[0003] It can be seen that how to achieve automatic fault tracing when an assertion failure event is triggered, solve the problems of high debugging costs and easy omissions, improve the efficiency and accuracy of fault tracing, and reduce the complexity of fault tracing are problems that technical personnel in this field need to solve. Summary of the Invention

[0004] The purpose of the embodiments of the present invention is to provide a fault tracing method and device for assertion failure events in business systems. This method can automatically trace the fault source when an assertion failure event occurs, solving the problems of high debugging costs and easy omissions, improving the efficiency and accuracy of fault tracing, and reducing the complexity of fault tracing. The specific solution is as follows: In a first aspect, the present application discloses a fault tracing method for a business system assertion failure event, comprising: Obtain target data of assertion failure events that occur during the operation of the target business system, and determine the assertion failure variable name, the function name to which the assertion failure event belongs, and the function signature string based on the target data; the target data includes the source file path, source file, and line number corresponding to the assertion failure event; Split and extract the function signature string of the assertion failure event to obtain the parameter name, and determine the parameter sequence number corresponding to the assertion failure variable name from the parameter list; Traverse the target files in the source code root directory of the target business system to match the target files with the function names of the assertion failure events to obtain line texts; the target files include source code files and header files; Based on the line text, parameter name and formal parameter sequence number, the target stub file that triggers the assertion failure event is filtered out from the stub file directory of the target business system.

[0005] In a second aspect, the present application discloses an electronic device, comprising: memory for storing computer programs; The processor is configured to implement the steps of the aforementioned method for tracing the source of a fault in a business system assertion failure event when executing a computer program.

[0006] In a third aspect, the present application discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the aforementioned fault tracing method for business system assertion failure events are implemented.

[0007] It can be seen that the present application provides a fault tracing method for assertion failure events in a business system, including obtaining target data of assertion failure events that occur during the operation of a target business system, and determining the assertion failure variable name, the function name to which the assertion failure event belongs, and the function signature string to which it belongs based on the target data; the target data includes the source file path, source file, and line number corresponding to the assertion failure event; the function signature string to which the assertion failure event belongs is split and extracted to obtain the parameter name, and the parameter sequence number corresponding to the assertion failure variable name is determined from the parameter list; the target files in the source code root directory in the target business system are traversed to match the target file with the function name to which the assertion failure event belongs to obtain line text; the target file includes a source code file and a header file; based on the line text, parameter name, and parameter sequence number, the target stub file that triggers the assertion failure event is screened out from the stub file directory of the target business system. This application is aimed at the problems of difficulty in locating the offending stub file, high debugging cost, and easy omission in large-scale tailored C / C++ projects when assertions fail at runtime due to stubbing or simulation modules returning null pointers or other illegal values. The application obtains the target data of assertion failure events that occur during the operation of the target business system, and determines the assertion failure variable name, the function name to which the assertion failure event belongs, and the function signature string based on the target data. It can achieve accurate extraction and matching, improve the accuracy of fault tracing, split and extract the function signature string to which the assertion failure event belongs, obtain the parameter name, and determine the parameter sequence corresponding to the assertion failure variable name. Number, traverse the target files in the source code root directory of the target business system to match the target files with the function name to which the assertion failure event belongs, obtain line text, reduce manual troubleshooting time and cost, accurately match the target files and the function names to solve the problems of high debugging costs and easy omissions, and based on line text, parameter names and formal parameter sequence numbers, filter out the target stub files that cause assertion failure events from the stub file directory of the target business system to achieve automatic fault tracing, improve fault tracing efficiency and accuracy, reduce the complexity of fault tracing, and reduce the time and error rate of developers locating stub files that cause assertion failures in tailored projects. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0009] Figure 1 This is a flow chart of a fault tracing method for business system assertion failure events disclosed in this application; Figure 2 This is a specific flow chart of needle fault tracing disclosed in this application; Figure 3 This is a schematic diagram of the structure of a fault tracing device for business system assertion failure events disclosed in this application. DETAILED DESCRIPTION

[0010] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0011] In large-scale distributed storage, network communications, and other business systems, modular design is employed, with common modules compiled and tailored separately, or some interfaces stubbed or faked in test environments. Due to the millions of lines of code involved and the complex call relationships between common modules and business modules, assertion failures often occur during runtime when business modules are compiled or tested, often due to stub implementations returning NULL or other invalid values. Current methods for locating these issues include manual code searches and grep / addr2line-assisted locating. This method relies on extensive experience and manual work. In projects with frequent iterations and large code volumes, manual scripts require constant adjustments and high maintenance costs. The other method uses a dynamic debugger and breakpoint tracking. However, in modular, tailored, stub-driven unit environments, this method often lacks complete initialization, dependent services, and test data, resulting in the inability to launch a usable running instance. Even if it does work, it requires manual setting of complex conditional breakpoints before and after assertions and repeated replication of the error scenario, resulting in low efficiency and difficulty in automation. It can be seen that how to achieve automatic fault tracing when an assertion failure event is triggered, solve the problems of high debugging costs and easy omissions, improve the efficiency and accuracy of fault tracing, and reduce the complexity of fault tracing are problems that technical personnel in this field need to solve.

[0012] See also Figure 1 As shown, an embodiment of the present invention discloses a fault tracing method for a business system assertion failure event, which may specifically include: Step S11: Obtain target data of an assertion failure event that occurs during the operation of the target business system, and determine the assertion failure variable name, the function name to which the assertion failure event belongs, and the function signature string based on the target data; the target data includes the source file path, source file, and line number corresponding to the assertion failure event.

[0013] In this embodiment, the process of determining the assertion failure variable name includes: determining the source file path and line number of the assertion failure event from the assertion failure log during the operation of the target business system; using a preset script and based on the source file path and line number, reading and regular matching the source file to extract the assertion failure variable name.

[0014] Among them, the source file reading and regular matching process includes: using a preset script and based on the source file path and line number, reading the source file and regular matching, and judging whether the regular matching is successful; if the regular matching is successful, extracting the assertion failure variable name; if the regular matching fails, generating an error message and returning the error message to the client.

[0015] For example, the source file path and line number aaa / bbb / baz.c:192 of the assertion failure event are read, and the corresponding source file line 192 is read. The regular expression matching format is as follows: xx_assert(_with_trace\d*)?\(\s*NULL\s*!=\s* <var>\); Will <var>Extract the variable name for the assertion failure.

[0016] In addition, for preset scripts, it also includes: real-time health detection and version detection of the preset scripts; if the health detection is abnormal, the health detection result of the preset script is fed back to the client; if the version detection is abnormal, the version detection result of the preset script is fed back to the client.

[0017] In this embodiment, the process of determining the function name and function signature string to which an assertion failure event belongs includes: using line numbers to determine the assertion line from the source file of the assertion failure event; scanning the assertion line according to a preset direction and performing compound regular distribution matching to determine the function name and function signature string to which the assertion failure event belongs.

[0018] For example, if the preset direction is upward, scan upward from the assertion line and use the compound regular step-by-step matching function to match the signature line, the form is as follows: <return type> <function name>(<parameter list>); It can be spliced ​​across multiple lines, and then the following curly braces are matched to confirm the function name, complete signature, and signature string of the function to which the assertion failed event belongs.

[0019] This application automatically identifies assertion failure statements in logs or source code, such as xx_assert(NULL != X), and accurately extracts the name of the variable that failed the assertion. It also scans the source code upward to locate the definition of the corresponding function, supporting complex declarations, multi-line signatures, and function prototypes modified with __attribute__ and other modifiers.

[0020] Step S12: Split and extract the function signature string to which the assertion failure event belongs to obtain parameter names, and determine the parameter sequence number corresponding to the assertion failure variable name from the parameter list.

[0021] In this embodiment, a preset splitting symbol is used to split the parameter list in the function signature string to which the assertion failure event belongs, and the last identifier of each segment is extracted; the last identifier is used as the parameter name; it is determined whether there is a parameter sequence number corresponding to the assertion failure variable name in the parameter list; if there is a parameter sequence number corresponding to the assertion failure variable name in the parameter list, the corresponding parameter sequence number is determined from the parameter list; if there is no parameter sequence number corresponding to the assertion failure variable name in the parameter list, an error message is generated and returned to the client.

[0022] For example, the preset splitting symbol is a comma, the parameter list in the function signature string is split by the comma, the last identifier of each segment is extracted as the parameter name, and the corresponding parameter sequence number idx is determined from the parameter list.

[0023] This application parses the function signature string, automatically splits the parameter list, and calculates the exact index of the asserted variable within the function parameter sequence. It supports extracting parameters such as pointers, function calls, type aliases, and parameters with * or compound types. This enables automated location and reduces manual troubleshooting costs: By automatically extracting and splitting the assertion context, it can locate NULL return stubs in seconds, replacing traditional manual reading of call stacks, Doxygen graphs, or file-by-file grep searches, significantly reducing troubleshooting time and labor costs.

[0024] Step S13: traverse the target files in the source code root directory of the target business system to match the target files with the function names to which the assertion failure events belong to, so as to obtain line texts; the target files include source code files and header files.

[0025] In this embodiment, all .c / .h files (i.e., target files) in the source code root directory are recursively traversed, the function names are roughly matched, including fragments, and the location of each call (file, line number, and call line text) is recorded to obtain the line text.

[0026] Step S14: based on the line text, parameter name and formal parameter sequence number, the target stub file that triggers the assertion failure event is screened out from the stub file directory of the target business system.

[0027] In this embodiment, the target actual parameter expression is parsed from the line text using the formal parameter sequence number, and the target actual parameter expression is used as a keyword; based on the parameter name and the keyword, the target stub file that triggers the assertion failure event is screened from the stub file directory of the target business system.

[0028] The process of screening target stub files that trigger an assertion failure event includes: judging whether there is a stub file containing a null pointer return in a stub file directory based on a parameter name and a keyword; if there is a stub file containing a null pointer return in the stub file directory, taking the stub file containing the null pointer return as a target stub file that triggers the assertion failure event, and generating a target stub file list; if there is no stub file containing a null pointer return in the stub file directory, generating information for indicating that there is no stub file containing a null pointer return; and printing and sending the information for indicating that there is no stub file containing a null pointer return to a client.

[0029] Specifically, the idxth target argument expression is parsed from the line text. The target argument expression supports cross-line splitting, function call stripping, pointer asterisk stripping, etc. The target argument expression or its type is used as a keyword to recursively search for target stub files containing return NULL, return 0, or return FALSE in the Stub directory (i.e., the stub file directory). The target stub file list including a list of suspicious paths is output.

[0030] This application accurately matches the target file and its function name, and combines it with the implementation path search in the Stub directory, with a positioning accuracy of over 97%. If an assertion fails, only one script execution is required to generate a complete list of suspicious Stubs and a report, significantly shortening fault recovery time and improving the reliability of high-availability storage systems.

[0031] This application uses a set of Python / Shell hybrid scripts as a carrier to implement the specific process of fault tracing for business system assertion failure events. Figure 2 As shown, this script can quickly locate problematic stubs and accelerate troubleshooting without modifying the source code: First, it locates AutoDep_AddStep (module.c:285) in the assertion failure log. The script automatically extracts the assertion variable inputCtx. It then scans upward to determine the corresponding function signature, void AutoDep_AddStep(StepHandle *handle, StepHandle *inputCtx), and calculates inputCtx as the second parameter. Next, it recursively searches the entire source code root directory, finding 154 instances of this function call. The script then extracts the second argument expression from each call and precisely matches implementation paths containing return NULL within the stub directory, such as public_stubs / dep_manager_stub.c, to obtain the target stub file. The entire process completes within 12 seconds, with 97% accuracy, significantly reducing the average time from logging to locating the problem from four hours to less than one minute.

[0032] This application can form a closed-loop detection system of assertion context collection - function signature analysis - call site retrieval - stub comparison - report generation. The stubs of each subsystem and common module in the closed-loop detection system can be continuously monitored and verified. When a new assertion error occurs, only one script needs to be executed to output a list of all suspicious stubs and generate a location report. It can automatically recommend a priority list based on call statistics and stub matching results. Users can review and confirm the location results in the interactive interface. It can also perform health monitoring and version updates on the script to ensure that the system can maintain efficient and accurate stub location capabilities under different code versions and compilation environments.

[0033] The present invention can simultaneously scan the source code and stubs of multiple subsystems and public modules to achieve unified monitoring of stubbing functions at all levels; when new assertions or stubs are added to public modules or business subsystems, they can be automatically incorporated into the positioning process without additional configuration, greatly improving maintenance and upgrade efficiency.

[0034] In addition, this closed-loop detection system can be seamlessly integrated with existing CI / CD (continuous integration / continuous delivery) pipelines and also supports command-line interaction and visual reporting. In the future, more assertion types (such as range checks, boundary checks, etc.) and multi-language support (C, C++, Go, etc.) can be connected through the plug-in mechanism to further expand automated positioning and troubleshooting capabilities.

[0035] In addition, when obtaining target data and determining the variable name, function name, and function signature string of the assertion failure, you can also introduce runtime monitoring tool integration, such as GDB for C / C++ or pdb for Python, to automatically capture the call stack when the assertion is triggered to enhance data accuracy. For example, use the backtrace() function to obtain complete stack information to avoid relying solely on line numbers. Moreover, if the assertion expression is complex and involves multiple variables or nested calls, you can use AST (Abstract Syntax Tree) to extract the exact variable name from the assertion line number. You can also handle edge cases: if the variable name is a macro, you need to expand the macro and trace the original variable. You can add a preprocessing step and use compiler flags to expand the source file. You can also use variable scope verification: ensure that the variable name belongs to the function local variable or parameter, not the global variable. If it is a non-parameter variable, the solution can be expanded to analyze the local variable table.

[0036] In this embodiment, target data of an assertion failure event occurring during operation of a target business system is obtained, and based on the target data, the assertion failure variable name, the function name to which the assertion failure event belongs, and the function signature string to which the assertion failure event belongs are determined; the target data includes the source file path, source file, and line number corresponding to the assertion failure event; the function signature string to which the assertion failure event belongs is split and extracted to obtain parameter names, and the parameter sequence number corresponding to the assertion failure variable name is determined from the parameter list; the target files in the source code root directory of the target business system are traversed to match the target files with the function name to which the assertion failure event belongs to obtain line text; the target files include source code files and header files; based on the line text, parameter names, and parameter sequence numbers, the target stub file that triggers the assertion failure event is screened out from the stub file directory of the target business system. This application is aimed at the problems of difficulty in locating the offending stub file, high debugging cost, and easy omission in large-scale tailored C / C++ projects when assertions fail at runtime due to stubbing or simulation modules returning null pointers or other illegal values. The application obtains the target data of assertion failure events that occur during the operation of the target business system, and determines the assertion failure variable name, the function name to which the assertion failure event belongs, and the function signature string based on the target data. It can achieve accurate extraction and matching, improve the accuracy of fault tracing, split and extract the function signature string to which the assertion failure event belongs, obtain the parameter name, and determine the parameter sequence corresponding to the assertion failure variable name. Number, traverse the target files in the source code root directory of the target business system to match the target files with the function name to which the assertion failure event belongs, obtain line text, reduce manual troubleshooting time and cost, accurately match the target files and the function names to solve the problems of high debugging costs and easy omissions, and based on line text, parameter names and formal parameter sequence numbers, filter out the target stub files that cause assertion failure events from the stub file directory of the target business system to achieve automatic fault tracing, improve fault tracing efficiency and accuracy, reduce the complexity of fault tracing, and reduce the time and error rate of developers locating stub files that cause assertion failures in tailored projects.

[0037] See also Figure 3 As shown, an embodiment of the present invention discloses a fault tracing device for a business system assertion failure event, which may specifically include: The variable name and function name determination module 11 is used to obtain the target data of the assertion failure event that occurs during the operation of the target business system, and determine the assertion failure variable name, the function name to which the assertion failure event belongs, and the function signature string based on the target data; the target data includes the source file path, source file, and line number corresponding to the assertion failure event; The splitting and extraction module 12 is used to split and extract the function signature string to which the assertion failure event belongs to obtain the parameter name, and determine the parameter sequence number corresponding to the assertion failure variable name from the parameter list; The matching module 13 is used to traverse the target files in the source code root directory of the target business system to match the target files with the function names to which the assertion failure events belong to, so as to obtain line texts; the target files include source code files and header files; The screening module 14 is used to screen out the target stub files that trigger the assertion failure event from the stub file directory of the target business system based on the line text, parameter name and formal parameter sequence number.

[0038] In some specific embodiments, the variable name and function name determination module 11 may specifically include: A source file path and line number determination module is used to determine the source file path and line number of the assertion failure event from the assertion failure log during the operation of the target business system; The file reading and regular expression matching module is used to use a preset script to read and perform regular expression matching on the source file based on the source file path and line number to extract the assertion failure variable name.

[0039] In some specific embodiments, the variable name and function name determination module 11 may specifically include: The regular expression matching judgment module is used to read and match the source file based on the source file path and line number using a preset script, and to determine whether the regular expression matching is successful; The assertion failure variable name extraction module is used to extract the assertion failure variable name if the regular expression matches successfully; The first error message generating module is used to generate an error message if the regular expression matching fails, and return the error message to the client.

[0040] In some specific embodiments, the splitting and extracting module 12 may specifically include: The formal parameter number judgment module is used to judge whether there is a formal parameter number corresponding to the assertion failure variable name in the formal parameter list; A formal parameter sequence number determination module is used to determine the corresponding formal parameter sequence number from the formal parameter list if there is a formal parameter sequence number corresponding to the assertion failure variable name in the formal parameter list; The second error information generating module is used to generate an error message if the parameter sequence number corresponding to the assertion failure variable name does not exist in the parameter list, and return the error message to the client.

[0041] In some specific embodiments, the fault tracing device for a business system assertion failure event may further include: Real-time health detection and version detection module, used to perform real-time health detection and version detection on preset scripts; The health check result feedback module is used to feed back the health check result of the preset script to the client if the health check is abnormal; The version detection result feedback module is used to feed back the version detection result of the preset script to the client if the version detection is abnormal.

[0042] In some specific embodiments, the variable name and function name determination module 11 may specifically include: An assertion line determination module, configured to determine an assertion line from a source file of an assertion failure event using a line number; The scanning and compound regular distribution matching module is used to scan and match the assertion lines according to the preset direction to determine the function name and function signature string to which the assertion failure event belongs.

[0043] In some specific embodiments, the splitting and extracting module 12 may specifically include: A splitting module is used to split the parameter list in the function signature string to which the assertion failure event belongs using a preset splitting symbol and extract the last identifier of each segment; The parameter name determination module is used to use the last identifier as the parameter name.

[0044] In some specific embodiments, the screening module 14 may specifically include: The target actual parameter expression parsing module is used to parse the target actual parameter expression from the line text using the formal parameter sequence number and use the target actual parameter expression as a keyword; The target stub file screening module is used to screen out the target stub files that trigger assertion failure events from the stub file directory of the target business system based on parameter names and keywords.

[0045] In some specific embodiments, the screening module 14 may specifically include: The stub file judgment module is used to judge whether there is a stub file containing a null pointer returned in the stub file directory based on the parameter name and keyword; The target stub file list generation module is used to use the stub file containing the returned null pointer as the target stub file that triggers the assertion failure event if there is a stub file containing the returned null pointer in the stub file directory, and generate a target stub file list.

[0046] In some specific embodiments, the screening module 14 may specifically include: A first information generating module is configured to generate information indicating that there is no stub file containing a null pointer return if there is no stub file containing a null pointer return in the stub file directory; The second information generating module is configured to print and send to the client information indicating that there is no stub file containing a returned null pointer.

[0047] Among them, the description of the features in the embodiment corresponding to the fault tracing device for business system assertion failure events can be found in the relevant description of the embodiment corresponding to the fault tracing method for business system assertion failure events, and will not be repeated here.

[0048] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned fault tracing method embodiments for business system assertion failure events.

[0049] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned fault tracing method embodiments for business system assertion failure events when running.

[0050] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0051] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0052] The above is a detailed introduction to the fault tracing method and device for business system assertion failure events provided by this application. This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only applicable to help understand the method of this application and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.< / var> < / var>

Claims

1. A fault tracing method for assertion failure events in a business system, characterized in that: include: Obtain target data of an assertion failure event that occurs during the operation of a target business system, and determine, based on the target data, the name of the assertion failure variable, the name of the function to which the assertion failure event belongs, and the signature string of the function to which it belongs; the target data includes the source file path, source file, and line number corresponding to the assertion failure event; Split and extract the function signature string to which the assertion failure event belongs to obtain parameter names, and determine the formal parameter sequence number corresponding to the assertion failure variable name from the formal parameter list; Traversing the target files in the source code root directory of the target business system to match the target files with the function name to which the assertion failure event belongs to obtain line text; the target files include source code files and header files; Based on the line text, the parameter name, and the formal parameter sequence number, a target stub file that triggers the assertion failure event is screened out from the stub file directory of the target business system.

2. The fault tracing method for a business system assertion failure event according to claim 1, characterized in that: The process of determining the variable name for an assertion failure includes: Determining the source file path and line number of the assertion failure event from the assertion failure log during the operation of the target business system; Using a preset script and based on the source file path and line number, the source file is read and regular expression matched to extract the assertion-failed variable name.

3. The fault tracing method for a business system assertion failure event according to claim 2, characterized in that: The method uses a preset script to read and perform regular expression matching on the source file based on the source file path and line number to extract the assertion-failed variable name, including: Using a preset script and based on the source file path and line number, the source file is read and regular matched, and whether the regular match is successful is determined; If the regular expression matches successfully, the variable name where the assertion failed is extracted; If the regular expression fails to match, an error message is generated and returned to the client; Accordingly, determining the parameter sequence number corresponding to the assertion-failed variable name from the parameter list includes: Determine whether there is a parameter number corresponding to the assertion failure variable name in the parameter list; If there is a parameter number corresponding to the assertion-failed variable name in the parameter list, then determine the corresponding parameter number from the parameter list; If the parameter sequence number corresponding to the assertion failure variable name does not exist in the parameter list, an error message is generated and returned to the client.

4. The fault tracing method for a business system assertion failure event according to claim 3, characterized in that: Also includes: Perform real-time health detection and version detection on the preset script; If the health check is abnormal, the health check result of the preset script is fed back to the client; If the version detection is abnormal, the version detection result of the preset script is fed back to the client.

5. The fault tracing method for a business system assertion failure event according to claim 1, characterized in that: The process of determining the function name and function signature string to which the assertion failure event belongs includes: Determining the assertion line from the source file of the assertion failure event using the line number; The assertion line is scanned and matched with a compound regular distribution according to a preset direction to determine the function name and function signature string to which the assertion failure event belongs.

6. The fault tracing method for a business system assertion failure event according to claim 1, characterized in that: The function signature string to which the assertion failure event belongs is split and extracted to obtain parameter names, including: Using a preset splitting symbol, split the parameter list in the function signature string to which the assertion failure event belongs, and extract the last identifier of each segment; The last identifier is used as the parameter name.

7. The fault tracing method for a business system assertion failure event according to any one of claims 1 to 6, characterized in that: The step of screening out the target stub file that triggers the assertion failure event from the stub file directory of the target business system based on the line text, the parameter name, and the formal parameter sequence number includes: parse the target actual parameter expression from the line text using the formal parameter sequence number, and use the target actual parameter expression as a keyword; Based on the parameter name and the keyword, a target stub file that triggers the assertion failure event is screened out from the stub file directory of the target business system.

8. The fault tracing method for a business system assertion failure event according to claim 7, characterized in that: The step of screening out the target stub file that triggers the assertion failure event from the stub file directory of the target business system based on the parameter name and the keyword includes: Based on the parameter name and the keyword, determining whether there is a pile file containing a return null pointer in the pile file directory; If there is a stub file containing a null pointer return in the stub file directory, the stub file containing the null pointer return is used as the target stub file for triggering the assertion failure event, and a target stub file list is generated.

9. The fault tracing method for a business system assertion failure event according to claim 8, characterized in that: After determining whether there is a stub file containing a null pointer returned in the stub file directory based on the parameter name and the keyword, the method further includes: If there is no stub file containing a null pointer return in the stub file directory, information indicating that there is no stub file containing a null pointer return is generated; Prints information indicating that there is no stub file containing a null pointer return value and sends it to the client.

10. An electronic device, characterized in that: include: memory for storing computer programs; A processor is configured to implement the steps of the fault tracing method for a business system assertion failure event as described in any one of claims 1 to 9 when executing the computer program.

Citation Information

Patent Citations

  • Automatic unit test realizing method and device

    CN104407973A

  • Embedded device firmware patch detection method and device based on symbolic execution

    CN117034277A

  • Request processing method and device, storage medium and electronic equipment

    CN117724931A

  • Chip software debugging method and device based on task stack backtracking mechanism

    CN118550834A

  • Fault positioning method and device, electronic equipment and storage medium

    CN120353696A