Method, device, storage medium and electronic device for generating call relationship
By filtering methods to define and call nodes in the abstract syntax tree, building a call chain and generating a call relationship, the problem of low efficiency and accuracy of generating call relationships in the existing technology is solved, and real-time monitoring support for small traffic services is achieved.
Patent Information
- Application Number
- CN202010990136.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-18
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2040-09-18
AI Technical Summary
In the prior art, the efficiency and accuracy of generating call relationships are low, which makes it difficult to monitor small traffic services in real time and easily accumulate into serious failures.
By filtering methods in the abstract syntax tree of the target source file, defining nodes and method calling nodes, building a call chain, and generating a call relationship based on these call chains.
The generation efficiency and accuracy of call relationships are improved, and the source code analysis is not required for technicians, and the call relationship is automatically and accurately generated, supporting real-time monitoring of small traffic services.
Smart Images

Figure CN114201173B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of electronic information technology, and in particular, to a method, device, storage medium and electronic device for generating a call relationship. Background Art
[0002] With the rapid development of information technologies such as the Internet and cloud computing, various APPs (English: Application, Chinese: Application Program) have appeared in the application market to meet the diverse needs of users. To ensure that APP can provide stable services to users, it is necessary to monitor the various services provided by APP. For services with large traffic, faults can be discovered through large-scale monitoring. For services with small traffic, it is often difficult to discover them in time because the problems are not obvious and the affected area is small. However, problems with services with small traffic will also affect user use and can easily accumulate into serious faults. Therefore, it is necessary to monitor services with small traffic in real time.
[0003] To monitor low-traffic businesses in real time, it is usually necessary to mark the method call relationships of interest based on the method paths in the APP code and insert detection code. However, method call relationships are often collected by technicians manually analyzing the source code, parsing the lexical and grammatical structure, and writing corresponding matching functions. This method of generating call relationships is inefficient and inaccurate. Summary of the invention
[0004] The purpose of the present disclosure is to provide a method, device, storage medium and electronic device for generating a call relationship, so as to solve the problem of low efficiency and accuracy in generating a call relationship in the prior art.
[0005] In order to achieve the above objective, according to a first aspect of an embodiment of the present disclosure, a method for generating a call relationship is provided, the method comprising:
[0006] Obtain at least one first call node in an abstract syntax tree corresponding to a target source file, where the first call node is a method definition node;
[0007] For each of the first call nodes, obtaining a child node of the first call node in the abstract syntax tree;
[0008] Determine, among the child nodes of the first calling node, a first called node corresponding to the first calling node, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include a block node;
[0009] The first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as a calling chain;
[0010] According to all the call chains, a call relationship of the target source file is generated.
[0011] Optionally, obtaining at least one first call node in an abstract syntax tree corresponding to the target source file includes:
[0012] At least one first call node is determined from all method definition nodes included in the abstract syntax tree, each of the first call nodes has a corresponding first type node, the first type node is a parent node of the first call node, and the first type node is a class definition node.
[0013] Optionally, before the first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as the calling chain of the first calling node, the method further includes:
[0014] Obtaining the first type of node corresponding to the first calling node;
[0015] According to the first calling node and the corresponding first class node, the method name of the first calling node and the class name to which the first calling node belongs are obtained to determine the first calling method, and according to the first called node, the method name of the first called node and the class name to which the first called node belongs are obtained to determine the first called method.
[0016] Optionally, after obtaining the child nodes of the first call node in the abstract syntax tree, the method further includes:
[0017] Determine, among the child nodes of the first calling node, at least one second called node corresponding to the first calling node, where the second called node is a method calling node;
[0018] For each of the second called nodes, obtaining a parent node of the second called node in the abstract syntax tree;
[0019] In the parent node of the second called node, a second calling node corresponding to the second called node is determined, wherein the second calling node is a method calling node, and child nodes of the second calling node include block nodes;
[0020] The second calling method corresponding to the second calling node calls the second called method corresponding to the second called node as a calling chain.
[0021] Optionally, before generating the calling relationship of the target source file according to all the calling chains, the method further includes:
[0022] Acquire at least one third call node in the abstract syntax tree, wherein the third call node is a method definition node, and the third call node has a corresponding third type node, the third type node is a parent node of the third call node, and the third type node is a classification definition node;
[0023] For each of the third call nodes, obtaining a child node of the third call node in the abstract syntax tree;
[0024] Determine, in the child nodes of the third calling node, a third called node corresponding to the third calling node, wherein the third called node is a method calling node;
[0025] The third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain.
[0026] Optionally, before using the third calling method corresponding to the third calling node to call the third called method corresponding to the third called node as a calling chain, the method further includes:
[0027] Obtain the third type node corresponding to the third calling node;
[0028] According to the third calling node and the corresponding third class node, the method name of the third calling node and the class name to which the third calling node belongs are obtained to determine the third calling method, and according to the third called node, the method name of the third called node and the class name to which the third called node belongs are obtained to determine the third called method.
[0029] Optionally, generating the calling relationship of the target source file according to all the calling chains includes:
[0030] If a calling method included in a first calling chain has an implicit call when calling a called method included in the first calling chain, obtaining attribute information of the called method included in the first calling chain, the attribute information including parameter information and / or return value information, and the first calling chain is any calling chain in all the calling chains;
[0031] Determine an implicit call chain according to the attribute information of the called method included in the first call chain;
[0032] The calling relationship of the target source file is generated according to the implicit calling chain and all the calling chains.
[0033] Optionally, there are multiple target source files, and the target source files belong to a target project. After generating the call relationship of the target source files according to all the call chains, the method further includes:
[0034] A calling relationship tree of the target project is generated according to the calling relationships of the plurality of target source files.
[0035] According to a second aspect of an embodiment of the present disclosure, a device for generating a call relationship is provided, the device comprising:
[0036] A first acquisition module is configured to acquire at least one first call node in an abstract syntax tree corresponding to a target source file, wherein the first call node is a method definition node;
[0037] The second acquisition module is configured to acquire, for each of the first calling nodes, the child nodes of the first calling node in the abstract syntax tree; determine, among the child nodes of the first calling node, a first called node corresponding to the first calling node, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes; and use the first calling method corresponding to the first calling node to call the first called method corresponding to the first called node as a call chain;
[0038] The first generating module is configured to generate a calling relationship of the target source file according to all the calling chains.
[0039] Optionally, the first acquisition module is configured to:
[0040] At least one first call node is determined from all method definition nodes included in the abstract syntax tree, each of the first call nodes has a corresponding first type node, the first type node is a parent node of the first call node, and the first type node is a class definition node.
[0041] Optionally, the second acquisition module is further configured to:
[0042] Before the first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as the calling chain of the first calling node, obtaining the first type of node corresponding to the first calling node;
[0043] According to the first calling node and the corresponding first class node, the method name of the first calling node and the class name to which the first calling node belongs are obtained to determine the first calling method, and according to the first called node, the method name of the first called node and the class name to which the first called node belongs are obtained to determine the first called method.
[0044] Optionally, the second acquisition module is further configured to:
[0045] After obtaining the child nodes of the first calling node in the abstract syntax tree, determining at least one second called node corresponding to the first calling node in the child nodes of the first calling node, wherein the second called node is a method calling node;
[0046] For each of the second called nodes, obtaining a parent node of the second called node in the abstract syntax tree;
[0047] In the parent node of the second called node, a second calling node corresponding to the second called node is determined, wherein the second calling node is a method calling node, and child nodes of the second calling node include block nodes;
[0048] The second calling method corresponding to the second calling node calls the second called method corresponding to the second called node as a calling chain.
[0049] Optionally, the second acquisition module is further configured to:
[0050] Acquire at least one third call node in the abstract syntax tree, wherein the third call node is a method definition node, and the third call node has a corresponding third type node, the third type node is a parent node of the third call node, and the third type node is a classification definition node;
[0051] For each of the third call nodes, obtaining a child node of the third call node in the abstract syntax tree;
[0052] Determine, in the child nodes of the third calling node, a third called node corresponding to the third calling node, wherein the third called node is a method calling node;
[0053] The third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain.
[0054] Optionally, the second acquisition module is further configured to:
[0055] Before the third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain, obtaining the third type node corresponding to the third calling node;
[0056] According to the third calling node and the corresponding third class node, the method name of the third calling node and the class name to which the third calling node belongs are obtained to determine the third calling method, and according to the third called node, the method name of the third called node and the class name to which the third called node belongs are obtained to determine the third called method.
[0057] Optionally, the first generating module includes:
[0058] an acquisition submodule, configured to acquire attribute information of the called method included in the first call chain if an implicit call exists when the calling method included in the first call chain calls the called method included in the first call chain, the attribute information including parameter information and / or return value information, and the first call chain is any call chain in all the call chains;
[0059] A determination submodule, configured to determine an implicit call chain according to the attribute information of the called method included in the first call chain;
[0060] A generating submodule is configured to generate the calling relationship of the target source file according to the implicit calling chain and all the calling chains.
[0061] Optionally, the device further comprises:
[0062] The second generating module is configured to generate a calling relationship tree of the target project according to the calling relationships of the plurality of target source files.
[0063] According to a third aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for generating a call relationship provided in the first aspect are implemented.
[0064] According to a fourth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0065] a memory having a computer program stored thereon;
[0066] A processor is used to execute the computer program in the memory to implement the steps of the method for generating a call relationship provided in the first aspect.
[0067] Through the above technical scheme, the present disclosure firstly selects at least one first calling node in the abstract syntax tree corresponding to the target source file, the first calling node is a method definition node, and then for each first calling node, the child node of the first calling node is searched in the abstract syntax tree, and then the corresponding first called node in the child node of the first calling node is determined, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes, and then the first calling method corresponding to the first calling node is used to call the first called method corresponding to the first called node as a calling chain, and finally the calling relationship of the target source file is generated according to all the calling chains. The present disclosure selects the nodes in the abstract syntax tree, extracts the calling chain between the calling method and the called method therein, and thus automatically and accurately generates the calling relationship according to the calling chain, thereby improving the generation efficiency of the calling relationship.
[0068] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0070] Figure 1 is a flow chart showing a method for generating a call relationship according to an exemplary embodiment;
[0071] Figure 2 is a schematic diagram showing a calling relationship according to an exemplary embodiment;
[0072] Figure 3 is a flow chart showing another method for generating a call relationship according to an exemplary embodiment;
[0073] Figure 4 is a flowchart of another method for generating a call relationship according to an exemplary embodiment;
[0074] Figure 5 is a schematic diagram showing another calling relationship according to an exemplary embodiment;
[0075] Figure 6 is a flow chart showing another method for generating a call relationship according to an exemplary embodiment;
[0076] Figure 7 is a flowchart of another method for generating a call relationship according to an exemplary embodiment;
[0077] Figure 8is a schematic diagram showing another calling relationship according to an exemplary embodiment;
[0078] Fig. 9 is a flowchart of another method for generating a call relationship according to an exemplary embodiment;
[0079] Fig.10 is a flowchart of another method for generating a call relationship according to an exemplary embodiment;
[0080] Fig.11 is a schematic diagram of a call relationship tree according to an exemplary embodiment;
[0081] Fig.12 is a block diagram of a device for generating a call relationship according to an exemplary embodiment;
[0082] Fig.13 is a block diagram of another device for generating a call relationship according to an exemplary embodiment;
[0083] Fig.14 is a block diagram of another device for generating a call relationship according to an exemplary embodiment;
[0084] Fig.15 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0085] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0086] Before introducing the method, device, storage medium and electronic device for generating call relations provided by the present disclosure, the application scenarios involved in each embodiment of the present disclosure are first introduced. The application scenario can be any APP, for example, it can be an APP based on the iOS platform. The code for implementing the APP is a project, which includes multiple source files. Each source file has a corresponding abstract syntax tree (English: Abstract Syntax Tree, abbreviation: AST), which is an abstract representation of the code in the source file. Among them, the abstract syntax tree can be analyzed through the ASTMatchers interface provided by Clang / LLVM. The abstract syntax tree includes multiple nodes, each of which represents a structure in the source file. For example: the ObjcMethodDecl node is a method definition node, which represents the structure of the method definition in Objective-C, including the implementation body of the method. The ObjcImplementationDecl node is a class definition node, which represents the structure of the class definition in Objective-C, including the complete implementation part of the class. The ObjcMessageExpr node is a method call node, which represents the structure of the method call in Objective-C. It can be understood that for each method call in the source file, there will be a corresponding ObjcMessageExpr node. The BlockExpr node is a block node, which represents the structure of a block expression in Objective-C, including the implementation of a block (i.e., Block). The ObjcCategoryImplDecl node is a category definition node, which represents the structure of an Objective-C definition category (i.e., Category), including the complete implementation of the category.
[0087] Figure 1 is a flowchart of a method for generating a call relationship according to an exemplary embodiment. Figure 1 As shown, the method may include the following steps:
[0088] Step 101: Obtain at least one first call node in an abstract syntax tree corresponding to a target source file, where the first call node is a method definition node.
[0089] For example, the target source file can be any source file in the target project corresponding to the APP, and the target source file can be, for example, a file in .m format. First, obtain the abstract syntax tree corresponding to the target source file, and then filter out at least one first call node from the abstract syntax tree. The first call node is a method definition node (i.e., ObjcMethodDecl node) in the abstract syntax tree. The first call node corresponds to a method, which includes the implementation body of the method, that is, the first call node is the definition of the corresponding method, rather than the declaration of the corresponding method. Furthermore, it can also be stipulated that the first call node has a parent node, and the parent node is a class definition node (i.e., ObjcImplementationDecl node). Specifically, the first matching rule (i.e., matcher) applicable to the first call node can be written according to the grammatical rules of DSL (English: Domain Specified Language, Chinese: Domain Specific Language), and then the first call node that meets the first matching rule is searched in the abstract syntax tree. The first matching rule can be, for example: ObjcMethodDecl()matcher.
[0090] Step 102: For each first call node, obtain the child nodes of the first call node in the abstract syntax tree.
[0091] Step 103, determining a first called node corresponding to the first calling node in the child nodes of the first calling node, the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes.
[0092] Step 104: The first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as a calling chain.
[0093] For example, for each first call node in at least one first call node, the child nodes of the first call node in the abstract syntax tree are obtained. The child nodes of the first call node may be one or more. Then, among the child nodes of the first call node, the first called node is screened out. The first called node also corresponds to a method. The first called node may be one or more. The first called node satisfies two conditions: condition one, the first called node is a method call node; condition two, the child nodes (which may be one or more) of the first called node in the abstract syntax tree do not include a block node (i.e., BlockExpr node). Among them, condition one can be understood as the method corresponding to the first call node calls the method corresponding to the first called node. Condition two can be understood as the parameters in the first called node do not include a block, that is, the method corresponding to the first called node does not call the method defined in the block. It should be noted that if the child nodes of the first call node do not exist in the abstract syntax tree, it means that the method corresponding to the first call node does not call other methods (the first call node may be called by other methods). It should be noted that the method corresponding to the first calling node and the method corresponding to the first called node can be understood as ordinary OC methods in the target source file, that is, methods that do not belong to blocks or categories.
[0094] After determining the first calling node and the corresponding first called node, the first calling method corresponding to the first calling node and the first called method corresponding to the first called node can be determined, and then the first calling method calls the first called method as a call chain. It should be noted that if there is only one first called node, then a call chain is obtained in step 104. If there are N (N is a natural number greater than 1) first called nodes, then step 104 can be executed N times to obtain N call chains. Among them, the call chain can be understood as the calling method (i.e., caller) calling the called method (i.e., callee), that is, the call chain consists of the calling method and the called method. If the call chain is represented by a directed edge, then the call chain is the edge from the calling method to the called method. For example, when determining the first calling method, the first calling method can be marked as caller, and the first called method can be marked as callee, so that the call chain is the edge from caller to callee.
[0095] Step 105: Generate a calling relationship of the target source file based on all calling chains.
[0096] For example, after obtaining the call chains of all the first call nodes, the call relationship of the target source file can be generated based on all the call chains. The call relationship can be understood as a collection of multiple call chains. If the call chain is represented by a directed edge, the call relationship can be represented by a directed graph. The same methods in multiple call chains can be merged to obtain a call relationship, where the same method can be understood as two methods with the same method name, and the class name of the class to which the two methods belong is also the same. Take the example of obtaining two first call nodes in step 101, corresponding to two first call methods: [Method A of class a], and [Method B of class b]. After executing steps 102 to 104 for each first call node, call chain 1 is obtained: [Method A of class a] calls [Method C of class a], call chain 2: [Method A of class a] calls [Method D of class b], call chain 3: [Method B of class b] calls [Method A of class a], such as Figure 2 Then, when generating the call relationship based on the above three call chains, the called function in call chain 3 (i.e. [class a method A]) is the same as the calling function in call chain 1 (i.e. [class a method A]), and they can be merged to obtain the call relationship as follows: Figure 2 As shown in (b) in .
[0097] In this way, the present disclosure selects the first calling node from the abstract syntax tree corresponding to the source file, and then matches the corresponding first called node for each first calling node, so that the call chain between the calling method and the called method included in the source file can be extracted, and finally the call relationship of the source file is generated according to all the call chains included in the source file, and the call relationship can be automatically and accurately obtained. There is no need for technicians to perform source code analysis, nor is there a need to manually write matching functions, which effectively improves the efficiency of generating call relationships.
[0098] In summary, the present disclosure firstly selects at least one first calling node in the abstract syntax tree corresponding to the target source file, the first calling node is a method definition node, and then for each first calling node, the child node of the first calling node is searched in the abstract syntax tree, and then the corresponding first called node in the child node of the first calling node is determined, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes, and then the first calling method corresponding to the first calling node is used to call the first called method corresponding to the first called node as a calling chain, and finally the calling relationship of the target source file is generated according to all the calling chains. The present disclosure selects the nodes in the abstract syntax tree, extracts the calling chain between the calling method and the called method therein, and thus automatically and accurately generates the calling relationship according to the calling chain, thereby improving the generation efficiency of the calling relationship.
[0099] In one implementation, the method of obtaining the first calling node in step 101 may be:
[0100] At least one first call node is determined from all method definition nodes included in the abstract syntax tree, each first call node has a corresponding first-class node, the first-class node is the parent node of the first call node, and the first-class node is a class definition node.
[0101] For example, since Objective-C requires that each method must belong to a certain class, the first call node can be further limited: in the abstract syntax tree, the first call node has a corresponding first-class node, where the first-class node meets two conditions: condition one: the first-class node is a class definition node; condition two, the first-class node is the parent node of the first call node. Among them, condition one means that the first-class node corresponds to a class, which includes the complete implementation part of the class. Condition two means that the method corresponding to the first call node belongs to the class corresponding to the first-class node, that is, the method corresponding to the first call node is defined in the class corresponding to the first-class node. If there is a method definition node in the abstract syntax tree that does not belong to any class (that is, there is no corresponding first-class node), then this method definition node is not a first call node, and this method definition node can be filtered out. Specifically, according to the grammar rules of DSL, a second matching rule applicable to the first-class node can be written, and then the first-class node that meets the second matching rule can be found in the abstract syntax tree. The second matching rule can be, for example: ObjcImplementationDecl()matcher.
[0102] Figure 3 is a flowchart of another method for generating a call relationship according to an exemplary embodiment. Figure 3 As shown, before step 104, the method may further include:
[0103] Step 106: Obtain a first type of node corresponding to the first calling node.
[0104] Step 107, based on the first calling node and the corresponding first class node, obtain the method name of the first calling node and the class name to which the first calling node belongs to determine the first calling method, and based on the first called node, obtain the method name of the first called node and the class name to which the first called node belongs to determine the first called method.
[0105] For example, to uniquely identify a method in the target project, you need to know the method name and class name of the method, that is, you need to identify a method from two dimensions, namely, the method name of the method and the class name of the class to which the method belongs. Then, to determine the first calling method and the first called method, you need to know the method name and class name of the first calling method, and the method name and class name of the first called method, respectively. Since the method name and class name of a method are specified when it is called (corresponding to the method calling node), the first called node can be directly parsed to obtain the method name of the first called method and the class name to which the first called method belongs. Since a method may only indicate the method name when it is defined (corresponding to the method definition node), by parsing the first calling node, only the method name of the first calling method can be obtained. To obtain the class name of the first calling method, you also need to first obtain the first class node corresponding to the first calling node, and then parse the first class node to obtain the class name to which the first calling method belongs.
[0106] Figure 4 is a flowchart of another method for generating a call relationship according to an exemplary embodiment. Figure 4 As shown, after step 102, the method may further include the following steps:
[0107] Step 108: Determine, among the child nodes of the first calling node, at least one second called node corresponding to the first calling node, where the second called node is a method calling node.
[0108] Step 109: For each second called node, obtain the parent node of the second called node in the abstract syntax tree.
[0109] Step 110, in the parent node of the second called node, determine the second calling node corresponding to the second called node, the second calling node is a method calling node, and the child nodes of the second calling node include block nodes.
[0110] Step 111: The second calling method corresponding to the second calling node calls the second called method corresponding to the second called node as a calling chain.
[0111] For example, in addition to ordinary OC methods, the target source file may also contain methods defined in blocks, so the call chain corresponding to the methods defined in the block can be further screened out from the abstract syntax tree. First, for each first call node determined in step 101, the child nodes (which may be one or more) of the first call node are determined, and then at least one second called node of the method call node is determined in the child nodes of the first call node. The second called node also corresponds to a method. In other words, the method corresponding to the first call node calls the method corresponding to the second called node. Afterwards, for each second called node, the parent node of the second called node is searched in the abstract syntax tree, and the second call node (which may be one or more) is determined in the parent node of the second called node, and the second call node also corresponds to a method. The second call node satisfies two conditions: Condition 1: The second call node is a method call node; Condition 2, the child nodes of the second call node include block nodes. Among them, Condition 1 indicates that the method corresponding to the second call node calls the method corresponding to the second called node. Condition 2 indicates that the second call node may have one or more child nodes, including a block node, that is, in the method corresponding to the second call node, the called method is the method defined in the block.
[0112] The second calling method corresponding to the second calling node calls the second called method corresponding to the second called node as a calling chain, and the calling chain corresponding to the method defined in the block can be obtained. Among them, since the second calling node and the second called node are both method calling nodes, the method name of the second calling method and the class name to which it belongs can be obtained by parsing the second calling node to determine the second calling method. Similarly, the method name of the second called method and the class name to which it belongs can be obtained by parsing the second called node to determine the second called method. It should be noted that if there is only one second calling node, then a calling chain is obtained in step 111. If there are M (M is a natural number greater than 1) second calling nodes, then step 111 can be executed M times to obtain M calling chains.
[0113] After obtaining the call chain corresponding to the method defined in the block, correspondingly, step 105 can aggregate the call chain corresponding to the ordinary OC method and the call chain corresponding to the method defined in the block to obtain the call relationship of the target source file. Take the call chain 4 obtained by executing steps 108 to 111: [class b method B] calls [class g method G] as an example, where [class g method G] is the method defined in the block (that is, the method corresponding to the second called node), and [class b method B] is an ordinary OC method (that is, the method corresponding to the second calling node). Figure 2 Based on the call relationship shown in (b) in FIG. 1 , the call relationship of the aggregated call chain 4 can be as follows: Figure 5 shown.
[0114] In this way, the present disclosure can also extract the call chain corresponding to the method defined in the block from the abstract syntax tree, further improving the accuracy and completeness of the call relationship, so that the call relationship can cover the method defined in the block, thereby also expanding the scope of application of the call relationship.
[0115] Figure 6 is a flowchart of another method for generating a call relationship according to an exemplary embodiment. Figure 6 Therefore, before step 105, the method may further include:
[0116] Step 112, obtaining at least one third call node in the abstract syntax tree, the third call node is a method definition node, and the third call node has a corresponding third type node, the third type node is the parent node of the third call node, and the third type node is a classification definition node.
[0117] For example, in addition to ordinary OC methods, the target source file may also contain methods defined in the classification. Therefore, the call chain corresponding to the method defined in the classification can be further screened out from the abstract syntax tree. First, at least one third call node is screened out in the abstract syntax tree. Among them, the third call node meets two conditions: Condition 1: The third call node is a method definition node; Condition 2: The third call node has a corresponding third-type node, the third-type node is the parent node of the third call node, and the third-type node is a classification definition node (i.e., ObjcCategoryImplDecl node). Among them, Condition 1 indicates that the third call node corresponds to a method, which includes the implementation body of the method, that is, the third call node is the definition of the corresponding method, not the declaration of the corresponding method. Condition 2 indicates that the method corresponding to the third call node belongs to the class corresponding to the third-type node, that is, the class corresponding to the third-type node defines the method corresponding to the third call method. It can be understood that the method corresponding to the third call node is a method defined in the classification in the abstract syntax tree. Specifically, a third matching rule applicable to the third type of node can be written according to the grammar rule of DSL, and then the third type of node that meets the third matching rule can be searched in the abstract syntax tree. The third matching rule can be, for example: ObjcCategoryImplDecl()matcher.
[0118] Step 113: For each third call node, obtain the child nodes of the third call node in the abstract syntax tree.
[0119] Step 114, determining a third called node corresponding to the third calling node in the child nodes of the third calling node, where the third called node is a method calling node.
[0120] Step 115: The third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain.
[0121] For example, for each third call node in at least one third call node, obtain the child nodes of the third call node in the abstract syntax tree, and the child nodes of the third call node can be one or more. Then, among the child nodes of the third call node, filter out the third called node, and the third called node also corresponds to a method, and the third called node can be one or more. The third called node is a method calling node, that is, the method corresponding to the third call node calls the method corresponding to the third called node. It should be noted that if the child nodes of the third call node do not exist in the abstract syntax tree, it means that the method corresponding to the third call node does not call other methods (the third call node may be called by other methods).
[0122] After determining the third calling node and the corresponding third called node, the third calling method corresponding to the third calling node and the third called method corresponding to the third called node can be determined, and then the third calling method and the third called method are used as a call chain to obtain the call chain corresponding to the method defined in the classification. It should be noted that if there is only one third called node, then one call chain is obtained in step 115, and if there are P (P is a natural number greater than 1) third called nodes, then step 104 can be executed P times to obtain P call chains.
[0123] Figure 7 is a flowchart of another method for generating a call relationship according to an exemplary embodiment. Figure 7 As shown, before step 115, the method further includes:
[0124] Step 116, obtaining a third type of node corresponding to the third calling node.
[0125] Step 117, based on the third calling node and the corresponding third class node, obtain the method name of the third calling node and the class name to which the third calling node belongs to determine the third calling method, and based on the third called node, obtain the method name of the third called node and the class name to which the third called node belongs to determine the third called method.
[0126] For example, the third called node can be directly parsed in the same manner as in steps 106 and 107 to obtain the method name of the third called method and the class name to which the third called method belongs, thereby determining the third called method. The method name of the third calling method is obtained by parsing the third calling node. The third class node corresponding to the third calling node is then obtained, and then the third class node is parsed to obtain the class name to which the third calling method belongs, thereby determining the third calling method.
[0127] After obtaining the call chain corresponding to the method defined in the classification, correspondingly, step 105 can aggregate the call chain corresponding to the ordinary OC method and the call chain corresponding to the method defined in the classification, and can further aggregate the call chain corresponding to the method defined in the block to obtain the call relationship of the target source file. Take executing steps 112 to 115 to obtain call chain 5: [class h method H] calls [class b method D] as an example, where [class h method H] is the method defined in the classification (that is, the method corresponding to the third calling node), and [class b method D] is an ordinary OC method (that is, the method corresponding to the third called node). Figure 5 Based on the call relationship shown in FIG. 1 , the call relationship of the aggregated call chain 5 can be as follows: Figure 8 shown.
[0128] In this way, the present disclosure can also extract the call chain corresponding to the method defined in the classification from the abstract syntax tree, further improving the accuracy and completeness of the call relationship, so that the call relationship can cover the method defined in the classification, thereby also expanding the scope of application of the call relationship.
[0129] Fig. 9 is a flowchart of another method for generating a call relationship according to an exemplary embodiment. Fig. 9 As shown, step 105 can be implemented in the following manner:
[0130] Step 1051, if the calling method included in the first calling chain has an implicit call when calling the called method included in the first calling chain, obtain the attribute information of the called method included in the first calling chain, the attribute information includes parameter information and / or return value information, and the first calling chain is any calling chain in all calling chains.
[0131] Step 1052: Determine an implicit call chain according to the attribute information of the called method included in the first call chain.
[0132] Step 1053, generating a calling relationship of the target source file according to the implicit calling chain and the entire calling chain.
[0133] For example, in addition to ordinary OC methods, methods defined in blocks, and methods defined in categories, there may also be implicit calls in the target source file. Since there is no method call node corresponding to the implicit call in the abstract syntax tree, when generating the call relationship of the target source file, it can be determined in turn whether there is an implicit call in each call chain, so as to obtain the implicit call chain corresponding to the implicit call, and finally generate the call relationship of the target source file according to the implicit call chain and all call chains. Specifically, taking the first call chain as an example, the first call chain consists of a calling method and a called method, that is, a calling method calls a called method. Then, it can be determined whether there is an implicit call when the calling method included in the first call chain calls the called method included in the first call chain. Since the number of implicit calls is limited, it can be determined whether there is an implicit call by exhaustive enumeration. If the calling method included in the first call chain has an implicit call when calling the called method included in the first call chain, then the attribute information of the called method included in the first call chain is obtained, and the attribute information may include parameter information, and / or return value information. Then, according to the attribute information of the called method included in the first call chain, an implicit call chain is determined. The implicit call chain can be one or more. The implicit call chain can make the first call chain more complete. It can be understood that the first call chain is a coarse-grained call, while the implicit call chain can complete the specific call mechanism between the calling method and the called method included in the first call chain.
[0134] Specifically, if the called method included in the first call chain includes a node that starts an Activity, then the node is used as the calling method, and the Activity node started by the node is used as the called method, to obtain an implicit call chain of the first call chain. If the called method included in the first call chain includes a node that starts a Service, then the node is used as the calling method, and the Service node started by the node is used as the called method, to obtain an implicit call chain of the first call chain. If the called method included in the first call chain includes a node that Registers Receiver, then the node is used as the calling method, and the Broadcast Receiver node registered by the node is used as the called method, to obtain an implicit call chain of the first call chain. If the called method included in the first call chain includes a node that sends a broadcast, then the node is used as the calling method, and the Broadcast Receiver node that receives the broadcast sent by the node is used as the called method, to obtain an implicit call chain of the first call chain.
[0135] Take the call chain 1 as an example, [Class a Method A] calls [Class a Method C]. According to the property information of [Class a Method C], it is determined that it includes a Register Receiver node. Then find the Broadcast Receiver node registered by the Register Receiver node, and get an implicit call chain from Register Receiver to Broadcast Receiver. Then the call chain 1 can be expanded to [Class a Method A] points to Register Receiver, RegisterReceiver points to Broadcast Receiver, and Broadcast Receiver points to [Class a Method C].
[0136] Fig.10 is a flowchart of another method for generating a call relationship according to an exemplary embodiment, wherein there are multiple target source files, and the target source files belong to a target project. After step 105, the method may further include:
[0137] Step 118, generating a call relationship tree of the target project according to the call relationships of the multiple target source files.
[0138] For example, the target project corresponding to the APP may include multiple target source files. The above method for generating a call relationship is executed for each target source file to obtain the call relationship of each target source file. Then, the call relationships of all target source files can be aggregated to obtain the call relationship tree of the target project. For example, the compilation database provided by iOS (for example, Clang compilation database) can be used to know how each target source file is compiled. Then, a batch script can be written to process all target source files to obtain a file containing the call relationship of each target source file (for example, a file in .json format). The batch script can first obtain the abstract syntax tree corresponding to the target source file, then filter the nodes therein according to the preset filtering conditions, then execute the above method for generating a call relationship, and finally format it to obtain a .json file including the call relationship. The preset filtering condition can be a blacklist, which records the specified filtering method, such as methods in a third-party library, etc. For example, the target project includes 3 target source files: 1.m, 2.m and 3.m. The 3 target source files are processed by a batch script to obtain the corresponding 1.json, 2.json and 3.json.
[0139] The call relationship tree can be understood as a collection of multiple call relationships. If directed edges are used to represent the call chain and directed graphs are used to represent the call relationship, the call relationship tree can also be represented by directed graphs. The same methods in multiple call relationships can be aggregated to obtain a call relationship tree. The same method can be understood as two methods with the same method name and the class name of the class to which the two methods belong is also the same. For example, the target project includes two target source files. The call relationship of one of the target source files is as follows: Figure 2 As shown in (b) in the figure, the call relationship of another target source file includes three call chains: call chain 6: [class d method D] calls [class a method A], call chain 7: [class d method D] calls [class e method E], call chain 8: [class e method E] calls [class e method F]. The call relationship tree of the target project can be obtained by aggregating the call relationships of the two target source files. Fig.11 shown.
[0140] In this way, the present disclosure can also obtain calling relationships across files, thereby aggregating the calling relationship tree of the target project, further expanding the application scope of the calling relationship.
[0141] In summary, the present disclosure firstly selects at least one first calling node in the abstract syntax tree corresponding to the target source file, the first calling node is a method definition node, and then for each first calling node, the child node of the first calling node is searched in the abstract syntax tree, and then the corresponding first called node in the child node of the first calling node is determined, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes, and then the first calling method corresponding to the first calling node is used to call the first called method corresponding to the first called node as a calling chain, and finally the calling relationship of the target source file is generated according to all the calling chains. The present disclosure selects the nodes in the abstract syntax tree, extracts the calling chain between the calling method and the called method therein, and thus automatically and accurately generates the calling relationship according to the calling chain, thereby improving the generation efficiency of the calling relationship.
[0142] Fig.12 is a block diagram of a device for generating a call relationship according to an exemplary embodiment. Fig.12 As shown, the device 200 includes:
[0143] The first acquisition module 201 is configured to acquire at least one first call node in an abstract syntax tree corresponding to a target source file, where the first call node is a method definition node.
[0144] The second acquisition module 202 is configured to acquire, for each first calling node, the child nodes of the first calling node in the abstract syntax tree. Among the child nodes of the first calling node, determine the first called node corresponding to the first calling node, the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes. The first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as a call chain.
[0145] The first generating module 203 is configured to generate a calling relationship of the target source file according to all calling chains.
[0146] In one implementation, the first acquisition module 201 is configured to:
[0147] At least one first call node is determined from all method definition nodes included in the abstract syntax tree, each first call node has a corresponding first-class node, the first-class node is the parent node of the first call node, and the first-class node is a class definition node.
[0148] In another implementation, the second acquisition module 202 is further configured to:
[0149] Before the first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as the calling chain of the first calling node, a first type of node corresponding to the first calling node is obtained.
[0150] According to the first calling node and the corresponding first class node, the method name of the first calling node and the class name to which the first calling node belongs are obtained to determine the first calling method, and according to the first called node, the method name of the first called node and the class name to which the first called node belongs are obtained to determine the first called method.
[0151] In another implementation, the second acquisition module 202 is further configured to:
[0152] After acquiring the child nodes of the first calling node in the abstract syntax tree, at least one second called node corresponding to the first calling node is determined in the child nodes of the first calling node, and the second called node is a method calling node.
[0153] For each second called node, obtain the parent node of the second called node in the abstract syntax tree.
[0154] In the parent node of the second called node, a second calling node corresponding to the second called node is determined, the second calling node is a method calling node, and the child nodes of the second calling node include block nodes.
[0155] The second calling method corresponding to the second calling node calls the second called method corresponding to the second called node as a calling chain.
[0156] In another implementation, the second acquisition module 202 is further configured to:
[0157] At least one third call node in the abstract syntax tree is obtained, the third call node is a method definition node, and the third call node has a corresponding third type node, the third type node is a parent node of the third call node, and the third type node is a classification definition node.
[0158] For each third call node, obtain the child nodes of the third call node in the abstract syntax tree.
[0159] In the child nodes of the third calling node, a third called node corresponding to the third calling node is determined, and the third called node is a method calling node.
[0160] The third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain.
[0161] In another implementation, the second acquisition module 202 is further configured to:
[0162] Before the third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain, the third type node corresponding to the third calling node is obtained.
[0163] According to the third calling node and the corresponding third class node, the method name of the third calling node and the class name to which the third calling node belongs are obtained to determine the third calling method, and according to the third called node, the method name of the third called node and the class name to which the third called node belongs are obtained to determine the third called method.
[0164] Fig.13 is a block diagram of another device for generating a call relationship according to an exemplary embodiment. Fig.13 As shown, the first generation module 203 includes:
[0165] The acquisition submodule 2031 is configured to acquire the attribute information of the called method included in the first call chain if there is an implicit call when the calling method included in the first call chain calls the called method included in the first call chain, the attribute information including parameter information and / or return value information, and the first call chain is any call chain among all call chains.
[0166] The determination submodule 2032 is configured to determine the implicit call chain according to the attribute information of the called method included in the first call chain.
[0167] The generation submodule 2033 is configured to generate a call relationship of the target source file according to the implicit call chain and the entire call chain.
[0168] Fig.14 is a block diagram of another device for generating a call relationship according to an exemplary embodiment. Fig.14 As shown, the device 200 also includes:
[0169] The second generating module 204 is configured to generate a calling relationship tree of the target project according to the calling relationships of the multiple target source files.
[0170] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0171] In summary, the present disclosure firstly selects at least one first calling node in the abstract syntax tree corresponding to the target source file, the first calling node is a method definition node, and then for each first calling node, the child node of the first calling node is searched in the abstract syntax tree, and then the corresponding first called node in the child node of the first calling node is determined, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes, and then the first calling method corresponding to the first calling node is used to call the first called method corresponding to the first called node as a calling chain, and finally the calling relationship of the target source file is generated according to all the calling chains. The present disclosure selects the nodes in the abstract syntax tree, extracts the calling chain between the calling method and the called method therein, and thus automatically and accurately generates the calling relationship according to the calling chain, thereby improving the generation efficiency of the calling relationship.
[0172] Fig.15 FIG. 1 is a block diagram of an electronic device 300 according to an exemplary embodiment. Fig.15 As shown, the electronic device 300 may include: a processor 301 , a memory 302 . The electronic device 300 may also include one or more of a multimedia component 303 , an input / output (I / O) interface 304 , and a communication component 305 .
[0173] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps in the method for generating the call relationship. The memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include, for example, instructions for any application or method used to operate on the electronic device 300, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, disk or optical disk. The multimedia component 303 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 302 or sent through the communication component 305. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 304 provides an interface between the processor 301 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 305 is used for wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 305 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0174] In an exemplary embodiment, the electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned method of generating a call relationship.
[0175] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the method for generating a call relationship described above are implemented. For example, the computer-readable storage medium may be the memory 302 including the program instructions described above, and the program instructions may be executed by the processor 301 of the electronic device 300 to complete the method for generating a call relationship described above.
[0176] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned method for generating a call relationship when executed by the programmable device.
[0177] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, those skilled in the art can easily conceive of other implementation plans of the present disclosure after considering the specification and practicing the present disclosure, and all of them belong to the protection scope of the present disclosure.
[0178] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. At the same time, the various different embodiments of the present disclosure can also be combined arbitrarily, as long as they do not violate the ideas of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure. The present disclosure is not limited to the precise structure described above, and the scope of the present disclosure is limited only by the attached claims.
Claims
1. A method for generating a call relationship, characterized in that: The method comprises: Obtain at least one first call node in an abstract syntax tree corresponding to a target source file, where the first call node is a method definition node; For each of the first call nodes, obtaining a child node of the first call node in the abstract syntax tree; Determine, among the child nodes of the first calling node, a first called node corresponding to the first calling node, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include a block node; The first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as a calling chain; Generate a calling relationship of the target source file according to all the calling chains; The step of obtaining at least one first call node in the abstract syntax tree corresponding to the target source file includes: Determine the at least one first call node from all method definition nodes included in the abstract syntax tree, each of the first call nodes has a corresponding first-type node, the first-type node is a parent node of the first call node, and the first-type node is a class definition node; Before the first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as a calling chain, the method further includes: Obtaining the first type of node corresponding to the first calling node; According to the first calling node and the corresponding first class node, the method name of the first calling node and the class name to which the first calling node belongs are obtained to determine the first calling method, and according to the first called node, the method name of the first called node and the class name to which the first called node belongs are obtained to determine the first called method.
2. The method according to claim 1, characterized in that After obtaining the child nodes of the first call node in the abstract syntax tree, the method further includes: Determine, among the child nodes of the first calling node, at least one second called node corresponding to the first calling node, where the second called node is a method calling node; For each of the second called nodes, obtaining a parent node of the second called node in the abstract syntax tree; In the parent node of the second called node, a second calling node corresponding to the second called node is determined, wherein the second calling node is a method calling node, and child nodes of the second calling node include block nodes; The second calling method corresponding to the second calling node calls the second called method corresponding to the second called node as a calling chain.
3. The method according to claim 1, characterized in that Before generating the calling relationship of the target source file according to all the calling chains, the method further includes: Acquire at least one third call node in the abstract syntax tree, wherein the third call node is a method definition node, and the third call node has a corresponding third type node, the third type node is a parent node of the third call node, and the third type node is a classification definition node; For each of the third call nodes, obtaining a child node of the third call node in the abstract syntax tree; Determine, in the child nodes of the third calling node, a third called node corresponding to the third calling node, wherein the third called node is a method calling node; The third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain.
4. The method according to claim 3, characterized in that Before the third calling method corresponding to the third calling node calls the third called method corresponding to the third called node as a calling chain, the method further includes: Obtain the third type node corresponding to the third calling node; According to the third calling node and the corresponding third class node, the method name of the third calling node and the class name to which the third calling node belongs are obtained to determine the third calling method, and according to the third called node, the method name of the third called node and the class name to which the third called node belongs are obtained to determine the third called method.
5. The method according to any one of claims 1 to 4, characterized in that Generating the calling relationship of the target source file according to all the calling chains includes: If a calling method included in a first calling chain has an implicit call when calling a called method included in the first calling chain, obtaining attribute information of the called method included in the first calling chain, the attribute information including parameter information and / or return value information, and the first calling chain is any calling chain in all the calling chains; Determine an implicit call chain according to the attribute information of the called method included in the first call chain; The calling relationship of the target source file is generated according to the implicit calling chain and all the calling chains.
6. The method according to any one of claims 1 to 4, characterized in that There are multiple target source files, and the target source files belong to a target project. After generating the call relationship of the target source files according to all the call chains, the method further includes: A calling relationship tree of the target project is generated according to the calling relationships of the plurality of target source files.
7. A device for generating a call relationship, characterized in that: The device comprises: A first acquisition module is configured to acquire at least one first call node in an abstract syntax tree corresponding to a target source file, wherein the first call node is a method definition node; The second acquisition module is configured to acquire, for each of the first calling nodes, the child nodes of the first calling node in the abstract syntax tree; determine, among the child nodes of the first calling node, a first called node corresponding to the first calling node, wherein the first called node is a method calling node, and the child nodes of the first called node in the abstract syntax tree do not include block nodes; and use the first calling method corresponding to the first calling node to call the first called method corresponding to the first called node as a call chain; A first generating module is configured to generate a calling relationship of the target source file according to all the calling chains; The step of obtaining at least one first call node in the abstract syntax tree corresponding to the target source file includes: Determine the at least one first call node from all method definition nodes included in the abstract syntax tree, each of the first call nodes has a corresponding first-type node, the first-type node is a parent node of the first call node, and the first-type node is a class definition node; The second acquisition module is further configured to, before the first calling method corresponding to the first calling node calls the first called method corresponding to the first called node as a calling chain, Obtaining the first type of node corresponding to the first calling node; According to the first calling node and the corresponding first class node, the method name of the first calling node and the class name to which the first calling node belongs are obtained to determine the first calling method, and according to the first called node, the method name of the first called node and the class name to which the first called node belongs are obtained to determine the first called method.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.
9. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Python-oriented function calling path (FCP) generation method and system
CN107704382A
Method and device for determining useless functions in engineering codes
CN107729015A