Fault positioning method and device, intelligent agent, electronic device, medium and product

CN122985489APending Publication Date: 2026-10-27BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611200066.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-07
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0003]但是,由于软件仓库包含大量文件和代码符号,这种在整个软件仓库范围内进行搜索的方式,会导致智能体在多步推理过程中偏离正确方向,产生大量无关的推理结果,降低了缺陷或故障的定位准确性

Benefits of technology

[0011]本公开实施例提供的故障定位方法,通过确定故障对应的警示入口函数中的所有符号对应的符号跳转路径,以及所有调用子函数对应的函数跳转路径,不仅可以明确该警示入口函数所处理的入口符号的来源,还能够明确该警示入口函数对应的后续函数跳转路径,缩小了故障的查找范围,使推理子智能体只在基于符号跳转路径和函数跳转路径确定的目标访问范围内进行故障推理,相较于在全局的代码库的查找范围而言,能够极大的缩小搜索范围,提升故障定位准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122985489A_ABST
    Figure CN122985489A_ABST
Patent Text Reader

Abstract

The present disclosure provides a fault positioning method, device, agent, electronic device, medium and product, and relates to the technical field of fault positioning based on an agent. The method comprises: in response to an alarm entry function corresponding to a fault, determining a symbol jump path corresponding to all symbols included in the alarm entry function, and a function jump path corresponding to a calling sub-function included in the alarm entry function; determining a target access range according to the symbol jump path and the function jump path; and controlling a reasoning sub-agent to perform fault reasoning in the target access range to determine a fault position. The application of the method can greatly reduce the search range and improve the fault positioning accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, specifically to the field of fault location based on intelligent agents, and particularly to a fault location method, as well as a corresponding fault location device, intelligent agent, electronic device, computer-readable storage medium, and computer program product. Background Technology

[0002] In the task of defect localization in large-scale software repositories, existing intelligent agents usually need to rely on multiple retrieval tools to search the entire software repository in order to finally determine the specific location of the defect or fault.

[0003] However, because software repositories contain a large number of files and code symbols, this method of searching the entire software repository can cause the agent to deviate from the correct direction during multi-step reasoning, generating a large number of irrelevant reasoning results and reducing the accuracy of defect or fault location. Summary of the Invention

[0004] This disclosure provides a fault location method, a fault location device, an intelligent agent, an electronic device, a computer-readable storage medium, and a computer program product.

[0005] In a first aspect, embodiments of this disclosure propose a fault location method, comprising: responding to a warning entry function corresponding to a fault, determining symbol jump paths corresponding to all symbols included in the warning entry function, and function jump paths corresponding to calling sub-functions included in the warning entry function; determining a target access range based on the symbol jump paths and function jump paths; and controlling a reasoning sub-agent to perform fault reasoning within the target access range to determine the fault location.

[0006] Secondly, embodiments of this disclosure propose a fault location device, comprising: a path determination unit configured to, in response to a warning entry function corresponding to a fault, determine symbol jump paths corresponding to all symbols included in the warning entry function, and function jump paths corresponding to calling sub-functions included in the warning entry function; a range determination unit configured to determine a target access range based on the symbol jump paths and function jump paths; and a reasoning unit configured to control a reasoning sub-agent to perform fault reasoning within the target access range to determine the fault location.

[0007] Thirdly, embodiments of this disclosure propose a fault location intelligent agent, comprising: an input module for receiving input information; a processing module for determining a target task based on the input information received by the input module, determining a fault location model based on the target task, executing a fault location method described in any implementation of the first aspect by calling the fault location model, and obtaining output information; and an output module for outputting the output information obtained by the processing module.

[0008] Fourthly, embodiments of this disclosure provide an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to implement the fault location method as described in any implementation of the first aspect.

[0009] Fifthly, embodiments of this disclosure provide a non-transitory computer-readable storage medium storing computer instructions that enable a computer to implement the fault location method as described in any implementation of the first aspect.

[0010] In a sixth aspect, embodiments of this disclosure provide a computer program product including a computer program that, when executed by a processor, can implement the fault location method as described in any implementation of the first aspect.

[0011] The fault location method provided in this disclosure determines the symbol jump paths corresponding to all symbols in the warning entry function and the function jump paths corresponding to all called sub-functions. This not only clarifies the source of the entry symbols processed by the warning entry function, but also clarifies the subsequent function jump paths corresponding to the warning entry function. This narrows the scope of fault search, allowing the reasoning agent to perform fault reasoning only within the target access range determined by the symbol jump paths and function jump paths. Compared to searching the global codebase, this greatly reduces the search scope and improves the accuracy of fault location.

[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0013] Other features, objects, and advantages of this disclosure will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is an exemplary system architecture to which this disclosure can be applied; Figure 2 A flowchart of a fault location method provided in an embodiment of this disclosure; Figure 3 A flowchart illustrating a method for determining a symbolic jump path provided in an embodiment of this disclosure; Figure 4 A flowchart illustrating a method for determining a function jump path provided in an embodiment of this disclosure; Figure 5A flowchart illustrating a method for determining a target access range provided in an embodiment of this disclosure; Figure 6 A flowchart of a fault reasoning method provided in an embodiment of this disclosure; Figure 7 A flowchart of another fault location method provided in this disclosure embodiment; Figure 8 A comparative diagram illustrating the search range provided in an embodiment of this disclosure; Figure 9 A structural block diagram of a fault location device provided in an embodiment of this disclosure; Figure 10 This is a structural block diagram of an electronic device suitable for performing a fault location method, provided as an embodiment of the present disclosure. Detailed Implementation

