Code flow tracking method and system
By analyzing function codes and constructing call relationships for computer programs, multi-level tracking analysis and visual display of different function codes within the program are achieved, which solves the problem that the program cannot be understood in real time in the existing technology and improves the program's ability Control and security.
Patent Information
- Application Number
- CN202210312500.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-28
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-03-28
AI Technical Summary
The existing technology is difficult to visualize the real-time operation of different function codes in computer programs, which leads to the inability to accurately determine the corresponding links of the function codes that occur during the program operation, which reduces the degree of visualization of program operation monitoring. and operational safety and stability.
By analyzing the program, identifying all function codes, and identifying the source code part and trigger code parts of each group of function codes, a collection of code trigger relationship information is constructed. Then, based on the running status information of all function codes during the test run, a collection of call logical relationship information between different function codes is determined, and a call relationship structure model is constructed. Finally, the calling relationship structure model is secondaryly expanded according to the code-triggered relationship information set and displayed in a visual tracking flow chart.
It realizes multi-level tracking and analysis of program function code, dynamically synchronously displays visual tracking flow charts, and tracks program operation in real time, improving the controllability and security of program operation.
Smart Images

Figure CN114816996B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of code data management, and in particular to a code flow tracking method and system. Background Art
[0002] Computer programs are usually composed of a large number of function codes. Each function code is a separate function unit that calculates and processes the input information and outputs the corresponding calculation results. In a computer program, there may be a logical relationship between calling and being called between different function codes. When the computer program is edited, designed and tested, it will be packaged and directly handed over to the user. When the user uses the computer program, it is impossible to visualize the real-time operation of different function codes inside the computer program. When an unexpected failure occurs during the operation of the computer program, the user cannot accurately determine the link corresponding to the function code where the unexpected failure occurs, and cannot track the operation of the computer program in real time, thereby reducing the visualization of the computer program operation monitoring and the safety and stability of the computer program operation. Summary of the invention
[0003] In view of the defects existing in the prior art, the present invention provides a code flow tracing method and system, which analyzes a program to obtain all the function codes contained therein, and identifies the source code part and the trigger code part of each group of function codes to obtain a code trigger relationship information set; then, based on the running status information of all function codes in the test running process of the program, a call logic relationship information set between different function codes is determined, so as to construct a call relationship structure model for all function codes; finally, based on the code trigger relationship information set, the call relationship structure model is secondary expanded, and the expanded call relationship structure model is displayed in the form of a visual tracing flowchart, which performs multi-level tracing analysis on the function code of the program from two aspects: the trigger relationship between different code parts within the function code and the call relationship between different groups of function codes, and also dynamically and synchronously displays the corresponding visual tracing flowchart, so as to track the program running status in real time and improve the controllability and security of the program running.
[0004] The present invention provides a code flow tracking method, which comprises the following steps:
[0005] Step S1, scanning and analyzing the program, identifying all function codes contained in the program, and assigning corresponding identification tags to each group of function codes; extracting corresponding source code parts and trigger code parts from each group of function codes, thereby forming a code trigger relationship information set within each group of function codes;
[0006] Step S2, collecting the running status information of all function codes of the program during the test running process, and determining the call logic relationship information set between all function codes during the running process of the program according to the running status information; and constructing a call relationship structure model of all function codes according to the identification mark and the call logic relationship information set;
[0007] Step S3, according to the code trigger relationship information set, the trigger relationship of each group of function codes in the calling relationship structure model is expanded to obtain an extended calling relationship structure model; the extended calling relationship structure model is displayed in the form of a visual tracking flowchart.
[0008] Furthermore, in step S1, the program is scanned and analyzed to identify all function codes contained in the program, and a corresponding identification mark is assigned to each group of function codes; the corresponding source code part and trigger code part are extracted from each group of function codes, so as to form a code trigger relationship information set within each group of function codes, which specifically includes:
[0009] Step S101, using program static analysis software to scan and analyze the program line by line, identify each function code line contained in the program; then analyze the adjacent function code lines to determine whether the two adjacent function code lines have the same function correlation; if they have the same function correlation, all function code lines with the same function correlation are identified and marked as the same group of function codes;
[0010] Step S102, detecting the same set of function codes to determine whether there is a code editing vulnerability in the same set of function codes; if there is a code editing vulnerability, checking and repairing all codes in the same set of function codes;
[0011] Step S103, extracting the source code part and the trigger code part for running the corresponding function from each group of function codes; constructing a code matching group about the source code part and the trigger code part, wherein the code matching group includes the trigger association information between the source code part and the trigger code part; and then combining all the code matching groups together to form a code trigger relationship information set within each group of function codes themselves.
[0012] Further, in the step S2, the running state information of all function codes of the program during the test running process is collected, and according to the running state information, a call logic relationship information set between all function codes during the running process of the program is determined; and according to the identification mark and the call logic relationship information set, a call relationship structure model of all function codes is constructed, which specifically includes:
[0013] Step S201, collecting function input information and function output information of all function codes of the program during the test operation process, and using this as the operation status information;
[0014] Step S202, determining whether the function output information of one of the function codes belongs to the function input information of another function code, and if so, determining that there is a calling logic relationship between the two function codes, thereby obtaining a calling logic relationship information set between all the function codes during the running of the program;
[0015] Step S203: constructing a call relationship structure model between different groups of function codes according to the identification mark and the call logic relationship information set.
[0016] Further, in the step S3, according to the code trigger relationship information set, the trigger relationship of each group of function codes in the call relationship structure model is expanded to obtain an extended call relationship structure model; and the extended call relationship structure model is displayed in the form of a visual tracking flowchart, which specifically includes:
[0017] Step S301, according to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes included in the call relationship structure model is extended and indexed, so as to obtain an extended call relationship structure model;
[0018] Step S302, converting the extended call relationship model into a visual tracking flowchart, and synchronously uploading the visual tracking flowchart to the terminal running the program;
[0019] Step S303, when the terminal runs the program, according to the actual progress of the terminal running the program, instructing the visual tracking flowchart to perform dynamic synchronous display.
[0020] The present invention also provides a code flow tracking system, which includes a function code analysis and processing module, a function code call relationship determination module, a call relationship structure model expansion module and a call relationship model visualization processing module; wherein,
[0021] The function code analysis and processing module is used to scan and analyze the program, identify all function codes contained in the program, and assign corresponding identification marks to each group of function codes; extract the corresponding source code part and trigger code part from each group of function codes, so as to form a code trigger relationship information set within each group of function codes;
[0022] The function code call relationship determination module is used to collect the running status information of all function codes of the program during the test running process, and determine the call logic relationship information set between all function codes during the running process of the program according to the running status information; and construct a call relationship structure model for all function codes according to the identification mark and the call logic relationship information set;
[0023] The calling relationship structure model extension module is used to extend the trigger relationship of each group of function codes in the calling relationship structure model according to the code trigger relationship information set, so as to obtain an extended calling relationship structure model;
[0024] The call relationship model visualization processing module is used to display the extended call relationship structure model in the form of a visual tracking flow chart.
[0025] Furthermore, the function code analysis and processing module is used to scan and analyze the program, identify all function codes contained in the program, and assign corresponding identification tags to each group of function codes; extract the corresponding source code part and trigger code part from each group of function codes, so as to form a code trigger relationship information set within each group of function codes, which specifically includes:
[0026] Use program static analysis software to scan and analyze the program line by line to identify each function code line contained in the program; then analyze the adjacent function code lines to determine whether the two adjacent function code lines have the same function correlation; if they have the same function correlation, all function code lines with the same function correlation are identified and marked as the same group of function codes;
[0027] Detect the same set of function codes to determine whether there are code editing vulnerabilities in the same set of function codes; if there are code editing vulnerabilities, check and repair all codes within the same set of function codes;
[0028] Extract the source code part and the trigger code part for running the corresponding function from each group of function codes; construct a code matching group about the source code part and the trigger code part, the code matching group includes the trigger association information between the source code part and the trigger code part; and then combine all the code matching groups into a set of code trigger relationship information within each group of function codes themselves.
[0029] Further, the function code call relationship determination module is used to collect the running status information of all function codes of the program during the test running process, and determine the call logic relationship information set between all function codes during the running process of the program according to the running status information; and constructing the call relationship structure model of all function codes according to the identification mark and the call logic relationship information set specifically includes:
[0030] Collecting function input information and function output information of all function codes of the program during the test running process as the running status information;
[0031] Determine whether the function output information of one of the function codes belongs to the function input information of another function code. If so, determine that there is a calling logic relationship between the two function codes, thereby obtaining a calling logic relationship information set between all function codes during the running of the program;
[0032] According to the identification mark and the call logic relationship information set, a call relationship structure model between different groups of function codes is constructed.
[0033] Further, the calling relationship structure model extension module is used to expand the trigger relationship of each group of function codes in the calling relationship structure model according to the code trigger relationship information set, so as to obtain an extended calling relationship structure model, which specifically includes:
[0034] According to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes included in the call relationship structure model is extended and indexed, thereby obtaining an extended call relationship structure model;
[0035] as well as,
[0036] The calling relationship model visualization processing module is used to display the extended calling relationship structure model in the form of a visual tracking flow chart, specifically including:
[0037] Converting the extended call relationship model into a visual tracking flowchart, and synchronously uploading the visual tracking flowchart to a terminal running the program;
[0038] When the terminal runs the program, the visual tracking flowchart is instructed to be dynamically and synchronously displayed according to the actual progress of the program running on the terminal.
[0039] Compared with the prior art, the code flow tracing method and system analyze the program to obtain all the function codes it contains, and identify the source code part and the trigger code part of each group of function codes to obtain a code trigger relationship information set; then, based on the running status information of all function codes in the test running process of the program, the call logic relationship information set between different function codes is determined to construct a call relationship structure model for all function codes; finally, based on the code trigger relationship information set, the call relationship structure model is secondary expanded, and the expanded call relationship structure model is displayed in the form of a visual tracing flowchart, which performs multi-level tracing analysis on the function code of the program from two aspects: the trigger relationship between different code parts within the function code and the call relationship between different groups of function codes, and also dynamically and synchronously displays the corresponding visual tracing flowchart, so as to track the program running status in real time and improve the controllability and security of the program running.
[0040] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0041] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A flowchart of the code flow tracing method provided by the present invention.
[0044] Figure 2 A schematic diagram of the structure of the code flow tracking system provided by the present invention. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] See also Figure 1 , is a flow chart of a code flow tracing method provided by an embodiment of the present invention. The code flow tracing method comprises the following steps:
[0047] Step S1, scanning and analyzing the program, identifying all function codes contained in the program, and assigning corresponding identification tags to each group of function codes; extracting corresponding source code parts and trigger code parts from each group of function codes, thereby forming a code trigger relationship information set within each group of function codes;
[0048] Step S2, collecting the running status information of all function codes of the program during the test running process, and determining the call logic relationship information set between all function codes during the running process of the program according to the running status information; and constructing a call relationship structure model of all function codes according to the identification mark and the call logic relationship information set;
[0049] Step S3, according to the code trigger relationship information set, the trigger relationship of each group of function codes in the call relationship structure model is expanded to obtain an extended call relationship structure model; the extended call relationship structure model is displayed in the form of a visual tracking flowchart.
[0050] The beneficial effects of the above technical solution are as follows: the code flow tracing method analyzes the program to obtain all the function codes it contains, and identifies the source code part and the trigger code part of each group of function codes to obtain a code trigger relationship information set; then, based on the running status information of all function codes in the program during the test running process, the call logic relationship information set between different function codes is determined to construct a call relationship structure model for all function codes; finally, based on the code trigger relationship information set, the call relationship structure model is secondary expanded, and the expanded call relationship structure model is displayed in the form of a visual tracing flowchart, which performs multi-level tracing analysis on the function code of the program from two aspects: the trigger relationship between different code parts within the function code and the call relationship between different groups of function codes, and also dynamically and synchronously displays the corresponding visual tracing flowchart, so as to track the program running status in real time and improve the controllability and security of the program running.
[0051] Preferably, in step S1, the program is scanned and analyzed to identify all function codes contained in the program, and a corresponding identification mark is assigned to each group of function codes; the corresponding source code part and trigger code part are extracted from each group of function codes to form a code trigger relationship information set within each group of function codes, specifically including:
[0052] Step S101, using program static analysis software to scan and analyze the program line by line, identify each function code line contained in the program; then analyze the adjacent function code lines to determine whether the two adjacent function code lines have the same function correlation; if they have the same function correlation, all function code lines with the same function correlation are identified and marked as the same group of function codes;
[0053] Step S102, detecting the same set of function codes to determine whether there is a code editing vulnerability in the same set of function codes; if there is a code editing vulnerability, checking and repairing all codes in the same set of function codes;
[0054] Step S103, extracting the source code part and the trigger code part for running the corresponding function from each group of function codes; constructing a code matching group about the source code part and the trigger code part, the code matching group including the trigger association information between the source code part and the trigger code part; and then combining all the code matching groups together to form a code trigger relationship information set within each group of function codes themselves.
[0055] The beneficial effects of the above technical solution are as follows: computer programs usually include a large number of function codes, and each group of function codes, as an independent function operation unit, can calculate the corresponding input quantity and obtain the corresponding output quantity. Among them, each function code is composed of multiple function code lines. The program static analysis software is used to scan and analyze the computer program as a whole line by line, and all function code lines included in the computer program as a whole can be quickly and accurately identified. Then, each function code line is semantically analyzed and identified to determine whether there is a function semantic association between two adjacent function code lines, that is, whether they have the same function association, and all function code lines belonging to the same function code are identified and marked as the same group of function codes. Then, the code editing vulnerabilities of the same group of function codes are detected and checked and repaired. Finally, the source code part and the trigger code part of the function during operation are lifted from each group of line codes, so that the code trigger relationship within each group of function codes can be determined, so as to form the association of each group of function codes at the code triggering level.
[0056] Preferably, in step S2, the running state information of all function codes of the program during the test running process is collected, and according to the running state information, a call logic relationship information set between all function codes during the running process of the program is determined; and according to the identification mark and the call logic relationship information set, a call relationship structure model of all function codes is constructed, which specifically includes:
[0057] Step S201, collecting function input information and function output information of all function codes of the program during the test operation process, and using this as the operation status information;
[0058] Step S202, determining whether the function output information of one of the function codes belongs to the function input information of another function code, and if so, determining that there is a calling logic relationship between the two function codes, thereby obtaining a calling logic relationship information set between all the function codes during the running of the program;
[0059] Step S203: constructing a call relationship structure model between different groups of function codes according to the identification mark and the call logic relationship information set.
[0060] The beneficial effect of the above technical solution is that in practical applications, each group of function codes of a computer program is used as an independent function operation unit, which can calculate the corresponding input quantity to obtain the corresponding output quantity. The function output information of one function code may be used as the function input information of another function code. The above output-input relationship determines that there is a calling logic relationship between the two function codes, and the calling relationship structure model between all function codes contained in the computer program is formed, so that the computer program can be tracked at the level of the function codes.
[0061] Preferably, in step S3, according to the code trigger relationship information set, the trigger relationship of each group of function codes in the call relationship structure model is expanded to obtain an extended call relationship structure model; and displaying the extended call relationship structure model in the form of a visual tracking flowchart specifically includes:
[0062] Step S301, according to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes included in the call relationship structure model is extended and indexed, thereby obtaining an extended call relationship structure model;
[0063] Step S302, converting the extended call relationship model into a visual tracking flowchart, and synchronously uploading the visual tracking flowchart to the terminal running the program;
[0064] Step S303, when the terminal runs the program, according to the actual progress of the terminal running the program, instruct the visual tracking flowchart to perform dynamic synchronous display.
[0065] The beneficial effect of the above technical solution is: according to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes contained in the call relationship structure model is extended and indexed, so that the computer program can be extended and indexed at two levels: the trigger relationship between different function code lines in the same group of function codes and the call relationship between different groups of function codes, so as to dynamically track and analyze the computer program. In addition, when the terminal runs the program, according to the actual progress of the terminal running the program, the visual tracking flowchart is instructed to be dynamically and synchronously displayed, so that the program running status can be tracked in real time, improving the controllability and security of the program running.
[0066] See also Figure 2 , is a schematic diagram of the structure of the code flow tracking system provided by an embodiment of the present invention. The code flow tracking system includes a function code analysis and processing module, a function code call relationship determination module, a call relationship structure model expansion module and a call relationship model visualization processing module; wherein,
[0067] The function code analysis and processing module is used to scan and analyze the program, identify all function codes contained in the program, and assign corresponding identification tags to each group of function codes; extract the corresponding source code part and trigger code part from each group of function codes, so as to form a code trigger relationship information set within each group of function codes;
[0068] The function code call relationship determination module is used to collect the running status information of all function codes during the test running process of the program, and determine the call logic relationship information set between all function codes during the running process of the program according to the running status information; and construct a call relationship structure model for all function codes according to the identification mark and the call logic relationship information set;
[0069] The call relationship structure model extension module is used to extend the trigger relationship of each group of function codes in the call relationship structure model according to the code trigger relationship information set, so as to obtain an extended call relationship structure model;
[0070] The call relationship model visualization processing module is used to display the extended call relationship structure model in the form of a visual tracking flow chart.
[0071] The beneficial effects of the above technical solution are as follows: the code flow tracking system analyzes the program to obtain all the function codes it contains, and identifies the source code part and the trigger code part of each group of function codes to obtain a code trigger relationship information set; then, based on the running status information of all function codes in the program during the test run, the call logic relationship information set between different function codes is determined to construct a call relationship structure model for all function codes; finally, based on the code trigger relationship information set, the call relationship structure model is secondary expanded, and the expanded call relationship structure model is displayed in the form of a visual tracking flowchart, which performs multi-level tracking analysis on the program's function code from two aspects: the trigger relationship between different code parts within the function code and the call relationship between different groups of function codes, and also dynamically and synchronously displays the corresponding visual tracking flowchart, so as to track the program running status in real time and improve the controllability and security of the program running.
[0072] Preferably, the function code analysis and processing module is used to scan and analyze the program, identify all function codes contained in the program, and assign corresponding identification marks to each group of function codes; extract the corresponding source code part and trigger code part from each group of function codes, so as to form a code trigger relationship information set within each group of function codes, specifically including:
[0073] Use program static analysis software to scan and analyze the program line by line to identify each function code line contained in the program; then analyze the adjacent function code lines to determine whether the two adjacent function code lines have the same function correlation; if they have the same function correlation, all function code lines with the same function correlation are identified and marked as the same group of function codes;
[0074] Detect the same set of function codes to determine whether there are code editing vulnerabilities in the same set of function codes; if there are code editing vulnerabilities, check and repair all codes within the same set of function codes;
[0075] The source code part and the trigger code part for running the corresponding function are extracted from each group of function codes; a code matching group about the source code part and the trigger code part is constructed, and the code matching group includes the trigger association information between the source code part and the trigger code part; and all the code matching groups are combined to form a code trigger relationship information set within each group of function codes themselves.
[0076] The beneficial effects of the above technical solution are as follows: computer programs usually include a large number of function codes, and each group of function codes, as an independent function operation unit, can calculate the corresponding input quantity and obtain the corresponding output quantity. Among them, each function code is composed of multiple function code lines. The program static analysis software is used to scan and analyze the computer program as a whole line by line, and all function code lines included in the computer program as a whole can be quickly and accurately identified. Then, each function code line is semantically analyzed and identified to determine whether there is a function semantic association between two adjacent function code lines, that is, whether they have the same function association, and all function code lines belonging to the same function code are identified and marked as the same group of function codes. Then, the code editing vulnerabilities of the same group of function codes are detected and checked and repaired. Finally, the source code part and the trigger code part of the function during operation are lifted from each group of line codes, so that the code trigger relationship within each group of function codes can be determined, so as to form the association of each group of function codes at the code triggering level.
[0077] Preferably, the function code call relationship determination module is used to collect the running state information of all function codes of the program during the test running process, and determine the call logic relationship information set between all function codes during the running process of the program according to the running state information; and constructing the call relationship structure model of all function codes according to the identification mark and the call logic relationship information set specifically includes:
[0078] Collect the function input information and function output information of all function codes of the program during the test running process, and use this as the running status information;
[0079] Determine whether the function output information of one of the function codes belongs to the function input information of another function code. If so, determine that there is a calling logic relationship between the two function codes, thereby obtaining a calling logic relationship information set between all function codes during the running of the program;
[0080] Based on the identification mark and the call logic relationship information set, a call relationship structure model between different groups of function codes is constructed.
[0081] The beneficial effect of the above technical solution is that in practical applications, each group of function codes of a computer program is used as an independent function operation unit, which can calculate the corresponding input quantity to obtain the corresponding output quantity. The function output information of one function code may be used as the function input information of another function code. The above output-input relationship determines that there is a calling logic relationship between the two function codes, and the calling relationship structure model between all function codes contained in the computer program is formed, so that the computer program can be tracked at the level of the function codes.
[0082] Preferably, the call relationship structure model extension module is used to expand the trigger relationship of each group of function codes in the call relationship structure model according to the code trigger relationship information set, so as to obtain an extended call relationship structure model, which specifically includes:
[0083] According to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes included in the call relationship structure model is extended and indexed, thereby obtaining an extended call relationship structure model;
[0084] as well as,
[0085] The call relationship model visualization processing module is used to display the extended call relationship structure model in the form of a visual tracking flow chart, specifically including:
[0086] Converting the extended call relationship model into a visual tracking flowchart, and synchronously uploading the visual tracking flowchart to a terminal running the program;
[0087] When the terminal runs the program, the visual tracking flow chart is instructed to be dynamically and synchronously displayed according to the actual progress of the program running on the terminal.
[0088] The beneficial effect of the above technical solution is: according to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes contained in the call relationship structure model is extended and indexed, so that the computer program can be extended and indexed at two levels: the trigger relationship between different function code lines in the same group of function codes and the call relationship between different groups of function codes, so as to dynamically track and analyze the computer program. In addition, when the terminal runs the program, according to the actual progress of the terminal running the program, the visual tracking flowchart is instructed to be dynamically and synchronously displayed, so that the program running status can be tracked in real time, improving the controllability and security of the program running.
[0089] It can be seen from the contents of the above embodiments that the code flow tracking method and system analyze the program to obtain all the function codes contained therein, and identify the source code part and the trigger code part of each group of function codes to obtain a code trigger relationship information set; then, based on the running status information of all function codes in the program during the test running process, the call logic relationship information set between different function codes is determined to construct a call relationship structure model for all function codes; finally, based on the code trigger relationship information set, the call relationship structure model is secondary expanded, and the expanded call relationship structure model is displayed in the form of a visual tracking flowchart, which performs multi-level tracking analysis on the function code of the program from two aspects: the trigger relationship between different code parts within the function code and the call relationship between different groups of function codes, and also dynamically and synchronously displays the corresponding visual tracking flowchart, so as to track the program running status in real time and improve the controllability and security of the program running.
[0090] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A code flow tracing method, characterized in that: It includes the following steps: Step S1, scanning and analyzing the program, identifying all function codes contained in the program, and assigning corresponding identification tags to each group of function codes; extracting corresponding source code parts and trigger code parts from each group of function codes, thereby forming a code trigger relationship information set within each group of function codes; Step S2, collecting the running status information of all function codes of the program during the test running process, and determining the call logic relationship information set between all function codes during the running process of the program according to the running status information; Constructing a call relationship structure model for all function codes according to the identification mark and the call logic relationship information set; Step S3, according to the code trigger relationship information set, the trigger relationship of each group of function codes in the calling relationship structure model is expanded to obtain an extended calling relationship structure model; the extended calling relationship structure model is displayed in the form of a visual tracking flowchart.
2. The code flow tracing method according to claim 1, characterized in that: In step S1, the program is scanned and analyzed to identify all function codes contained in the program, and a corresponding identification mark is assigned to each group of function codes; The corresponding source code part and trigger code part are extracted from each group of function codes to form a code trigger relationship information set within each group of function codes, which specifically includes: Step S101, using program static analysis software to scan and analyze the program line by line, identify each function code line contained in the program; then analyze the adjacent function code lines to determine whether the two adjacent function code lines have the same function correlation; if they have the same function correlation, all function code lines with the same function correlation are identified and marked as the same group of function codes; Step S102, detecting the same set of function codes to determine whether there is a code editing vulnerability in the same set of function codes; if there is a code editing vulnerability, checking and repairing all codes in the same set of function codes; Step S103, extracting the source code part and the trigger code part for running the corresponding function from each group of function codes; constructing a code matching group about the source code part and the trigger code part, wherein the code matching group includes the trigger association information between the source code part and the trigger code part; and then combining all the code matching groups together to form a code trigger relationship information set within each group of function codes themselves.
3. The code flow tracing method according to claim 2, characterized in that: In the step S2, the running status information of all function codes of the program during the test running process is collected, and according to the running status information, the call logic relationship information set between all function codes during the running process of the program is determined; According to the identification mark and the call logic relationship information set, constructing a call relationship structure model for all function codes specifically includes: Step S201, collecting function input information and function output information of all function codes of the program during the test operation process, and using this as the operation status information; Step S202, determining whether the function output information of one of the function codes belongs to the function input information of another function code, and if so, determining that there is a calling logic relationship between the two function codes, thereby obtaining a calling logic relationship information set between all the function codes during the running of the program; Step S203: constructing a call relationship structure model between different groups of function codes according to the identification mark and the call logic relationship information set.
4. The code flow tracing method according to claim 3, characterized in that: In the step S3, according to the code trigger relationship information set, the trigger relationship of each group of function codes in the calling relationship structure model is expanded, so as to obtain an expanded calling relationship structure model; Displaying the extended call relationship structure model in the form of a visual tracking flowchart specifically includes: Step S301, according to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes included in the call relationship structure model is extended and indexed, so as to obtain an extended call relationship structure model; Step S302, converting the extended call relationship model into a visual tracking flowchart, and synchronously uploading the visual tracking flowchart to the terminal running the program; Step S303, when the terminal runs the program, according to the actual progress of the terminal running the program, instructing the visual tracking flowchart to perform dynamic synchronous display.
5. Code flow tracking system, characterized by: It includes a function code analysis and processing module, a function code call relationship determination module, a call relationship structure model expansion module and a call relationship model visualization processing module; wherein, The function code analysis and processing module is used to scan and analyze the program, identify all function codes contained in the program, and assign corresponding identification marks to each group of function codes; extract the corresponding source code part and trigger code part from each group of function codes, so as to form a code trigger relationship information set within each group of function codes; The function code call relationship determination module is used to collect the running status information of all function codes of the program during the test running process, and determine the call logic relationship information set between all function codes during the running process of the program according to the running status information; and construct a call relationship structure model for all function codes according to the identification mark and the call logic relationship information set; The calling relationship structure model extension module is used to extend the trigger relationship of each group of function codes in the calling relationship structure model according to the code trigger relationship information set, so as to obtain an extended calling relationship structure model; The call relationship model visualization processing module is used to display the extended call relationship structure model in the form of a visual tracking flow chart.
6. The code flow tracking system according to claim 5, characterized in that: The function code analysis and processing module is used to scan and analyze the program, identify all function codes contained in the program, and assign corresponding identification tags to each group of function codes; extract the corresponding source code part and trigger code part from each group of function codes, so as to form a code trigger relationship information set within each group of function codes, which specifically includes: Use program static analysis software to scan and analyze the program line by line to identify each function code line contained in the program; then analyze the adjacent function code lines to determine whether the two adjacent function code lines have the same function correlation; if they have the same function correlation, all function code lines with the same function correlation are identified and marked as the same group of function codes; Detect the same set of function codes to determine whether there are code editing vulnerabilities in the same set of function codes; if there are code editing vulnerabilities, check and repair all codes within the same set of function codes; Extract the source code part and the trigger code part for running the corresponding function from each group of function codes; construct a code matching group about the source code part and the trigger code part, the code matching group includes the trigger association information between the source code part and the trigger code part; and then combine all the code matching groups into a set of code trigger relationship information within each group of function codes themselves.
7. The code flow tracking system according to claim 6, characterized in that: The function code calling relationship determination module is used to collect the running status information of all function codes of the program during the test running process, and determine the calling logic relationship information set between all function codes of the program during the running process according to the running status information; According to the identification mark and the call logic relationship information set, constructing a call relationship structure model for all function codes specifically includes: Collecting function input information and function output information of all function codes of the program during the test running process as the running status information; Determine whether the function output information of one of the function codes belongs to the function input information of another function code. If so, determine that there is a calling logic relationship between the two function codes, thereby obtaining a calling logic relationship information set between all function codes during the running of the program; According to the identification mark and the call logic relationship information set, a call relationship structure model between different groups of function codes is constructed.
8. The code flow tracking system according to claim 7, characterized in that: The calling relationship structure model extension module is used to extend the trigger relationship of each group of function codes in the calling relationship structure model according to the code trigger relationship information set, so as to obtain an extended calling relationship structure model, which specifically includes: According to the code trigger relationship information set, the code trigger relationship between the source code part and the trigger code part in each group of function codes included in the call relationship structure model is extended and indexed, thereby obtaining an extended call relationship structure model; as well as, The calling relationship model visualization processing module is used to display the extended calling relationship structure model in the form of a visual tracking flow chart, specifically including: Converting the extended call relationship model into a visual tracking flowchart, and synchronously uploading the visual tracking flowchart to a terminal running the program; When the terminal runs the program, the visual tracking flowchart is instructed to be dynamically and synchronously displayed according to the actual progress of the program running on the terminal.
Citation Information
Patent Citations
Software safety code analyzer based on static analysis of source code and testing method therefor
CN101017458A
System for detecting software bug triggered during practical running of computer program
CN101968766A