CN114168447A - Software debugging method and electronic equipment - Google Patents

Software debugging method and electronic equipment Download PDF

Info

Publication number
CN114168447A
CN114168447A CN202010949710.4A CN202010949710A CN114168447A CN 114168447 A CN114168447 A CN 114168447A CN 202010949710 A CN202010949710 A CN 202010949710A CN 114168447 A CN114168447 A CN 114168447A
Authority
CN
China
Prior art keywords
data set
tested
program
variable
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010949710.4A
Other languages
Chinese (zh)
Inventor
魏可鑫
董鑫
林志强
胡绍平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010949710.4A priority Critical patent/CN114168447A/en
Publication of CN114168447A publication Critical patent/CN114168447A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a software debugging method and electronic equipment. The method comprises the following steps: determining to-be-tested variables of a to-be-tested program, wherein the to-be-tested variables comprise independent variables and dependent variables with incidence relations; recording the continuous change of the independent variable and the dependent variable in the running process of the program to be tested to obtain a training data set; training a computer learning model based on the training data set, and fitting a regression model for testing; and inputting the value of the independent variable in the running process of the program to be tested into the regression model for testing, comparing the output of the regression model for testing with the value of the dependent variable in the running process of the program to be tested, and determining the abnormal point of the data in the running process of the program to be tested. According to the method, the accuracy of software vulnerability positioning can be greatly improved, time consumption of software vulnerability positioning is reduced, and software vulnerabilities are prevented from being omitted.

Description