[0014] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding; these should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.

[0015] The collection, storage, use, processing, transmission, provision, and disclosure of any type of information, such as user personal information, in this technical solution comply with relevant laws and regulations and do not violate public order and good morals.

[0016] Figure 1 An exemplary system architecture 100 is shown, in which embodiments of the fault location methods, apparatus, electronic devices, and computer-readable storage media of this application can be applied.

[0017] like Figure 1 As shown, system architecture 100 may include terminal device 101, terminal device 102, terminal device 103, network 104, and server 105. Network 104 is used as a medium to provide communication links between terminal device 101, terminal device 102, terminal device 103, and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0018] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various applications for enabling information communication between the terminal devices 101, 102, 103, and server 105 can be installed. These applications include navigation applications and large language model reasoning applications.

[0019] Terminal devices 101, 102, 103, and server 105 can be either hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with displays, including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices, and can be implemented as multiple software programs or software modules, or as a single software program or software module; no specific limitation is made here. When server 105 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When server 105 is software, it can be implemented as multiple software programs or software modules, or as a single software program or software module; no specific limitation is made here.

[0020] Server 105 can provide various services through its built-in applications. Taking a navigation application as an example, when running this application, server 105 can achieve the following: After receiving a navigation request from a terminal device (e.g., terminal device 101, terminal device 102, terminal device 103), server 105 displays a fault. The fault displays the corresponding warning entry function. By determining the symbol jump path corresponding to all symbols in the warning entry function and the function jump path corresponding to all called sub-functions, server 105 can not only clarify the source of the entry symbol processed by the warning entry function, but also clarify the subsequent function jump path corresponding to the warning entry function. This can narrow the scope of fault search, allowing the reasoning agent to perform fault reasoning only within the target access range determined by the symbol jump path and function jump path. Compared to searching the global codebase, this greatly narrows the search scope and improves the accuracy of fault location.

[0021] Because training the inference agent requires significant computing resources and power, the fault location methods provided in subsequent embodiments of this application are generally executed by a server 105 with strong computing power and abundant computing resources. Correspondingly, the fault location agent is also generally located within the server 105. However, it should also be noted that when terminal devices 101, 102, and 103 also possess sufficient computing power and resources, they can also perform the aforementioned calculations performed by the server 105 through navigation applications installed on them, thereby outputting the same results as the server 105. Accordingly, the fault location agent can also be located within terminal devices 101, 102, and 103. In this case, the exemplary system architecture 100 may not include the server 105 and the network 104.

[0022] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0023] In some related technical solutions, navigation schemes based on code graph structures typically construct a directed heterogeneous graph based on the coverage of the entire software repository, and then use an agent to perform multi-hop reasoning on this heterogeneous graph; or, they use dynamic construction of module call graphs and function call graphs to perform two-stage search to determine the fault location. However, the above methods all represent the coverage of the software repository in a structured way, and in essence, fault location still needs to be performed within the entire coverage of the software repository, which will lead to inaccurate fault location.

[0024] In other related technical solutions, training methods based on distillation and reinforcement learning first obtain the initial policy from the closed-source strong model through distillation, and then improve the output accuracy of the model through reinforcement learning algorithms. However, its search range is also the entire coverage of the software repository, which cannot accurately determine the fault location.

[0025] To address the aforementioned problems, embodiments of this disclosure provide a fault location method, a fault location device, an intelligent agent, an electronic device, a computer-readable storage medium, and a computer program product.

[0026] Please refer to Figure 2 , Figure 2 A flowchart of a fault location method provided in this disclosure embodiment, wherein process 200 includes the following steps: Step 201: In response to the warning entry function corresponding to the fault, determine the symbol jump paths corresponding to all symbols included in the warning entry function, and the function jump paths corresponding to the called sub-functions included in the warning entry function.

[0027] The alert entry point function is a program entry point marked as corresponding to a fault, containing high-risk information, and / or requiring close review. The alert entry point function includes multiple symbols and sub-functions, each symbol having a different physical meaning. The sub-functions are used to call other functions to implement the corresponding sub-functions.

