A simulation debugging method, device, computing equipment and computer storage medium
By dividing the code to be debugged into multiple code fragments and identifying the dead loop code fragments using a preset detection mechanism, the problem of low debugging of simulation dead loop in chip verification is solved, and more efficient simulation verification is achieved.
Patent Information
- Application Number
- CN202111076481.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-14
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2041-09-14
AI Technical Summary
In chip verification, the debugging efficiency of simulation dead loop problems is low and usually takes a lot of time to debug in a single step.
By dividing the code to be debugged into multiple code fragments and determining the simulation time list based on the set number, the preset detection mechanism is used to identify the dead loop code fragment from the code fragment, obtain its positioning information and debug it.
It improves the efficiency of debugging simulation dead loop, significantly reduces debugging time compared to single-step debugging, and improves the efficiency of simulation verification.
Smart Images

Figure CN113792523B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of chip verification technology, and in particular to a simulation debugging method, apparatus, computing device, and computer storage medium. Background Art
[0002] With the development of chip verification technology, the verification methodology in chip verification technology can be efficiently used to build a verification platform using object-oriented methods, but the simulation technology in chip verification technology still cannot be efficiently used to build a verification platform using object-oriented methods.
[0003] In a verification environment using simulation technology, the problem of simulation dead loop (also called simulation hang) is often encountered. To solve the problem of simulation dead loop, single-step debugging is currently usually used (where single-step debugging refers to a debugging method commonly used in program development to find program bugs. It tracks the program simulation process step by step and finds the cause of the error based on the value of the variable) to solve the problem of simulation dead loop.
[0004] However, the single-step debugging method takes a lot of time to solve the simulation dead loop problem, resulting in low efficiency in debugging the simulation dead loop. Summary of the invention
[0005] The embodiments of the present application provide a simulation debugging method, apparatus, computing device and computer storage medium, which can improve the efficiency of debugging simulation dead loops.
[0006] In a first aspect, an embodiment of the present application provides a simulation debugging method, including:
[0007] Determine the code to be debugged;
[0008] Divide the code to be debugged into a plurality of code segments according to a set number, and determine a simulation time list and a simulation time corresponding to each code segment, wherein the simulation time list includes a plurality of simulation times and information of the code segment to be simulated at each simulation time, and the simulation time is used to indicate the execution time of the corresponding code segment;
[0009] Determine the code segment to be simulated according to the current simulation time and the simulation time list, and perform simulation verification on the code segment to be simulated;
[0010] According to a preset detection mechanism, a dead loop code segment is determined from the code segment to be simulated;
[0011] The positioning information of the dead loop code snippet is obtained, and based on the positioning information, the dead loop code snippet is queried and debugged.
[0012] Optionally, after determining the code segment to be simulated according to the current simulation time and the simulation time list, and performing simulation verification on the code segment to be simulated, the method further includes:
[0013] Prints code snippets that have completed simulation verification in the result log file.
[0014] Optionally, the determining of the dead loop code fragment from the code fragment to be simulated according to a preset detection mechanism includes:
[0015] If it is detected that the same code segment is repeatedly printed in the result log file, the code segment is determined as an infinite loop code segment.
[0016] Optionally, the determining of the dead loop code fragment from the code fragment to be simulated according to a preset detection mechanism includes:
[0017] If it is detected in the result log file that the number of simulation verifications of a code segment exceeds a preset number, the code segment is determined to be an infinite loop code segment.
[0018] Optionally, the determining of the dead loop code fragment from the code fragment to be simulated according to a preset detection mechanism includes:
[0019] If it is detected that the simulation time is continuously increasing while the simulation waveform is not increasing, the code segment currently being simulated and verified is determined to be a dead loop code segment.
[0020] Optionally, determining the code segment to be simulated according to the current simulation time and the simulation time list, and performing simulation verification on the code segment to be simulated includes:
[0021] The code fragments to be simulated are determined to form a simulation scheduling queue, and the simulation scheduling queue is simulated and verified.
[0022] Optionally, determining the code to be debugged includes:
[0023] Use VCS commands to compile and simulate the source code file to obtain the code to be debugged.
[0024] Optionally, before obtaining the location information of the dead loop code snippet, the method further includes:
[0025] The code range information and simulation time corresponding to the dead loop code snippet are used as the positioning information of the code snippet and redirected to the result log file.
[0026] In a second aspect, an embodiment of the present application provides a simulation debugging device, including:
[0027] A determination module is used to determine the code to be debugged;
[0028] A processing module, used for dividing the code to be debugged into a plurality of code segments according to a set number, and determining a simulation time list and a simulation time corresponding to each code segment, wherein the simulation time list includes a plurality of simulation times and a code segment to be simulated at each simulation time, and the simulation time is used for indicating the execution time of the corresponding code segment;
[0029] A simulation module, used to determine the code segment to be simulated according to the current simulation time and the simulation time list, and perform simulation verification on the code segment to be simulated;
[0030] A detection module, used for determining the dead loop code fragment from the code fragment to be simulated according to a preset detection mechanism;
[0031] The debugging module is used to obtain the location information of the dead loop code fragment, and query and debug the dead loop code fragment based on the location information.
[0032] In a third aspect, an embodiment of the present application provides a computing device, comprising a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the simulation debugging method described in the first aspect above.
[0033] In a fourth aspect, an embodiment of the present application provides a computer storage medium storing a computer program, which, when executed by a computer, implements the simulation debugging method described in the first aspect above.
[0034] In the embodiment provided by the present application, the code to be debugged is determined; the code to be debugged is divided into multiple code fragments according to a set number, and a simulation time list and the simulation time corresponding to each code fragment are determined; the code fragment to be simulated is determined according to the current simulation time and the simulation time list, and the code fragment to be simulated is simulated and verified; according to a preset detection mechanism, a dead loop code fragment is determined from the code fragment to be simulated; the positioning information of the dead loop code fragment is obtained, and based on the positioning information, the dead loop code fragment is queried and debugged. The present application determines the dead loop code fragment from the code fragment to be simulated through a preset detection mechanism, and can improve the efficiency of debugging and simulating dead loops.
[0035] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0037] Figure 1 A flowchart of a simulation debugging method provided in an embodiment of the present application;
[0038] Figure 2 A schematic diagram of a simulation time list provided in an embodiment of the present application;
[0039] Figure 3 A flowchart of another simulation debugging method provided in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of a simulation waveform provided in an embodiment of the present application;
[0041] Figure 5 A structural diagram of a simulation debugging device provided in an embodiment of the present application;
[0042] Figure 6 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0044] In some of the processes described in the specification and claims of this application and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0045] Before introducing a simulation debugging method provided by this application, a brief introduction to the relevant concepts and research background involved in this application is first given:
[0046] (1) Related concepts
[0047] Single-step debugging: refers to a debugging method commonly used in program development to find program bugs. It tracks the program execution process step by step and finds the cause of the error based on the value of the variable.
[0048] Infinite loop: In programming, a program that cannot be terminated by its own control is called an infinite loop.
[0049] Among them, the dead loop includes the following situations:
[0050] 1. Two or more always blocks call each other without delay. For example, if the process block includes process block A and process block B, at time 0, process block A is assigned to 1. When any one of process blocks A and process block B changes, the inverse of process block B is assigned to process block A. When any one of process blocks A and process block B changes, process block A is assigned to process block B.
[0051] 2. Multiple instantiations of one or more modules in the chip feed back to each other through module ports.
[0052] 3. The assignments of multiple constants are interdependent, the assignments of constants and gate circuits are interdependent, or the assignments of process blocks and constants are interdependent.
[0053] 4. The input port and output port of one or more gate circuits in the chip are interdependent. For example, if the gate circuit includes gate circuit C and gate circuit D, the output value of the output port of gate circuit C is input to the input port of gate circuit D, and the output value of gate circuit D is input to the input port of gate circuit C.
[0054] (2) Research background
[0055] The inventor found that in current simulation verification simulation, when encountering the problem of simulation dead loop (also called simulation hang), industry insiders usually use single-step debugging to find the code fragment where the dead loop occurs, thereby solving the problem of simulation dead loop. However, when solving the problem of simulation dead loop by single-step debugging, it takes a lot of time, resulting in low efficiency in debugging simulation dead loop.
[0056] In order to solve the problem of low efficiency in debugging simulation dead loops, the present application provides a simulation debugging method, which determines the dead loop code fragment from the code fragment to be simulated through a preset detection mechanism, thereby improving the efficiency of debugging simulation dead loops.
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0058] Figure 1 A flowchart of a simulation debugging method is provided for an embodiment of the present application, such as Figure 1 As shown, the method includes:
[0059] 101. Determine the code to be debugged.
[0060] In an embodiment of the present application, the code to be debugged that needs to be simulated is determined from a source code file. The code to be debugged may be a source code file or a code region in the source code file.
[0061] 102. Divide the code to be debugged into a plurality of code segments according to a set number, and determine a simulation time list and a simulation time corresponding to each code segment.
[0062] In this step, the simulation time list includes multiple simulation times and information about the code snippet to be simulated at each simulation time, and the simulation time is used to indicate the execution time of the corresponding code snippet.
[0063] It should be noted that before executing step 102, a simulation time list of the code to be debugged needs to be established in advance, for example Figure 2 As shown, the simulation time list includes multiple simulation times and code snippet information to be simulated at each simulation time.
[0064] In the embodiment of the present application, in order to improve the detection efficiency of the dead loop code fragment, the code to be debugged can be divided into multiple code fragments according to a set number. For example, the set number includes 1000. The code to be debugged can be divided into 1000 code fragments. This application takes the code to be debugged as divided into three code fragments a, b, and c as an example. Figure 2 In the simulation time list, it can be determined that the simulation time of code fragment a is 00:00:01, the simulation time of code fragment b is 00:00:02, and the simulation time of code fragment a is 00:00:03.
[0065] 103. Determine the code segment to be simulated according to the current simulation time and the simulation time list, and perform simulation verification on the code segment to be simulated.
[0066] In this step, the default simulation debugging process starts at 00:00:00. As the simulation time increases, the next code snippet will be continuously obtained according to the simulation time list for simulation verification. If an infinite loop code occurs, the simulator will repeatedly simulate the same code snippet.
[0067] In the embodiment of the present application, for example, a simulation debugging process is simulated from 00:00:00. As the simulation time increases, when the simulation time is 00:00:01, according to the simulation time list, the code fragment to be simulated is determined to be code fragment a, and the code fragment a is simulated and verified. By analogy, if there is no dead loop code fragment in the code to be debugged, each code fragment will be executed in sequence according to the simulation time list until the entire code to be debugged is executed. If a code fragment has a dead loop, the simulation time will continue to increase, but the simulator will repeat the execution of the code fragment. For example, with code fragment a as the dead loop code fragment, when the simulation time is 00:00:01, the code fragment a is simulated and verified. At this time, the simulation time continues to increase to 00:00:02. According to the simulation time list, the code fragment b should be simulated and verified at this moment. When the code fragment a has a dead loop, it will cause the code fragment a to be simulated and verified at 00:00:02. Therefore, the purpose of this application is to find and debug the dead loop code fragment, so that the simulator can execute each code fragment in sequence according to the simulation time list until the entire code to be debugged is executed.
[0068] 104. According to a preset detection mechanism, a dead loop code segment is determined from the code segment to be simulated.
[0069] In this step, the detection mechanism can be set according to the requirements, and there can be multiple detection mechanisms.
[0070] In the embodiment of the present application, for example, the preset detection mechanism includes detecting whether the simulator is repeatedly executing the same code snippet, or whether the result log file is outputting the same code snippet, etc. Specifically, under the premise that the code snippet that has completed simulation verification is printed in the result log file, if it is detected that the same code snippet is repeatedly printed in the result log file, the code snippet is determined to be an infinite loop code snippet; or, if it is detected that the number of simulation verifications of a code snippet exceeds a preset number, the code snippet is determined to be an infinite loop code snippet.
[0071] In addition, other detection mechanisms may be set, and the above detection mechanism is only an example, and this application does not limit this.
[0072] 105. Obtain location information of the dead loop code snippet, and query and debug the dead loop code snippet based on the location information.
[0073] In this step, the location information of the dead loop code snippet may include the simulation time of the dead loop code snippet and the code range information corresponding to the dead loop code snippet. The simulation time is the time to determine the dead loop code snippet from the code snippet to be simulated according to the preset detection mechanism, and the code range information is the information such as the bytes and the number of bytes contained in the dead loop code snippet.
[0074] In an embodiment of the present application, when a dead loop code snippet is determined, it is necessary to obtain the simulation time of the dead loop code snippet and the code range information corresponding to the code snippet, and use the simulation time and code range information as the location information of the dead loop code snippet, and redirect them to the detection result log file, so as to facilitate the subsequent query and debugging of the code snippet according to the location information of the dead loop code snippet in the detection result log file, thereby solving the problem of dead loop occurring during simulation debugging.
[0075] Furthermore, the code snippet can be quickly found in the code area based on the location information of the code snippet. The method of finding and locating the code can refer to the current code location technology, which will not be described in detail in this application.
[0076] In the embodiment of the present application, the problem of simulation dead loop can be solved by debugging code snippets, and the dead loop code snippets can be quickly detected through a preset detection mechanism. Compared with the single-step debugging method, the simulation debugging method of the present application improves the efficiency of detecting dead loop code snippets and solving simulation dead loops.
[0077] Figure 3 A flowchart of a simulation debugging method is provided for an embodiment of the present application, such as Figure 3 As shown, the method includes:
[0078] 201. Determine the code to be debugged.
[0079] In an embodiment of the present application, as a possible implementation method, after the source code file is compiled and simulated through the VCS command, the code to be debugged that needs to be simulated is determined from the source code file. The code to be debugged can be the source code file or a code area in the source code file.
[0080] Among them, the VCS command may include: vcs test.sv+v2k+vcs+loopreport+[threshold], which means using the VCS simulator to compile and simulate the test.sv source code file, and the simulation options are "v2k" (simulation option in the VCS simulator) and "vcsloopreport" (simulation option in the VCS simulator, which is used to enable the simulator's execution dead loop debugging function, that is, according to a preset detection mechanism, determine the dead loop code fragment from the code fragment to be simulated).
[0081] 202. Divide the code to be debugged into a plurality of code segments according to a set number, and determine a simulation time list and a simulation time corresponding to each code segment.
[0082] In the embodiment of the present application, the execution process of this step can refer to the above-mentioned step 102, and the embodiment of the present application will not be repeated here.
[0083] 203. Determine the code segment to be simulated according to the current simulation time and the simulation time list, and perform simulation verification on the code segment to be simulated.
[0084] In the embodiment of the present application, the execution process of this step can refer to the above-mentioned step 103, and the embodiment of the present application will not be repeated here.
[0085] It should be noted that, as a possible implementation scheme, during the execution of step 203, the code fragments to be simulated can be formed into a simulation scheduling queue, and the simulation scheduling queue can be simulated and verified. The present application can speed up the simulation scheduling by forming the code fragments to be simulated into a simulation scheduling queue in advance, thereby avoiding the need to query and obtain the next code fragment after simulating and verifying a code fragment.
[0086] 204. Print the code snippet that has completed the simulation verification in the result log file.
[0087] In the embodiment of the present application, the code snippets that have completed the simulation verification are printed in the result log file to facilitate recording the execution results of the simulation verification.
[0088] 205. According to a preset detection mechanism, a dead loop code segment is determined from the code segment to be simulated.
[0089] In this step, the detection mechanism can be set according to the requirements, and there can be multiple detection mechanisms.
[0090] In the embodiment of the present application, as a possible implementation scheme, step 205 may include: if it is detected that the same code segment is printed repeatedly in the result log file, determining the code segment as an infinite loop code segment.
[0091] In this implementation, each time a code segment in the simulation queue is simulated and verified, the code segment is printed in a result log file, and the next code segment is simulated according to the timestamp simulation time list. If the previous code segment is still printed in the result log after the simulation verification is performed on the next code segment, the previous code segment is determined to be an infinite loop code segment.
[0092] As another possible implementation scheme, step 205 may include: if it is detected in the result log file that the number of simulation verifications of a code segment exceeds a preset number, determining the code segment as an infinite loop code segment.
[0093] In this implementation, similar to the above implementation, each time a code segment in the simulation queue is simulated and verified, the code segment is printed in the result log file, and the next code segment is simulated according to the timestamp simulation time list. If the previous code segment is still printed in the result log after the simulation verification is performed on the next code segment, and the number of prints of the previous code segment exceeds the preset number, the previous code segment is determined to be an infinite loop code segment.
[0094] As another possible implementation scheme, step 205 may include: if it is detected that the simulation time is continuously increasing while the simulation waveform is not increasing, determining the code segment currently being simulated and verified as a dead loop code segment.
[0095] This implementation scheme is different from the above two implementation schemes. The above two implementation schemes both detect whether the code snippet to be simulated is an infinite loop code snippet by checking the result log file, while in this implementation scheme, it is determined whether the code snippet currently being simulated and verified is an infinite loop code snippet by detecting the simulation waveform file.
[0096] It should be noted that each time a new code snippet is executed, corresponding waveform information will be added to the waveform file. If the simulator no longer adds new waveform information when repeatedly executing a certain code snippet, if it is detected that the simulation time is continuously increasing while the simulation waveform is not increasing, the code snippet currently being simulated and verified can be determined as an infinite loop code snippet.
[0097] For example, Figure 4 As shown, Figure 4The simulation time 1 indicates that when the simulator performs simulation verification, when the dead loop code fragment is code fragment b, as the simulation time increases to 00:00:03, the simulation verification should be performed on code fragment c according to the simulation time list. When a dead loop occurs in code fragment b, the simulator will continue to simulate and verify code fragment b, which will cause the simulation time to continue to increase, but the simulation waveform will no longer increase.
[0098] 206. Use the code range information and simulation time corresponding to the dead loop code snippet as the location information of the code snippet, and redirect them to the result log file.
[0099] In this step, the simulation time is the time to determine the dead loop code fragment from the code fragment to be simulated according to the preset detection mechanism. The code range information is information such as the bytes and the number of bytes contained in the dead loop code fragment.
[0100] In the embodiment of the present application, the dead loop code fragment determined from the code fragment to be simulated needs to print the location information of the dead loop code fragment in the result log file to facilitate subsequent query and debugging of the dead loop code fragment.
[0101] 207. Obtain location information of the dead loop code snippet, and query and debug the dead loop code snippet based on the location information.
[0102] In the embodiment of the present application, the execution process of this step can refer to step 105 of the above embodiment, and the present application will not repeat it again.
[0103] Figure 5 A schematic diagram of the structure of a simulation debugging device is provided for an embodiment of the present application. Figure 5 As shown, the device comprises:
[0104] A determination module 31 is used to determine the code to be debugged;
[0105] The processing module 32 is used to divide the code to be debugged into multiple code fragments according to a set number, and determine a simulation time list and a simulation time corresponding to each code fragment, wherein the simulation time list includes multiple simulation times and a code fragment to be simulated at each simulation time, and the simulation time is used to indicate the execution time of the corresponding code fragment;
[0106] A simulation module 33, used to determine the code segment to be simulated according to the current simulation time and the simulation time list, and perform simulation verification on the code segment to be simulated;
[0107] A detection module 34, used to determine the dead loop code fragment from the code fragment to be simulated according to a preset detection mechanism;
[0108] The debugging module 35 is used to obtain the location information of the dead loop code snippet, and query and debug the dead loop code snippet based on the location information.
[0109] In the embodiment of the present application, optionally, the device also includes: a printing module 36.
[0110] The printing module 36 is used to print the code snippets that have completed the simulation verification in the result log file.
[0111] In the embodiment of the present application, optionally, the device detection module 34 is specifically configured to determine the code segment as an infinite loop code segment if it is detected that the same code segment is repeatedly printed in the result log file.
[0112] In the embodiment of the present application, optionally, the device detection module 34 is specifically used to determine the code segment as an infinite loop code segment if it is detected in the result log file that the number of simulation verifications of a code segment exceeds a preset number.
[0113] In the embodiment of the present application, optionally, the device detection module 34 is specifically used to determine the code segment currently being simulated and verified as a dead loop code segment if it is detected that the simulation time is continuously increasing while the simulation waveform is not increasing.
[0114] In the embodiment of the present application, optionally, the device simulation module 33 is specifically used to form a simulation scheduling queue by determining the code fragments to be simulated, and perform simulation verification on the simulation scheduling queue.
[0115] In the embodiment of the present application, optionally, the device determination module 31 is specifically used to compile and simulate the source code file through the VCS command to obtain the code to be debugged.
[0116] In the embodiment of the present application, optionally, the device printing module 36 is specifically used to use the code range information and simulation time corresponding to the dead loop code fragment as the positioning information of the code fragment, and redirect it to the result log file.
[0117] Figure 5 The simulation debugging device can execute Figure 3 The implementation principle and technical effect of the simulation debugging method described in the embodiment are not described in detail. The specific way in which each module and unit performs operations in the simulation debugging device in the above embodiment has been described in detail in the embodiment of the method, and will not be described in detail here.
[0118] In one possible design, Figure 5 The simulation debugging device of the embodiment shown can be implemented as a computing device. Figure 6As shown in , the computing device may include a storage component 401 and a processing component 402;
[0119] The storage component 401 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component 402 to implement Figure 1 or Figure 2 The simulation debugging method described in the embodiment.
[0120] The processing component 402 may include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing component may also be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above Figure 1 or Figure 2 The simulation debugging method described in the embodiment.
[0121] The storage component 401 is configured to store various types of data to support operations at the terminal. The storage component can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0122] The present application also provides a computer-readable storage medium storing a computer program, wherein the computer program can achieve the above-mentioned Figure 1 or Figure 2 The simulation debugging method of the illustrated embodiment.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0124] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0125] Through the description of the above implementation methods, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A simulation debugging method, characterized in that: include: Determine the code to be debugged; Divide the code to be debugged into a plurality of code segments according to a set number, and determine a simulation time list and a simulation time corresponding to each code segment, wherein the simulation time list includes a plurality of simulation times and information of the code segment to be simulated at each simulation time, and the simulation time is used to indicate the execution time of the corresponding code segment; Determine the code segment to be simulated according to the current simulation time and the simulation time list, and perform simulation verification on the code segment to be simulated; According to a preset detection mechanism, a dead loop code segment is determined from the code segment to be simulated; Acquire location information of the dead loop code snippet, and query and debug the dead loop code snippet based on the location information; Print the code snippets that have completed simulation verification in the result log file; The method of determining the dead loop code segment from the code segment to be simulated according to the preset detection mechanism includes: If it is detected that the same code fragment is repeatedly printed in the result log file, the code fragment is determined as an infinite loop code fragment; If it is detected in the result log file that the number of simulation verifications of a code segment exceeds a preset number, the code segment is determined to be an infinite loop code segment; If it is detected that the simulation time is continuously increasing while the simulation waveform is not increasing, the code segment currently being simulated and verified is determined to be a dead loop code segment.
2. The method according to claim 1, characterized in that The step of determining the code segment to be simulated according to the current simulation time and the simulation time list, and performing simulation verification on the code segment to be simulated includes: The code fragments to be simulated are determined to form a simulation scheduling queue, and the simulation scheduling queue is simulated and verified.
3. The method according to claim 1, characterized in that The step of determining the code to be debugged includes: Use VCS commands to compile and simulate the source code file to obtain the code to be debugged.
4. The method according to claim 1, characterized in that: Before obtaining the location information of the dead loop code snippet, the method includes: The code range information and simulation time corresponding to the dead loop code snippet are used as the positioning information of the code snippet and redirected to the result log file.
5. A simulation debugging device, characterized in that: include: A determination module is used to determine the code to be debugged; A processing module, used for dividing the code to be debugged into a plurality of code segments according to a set number, and determining a simulation time list and a simulation time corresponding to each code segment, wherein the simulation time list includes a plurality of simulation times and a code segment to be simulated at each simulation time, and the simulation time is used for indicating the execution time of the corresponding code segment; A simulation module, used to determine the code segment to be simulated according to the current simulation time and the simulation time list, and perform simulation verification on the code segment to be simulated; A detection module, used for determining the dead loop code fragment from the code fragment to be simulated according to a preset detection mechanism; A debugging module, used to obtain the location information of the dead loop code snippet, and query and debug the dead loop code snippet based on the location information; Printing module, used to print the code snippets that have completed simulation verification in the result log file; The detection module is specifically used to determine the code segment as an infinite loop code segment if it is detected that the same code segment is repeatedly printed in the result log file; if it is detected in the result log file that the number of simulation verifications of a code segment exceeds a preset number, determine the code segment as an infinite loop code segment; If it is detected that the simulation time is continuously increasing while the simulation waveform is not increasing, the code segment currently being simulated and verified is determined to be a dead loop code segment.
6. A computing device, characterized in that It comprises a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are used to be called by the processing component for simulation, so as to implement the simulation debugging method as described in any one of claims 1-4.
7. A computer storage medium, characterized in that: A computer program is stored, and when the computer program is simulated by a computer, the simulation debugging method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Method, tool and device for debugging application program
CN101739333A
Malicious script detection method and device, electronic device and storage medium
CN108959925A