Software debugging method and electronic equipment
Technical Field
The application relates to the technical field of intelligent terminals, in particular to a software debugging method and electronic equipment.
Background
During the writing of a software program, typically no programmer can write error-free code at a single stroke. Therefore, after the software code is completed, the software code is required to be debugged to locate the software problem. The most common debugging method is to use a debugging tool which mainly comprises a debugger for debugging, and starts from the symptoms of problems, and traces the software bugs forward or backward, so that the efficiency of locating the root causes of the software bugs is greatly improved.
In the prior art environment, the software environment is continuously developing towards large-scale, parallelization and complication, and the reason which is not in accordance with the program expectation can be a very small problem but is not easy to find. The difficulty of positioning the software bug is continuously improved, the time consumption for positioning the software bug by the existing software debugging method is continuously increased, the time for software debugging is usually longer than the time for coding, and even in some application scenes, the software bug cannot be positioned.
Disclosure of Invention
The application provides a software debugging method and electronic equipment, and further provides a computer readable storage medium, aiming at the problems that software debugging time is too long and software bugs cannot be located in some application scenes in the prior art.
The embodiment of the application adopts the following technical scheme:
in a first aspect, the present application provides a software debugging method, including:
determining to-be-tested variables of a to-be-tested program, wherein the to-be-tested variables comprise independent variables and dependent variables with incidence relations;
data acquisition, including recording the continuous change of the independent variable and the dependent variable in the running process of the program to be tested, acquiring a recorded data set, and generating a training data set according to the recorded data set;
training a computer learning model based on the training data set, and fitting a test regression model, wherein the test regression model is used for embodying the association relationship between the independent variable and the dependent variable, and in the model training process, a model input item is the value of the independent variable in the training data set, and a model output item is the value of the dependent variable in the training data set;
and positioning the abnormal points, namely inputting the values of the independent variables in the running process of the program to be tested into the regression model for testing, comparing the output of the regression model for testing with the values of the dependent variables in the running process of the program to be tested, and determining the data abnormal points in the running process of the program to be tested.
In an implementation manner of the first aspect, the data acquisition includes:
and repeatedly running the program to be tested, stopping running the program to be tested when the running times of the program to be tested meet preset times or the record number in the record data set meets preset record number, and generating a training data set according to the record data set.
In an implementation manner of the first aspect, the data acquisition includes:
repeatedly running the program to be tested, and outputting a data acquisition completion prompt when the running times of the program to be tested meet a preset number or the record number in the record data set meets a preset record number;
and when the data acquisition is closed or the software debugging is started, stopping running the program to be tested, and generating a training data set according to the recorded data set.
In an implementation manner of the first aspect:
the data acquisition comprises: running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable, acquiring a first recorded data set, and taking the first recorded data set as the training data set;
the outlier positioning comprises:
the data acquisition comprises: running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable, acquiring a second recorded data set, and taking the second recorded data set as the test data set;
and inputting the value of the independent variable in the test data set into the regression model for test, and comparing the output of the regression model for test with the value of the dependent variable in the test data set to determine the abnormal point of the data in the test data set.
In an implementation manner of the first aspect:
the data acquisition comprises: running the program to be tested, recording the continuous change of the independent variable and the dependent variable, and acquiring the recorded data set; segmenting the recording dataset into the training dataset and a test dataset;
and positioning the abnormal points, namely inputting the values of the independent variables in the test data set into the test regression model, and comparing the output of the test regression model with the values of the dependent variables in the test data set to determine the data abnormal points in the test data set.
In an implementation manner of the first aspect, the model training includes:
calling an un-called machine learning model in the machine learning model library:
training the machine learning model based on the training data set to fit a regression model for alternative testing;
inputting the values of the independent variables in the test data set as input items into the regression model for the alternative test to obtain the output of the regression model for the alternative test;
calculating the similarity between the output of the regression model for the alternative test and the value of the dependent variable in the test data set;
and when the similarity between the output of the regression model for the alternative test and the value of the dependent variable in the test data set is greater than or equal to a preset similarity threshold value, taking the regression model for the alternative test as the regression model for the test.
In an implementation manner of the first aspect, the model training includes:
calling a machine learning model in a machine learning model library:
respectively training each machine learning model in the machine learning model library based on the training data set to fit a plurality of regression models for alternative tests;
respectively inputting the value of the independent variable in the test data set as an input item into each regression model for the alternative test to obtain the output of each regression model for the alternative test;
calculating the similarity between the output of each regression model for the alternative tests and the value of the dependent variable in the test data set to obtain a similarity array;
and when the maximum similarity value in the similarity array is greater than or equal to a preset similarity threshold value, taking the alternative regression model for testing corresponding to the maximum similarity value as the regression model for testing.
In an implementation manner of the first aspect, the model training includes:
training the computer learning model based on the training data set, and fitting a regression model for alternative testing;
inputting the values of the independent variables in the training data set into the regression model for the alternative test, and comparing the output of the regression model for the alternative test with the values of the dependent variables in the training data set to determine the abnormal points of the data in the training data set;
removing data outliers from the training dataset;
training the computer learning model based on the training data set with the data outliers removed, and fitting the regression model for testing.
In an implementation manner of the first aspect, the method further includes:
and drawing a variable graph according to the record data set, wherein the variable graph is used for describing the continuous change of the independent variable and the dependent variable in an imaging mode.
In an implementation manner of the first aspect, the method further includes:
marking the data anomaly points on the variable graph.
In an implementation manner of the first aspect, the method further includes:
confirming the value of the independent variable and/or the dependent variable corresponding to the rollback node;
running the program to be tested by taking the initial value of the independent variable as a starting point;
when the running of the program to be tested causes the value of the independent variable and/or the dependent variable to reach the value of the independent variable and/or the dependent variable corresponding to the rollback node, stopping running the program to be tested;
and displaying the current state of the program to be tested.
In an implementation manner of the first aspect, the fallback node is a data anomaly point selected by a user.
In an implementation manner of the first aspect, the method further includes:
when the independent variable and/or the dependent variable are/is a group variable comprising a plurality of sub-quantities, drawing a variable graph aiming at a group variable display node, wherein the variable graph is used for graphically describing the value of each sub-quantity in the group variable display node;
on the variable graph, a sub-quantity that is an operation focus of the set of variable display nodes is marked.
In one implementation of the first aspect, the nodes are presented for the set of variables with user-selected data outliers.
In a second aspect, the present application provides an electronic device comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the electronic device to perform the method steps according to embodiments of the present application.
In a third aspect, the present application provides a computer-readable storage medium having stored thereon a computer program, which, when run on a computer, causes the computer to perform the method of an embodiment of the present application.
According to the technical scheme provided by the embodiment of the application, at least the following technical effects can be realized:
according to the method, the change relation between variables with the incidence relation in the program to be tested is fitted in an intelligent computer learning mode, whether the change relation between the variable change state in the running process of the program to be tested and the fitted variables is matched or not is detected, so that the abnormal data points of the variable change in the running process of the program to be tested are determined, the possible software bugs of the program to be tested are automatically positioned, and software debugging personnel are assisted in software debugging; according to the method, the accuracy of software vulnerability positioning can be greatly improved, time consumption of software vulnerability positioning is reduced, and software vulnerabilities are prevented from being omitted.
Drawings
FIG. 1 is a flow chart illustrating a software debugging method according to an embodiment of the present application;
FIG. 2 is a diagram of a set interface for variables to be tested according to one embodiment of the present application;
FIG. 3 is a flowchart illustrating a software debugging method according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a software debugging method according to an embodiment of the present application;
FIG. 5 is a diagram illustrating a software debugging apparatus according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating a software debugging method according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating a software debugging method according to an embodiment of the present application;
FIG. 8 is a flowchart illustrating a software debugging method according to an embodiment of the present application;
FIG. 9 is a partial flow diagram of a software debugging method according to an embodiment of the present application;
FIG. 10 is a flowchart illustrating a software debugging method according to an embodiment of the present application;
FIG. 11 is a flowchart illustrating a software debugging method according to an embodiment of the present application;
FIG. 12 is a diagram of a display interface graphically showing a continuous variation of a variable, in accordance with an embodiment of the present application;
FIG. 13 is a partial flow diagram of a software debugging method according to an embodiment of the present application;
FIG. 14 is a diagram illustrating a display interface for graphically displaying array variables according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terminology used in the description of the embodiments section of the present application is for the purpose of describing particular embodiments of the present application only and is not intended to be limiting of the present application.
The problem that software bugs cannot be located in certain application scenes due to the fact that software debugging time is too long in the prior art is solved. In a common application scenario, software debugging is that a software debugging person uses debugging software to run a code to be debugged, whether a software bug exists in the code to be debugged is distinguished according to feedback on the debugging software in the running process of the code to be debugged, and the root of the software bug is further positioned. In the above process, the positioning of the software bug is mainly obtained by analyzing and judging the output result of the debugging software by software debugging personnel, and because the manual analysis is usually executed by depending on the experience of the software debugging personnel, the problems of low speed and high error rate exist, so that the positioning of the software bug not only consumes too long time and has low accuracy, but also easily omits the software bug.
In view of the foregoing problems, an embodiment of the present application provides a software debugging method. Specifically, fig. 1 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one embodiment of the present application, as shown in fig. 1:
step 110, determining variables to be tested of a program to be tested, wherein the variables to be tested comprise independent variables and dependent variables with incidence relations;
step 120, running a program to be tested, recording continuous changes of values of independent variables and dependent variables in the variable to be tested, acquiring a recorded data set, and acquiring a training data set according to the recorded data set;
step 130, calling a computer learning model, training the computer learning model based on a training data set, fitting a test regression model which embodies the incidence relation between independent variables and dependent variables in the variables to be tested, wherein in the model training process, model input items are the independent variables in the training data set, and model output items are the dependent variables in the training data set;
step 140, using the regression model for testing to detect the test data set, wherein the test data set does not match the data abnormal points of the regression model for testing, specifically, inputting the independent variable value of the program to be tested in the running process into the regression model for testing, and comparing the output of the regression model for testing with the dependent variable value of the program to be tested in the running process to determine the data abnormal points of the program to be tested in the running process;
step 150, outputting the prompt information of the data anomaly point to the software debugging personnel, for example, outputting a voice prompt or outputting a pop-up prompt on a screen.
According to the method of the embodiment shown in fig. 1, the change relationship between the variables having the association relationship in the program to be tested is fitted in an intelligent learning manner through a computer, and whether the change relationship between the variable change state in the running process of the program to be tested and the fitted variables is matched or not is detected, so that the abnormal data points of the variable change in the running process of the program to be tested are determined, the software bugs possibly existing in the program to be tested are automatically positioned, and software debugging personnel are assisted in software debugging. According to the method, the accuracy of software vulnerability positioning can be greatly improved, time consumption of software vulnerability positioning is reduced, and software vulnerabilities are prevented from being omitted.
Further, in an actual application scenario, the association relationship between variables in the program to be tested is usually not a simple one-to-one relationship, that is, the relationship between variables in the program to be tested is usually not a simple correspondence relationship in which one independent variable corresponds to one dependent variable. To address this issue, in one implementation of step 110, the specific contents of the variables to be tested are determined according to the program to be tested. For different programs to be tested, the variable to be tested can comprise an independent variable and a dependent variable; the variables to be tested may also include an independent variable and a plurality of dependent variables; the variables to be tested may also comprise a plurality of independent variables and a dependent variable; the variables to be tested may also include a plurality of independent variables and a plurality of dependent variables.
For example, in an application scenario, the setting interface for the variables to be tested is shown in FIG. 2. In the dashed box 200 are the variables that are included in the variable to be tested, each row representing a variable. The type of variable may be selected in 201 and the name of the variable is entered in 202. The search button 203 is used to search all variables in the program currently under test. The plus button in 204 is used to add a variable to the variables to be tested, and the minus button is used to move the variables of the current row out of the variables to be tested.
Furthermore, in an actual application scenario, a plurality of different implementation modes can be adopted to detect the data abnormal points of the regression model for testing in the running process of the program to be tested.
Specifically, in one implementation of step 140, after the training of the regression model for testing is completed, the program to be tested is run, and during the running of the program to be tested, the abnormal data points not matching the regression model for testing are detected.
Further, in order to reduce the implementation difficulty of the scheme, in one implementation manner of step 140, the detection process is separated from the running process of the program to be tested. Specifically, after training of the regression model for testing is completed, running a program to be tested, recording continuous changes of independent variables and dependent variables in the variable to be tested, and acquiring a test data set; the test regression model is used to detect test datasets that do not match the data outliers of the test regression model.
FIG. 3 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one embodiment of the present application, as shown in fig. 3:
step 310, determining to-be-tested variables of a to-be-tested program, wherein the to-be-tested variables comprise independent variables and dependent variables with incidence relations;
step 320, running a program to be tested, recording the continuous change of the values of independent variables and dependent variables in the variable to be tested, and acquiring a training data set;
step 330, calling a computer learning model, training the computer learning model based on a training data set, fitting a test regression model which embodies the incidence relation between independent variables and dependent variables in the variables to be tested, wherein in the model training process, the input items of the model are the independent variables in the training data set, and the output items of the model are the dependent variables in the training data set;
step 341, running a program to be tested, recording the continuous change of the values of the independent variable and the dependent variable in the variable to be tested, and acquiring a test data set;
342, inputting the value of the independent variable in the test data set into a test regression model, and comparing the output of the test regression model with the value of the dependent variable in the test data set to determine the abnormal point of the data in the test data set;
and step 350, outputting the prompt information of the data abnormal point to a software debugging person.
Further, in an actual application scenario, before a program to be tested is run each time, a series of operations including initialization of environmental parameters, initialization of running parameters, setting of running parameters, and the like are generally required. If the operation of running-stopping-rerunning the program to be tested is repeated for many times, a large amount of unnecessary processing resource consumption is inevitably caused. Therefore, in order to reduce resource consumption and reduce implementation difficulty of the scheme, in the same data acquisition and execution link, a training data set for training the regression model for testing and a testing data set for detecting abnormal points of data are uniformly acquired.
Specifically, fig. 4 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one embodiment of the present application, as shown in fig. 4:
step 410, determining to-be-tested variables of a to-be-tested program, wherein the to-be-tested variables comprise independent variables and dependent variables with incidence relations;
step 420, running a program to be tested, recording the continuous change of the values of the independent variable and the dependent variable in the variable to be tested, and acquiring a recorded data set;
step 421, generating a training data set and a testing data set according to the recording data set;
step 430, calling a computer learning model, training the computer learning model based on the training data set, and obtaining a testing regression model which embodies the incidence relation between the independent variable and the dependent variable in the to-be-tested variable, wherein in the model training process, the input item of the model is the independent variable in the training data set, and the output item of the model is the dependent variable in the training data set;
step 440, inputting the value of the independent variable in the test data set into the regression model for testing, and comparing the output of the regression model for testing with the value of the dependent variable in the test data set to determine the abnormal point of the data in the test data set;
and step 450, outputting the prompt information of the data abnormal point to a software debugging person.
Specifically, in one implementation of step 421, the data in the recorded data set is multiplexed. All data in the recorded data set are used as a training data set, and all data in the recorded data set are used as a test data set; or, all data in the recorded data set is used as a training data set, and a part of data in the recorded data set is used as a test data set; alternatively, a portion of the recorded data set may be used as a training data set and all of the recorded data set may be used as a test data set.
Further, in one implementation of step 421, the training data set and the testing data set are separated. Specifically, the recorded data set is divided into two parts, one part is a training data set, and the other part is a testing data set. For example, use is made of 8: 2, randomly distributing data, and dividing the record data set into a training data set and a test data set.
Specifically, fig. 5 is a block diagram of a software debugging apparatus according to an embodiment of the present application. As shown in fig. 5, the to-be-tested program input module 501 obtains a to-be-tested program, for example, receives a transmitted to-be-tested program package through a communication interface, or reads a to-be-tested program code stored in a designated storage location.
The monitoring target setting module 502 confirms the variables to be tested to be monitored, and determines the independent variables and the dependent variables of the variables to be tested, for example, the variables to be tested to be monitored and the independent variables and the dependent variables of the variables to be tested are directly and manually set by software debugging personnel.
The program running module 510 executes the program to be tested acquired by the program to be tested input module 501. The data recording module 511 records changes of the independent variable and the dependent variable during the process of executing the program to be tested by the program running module 510 based on the independent variable and the dependent variable confirmed by the monitoring target setting module 502, and generates a record data set.
The data set segmentation module 520 segments the record data set generated by the data recording module 511 into a training data set and a test data set according to a preset data segmentation strategy, and stores the training data set and the test data set in the training set database 521 and the test set database 522, respectively.
The model training module 530 trains the regression model for testing using the training data set in the training set database 521.
The test module 540 tests the test data set in the test set database 522 using the test regression model trained by the model training module 530 to identify data outliers in the test data set.
The output module 550 outputs the data abnormal point detected by the test module 540 to the software tester, so that the software tester further determines whether the abnormal point is a software bug, and determines the source of the software bug.
Further, in practical application scenarios, the model training needs to be supported by enough training data, so in one implementation of step 130, the program to be tested is repeatedly executed multiple times to obtain a training data set with enough data amount. Specifically, in an embodiment, the repeated execution manner of the program to be tested is determined according to the structure of the program to be tested, for example, the program to be tested is repeatedly executed in a loop or recursive manner.
Further, to ensure that the amount of data in the training dataset is sufficient when training the regression model for testing, in one implementation of step 120, a minimum amount of data in the training dataset and/or the recording dataset is determined according to the amount of data required for training the regression model for testing, a round of repeatedly running the program to be tested is set according to the minimum amount of data in the training dataset and/or the recording dataset (for example, the program to be tested is repeatedly executed 10 times), or a minimum number of records in the training dataset is set (for example, 100 sets of data).
When the program to be tested is repeatedly executed for multiple times to obtain the training data set, the training of the regression model for testing can be started only after the repeated execution turn of the program to be tested is larger than or equal to the preset turn, or the record number in the training data set is larger than or equal to the preset record number.
Specifically, in an implementation manner of step 120, the program to be tested is repeatedly executed for multiple times, when the number of times of the repeated execution of the program to be tested is greater than or equal to the preset number of times, or the number of records in the training data set is greater than or equal to the preset number of records, the program to be tested is stopped being executed, a prompt that data acquisition is completed is output, and a software debugger starts the regression model for training test is waited.
Specifically, fig. 6 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one embodiment of the present application, as shown in fig. 6:
step 610, determining a to-be-tested variable of a to-be-tested program;
step 620, repeatedly running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable in the variable to be tested, and adding the recording result into the recording data set;
step 621, determining whether the number of times of repeated execution of the program to be tested reaches a preset number of times;
if the repeated execution times of the program to be tested does not reach the preset times, returning to the step 620, and continuously and repeatedly running the program to be tested;
if the repeated execution times of the program to be tested reaches the preset times, executing step 630;
step 630, stopping running the program to be tested, and outputting a data acquisition completion prompt;
step 631, determining whether the software debugging personnel instructs to start debugging;
if the software debugging personnel does not indicate to start debugging, returning to the step 631;
if the software debugger indicates to begin debugging, go to step 640;
step 640, generating a training data set and a testing data set according to the recorded data set;
step 650, calling a computer learning model, training the computer learning model based on the training data set, and fitting a regression model for testing;
step 660, detecting the test data set by using the test regression model, wherein the test data set does not match the data abnormal points of the test regression model;
step 670, outputting the prompt information of the data abnormal point to the software debugging personnel.
Further, to speed up software debugging rhythm and avoid time waste caused by software debugging personnel forgetting to start testing, in an implementation manner of step 120, the program to be tested is repeatedly executed for multiple times, when the repeated execution cycle of the program to be tested is greater than or equal to the preset cycle, or the number of records in the training data set is greater than or equal to the preset number of records, the program to be tested is stopped being executed, the prompt of completing data acquisition is not output, but step 130 is automatically executed, a regression model for testing is started to be trained, and the subsequent detection step is automatically executed after the training of the regression model for testing is completed.
Specifically, fig. 7 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one embodiment of the present application, as shown in fig. 7:
step 710, determining a to-be-tested variable of a to-be-tested program;
step 720, repeatedly running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable in the variable to be tested, and adding the recording result into the recording data set;
step 721, determining whether the number of times of repeated execution of the program to be tested reaches a preset number of times;
if the repeated execution times of the program to be tested does not reach the preset times, returning to the step 720, and continuing to repeatedly run the program to be tested;
if the repeated execution times of the program to be tested reaches the preset times, executing step 730;
step 730, stopping running the program to be tested;
step 740, generating a training data set and a test data set according to the recorded data set;
step 750, calling a computer learning model, training the computer learning model based on a training data set, and obtaining a testing regression model which embodies the association relation between independent variables and dependent variables in the variables to be tested;
step 760, detecting the test data set using the test regression model, without matching the data outliers of the test regression model;
and step 770, outputting the prompt information of the data abnormal point to a software debugging person.
Or, in an implementation manner of step 120, the program to be tested is repeatedly executed for multiple times, and when the number of times of repeatedly executing the program to be tested is greater than or equal to the preset number of times, or the number of records in the training data set is greater than or equal to the preset number of records, the program to be tested is stopped being executed, the data acquisition completion prompt is not output, but step 130 is automatically executed, and the training of the regression model for testing is started. And outputting prompt information capable of detecting the software to software debugging personnel after the training of the test regression model is finished, and waiting for the software debugging personnel to start detection.
Further, in a practical application scenario, when training a model, generally, the more training data, the more accurate the model obtained by training. Therefore, in an implementation manner of step 120, the program to be tested is repeatedly executed for multiple times, when the repeated execution rounds of the program to be tested satisfy the preset rounds, or the number of records in the training data set satisfies the preset number of records, the program to be tested is not stopped being executed, but a data acquisition completion prompt is output, and the program to be tested is continuously and repeatedly executed, the data volume of the training data set is continuously expanded until the software debugger stops the data acquisition operation of the training data set. In this way, as much training data support as possible can be provided for training the regression model for testing.
Specifically, fig. 8 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one embodiment of the present application, as shown in fig. 8:
step 810, determining a to-be-tested variable of a to-be-tested program;
step 820, repeatedly running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable in the variable to be tested, and adding the recording result into the recording data set;
step 821, determining whether the repeated execution times of the program to be tested reaches the preset times;
if the repeated execution times of the program to be tested does not reach the preset times, returning to the step 820, and continuously and repeatedly running the program to be tested;
if the repeated execution times of the program to be tested reaches the preset times, executing step 830;
step 830, outputting a data acquisition completion prompt;
step 831, judge whether the software debugging personnel instructs to start debugging;
if the software debugging personnel does not indicate to start debugging, executing step 841;
if the software debugger indicates to begin debugging, go to step 842;
step 841, running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable in the variable to be tested, adding the recording result into the recording data set, and returning to step 831;
step 842, stopping running the program to be tested, and generating a training data set and a test data set according to the recorded data set;
step 850, calling a computer learning model, training the computer learning model based on the training data set, and fitting a regression model for testing;
860, detecting the test data set by using the test regression model, wherein the test data set does not match the data anomaly points of the test regression model;
and step 870, outputting the prompt information of the data abnormal point to a software debugging person.
Further, in an embodiment of the present application, to improve the accuracy of the regression model for testing, a multi-round training mode is adopted to train the regression model for testing. Specifically, fig. 9 is a partial flowchart of a software debugging method according to an embodiment of the present application. In one embodiment of the present application, as shown in fig. 9:
step 900, calling a computer learning model, training the computer learning model based on a training data set, and fitting a regression model for alternative testing;
step 910, using the regression model for alternative testing to detect the abnormal data points in the training data set that do not match the regression model for alternative testing;
step 920, removing data outliers from the training dataset;
step 930, calling the computer learning model, training the computer learning model based on the training data set with the data outliers removed, and fitting the regression model for testing.
Further, in an actual application scenario, multiple rounds of steps 900-930 can be performed according to actual needs to obtain a regression model for testing meeting precision requirements.
Further, in an embodiment of the present application, after the regression model for testing is obtained, the derivation and encapsulation operations are performed on the regression model for testing, so as to save the regression model for testing as a fixed testing tool. Therefore, the monitoring module or the protection module can be directly called in a subsequent application scene, so that the workload of software debugging personnel is greatly reduced, and the working efficiency is improved.
Further, in practical application scenarios, the computer learning models that are commonly used include deep learning models, such as a convolutional neural network model, a recursive neural network model, and the like. Although the deep learning model has the advantage of high fitting accuracy, training of the deep learning model not only consumes a large amount of training time, but also requires a large amount of training data to support. If the deep learning model is invoked in step 130, training the test regression model consumes a significant amount of training data acquisition time as well as model training time. Thus, in one implementation of step 130, the invoked computer learning model is not a deep learning model, but a machine learning model that is relatively simple in structure. Specifically, in an actual application scenario, the computer learning model called in step 130 includes, but is not limited to, linear regression, decision tree, logistic regression, and Boosting model.
Further, in the actual application scenario, there are cases where multiple machine learning models are available to be called at the same time when step 130 is executed, and therefore, when step 130 is executed, it is necessary to first confirm the machine learning model to be called. Specifically, in one implementation of step 130, a computer learning model adapted to the current application scenario is determined according to the structure of the program to be tested.
Further, in an implementation manner of step 130, it is not directly determined whether the machine learning model is suitable for the current application scenario, but the test regression model is trained first, and then it is determined whether the trained test regression model is suitable for the current application scenario.
Specifically, in one implementation of step 130, the test regression model is determined based on how well the test regression model matches the test data set. After the test regression model is obtained through training, the independent variable in the test data set is input into the test regression model as an input item to obtain the output of the test regression model, and the similarity between the output of the test regression model and the dependent variable in the test data set is calculated (the higher the similarity between the output of the test regression model and the dependent variable in the test data set is, the more the test regression model adapts to the current application scene).
Specifically, fig. 10 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one implementation of step 130, as shown in FIG. 10:
step 1000, calling an un-called machine learning model in a machine learning model library;
step 1010, training the machine learning model called in the step 1000 by using a training data set to fit a regression model for alternative tests;
step 1020, inputting the value of the independent variable in the test data set as an input item into the regression model for the alternative test to obtain the output of the regression model for the alternative test, and calculating the similarity between the output of the regression model for the alternative test and the value of the dependent variable in the test data set;
step 1040, judging whether the similarity between the output of the regression model for the alternative test and the dependent variable in the test data set is greater than or equal to a preset similarity threshold;
if the similarity between the output of the regression model for the alternative test and the dependent variable in the test data set is smaller than a preset similarity threshold, executing a step 1050;
if the similarity between the output of the regression model for the candidate test and the dependent variable in the test data set is greater than or equal to the preset similarity threshold, go to step 1060;
step 1050, judging whether an un-called machine learning model still exists in the machine learning model library;
if the machine learning model library still has the machine learning model which is not called, returning to the step 1000;
if the machine learning model library does not have the machine learning model which is not called, executing the step 1001;
1001, outputting a test regression model training failure prompt;
step 1060, the regression model for alternate testing is used as the regression model for testing.
Specifically, fig. 11 is a flowchart illustrating a software debugging method according to an embodiment of the present application. In one implementation of step 130, as shown in FIG. 11:
step 1110, respectively training each machine learning model in the machine learning model library by using the training data set to fit a plurality of regression models for alternative tests;
step 1120, inputting the independent variables in the test data set as input items into each regression model for the alternative test to obtain the output of each regression model for the alternative test;
step 1130, respectively calculating the similarity between the output of each regression model for the alternative test and the dependent variable in the test data set, and generating a similarity set comprising a plurality of similarity values;
step 1140, determining whether the maximum similarity value in the similarity set is greater than or equal to a preset similarity threshold;
if the similarity between the output of the regression model for the alternative test and the dependent variable in the test data set is less than the preset similarity threshold, execute step 1150;
if the similarity between the output of the regression model for the alternative test and the dependent variable in the test data set is greater than or equal to the preset similarity threshold, executing step 1160;
step 1150, outputting a test regression model training failure prompt;
step 1160, using the candidate regression model corresponding to the maximum similarity value as the regression model for testing.
Furthermore, in an actual application scenario, in order to facilitate software debugging personnel to monitor variables in the program to be debugged, a feasible scheme is to display graphical representations of the variables. For example, looking at a variable whose type is a graphic, the corresponding graphic can be directly displayed.
Although the variable content can be visually displayed by the graphical expression mode, in the running process of the program to be debugged, the values of a plurality of variables are constantly changed, different variables are often associated, and software bugs are often associated with the variables and are variable. Therefore, the content of a specific variable is graphically displayed, and the help of software debugging personnel for checking software bugs is limited.
In order to solve the above problems, in an embodiment of the present application, a software debugging worker is provided with graphical help by graphically displaying continuous changes of independent variable variables in a program to be debugged, so that the difficulty of the software debugging worker in positioning a software bug is reduced. Specifically, in an embodiment, in the running process of the program to be tested, the continuous changes of the values of the independent variable and the dependent variable are recorded, a recorded data set is obtained, a variable graph is drawn according to the recorded data set, and the variable graph is used for describing the continuous changes of the values of the independent variable and the dependent variable in an imaging manner.
Specifically, for an application scenario, as shown in fig. 12, the independent variable to be displayed is i, the dependent variable is data1, data2, and dataTotal are set in 1300. In the graph of fig. 12, the horizontal axis represents independent variables and the vertical axis represents dependent variables. In the process of running the program to be debugged, when the independent variable i continuously changes, the corresponding data1, data2 and dataTotal continuously change ( curves 1301, 1302 and 1303). Thus, a software debugger can directly observe the variation relationship among the independent variable i, the dependent variable data1, the data2 and the dataTotal from the image, so that software bugs are located through the variation of the independent variable i, the dependent variable data1, the data2 and the dataTotal.
Further, in an actual application scenario, a variety of different graphical interface forms can be adopted according to the variable type, such as a line graph, a bar graph, a time axis, and the like, or a mixed graph format. For example, when an argument x of a double precision (float) type indicates a graphics compression ratio, a dependent variable y of a type of picture is a picture display. As the developer drags the value coordinates of x, the y image content (sharpness quality) follows.
Further, in an embodiment of the present application, in order to visually display the data exception point to the software debugging person, a data exception point reminder is superimposed on the graphical display interface. Specifically, the independent variable and the dependent variable that change continuously are displayed in a graphical manner (for example, on the coordinate axes shown in fig. 12), and data anomaly points are marked on the continuously changing graphs of the independent variable and the dependent variable.
FIG. 13 is a partial flow diagram of a software debugging method according to an embodiment of the present application. In an embodiment of the present application, as shown in fig. 13:
step 1410, determining a to-be-tested variable of a to-be-tested program;
step 1420, running a program to be tested, recording continuous changes of independent variables and dependent variables in the variable to be tested, and acquiring a training data set;
step 1430, calling a computer learning model, training the computer learning model based on the training data set, and obtaining a testing regression model which embodies the incidence relation between the independent variable and the dependent variable in the to-be-tested variable, wherein in the model training process, the input item of the model is the independent variable in the training data set, and the output item of the model is the dependent variable in the training data set;
1441, running a program to be tested, recording continuous changes of values of independent variables and dependent variables in variables to be tested, and acquiring a test data set;
step 1442, detecting the test data set by using the regression model for testing, wherein the test data set does not match the abnormal data points of the regression model for testing;
and 1450, drawing a variable graph displaying continuous variation of the independent variable and the dependent variable according to the test data set, and marking data abnormal points on the variable graph.
Further, in an actual application scenario, in the running process of the program to be tested, or after the program to be tested stops running, if a software tester needs to check the running state of a certain running node (for example, time T, or the value of the variable i reaches the value a) before the program to be tested runs, one of the feasible schemes is a state rollback scheme based on the breakpoint snapshot. Specifically, a plurality of breakpoints are set according to a preset strategy (for example, a breakpoint is set every 5 seconds) in the running process of the program to be tested, and a snapshot of the running state of the program to be tested at the position of the breakpoint is stored. When a software tester needs to check the running state of a program to be tested running at a certain previous moment, a breakpoint corresponding to the moment is determined, and a snapshot corresponding to the breakpoint is called. Although the state rollback scheme based on breakpoint snapshot can be used for rapidly rolling back the program to be tested to a specific breakpoint, the scheme is based on the rollback of the breakpoint and is not based on the rollback of a variable value, so that accurate rollback cannot be achieved. For example, when a software tester needs to check the running state of a program to be tested when running at a time node T, if a breakpoint is not set when the program to be tested runs at the time node T, the software tester can only back to the breakpoint closest to the time node T, and cannot realize accurate back.
In order to solve the above problem, in an embodiment of the application, a re-execution rollback scheme is adopted, when a software tester needs to check the running state of a program to be tested when running at a running node a, the program to be tested is re-run, and when the running state of the program to be tested reaches the running node a, the running of the program to be tested is stopped, and the current running state of the program to be tested is displayed.
Specifically, in an embodiment of the present application, the method further includes:
confirming the value of an independent variable and/or a dependent variable corresponding to a rollback node;
taking the initial value of the independent variable as a starting point, and running a program to be tested;
when the running of the program to be tested causes the value of the independent variable and/or the dependent variable to reach the value of the independent variable and/or the dependent variable corresponding to the backspacing node, stopping running the program to be tested;
and displaying the current state of the program to be tested.
Further, in an embodiment, the data exception point selected by the user is used as a rollback node.
Taking an application scenario as an example, as shown in fig. 12, it is assumed that, during a graphical observation process, continuous changes of the dependent variables data1, data2 and dataTotal corresponding to the continuous change of the independent variable i from 1 to 14 are graphically shown ( curves 1301, 1302 and 1303). Assuming that the point i-5 is marked as a data anomaly point, a software tester needs to check the running state of the program to be tested when the program runs at the point i-5.
Clicking the history value on the horizontal axis, clicking i to 5, and prompting by the debugger whether to rollback to i to 5. When the software tester chooses to return to i-5, the program to be tested is re-executed (starting from i-1) and stops executing until i-5 (corresponding to the state (including all context values) when the whole system stack returns to i-5).
Further, in an actual application scenario, the variable a in the program to be tested may be a variable group including a plurality of variable values, for example, an array. In the process of running the program to be tested, in a certain flow, the variable a may participate in the flow as a whole, but in the actual execution process of the code, the operation for the variable a is executed according to a specific logic sequence and respectively for each variable value in the variable a. At some point, the object for which the program operates may be only one variable value of the variable a. For example, when the array variable {55,38,65,97,76,13,27,87} is sorted by the minimum method, the flow is as follows:
1, taking the minimum value of all parameter values in {55,38,65,97,76,13,27 and 87} as 13;
2, arranging 13 at the forefront position to obtain {13,55,38,65,97,76,27,87 };
3, taking the minimum value of the last 7-bit parameter values in {13,55,38,65,97,76,27 and 87} as 27;
4, rank 27 second, resulting in {13,27,55,38,65,97,76,87 };
5, taking the minimum value of the later 6-bit parameter values in {13,27,55,38,65,97,76 and 87} as 38;
6, arrange 38 in the third place, resulting in {13,27,38,55,65,97,76,87 };
7, taking the minimum value of the last 5-bit parameter values in {13,27,38,55,65,97,76 and 87} as 55;
8, arranging 55 at the fourth position to obtain {13,27,38,55,65,97,76,87 };
9, taking the minimum value of the last 4-bit parameter values in {13,27,38,55,65,97,76 and 87} as 65;
10, line 65 in the fifth bit, resulting in {13,27,38,55,65,97,76,87 };
11, taking the minimum value of the last 3-bit parameter values in {13,27,38,55,65,97,76 and 87} as 76;
12, ranking 76 in the sixth digit, resulting in {13,27,38,55,65,76,97,87 };
13, taking the minimum value of the last 2-bit parameter values in {13,27,38,55,65,76,97 and 87} as 87;
14, line 87 in the seventh position, resulting in {13,27,38,55,65,76,87,97 };
although the above flow is to perform sorting operation on the array variables {55,38,65,97,76,13,27,87}, in the code execution process, actually, the operation is performed on one value of the array variables {55,38,65,97,76,13,27,87} in each step in a plurality of steps. If only the values of the array variables {55,38,65,97,76,13,27,87} are graphically displayed, the details of the code running process are difficult to embody, and software debugging personnel cannot be helped to locate software bugs existing in the code running process.
In view of the above problem, in an embodiment of the present application, for a variable group including a plurality of variable values, not only each variable value in the variable group is graphically displayed, but also the variable value in the variable group that is the current operation focus is marked, for example, a different color is used to implement the marking. Therefore, the change of the operation focus can be visually displayed to software debugging personnel, and the software debugging personnel can be helped to position the software bugs existing in the running process of the codes according to the change of the operation focus.
Specifically, in an embodiment of the present application, the method further includes:
when the independent variable and/or the dependent variable are/is a group variable comprising a plurality of sub-quantities, drawing a variable graph aiming at the group variable display node, wherein the variable graph is used for graphically describing the value of each sub-quantity in the group variable at the group variable display node;
on the variable graph, a sub-quantity showing the operation focus of the node as a group variable is marked.
Further, in one embodiment, the nodes are shown with the user selected data outliers as the group variables.
FIG. 14 shows a graphical representation of array variables as they proceed to step 11 in the process of sorting the array variables {55,38,65,97,76,13,27,87 }. As shown in fig. 14, when step 11 is executed, 13,27,38,55,65 are already sorted, the minimum value is currently determined from 97,76,87, and the operation focus is 76 of the minimum value.
It is to be understood that some or all of the steps or operations in the above-described embodiments are merely examples, and other operations or variations of various operations may be performed by the embodiments of the present application. Further, the various steps may be performed in a different order presented in the above-described embodiments, and it is possible that not all of the operations in the above-described embodiments are performed.
Further, as technology advances, many process flow improvements today can be seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. Such as a Programmable Logic Device (PLD), whose Logic function is determined by the party accessing the programming of the Device. A digital device is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate a dedicated integrated circuit chip. Furthermore, nowadays, instead of manually manufacturing an integrated circuit chip, such programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development, and the original code before compiling is also written by a specific programming Language, which is called Hardware Description Language (HDL). It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
In the description of the embodiments of the present application, for convenience of description, the device is described as being divided into various modules by functions, the division of each module is only a division of logic functions, and the functions of each module may be implemented in one or more pieces of software and/or hardware when the embodiments of the present application are implemented.
Specifically, the apparatuses proposed in the embodiments of the present application may be wholly or partially integrated into one physical entity or may be physically separated when actually implemented. And these modules can be realized in the form of software called by processing element; or may be implemented entirely in hardware; and part of the modules can be realized in the form of calling by the processing element in software, and part of the modules can be realized in the form of hardware. For example, the detection module may be a separate processing element, or may be integrated into a chip of the electronic device. Other modules are implemented similarly. In addition, all or part of the modules can be integrated together or can be independently realized. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
Those skilled in the art can appreciate that the specific working processes of the devices and modules described in the embodiments of the present application may refer to the corresponding processes in the foregoing method embodiments.
An embodiment of the present application also proposes an electronic device comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the electronic device to perform the method steps as described in the embodiments of the present application.
Specifically, in an embodiment of the present application, the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the apparatus, cause the apparatus to perform the method steps described in the embodiment of the present application.
Specifically, in an embodiment of the present application, a processor of the electronic device may be an on-chip device SOC, and the processor may include a Central Processing Unit (CPU), and may further include other types of processors. Specifically, in an embodiment of the present application, the processor of the electronic device may be a PWM control chip.
Specifically, in an embodiment of the present application, the processors may include, for example, a CPU, a DSP, a microcontroller, or a digital Signal processor, and may further include a GPU, an embedded Neural-Network Processor (NPU), and an Image Signal Processing (ISP), and the processors may further include necessary hardware accelerators or logic Processing hardware circuits, such as an ASIC, or one or more integrated circuits for controlling the execution of the program according to the present application. Further, the processor may have the functionality to operate one or more software programs, which may be stored in the storage medium.
Specifically, in an embodiment of the present application, the memory of the electronic device may be a read-only memory (ROM), another type of static storage device capable of storing static information and instructions, a Random Access Memory (RAM), or another type of dynamic storage device capable of storing information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or another optical disc storage, an optical disc storage (including a compact disc, a laser disc, an optical disc, a digital versatile disc, a blu-ray disc, etc.), a magnetic disc storage medium, or another magnetic storage device, or any computer readable medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
In particular, in an embodiment of the present application, the processor and the memory may be combined into a processing device, and more generally, independent components, and the processor is configured to execute the program code stored in the memory to implement the method described in the embodiment of the present application. In particular implementations, the memory may be integrated within the processor or may be separate from the processor.
Further, the apparatuses, devices, or modules illustrated in the embodiments of the present application may be implemented by a computer chip or an entity, or by a product with certain functions.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied in the medium.
In the several embodiments provided in the present application, any function, if implemented in the form of a software functional module and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application.
Specifically, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute the method provided by the embodiment of the present application.
An embodiment of the present application further provides a computer program product, which includes a computer program, when it runs on a computer, causes the computer to execute the method provided by the embodiment of the present application.
The embodiments herein are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments herein. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In the embodiments of the present application, "at least one" means one or more, "and" a plurality "means two or more. "and/or" describes the association relationship of the associated objects, and means that there may be three relationships, for example, a and/or B, and may mean that a exists alone, a and B exist simultaneously, and B exists alone. Wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c may represent: a, b, c, a and b, a and c, b and c or a and b and c, wherein a, b and c can be single or multiple.
In the embodiments of the present application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the specific embodiments of the present application, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present disclosure, and all the changes or substitutions should be covered by the protection scope of the present application. The protection scope of the present application shall be subject to the protection scope of the claims.