[0028] This step is intended for the entity executing the fault location method (e.g., Figure 1 The server 105 shown uses an alert entry function to identify a possible location in code execution starting from that entry function. Furthermore, by obtaining the symbolic jump paths corresponding to all symbols included in the alert entry function, as well as the function jump paths corresponding to the called sub-functions included in the alert entry function, the server can determine the reference relationships corresponding to the symbols through the symbolic jump paths and determine the location information of the sub-functions that need to be called subsequently through the function jump paths. This allows for fault localization based on different jump paths.

[0029] Step 202: Determine the target access range based on the symbol jump path and the function jump path.

[0030] The target access range is the searchable range constructed from symbol jump paths and function jump paths. By determining the target access range, the specific searchable range starting from the warning entry function can be clearly defined, so as to facilitate subsequent fault location.

[0031] Step 203: Control the reasoning sub-agent to perform fault reasoning within the target access range and determine the fault location.

[0032] Among them, the reasoning sub-agent is a pre-trained agent used for fault location based on fault information.

[0033] This step aims to have the aforementioned executing entity send the target access range to the inference sub-agent, so that the inference sub-agent can perform fault inference only within the target access range. Compared with the method of searching the entire software library, this can narrow the search range and improve the accuracy of fault location.

[0034] The fault location method provided in this disclosure determines the symbol jump paths corresponding to all symbols in the warning entry function and the function jump paths corresponding to all called sub-functions. This not only clarifies the source of the entry symbols processed by the warning entry function, but also clarifies the subsequent function jump paths corresponding to the warning entry function. This narrows the scope of fault search, allowing the reasoning agent to perform fault reasoning only within the target access range determined by the symbol jump paths and function jump paths. Compared to searching the global codebase, this greatly reduces the search scope and improves the accuracy of fault location.

[0035] Please refer to Figure 3 , Figure 3 A flowchart illustrating a method for determining a symbolic jump path provided in this disclosure embodiment, specifically for... Figure 2 The step 201 in process 200, "determining the symbol jump paths corresponding to all symbols included in the warning entry function," provides a specific implementation method. Other steps in process 200 are not adjusted. A new complete embodiment is obtained by replacing the method for determining the symbol jump paths in step 201 with the specific implementation method provided in this embodiment. Process 300 includes the following steps: Step 301: Based on the preset abstract syntax tree, parse all symbols in the warning entry function to obtain the symbol name and attribute expression corresponding to the symbol.

[0036] The abstract syntax tree (AST) is a structured, tree-like intermediate representation of the source code, where each node represents a syntax structure (such as a function, expression, statement, parameter, etc.).

[0037] By comparing each symbol in the alert entry function with any node in the abstract syntax tree, the symbol name and attribute expression corresponding to that symbol can be determined. The symbol name represents the specific physical meaning of the symbol, and the attribute expression is an expression that dynamically calculates or describes the value or condition of a certain "attribute" (feature, field) by combining elements such as variables, operators, and functions.

[0038] For example, if the symbol corresponding to the attribute expression is ab, the type of a (e.g., union type) can be inferred through the language server. The annotation information, control flow analysis, function return type, and stub file acquisition type information corresponding to the symbol can be analyzed to determine the corresponding sequential call relationship information. Based on the sequential call relationship information, the definition of the symbol "b" can be found, that is, the symbol name of b.

[0039] Step 302: Based on recursive jumps, determine the first symbol sub-jump path corresponding to all symbol names and the second symbol sub-jump path corresponding to all attribute expressions.

[0040] The recursive jump method refers to a jump logic that triggers itself, forming a nested / looping jump. For each symbol name 'a', all reference paths that refer to symbol name 'a', as well as paths that use symbol name 'a' as input parameters, are summarized to obtain the symbol sub-jump path corresponding to symbol name 'a', where 'a' is an integer greater than or equal to 1; then, all symbol sub-jump paths corresponding to symbol names are summarized to obtain the first symbol sub-jump path.

[0041] For each attribute expression m, all reference paths that refer to the attribute expression m, as well as the paths that use the attribute expression m as input parameters, are summarized to obtain the m-symbol sub-jump path for the attribute expression m, where m is an integer greater than or equal to 1; then, the symbol self-adjustment paths corresponding to all attribute expressions are summarized to obtain the second symbol sub-jump path.

[0042] In this embodiment, by mapping all symbols in the alert entry function to the abstract syntax tree, symbol parsing is performed to obtain the symbol names and attribute expressions corresponding to all symbols in the alert entry function; and the corresponding symbol jump path is obtained based on recursive jump. Through each symbol jump path, the physical meaning and calling relationship of each symbol can be clearly understood, which is convenient for subsequent use.

[0043] Please refer to Figure 4 , Figure 4 A flowchart illustrating a method for determining a function jump path provided in this disclosure embodiment, specifically for... Figure 2 The step 201 in process 200, which determines the "function jump path corresponding to the called sub-function included in the warning entry function," provides a specific implementation method. Other steps in process 200 are not adjusted. A new complete embodiment is obtained by replacing the method for determining the function jump path in step 201 with the specific implementation method provided in this embodiment. Process 400 includes the following steps: Step 401: Determine the initial jump path corresponding to the called sub-function based on recursive jump.

[0044] By recursively jumping, starting from the calling subfunction, we can obtain its corresponding upstream reference entry path and downstream usage path, thus obtaining the initial jump path corresponding to the calling subfunction and clarifying the scope of use of the calling subfunction.

[0045] Step 402: Based on the initial jump path, analyze the control flow corresponding to the called sub-function to determine the sequential call relationship information of the called sub-function.

[0046] The sequential call relationship information satisfies at least one of the following constraints: the subclass call information takes precedence over the parent class call information, the writing order priority information, and the linear monotonic priority information.

[0047] It should be noted that the subclass priority call information means that when both a subclass and a parent class exist, the subclass is called first.

[0048] The order of writing indicates that symbols written earlier have higher priority than those written later. For example, in the code class D(B,C), the symbol B has higher priority than the symbol C.

[0049] Linear monotonic precedence information means that for two given symbols X and Y, if symbol X comes before symbol Y, then in the method resolution order of all subclasses involving symbols X and Y, symbol X must always come before symbol Y, and there must be no contradiction.

[0050] By defining the order of sub-function calls based on the above constraints, we can clarify the specific order in which the sub-function is called and in which classes it is called sequentially. This information facilitates the subsequent determination of the role of the sub-function based on the order of calls.

[0051] Step 403: Determine the function jump path corresponding to the sub-function call based on the sequential call relationship information.

[0052] By analyzing the sequential call relationship information corresponding to the called sub-functions, the calling order and call location information of the called sub-functions can be determined, thereby sequentially determining the function jump path corresponding to the called sub-function. This facilitates subsequent fault location based on the function jump path and improves the accuracy of fault location.

[0053] In some embodiments, the method further includes: in response to the warning entry function including symbols across files, resolving all symbols in the warning entry function according to a preset file-level call relationship dependency graph to obtain the symbol name and attribute expression corresponding to the symbol, as well as the call sub-functions included in the warning entry function.

[0054] The file-level call dependency graph is a graphical representation of the relationships between symbols called across multiple files. By graphically representing the paths to which symbols are referenced or processed, the symbol names and attribute expressions corresponding to all symbols in the alert entry function, as well as the sub-functions called within the alert entry function, can be obtained more intuitively, improving parsing accuracy.

[0055] In some embodiments, the name symbol of the input parameter included in the alert entry function is S. The corresponding code can be found based on the name symbol S to determine the value of the input parameter. Similarly, if the attribute expression included in the alert entry function is (a+b), the specific parameter value corresponding to the attribute expression can also be determined by finding the code. The calling sub-functions included in the alert entry function are execution functions for subsequent steps, facilitating the calculation and subsequent processing of the input parameters and / or attribute expressions.

[0056] Please refer to Figure 5 , Figure 5 A flowchart illustrating a method for determining a target access range provided in this disclosure embodiment, namely for... Figure 2Step 202 in process 200 provided a specific implementation. Other steps in process 200 are not adjusted; a new complete embodiment is obtained by replacing step 202 with the specific implementation provided in this embodiment. Process 500 includes the following steps: Step 501: Based on recursive jumps, analyze the symbolic jump path and function jump path to determine the propagation range.

[0057] The scope of propagation is the set of all code that can be reached from the warning entry function through symbolic jump paths and function jump paths.

[0058] Each symbol included in the warning entry function corresponds to a symbol jump path transmission chain. This chain includes all nodes that reference and use the symbol, thus clarifying the hierarchical reference relationships of all symbols included in the warning entry function.

[0059] Correspondingly, every sub-function called that is part of the warning entry function has a corresponding function jump path transmission chain. This chain includes all the nodes that are referenced and used by the sub-function, which clearly shows the hierarchical reference relationship of the sub-function.

[0060] Step 502: Determine the target access range based on the transmission range.

[0061] This step aims to filter a certain range within the global software repository by passing a range, thereby narrowing the search scope and improving the accuracy of fault location during the fault localization process.

[0062] In this embodiment, the scope of transmission is determined by recursive jumps. That is, all code that can be reached through all jump paths starting from the warning entry function is within the scope of transmission. Compared with the existing technology that requires searching for faults in the entire repository, this can narrow the search scope and improve the efficiency of fault location.

[0063] In some embodiments, determining the target access range based on the transmission range in step 502 includes: constructing a transmission closure based on the minimum transmission path in any binary scheduling relationship within the transmission range; and determining the target access range based on the transmission closure.

[0064] If the transit range is represented by a set, then the transit closure represents the minimum transit relationship of the binary scheduling relationships on that set, that is, the intersection of the transit chains corresponding to all the binary scheduling relationships included in the set.

[0065] For example, in code family relationships, transitive closures can be expressed as multi-level parent-child relationships; paths can be connected through a finite sequence of elements.

[0066] In this embodiment, by determining the target access range based on transitive closures, the search range can be further narrowed, because the jump path contained in the transitive closure is the minimum transit path, which shortens the search time for multi-step jumps.

[0067] Please refer to Figure 6 , Figure 6 A flowchart of a fault reasoning method provided in this disclosure embodiment, namely for Figure 2 Step 203 in process 200 provided a specific implementation. Other steps in process 200 are not adjusted; a new complete embodiment is obtained by replacing step 203 with the specific implementation provided in this embodiment. Process 600 includes the following steps: Step 601: Control the inference sub-agent to perform fault inference within the target access range, and obtain inference result information based on natural language output, and / or, inference result information based on preset code format output.

[0068] The inference results output based on natural language can be descriptive, such as information about the code location that needs to be modified, indicating a potential fault. The preset code format can be JSON, and the inference results output based on the preset code format will be inference results output in JSON format.

[0069] The reasoning result information represents the location information and / or type information of the fault determined by the reasoning sub-agent during the analysis and reasoning of the fault within the target access range.

[0070] Step 602: Decode the inference result information to obtain the fault location.

[0071] This step aims to determine the location of the fault by analyzing the inference results. For example, if the inference results are based on natural language output, the output can be converted into machine-understandable location information such as the line number of the fault, facilitating rapid fault location and repair.

[0072] For example, if the inference result information is output in JSON format, the corresponding decoding method is to parse the inference result information according to the JSON syntax rules to obtain the final fault location.

[0073] In this embodiment, by controlling the reasoning sub-agent to perform fault reasoning within the target access range, reasoning result information based on natural language output is obtained, and / or reasoning result information based on preset code format output is obtained. Furthermore, the reasoning result information is decoded to obtain fault location that can be understood by R&D personnel, and / or specific location information such as code line number that can be accurately located by the machine, which effectively improves the efficiency of fault location.

[0074] In some embodiments, the faults include at least one of the following: semantic parsing faults in navigation systems, code recognition faults in code review systems, backtracking faults in automated regression testing, and benchmarking defects in evaluating large language models.

[0075] In the navigation system, semantic parsing failures can occur in an integrated development environment. When developers start troubleshooting corresponding semantic parsing failures from a test case or error stack entry, the navigation system automatically tracks jump chains to limit the navigation scope to a semantically relevant subset of code (i.e., the target access scope). This reduces the time developers spend searching in irrelevant code and improves the debugging efficiency of the navigation system.

[0076] Code identification faults in code review systems occur when, in a code review scenario, the system starts from the warning entry function and, through automatic recursive jumps, identifies the target access scope corresponding to potentially affected code. This allows the system to focus on the subset of code that truly needs attention, thereby improving the quality and efficiency of code review.

[0077] In automated regression testing, reverse fault tracing occurs when a section of code is modified during the automated regression testing process. The execution entity described above starts from the point of code change (i.e., the warning entry function) and traces its corresponding reference relationships in reverse to determine the scope of affected tests and functional modules (i.e., the target access scope). This provides a basis for accurate regression testing and avoids unnecessary full testing.

[0078] Evaluating benchmark defects in a large language model involves using fault / defect description information and warning entry functions as input in an automated software defect localization system. The system leverages the access range of a jump tool to constrain the search space of the reasoning sub-agent, ensuring that the sub-agent performs multi-step reasoning only within a reachable subset of code (i.e., the target access range). This yields output information, namely the location information of the files and functions that need modification. This information allows downstream repair modules to modify the files or functions based on the location information, thereby improving the large language model.

[0079] To enhance understanding, this disclosure also provides a specific implementation scheme in conjunction with a particular application scenario.

[0080] Please refer to Figure 7 , Figure 7 A flowchart of another fault location method provided in this disclosure embodiment, wherein process 700 includes the following steps: Step 701: Obtain the warning entry function corresponding to the fault and initialize the jump tool.

[0081] In this context, a fault is an anomaly or defect that appears in an alarm or warning message during the operation of an application. The warning entry function corresponding to the fault is obtained through the warning message. This warning entry function is the program entry point marked as "high risk / requires special review".

[0082] For example, given a software repository R={f1,…,fn} and an Issue description, the corresponding alert entry function can be determined from the Issue description. This could be a data receiving function or a clock synchronization entry function. Here, fn represents the nth function, and n is an integer greater than or equal to 1.

[0083] The jump tool is a tool that allows users to jump from the "alert entry function" to the dangerous function it calls (or reverse trace) with a single click during the audit / scan process. Initializing the jump tool prepares it for the corresponding function call processing, facilitating subsequent calls.

[0084] For example, there can be one or more jump tools. However, experiments show that using only one jump tool significantly improves fault location accuracy compared to using multiple jump tools. This is because using a single jump tool allows for a more focused range of accesses, which is beneficial for pinpointing the fault location.

[0085] Step 702: Determine the symbol jump paths corresponding to all symbols included in the warning entry function.

[0086] Specifically, the source code file corresponding to the warning entry function can be provided to the language server so that the language server can parse the source code file and obtain the symbol names, attribute expressions, and sub-functions called for all symbols included in the warning entry function.

[0087] For example, the symbol resolution corresponding to the warning entry function can be mapped to the following formula: .in, This indicates a jump tool, and 's' represents any symbol in the warning entry function. This indicates the source code location corresponding to the symbol 's'. This indicates the file path corresponding to the symbol 's'. and location information .

[0088] In some embodiments, the input parameters of the jump tool may include: the file path (file_path) where the symbol is referenced, the symbol to be resolved (symbol), and the index (index) used for disambiguation of symbols with the same name (index).

[0089] In some embodiments, all symbols in the alert entry function can be parsed according to a preset abstract syntax tree to obtain the symbol name and attribute expression corresponding to the symbol; based on recursive jump, the first symbol sub-jump path corresponding to all symbol names and the second symbol sub-jump path corresponding to all attribute expressions can be determined.

[0090] The abstract syntax tree (AST) is a structured, tree-like intermediate representation of the source code. Each node in the tree represents a syntax structure (such as a function, expression, statement, parameter, etc.). By comparing each symbol in the warning entry function with any node in the AST, the symbol name and attribute expression corresponding to that symbol can be determined.

[0091] For example, for a specific symbol, the symbol name can be determined by searching for candidate definitions in the lexical scope chain based on the Local-Enclosing-Module-Builtins (LEGB) rule.

[0092] Local represents the local scope: variables (including function parameters) defined inside the current function or code block.

[0093] Enclosing indicates nested / closure scope: if the current function is inside another function, the search extends outward to the local scope of the outer function, and so on upwards until the outermost non-global function is reached.

[0094] Module represents the global / module scope: including the top level of the current source code file (or module).

[0095] Builtins refers to the built-in scope: the built-in namespace that is automatically loaded when the interpreter (such as the Python interpreter) starts, which contains various types of built-in functions and symbol types.

[0096] For example, for a related symbol (e.g., ab), the type of a (e.g., union type) can be inferred through the language server. The annotation information, control flow analysis, function return type, and stub file acquisition type information corresponding to the symbol can be analyzed to determine the corresponding sequential call relationship information. Based on the sequential call relationship information, the definition of the symbol "b" can be found, that is, the symbol name of b.

[0097] In some embodiments, the attribute expression obtained by parsing can be analyzed using the following formula to determine the second symbolic sub-jump path corresponding to the attribute expression: Here, T(a) represents the set of types for symbol a, and MRO(t) represents the Method Resolution Order (MRO). That is, within the set of types T(a) for symbol a, the symbol name and corresponding attribute information for b are retrieved using the MRO method, thereby ultimately determining the attribute expression. The physical meaning it represents.

[0098] Step 703: Determine the function jump path corresponding to the sub-functions called in the warning entry function.

[0099] The function jump path can be obtained in the following way: Based on recursive jump, determine the initial jump path corresponding to the called sub-function; based on the initial jump path, analyze the control flow corresponding to the called sub-function to determine the sequential call relationship information corresponding to the called sub-function; based on the sequential call relationship information corresponding to the called sub-function, determine the function jump path corresponding to the called sub-function.

[0100] The sequential call relationship information satisfies at least one of the following constraints: the subclass call information takes precedence over the parent class call information, the writing order priority information, and the linear monotonic priority information.

[0101] In some embodiments, the alert entry function also includes cross-file symbols, which can be resolved as follows: based on a preset file-level call relationship dependency graph, all symbols in the alert entry function are resolved to obtain the symbol name and attribute expression corresponding to the symbol, as well as the call sub-functions included in the alert entry function.

[0102] The resolution of symbols across files essentially involves establishing a mapping relationship of "name → definition / address" between multiple compilation units (or source files).

[0103] A file-level call dependency graph is a static import dependency graph that simulates module loading semantics. For example, when using an import statement to bind a local name to an exported symbol of a target module, the resolution process may involve multiple module re-exports and __all__ filtering to obtain the final definition location.

[0104] The `import` statement essentially clearly specifies which package or module a class / function comes from, avoiding conflicts between classes / functions with the same name in different codebases; that is, it tells the program "I want to use code that has already been defined in another module / package" and imports it into the current scope, thus avoiding duplicate symbol definitions. `__all__` filtering is a mechanism in Python used to control the interface exposed by a module; its most common use is in conjunction with `from module import`. Perform filtering.

[0105] In some embodiments, the jump tool can be repeatedly invoked to progressively parse all symbols referenced in the warning entry function. Then, for each symbol, the definition file path and location information corresponding to the symbol returned by each jump are recorded. Upon obtaining the target symbol that calls the symbol, the jump tool is invoked again to perform jump parsing on the target symbol, thereby obtaining the complete symbol call relationship. Each symbol can be an independent symbol, an attribute expression with an association relationship, or a calling subfunction; this disclosure does not impose any restrictions and will not be elaborated further here.

[0106] Step 704: Determine the target access range based on the symbol jump path and the function jump path.

[0107] Among them, symbolic jump paths and function jump paths can be analyzed based on recursive jumps to determine the propagation range; the propagation range is the set of all code that can be reached from the warning entry function through symbolic jump paths and function jump paths; the target access range is determined based on the propagation range.

[0108] In some embodiments, a transit closure can be constructed based on the minimum transit path in any binary scheduling relationship within the transit range; the target access range can then be determined based on the transit closure.

[0109] In this context, transitive closure represents the set of all code definitions that can be reached from the warning entry function through a chain of symbolic references.

[0110] Step 705: Use the target access range as the search space for the reasoning sub-agent.

[0111] It should be noted that since the recursive parsing of the jump tool is essentially a static approximation of the program execution flow, the code corresponding to any fault that requires code modification to resolve must be located on a path within the target access range. By using the target access range as the search space of the inference sub-agent, the search range can be further narrowed; compared to the conventional method of searching the entire software repository, this greatly reduces the search range, thereby improving fault location efficiency.

[0112] Step 706: Control the reasoning sub-agent to perform fault reasoning within the target access range and determine the fault location.

[0113] Among them, the reasoning sub-agent can be an agent with fault reasoning function implemented based on a pre-trained large language model.

[0114] For example, by controlling the reasoning sub-agent to perform fault reasoning within the target access range, reasoning result information based on natural language output can be obtained, and / or, reasoning result information based on a preset code format output; then, the reasoning result information is decoded to obtain the fault location.

[0115] The preset code format can be JSON, and the corresponding decoding method is to parse the inference result information according to the JSON syntax rules to obtain the final fault location.

[0116] To distinguish it from existing technologies, this disclosure provides a comparative diagram of search ranges, referring to... Figure 8 , Figure 8 This is a comparative diagram illustrating a search range provided in an embodiment of the present disclosure.

[0117] like Figure 8 As shown, Figure 8 The Venn diagram illustrates the containment relationships between the three sets. The largest ellipse represents the Repo Scope, which includes all code in the software repository and its corresponding location information.

[0118] The ellipse in the middle represents the target access scope, that is, the subset of code that can be reached from the alert entry function through recursive jumps; for example, it can be represented by the following formula: .

[0119] in, Indicates transitive closure; Indicates the warning entry function; Indicates a jump tool.

[0120] The smallest ellipse represents the ground truth set of the fault, that is, the actual code that needs to be modified corresponding to the fault and its corresponding location information.

[0121] Depend on Figure 8 The comparison shows that the target access scope is significantly smaller than the software repository scope, and its first overlap with the fault truth set is much higher than the second overlap between the software repository scope and the fault truth set. For example, this can be expressed by the following formula: .

[0122] in, This represents the intersection-union ratio (IUU) between the target access range and the set of fault truth values, i.e., the first degree of overlap. This represents the intersection-union ratio between the software repository scope and the fault truth set, i.e., the second overlap.

[0123] In some embodiments, the faults include at least one of the following: semantic parsing faults in navigation systems, code recognition faults in code review systems, backtracking faults in automated regression testing, and benchmarking defects in evaluating large language models.

[0124] In this embodiment, by employing a jump tool, recursive jumps are performed based on the warning entry function to obtain the target access range, which can greatly narrow the fault reasoning range of the reasoning sub-agent and improve the accuracy of fault location; it is also beneficial to improve the efficiency of fault repair.

[0125] Further reference Figure 9 As an implementation of the methods shown in the above figures, this disclosure provides an embodiment of a fault location device, which is similar to... Figure 2 The fault location method shown corresponds to the embodiment described above. The fault location device described above can be specifically applied to various electronic devices.

[0126] like Figure 9 As shown, the fault location device 900 of this embodiment may include: a path determination unit 910, a range determination unit 920, and a reasoning unit 930.

[0127] The path determination unit 910 is configured to, in response to the alarm entry function corresponding to the fault, determine the symbol jump paths corresponding to all symbols included in the alarm entry function, and the function jump paths corresponding to the called sub-functions included in the alarm entry function.

[0128] The range determination unit 920 is configured to determine the target access range based on the symbol jump path and the function jump path.

[0129] The reasoning unit 930 is configured to control the reasoning sub-agent to perform fault reasoning within the target access range and determine the fault location.

[0130] In this embodiment, the specific processing of the path determination unit 910, the range determination unit 920, and the reasoning unit 930 in the fault location device 900, and the resulting technical effects, can be referred to respectively. Figure 2 The relevant descriptions of steps 201-203 in the corresponding embodiments will not be repeated here.

[0131] In some optional implementations of this embodiment, the scope determination unit 920 can be further configured to: analyze symbolic jump paths and function jump paths based on recursive jumps to determine the transmission scope; the transmission scope is the set of all code that can be reached from the warning entry function through symbolic jump paths and function jump paths; and determine the target access scope based on the transmission scope.

[0132] In some optional implementations of this embodiment, determining the target access range based on the transmission range includes: constructing a transmission closure based on the minimum transmission path in any binary scheduling relationship within the transmission range; and determining the target access range based on the transmission closure.

[0133] In some optional implementations of this embodiment, the path determination unit 910 determines the symbol jump paths corresponding to all symbols included in the warning entry function, including: parsing all symbols in the warning entry function according to a preset abstract syntax tree to obtain the symbol name and attribute expression corresponding to the symbol; and determining the first symbol sub-jump path corresponding to all symbol names and the second symbol sub-jump path corresponding to all attribute expressions based on recursive jump.

[0134] In some optional implementations of this embodiment, the function jump path corresponding to the called sub-function included in the path determination unit 910 for determining the warning entry function includes: determining the initial jump path corresponding to the called sub-function based on recursive jump; analyzing the control flow corresponding to the called sub-function according to the initial jump path to determine the sequential call relationship information corresponding to the called sub-function; the sequential call relationship information satisfies at least one of the following constraints: subclass call information takes precedence over parent class, writing order priority information and linear monotonic priority information; determining the function jump path corresponding to the called sub-function according to the sequential call relationship information corresponding to the called sub-function.

[0135] In some optional implementations of this embodiment, the fault location device 900 further includes: a parsing unit (not shown in the figure), configured to, in response to the warning entry function including symbols across files, parse all symbols in the warning entry function according to a preset file-level call relationship dependency graph, to obtain the symbol name and attribute expression corresponding to the symbol, as well as the calling sub-functions included in the warning entry function.

[0136] In some optional implementations of this embodiment, the inference unit 930 can be further configured to: control the inference sub-agent to perform fault inference within the target access range, obtain inference result information based on natural language output, and / or, inference result information based on a preset code format; decode the inference result information to obtain the fault location.

[0137] In some optional implementations of this embodiment, the faults include at least one of the following: semantic parsing faults in the navigation system, code recognition faults in the code review system, reverse tracing faults in automatic regression testing, and benchmarking defects in evaluating large language models.

[0138] This embodiment exists as a device embodiment corresponding to the above method embodiment. The fault location device provided in this embodiment, by determining the symbol jump paths corresponding to all symbols in the warning entry function corresponding to the fault, as well as the function jump paths corresponding to all called sub-functions, can not only clarify the source of the entry symbols processed by the warning entry function, but also clarify the subsequent function jump paths corresponding to the warning entry function, thus narrowing the fault search range. This allows the reasoning sub-agent to perform fault reasoning only within the target access range determined based on the symbol jump paths and function jump paths. Compared to the search range in the global code library, this can greatly narrow the search range and improve the accuracy of fault location.

[0139] According to embodiments of this disclosure, this disclosure also provides a fault location intelligent agent, including: an input module for receiving input information; a processing module for determining a target task based on the input information received by the input module, determining a fault location model based on the target task, implementing the fault location method described in any of the above embodiments by calling the fault location model, and obtaining output information; and an output module for outputting the output information obtained by the processing module.

[0140] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to implement the fault location method described in any of the above embodiments when executed.

[0141] According to embodiments of this disclosure, this disclosure also provides a readable storage medium storing computer instructions that enable a computer to implement the fault location method described in any of the above embodiments when executed.

[0142] This disclosure provides a computer program product that, when executed by a processor, can implement the fault location method described in any of the above embodiments.

[0143] Figure 10This is a structural block diagram of an exemplary electronic device 1000 suitable for performing a fault location method, provided for embodiments of this disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0144] like Figure 10 As shown, device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1002 or a computer program loaded into random access memory (RAM) 1003 from storage unit 1008. The RAM 1003 may also store various programs and data required for the operation of device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. Input / output (I / O) interface 1005 is also connected to bus 1004.

[0145] Multiple components in device 1000 are connected to I / O interface 1005, including: input unit 1006, such as keyboard, mouse, etc.; output unit 1007, such as various types of monitors, speakers, etc.; storage unit 1008, such as disk, optical disk, etc.; and communication unit 1009, such as network card, modem, wireless transceiver, etc. Communication unit 1009 allows device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0146] The computing unit 1001 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as fault location methods. For example, in some embodiments, the fault location method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the fault location method described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform fault location methods by any other suitable means (e.g., by means of firmware).

[0147] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0148] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0149] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0150] The technical solution of this disclosure, by determining the symbol jump paths corresponding to all symbols in the warning entry function corresponding to the fault, as well as the function jump paths corresponding to all called sub-functions, can not only clarify the source of the entry symbols processed by the warning entry function, but also clarify the subsequent function jump paths corresponding to the warning entry function. This narrows the scope of fault search, enabling the reasoning sub-agent to perform fault reasoning only within the target access range determined based on the symbol jump paths and function jump paths. Compared to the search scope in the global code library, this can greatly narrow the search scope and improve the accuracy of fault location.

[0151] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this is not limited herein.

Claims

1. A fault location method, characterized in that, The method includes: In response to the warning entry function corresponding to the fault, determine the symbol jump paths corresponding to all symbols included in the warning entry function, and the function jump paths corresponding to the called sub-functions included in the warning entry function; The target access range is determined based on the symbol jump path and the function jump path; The control reasoning sub-agent performs fault reasoning within the target access range to determine the fault location.