Claims (16)

1. A method for debugging software, comprising:
determining to-be-tested variables of a to-be-tested program, wherein the to-be-tested variables comprise independent variables and dependent variables with incidence relations;
data acquisition, including recording the continuous change of the independent variable and the dependent variable in the running process of the program to be tested, acquiring a recorded data set, and generating a training data set according to the recorded data set;
training a computer learning model based on the training data set, and fitting a test regression model, wherein the test regression model is used for embodying the association relationship between the independent variable and the dependent variable, and in the model training process, a model input item is the value of the independent variable in the training data set, and a model output item is the value of the dependent variable in the training data set;
and positioning the abnormal points, namely inputting the values of the independent variables in the running process of the program to be tested into the regression model for testing, comparing the output of the regression model for testing with the values of the dependent variables in the running process of the program to be tested, and determining the data abnormal points in the running process of the program to be tested.
2. The method of claim 1, wherein the data acquisition comprises:
and repeatedly running the program to be tested, stopping running the program to be tested when the running times of the program to be tested meet preset times or the record number in the record data set meets preset record number, and generating a training data set according to the record data set.
3. The method of claim 1, wherein the data acquisition comprises:
repeatedly running the program to be tested, and outputting a data acquisition completion prompt when the running times of the program to be tested meet a preset number or the record number in the record data set meets a preset record number;
and when the data acquisition is closed or the software debugging is started, stopping running the program to be tested, and generating a training data set according to the recorded data set.
4. The method of claim 1, wherein:
the data acquisition comprises: running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable, acquiring a first recorded data set, and taking the first recorded data set as the training data set;
the outlier positioning comprises:
the data acquisition comprises: running the program to be tested, recording the continuous change of the values of the independent variable and the dependent variable, acquiring a second recorded data set, and taking the second recorded data set as the test data set;
and inputting the value of the independent variable in the test data set into the regression model for test, and comparing the output of the regression model for test with the value of the dependent variable in the test data set to determine the abnormal point of the data in the test data set.
5. The method of claim 1, wherein:
the data acquisition comprises: running the program to be tested, recording the continuous change of the independent variable and the dependent variable, and acquiring the recorded data set; segmenting the recording dataset into the training dataset and a test dataset;
and positioning the abnormal points, namely inputting the values of the independent variables in the test data set into the test regression model, and comparing the output of the test regression model with the values of the dependent variables in the test data set to determine the data abnormal points in the test data set.
6. The method of claim 5, wherein the model training comprises:
calling an un-called machine learning model in the machine learning model library:
training the machine learning model based on the training data set to fit a regression model for alternative testing;
inputting the values of the independent variables in the test data set as input items into the regression model for the alternative test to obtain the output of the regression model for the alternative test;
calculating the similarity between the output of the regression model for the alternative test and the value of the dependent variable in the test data set;
and when the similarity between the output of the regression model for the alternative test and the value of the dependent variable in the test data set is greater than or equal to a preset similarity threshold value, taking the regression model for the alternative test as the regression model for the test.
7. The method of claim 5, wherein the model training comprises:
calling a machine learning model in a machine learning model library:
respectively training each machine learning model in the machine learning model library based on the training data set to fit a plurality of regression models for alternative tests;
respectively inputting the value of the independent variable in the test data set as an input item into each regression model for the alternative test to obtain the output of each regression model for the alternative test;
calculating the similarity between the output of each regression model for the alternative tests and the value of the dependent variable in the test data set to obtain a similarity array;
and when the maximum similarity value in the similarity array is greater than or equal to a preset similarity threshold value, taking the alternative regression model for testing corresponding to the maximum similarity value as the regression model for testing.
8. The method of claim 1, wherein the model training comprises:
training the computer learning model based on the training data set, and fitting a regression model for alternative testing;
inputting the values of the independent variables in the training data set into the regression model for the alternative test, and comparing the output of the regression model for the alternative test with the values of the dependent variables in the training data set to determine the abnormal points of the data in the training data set;
removing data outliers from the training dataset;
training the computer learning model based on the training data set with the data outliers removed, and fitting the regression model for testing.
9. The method according to any one of claims 1 to 8, further comprising:
and drawing a variable graph according to the record data set, wherein the variable graph is used for describing the continuous change of the independent variable and the dependent variable in an imaging mode.
10. The method of claim 9, further comprising:
marking the data anomaly points on the variable graph.
11. The method according to any one of claims 1 to 8, further comprising:
confirming the value of the independent variable and/or the dependent variable corresponding to the rollback node;
running the program to be tested by taking the initial value of the independent variable as a starting point;
when the running of the program to be tested causes the value of the independent variable and/or the dependent variable to reach the value of the independent variable and/or the dependent variable corresponding to the rollback node, stopping running the program to be tested;
and displaying the current state of the program to be tested.
12. The method of claim 11, wherein a user-selected data anomaly point is used as the fallback node.
13. The method according to any one of claims 1 to 8, further comprising:
when the independent variable and/or the dependent variable are/is a group variable comprising a plurality of sub-quantities, drawing a variable graph aiming at a group variable display node, wherein the variable graph is used for graphically describing the value of each sub-quantity in the group variable display node;
on the variable graph, a sub-quantity that is an operation focus of the set of variable display nodes is marked.
14. The method of claim 13, wherein nodes are exposed for the set of variables with user-selected data anomaly points.
15. An electronic device, characterized in that the electronic device comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the electronic device to perform the method steps of any of claims 1-14.
16. A computer-readable storage medium, in which a computer program is stored which, when run on a computer, causes the computer to carry out the method according to any one of claims 1-14.
CN202010949710.4A 2020-09-10 2020-09-10 Software debugging method and electronic equipment Pending CN114168447A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010949710.4A CN114168447A (en) 2020-09-10 2020-09-10 Software debugging method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010949710.4A CN114168447A (en) 2020-09-10 2020-09-10 Software debugging method and electronic equipment