2. The method according to claim 1, characterized in that, The step of determining the target access range based on the symbol jump path and the function jump path includes: Based on recursive jumps, the symbol jump path and the function jump path are analyzed to determine the propagation range; the propagation range is the set of all code that can be reached from the warning entry function through the symbol jump path and the function jump path; The target access range is determined based on the transmission range.

3. The method according to claim 2, characterized in that, Determining the target access range based on the transmission range includes: Construct a transit closure based on the minimum transit path in any binary scheduling relationship within the transit range; The target access range is determined based on the transitive closure.

4. The method according to claim 1, characterized in that, Determining the symbol jump paths corresponding to all symbols included in the warning entry function includes: Based on the preset abstract syntax tree, all symbols in the warning entry function are parsed to obtain the symbol name and attribute expression corresponding to the symbol; Based on recursive jumps, determine the first symbol sub-jump path corresponding to all the symbol names and the second symbol sub-jump path corresponding to all the attribute expressions.

5. The method according to claim 1, characterized in that, Determine the function jump path corresponding to the called sub-functions included in the warning entry function, including: The initial jump path corresponding to the called sub-function is determined based on recursive jump. Based on the initial jump path, the control flow corresponding to the called sub-function is analyzed to determine the sequential call relationship information corresponding to the called sub-function; the sequential call relationship information satisfies at least one of the following constraints: subclass call information takes precedence over parent class call information, writing order priority information and linear monotonic priority information; Based on the sequential call relationship information corresponding to the called sub-function, the function jump path corresponding to the called sub-function is determined.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: In response to the warning entry function including symbols across files, all symbols in the warning entry function are parsed according to a preset file-level call relationship dependency graph to obtain the symbol name and attribute expression corresponding to the symbol, as well as the calling sub-functions included in the warning entry function.

7. The method according to any one of claims 1 to 5, characterized in that, The control reasoning sub-agent performs fault reasoning within the target access range to determine the fault location, including: The control reasoning sub-agent performs fault reasoning within the target access range to obtain reasoning result information based on natural language output, and / or, reasoning result information based on a preset code format. The inference result information is decoded to obtain the fault location.

8. The method according to any one of claims 1 to 5, characterized in that, The fault includes at least one of the following: Semantic parsing failures in navigation systems, code recognition failures in code review systems, reverse tracing failures in automated regression testing, and benchmarking defects in evaluating large language models.

9. A fault location device, comprising: The path determination unit is configured to, in response to the alarm entry function corresponding to the fault, determine the symbol jump paths corresponding to all symbols included in the alarm entry function, and the function jump paths corresponding to the called sub-functions included in the alarm entry function; The range determination unit is configured to determine the target access range based on the symbol jump path and the function jump path; The reasoning unit is configured to control the reasoning sub-agent to perform fault reasoning within the target access range to determine the fault location.

10. A fault location intelligent agent, comprising: The input module is used to receive input information; The processing module is configured to determine a target task based on the input information received by the input module, determine a fault location model based on the target task, and execute the fault location method according to any one of claims 1 to 8 by calling the fault location model to obtain output information; An output module is used to output the output information obtained by the processing module.

11. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the fault location method according to any one of claims 1 to 8.

12. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the fault location method according to any one of claims 1 to 8.

13. A computer program product comprising a computer program that, when executed by a processor, implements the fault location method according to any one of claims 1 to 8.