Publications (1)

Publication Number Publication Date
CN114168447A true CN114168447A (en) 2022-03-11

Family

ID=80475866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010949710.4A Pending CN114168447A (en) 2020-09-10 2020-09-10 Software debugging method and electronic equipment

Country Status (1)

Country Link
CN (1) CN114168447A (en)

Similar Documents

Publication Publication Date Title
US10025696B2 (en) System and method for equivalence class analysis-based automated requirements-based test case generation
US8935673B1 (en) System and method for debugging computer program based on execution history
Mayerhofer et al. A runtime model for fUML
US9239773B1 (en) Method and system for debugging a program that includes declarative code and procedural code
Ryser et al. SCENT: A method employing scenarios to systematically derive test cases for system test
US7895575B2 (en) Apparatus and method for generating test driver
US20170153967A1 (en) Using model-based diagnosis to improve software testing
US20140214396A1 (en) Specification properties creation for a visual model of a system
US10037260B2 (en) System for expression evaluation at debug time
CN112286814A (en) Automatic generation system and method of test case script
CN114138670B (en) Method based on integration of interface automation test and function, performance and safety test
CN115509904A (en) Assertion generation method and device of interface test case
CN110297765B (en) Early evaluation method for software reliability
Dwarakanath et al. Accelerating test automation through a domain specific language
CN114168447A (en) Software debugging method and electronic equipment
CN111143228A (en) Test code generation method and device based on decision table method
CN113778454B (en) Automatic evaluation method and system for artificial intelligent experiment platform
Jukks et al. Transformations debugging transformations
US9489284B2 (en) Debugging method and computer program product
US10969429B1 (en) System and method for debugging in concurrent fault simulation
JP2005301568A (en) Display information storage controller, and program thereof
Seifert et al. Debugging triple graph grammar-based model transformations
Schöpp et al. Requirements-based code model checking
CN113672490B (en) Function definition identification method, device and equipment
CN112506780A (en) Method, system, electronic device and storage medium for problem tracking

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination