CN105224463A - A kind of software defect Code location method based on collapse stack data - Google Patents

A kind of software defect Code location method based on collapse stack data Download PDF

Info

Publication number
CN105224463A
CN105224463A CN201510714252.5A CN201510714252A CN105224463A CN 105224463 A CN105224463 A CN 105224463A CN 201510714252 A CN201510714252 A CN 201510714252A CN 105224463 A CN105224463 A CN 105224463A
Authority
CN
China
Prior art keywords
collapse
code unit
history
stack data
defect
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.)
Granted
Application number
CN201510714252.5A
Other languages
Chinese (zh)
Other versions
CN105224463B (en
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.)
Nanjing University
Original Assignee
Nanjing University
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 Nanjing University filed Critical Nanjing University
Priority to CN201510714252.5A priority Critical patent/CN105224463B/en
Publication of CN105224463A publication Critical patent/CN105224463A/en
Application granted granted Critical
Publication of CN105224463B publication Critical patent/CN105224463B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The present invention relates to a kind of software defect Code location method based on collapse stack data, in conjunction with history collapse stack data and history codes maintenance record, applied for machines learning art, build defect code forecast model, each final goal collapse code unit of defect is comprised in forecasting software, thus in quick position software, comprise the code unit of defect, and evaluate for each final goal collapse code unit, effectively improve the work efficiency that software code is repaired; And method for designing of the present invention is simple, be applicable to dissimilar programming language, and the computer software of different scales, there is extendability and adaptability, conveniently apply parallel algorithm, can collapse stack data that fast and effeciently treatment and analysis is a large amount of, improve the usefulness of software defect location, to the test of large software system and maintenance work in can be used for.

Description

A kind of software defect Code location method based on collapse stack data
Technical field
The present invention relates to a kind of software defect Code location method based on collapse stack data, belong to software test maintenance technology field.
Background technology
Computer software inevitably produces software defect in exploitation and maintenance process, and defect location is the work that in software debugging process, takes time and effort, all the more so to large scope software system.Software defect location is one of hot issue in soft project research field always.Defect location utilizes code to perform information and defect (problem) report, and the possible range of prediction defect code, auxiliary development personnel find defective locations.Current software system scale is increasing, and code file gets more and more, and according to defect report content, the process navigating to defect code from the code file of magnanimity is look for a needle in a haystack.In addition, in software development cycle, also present a contrast between huge software size and limited development& testing cost.
Current defect code location is still judged to be master manually to locate with experience, utilizes interactively debugging acid more, needs a large amount of manual intervention, location efficiency is low, at substantial time and cost, and not reproducible, be difficult to the debugging demand meeting and adapt to large scope software system.In recent years, researcher proposes some automatic defect Code location methods, but these methods need the multidate information obtaining software execute process more, as code coverage data and execution track etc., is applicable to the software defect location of statement level among a small circle; Still can not meet the defect location requirement of large scope software system at function and procedure level.
Summary of the invention
For above-mentioned technical matters, technical matters to be solved by this invention is to provide a kind of software defect Code location method based on collapse stack data, applied for machines learning art, can comprise the code unit of defect in quick position software, effectively improves the work efficiency that software code is repaired.
The present invention is in order to solve the problems of the technologies described above by the following technical solutions: the present invention devises a kind of software defect Code location method based on collapse stack data, comprises the steps:
Step 001. collects history collapse stack data and the history codes maintenance record of software systems, and respectively for each history collapse stack data, obtain each history collapse code unit corresponding to history collapse stack data, form the history collapse code unit set corresponding to all history collapse stack data, and enter step 002;
Step 002. for each history collapse code unit in the set of history collapse code unit, obtains the eigenwert of each default characteristic index of history collapse code unit respectively; Then respectively for each history collapse code unit, history is collapsed the proper vector that code unit is converted into the eigenwert composition of each default characteristic index corresponding to it, obtaining each history collapse code unit institute, to distinguish characteristic of correspondence vectorial, and enter step 003;
Step 003., according to history codes maintenance record, distinguish characteristic of correspondence in conjunction with each history collapse code unit institute vectorial, is judged that each history is collapsed code unit and whether comprised defect respectively; Then for each history collapse code unit comprising defect, obtain and collapse by this each history the eigenvectors matrix that corresponding to code unit, proper vector forms, composing training collection, and enter step 004;
Step 004. application training collection, trains for default sorter, obtains trained sorter, and enters step 005;
Step 005., for each target collapse stack data, obtains each target collapse code unit corresponding to each target collapse stack data difference, forms the target collapse code unit set corresponding to all targets collapse stack data, and enters step 006;
Step 006. for each target collapse code unit in the set of target collapse code unit, obtains the eigenwert of each default characteristic index of target collapse code unit respectively; Then respectively for each target collapse code unit, target is collapsed the proper vector that code unit is converted into the eigenwert composition of each default characteristic index corresponding to it, obtaining each target collapse code unit institute, distinguish characteristic of correspondence vectorial, formation target prediction collection, and enter step 007;
Step 007. adopts trained sorter, predicts for target prediction collection, predicts whether each target collapse code unit comprises defect, determines each final goal collapse code unit comprising defect in each target collapse stack data respectively.
As a preferred technical solution of the present invention: also comprise the steps 008 after described step 007:
Step 008., according to history codes maintenance record, is evaluated for each final goal collapse code unit.
As a preferred technical solution of the present invention: described step 008 specifically comprises the steps:
Step 00801., for each final goal collapse code unit, obtains the desired value x of each default defect tendency index of final goal collapse code unit respectively i, and enter step 00802; Wherein, 1≤i≤I, I is the number of default defect tendency index;
Step 00802., according to following formula, for each final goal collapse code unit, obtains the defect tendency scoring Score of each final goal collapse code unit respectively, and enters step 00803;
S c o r e = 1 1 + e - Σ i = 1 I x i
Step 00803., according to the defect tendency scoring Score of each final goal collapse code unit, sorts for each final goal collapse code unit.
As a preferred technical solution of the present invention: the number I=5 of described default defect tendency index, in described step 00701, according to following 5 default defect tendency indexs, and desired value x icomputing formula, for each final goal collapse code unit, obtains the desired value x of each default defect tendency index of final goal collapse code unit respectively i;
x 1 = 10 1 + F r a m e + D i s e
X 1represent reverse calling distance defect tendency index, for weigh final goal collapse code unit distance collapse point call distance; Frame represents that final goal collapse code unit is positioned at the number of plies position of corresponding target collapse stack data, wherein, the number of plies residing for collapse point is 0, if when final goal collapse code unit does not appear in corresponding target collapse stack data, then Frame equals the maximum number of plies of corresponding target collapse stack data and adds 1; Dise represent final goal collapse code unit call the degree of depth;
x 2=log(LOC+1)
X 2represent final goal collapse code unit unit length defect tendency index, for weighing the relative length of final goal collapse code unit, LOC represents the code line sum that final goal collapse code unit comprises;
x 3 = 10 l o g ( D a y + 1 )
X 3represent final goal collapse code unit defect perdurability tendency index, for weighing final goal collapse code unit with the last time gap of repairing or upgrading; Day represents the nearest number of days once repaired or upgrade of final goal collapse code unit;
x 4 = 10 × N d e f e c t N
X 4represent final goal collapse code unit defect rate tendency index, for weighing final goal collapse code unit predicted ratio comprising defect in default sorter; N represents the quantity of base sorter in default sorter; N defectrepresent to preset in sorter and predict that final goal collapse code unit comprises the quantity of the base sorter of defect;
x 5 = 100 × No d e f e c t N o
X 5representing final goal collapse code unit historic defects ratio tendency index, in history collapse stack data, being predicted to be the ratio comprising defect for weighing final goal collapse code unit; No represents the number of the history collapse stack data relating to final goal collapse code unit; No defectrepresent the quantity of the target collapse stack data comprising defect according to history codes maintenance record determination final goal collapse code unit.
As a preferred technical solution of the present invention: described default sorter is AdaBoost sorter
As a preferred technical solution of the present invention: in described step 001, respectively for each history collapse stack data, perform following steps a01 to step a03, obtain each history collapse code unit corresponding to each history collapse stack data difference, form the history collapse code unit set corresponding to all history collapse stack data;
Step a01. application call link analysis method, analysis expansion is carried out for the code unit related in history collapse stack data, obtain the whole code units involved by this history collapse stack data, and build the static call figure corresponded, then enter step a02;
Step a02. application controls flow analysis method, based on software control stream order, deletes software in static call figure and performs inaccessible code unit, and enter step a03;
Step a03. applies reverse microtomy, based on software control stream order, delete in static call figure and collapse with this history the code unit that in stack data, collapse point variable reference is irrelevant, finally, in static call figure, remaining code unit is each history collapse code unit corresponding to this history collapse stack data.
As a preferred technical solution of the present invention: in described step 005, for each target collapse stack data, perform following steps b01 respectively to step b03, obtain each target collapse code unit corresponding to each target collapse stack data difference, form the target collapse code unit set corresponding to all targets collapse stack data;
Step b01. application call link analysis method, analysis expansion is carried out for the code unit related in target collapse stack data, obtain the whole code units involved by this target collapse stack data, and build the static call figure corresponded, then enter step b02;
Step b02. application controls flow analysis method, based on software control stream order, deletes software in static call figure and performs inaccessible code unit, and enter step b03;
Step b03. applies reverse microtomy, based on software control stream order, delete in static call figure and collapse with this target the code unit that in stack data, collapse point variable reference is irrelevant, finally, in static call figure, remaining code unit is each target collapse code unit corresponding to this target collapse stack data.
As a preferred technical solution of the present invention: in described step 002 and described step 006, the eigenwert of each default characteristic index is respectively and calls depth characteristic index, lines of code characteristic index, executable code line number characteristic index, statement lines of code characteristic index, annotated code line number characteristic index, annotation ratio characteristic index, space ratio characteristic index, punctuate ratio characteristic index, code path number characteristic index, cyclomatic complexity characteristic index, input variable number characteristic index, output variable number characteristic index.
A kind of software defect Code location method based on collapse stack data of the present invention adopts above technical scheme compared with prior art, there is following technique effect: the software defect Code location method based on collapse stack data of the present invention's design, in conjunction with history collapse stack data and history codes maintenance record, applied for machines learning art, build defect code forecast model, each final goal collapse code unit of defect is comprised in forecasting software, thus in quick position software, comprise the code unit of defect, and evaluate for each final goal collapse code unit, the work efficiency that effective raising software code is repaired, and method for designing of the present invention is simple, be applicable to dissimilar programming language, and the computer software of different scales, there is extendability and adaptability, conveniently apply parallel algorithm, can collapse stack data that fast and effeciently treatment and analysis is a large amount of, improve the usefulness of software defect location, to the test of large software system and maintenance work in can be used for.
Accompanying drawing explanation
Fig. 1 is the overall framework schematic diagram that the present invention designs the software defect Code location method based on collapse stack data;
Fig. 2 is the schematic flow sheet that the present invention designs the software defect Code location method based on collapse stack data;
Fig. 3 is software crash stack data instance;
Fig. 4 a is that the present invention designs the static call figure obtaining embodiment in history collapse stack data corresponding each history collapse code unit;
Fig. 4 b is that the present invention designs the collapse stack schematic diagram data obtaining embodiment in history collapse stack data corresponding each history collapse code unit;
Fig. 4 c is the degree of depth schematic diagram that the present invention designs the code unit obtaining embodiment in history collapse stack data corresponding each history collapse code unit;
Fig. 4 d is that the present invention designs the source code schematic diagram obtaining embodiment in history collapse stack data corresponding each history collapse code unit.
Embodiment
Be described in further detail for the specific embodiment of the present invention below in conjunction with Figure of description.
As depicted in figs. 1 and 2, the designed software defect Code location method based on collapse stack data of the present invention, in the middle of actual application, comprise the steps, wherein, code unit refers to function, process or object method in software program.
Step 001. software developer can build defect report system in software system development and maintenance process, maintenance aacode defect history library wherein, comprises the collapse stack data, component name, version number, operating system etc. relevant to each software defect; For the aacode defect repaired, the reparation record etc. of defect code corresponding to each collapse stack data, code also can be recorded; Therefore, first we are based on defect report system, collect history collapse stack data and the history codes maintenance record of software systems.
As shown in Figure 3, in this example, the collapse stack data of software result from a run time error (collapse ID:f2f55573-e2cd-4ce9-92be-b16e72130904) of FireFox browser; Collapse stack data are made up of multiple layer, and every one deck comprises a code unit title and corresponding source file location (file path name and code line number); The representative of its middle level 0 triggers the code executing location of collapse.In most software systems, such as MicrosoftWindows, collapse stack data are divided into different groups automatically according to trigger point, and so grouping carries out supposing based on " same defect can trigger collapse in identical code position " situation.
Then, respectively for each history collapse stack data, as shown in Figure 4 a-shown in Figure 4 d, perform following steps a01 to step a03, obtain each history collapse code unit corresponding to each history collapse stack data difference, form the history collapse code unit set corresponding to all history collapse stack data, and enter step 002.
Step a01. application call link analysis method, analysis expansion is carried out for the code unit related in history collapse stack data, obtain the whole code units involved by this history collapse stack data, and build the static call figure corresponded, then enter step a02;
For step a01, as shown in fig. 4 a, wherein node representative code unit, while represent call relation; There is collapse in CU11 position; Such as " CU2 → CU6 " represents that code unit CU2 have invoked CU6; According to collapse stack schematic diagram data as shown in Figure 4 b, call chain CU1 → CU3 → CU12 → CU11 do not have complete reaction collapse time call track, need to expand calling track based on static call figure.Such as, for CU1, two are had to call CU1 → CU3 and CU1 → CU4; Because CU4 may be called before CU3, CU4 joins and calls in track; Once CU4 is added into, so CU9 and CU13 is also added into and calls in track; In like manner, by analyzing other code units (CU3, CU12 and CU11), can obtain and complete call track.
Due in application call link analysis method, carry out analyzing in the process of expansion for the code unit related in history collapse stack data, the exponentially level growth of code unit quantity can be caused, need the range of search reducing code unit, therefore, after execution of step a01, need to enter following steps a02.
Step a02. application controls flow analysis method, based on software control stream order, deletes software in static call figure and performs inaccessible code unit, and enter step a03;
Based on the embodiment shown in Fig. 4 a and Fig. 4 b, for step a02, as illustrated in fig. 4 c, code analysis unit CU11, uses basic extended method, and CU14, CU15, CU16 and CU17 can be included in and do further expansion; But, based on software control stream order, analyze and show that CU14 is inaccessible from collapse point, therefore, delete software in static call figure and perform inaccessible code unit CU14.
Step a03. applies reverse microtomy, based on software control stream order, delete in static call figure and collapse with this history the code unit that in stack data, collapse point variable reference is irrelevant, finally, in static call figure, remaining code unit is each history collapse code unit corresponding to this history collapse stack data.
Continue based on the embodiment shown in Fig. 4 a, Fig. 4 b, Fig. 4 c, for step a03, as shown in figure 4d, according to collapse point, can determine that variable s with c is relevant with collapse; With this Two Variables for starting point, by reverse microtomy, variable b can be introduced further; But CU15 does not have influence on variable s, c and b, s, c and the b in static call figure therefore can be deleted.
Step 002. for each history collapse code unit in the set of history collapse code unit, obtains the eigenwert of each default characteristic index of history collapse code unit respectively; Then respectively for each history collapse code unit, history is collapsed the proper vector that code unit is converted into the eigenwert composition of each default characteristic index corresponding to it, obtaining each history collapse code unit institute, to distinguish characteristic of correspondence vectorial, and enter step 003.
Wherein, the eigenwert of each default characteristic index each characteristic index following respectively:
(1) call depth characteristic index, a code unit call any one code unit that depth characteristic index expression occurs from collapse stack data, arrive the most minor chain length of this code unit; If this code unit appears in collapse stack data, then calling the degree of depth is 0;
(2) lines of code characteristic index, for representing the lines of code comprised in code unit, comprises annotation;
(3) executable code line number characteristic index, for representing the line number of the executable code comprised in code unit;
(4) lines of code characteristic index is stated, for representing the lines of code for defining variable sum functions in code unit;
(5) annotated code line number characteristic index, for representing the lines of code for annotating in code unit;
(6) ratio characteristic index is annotated, for representing the ratio accounting for total character number in code unit for the character number annotated;
(7) space ratio characteristic index, for the ratio representing space character in code unit, Tab symbol, newline number accounts for total character number;
(8) punctuate ratio characteristic index, for representing that the punctuation mark numbers such as branch in code unit, comma, slash, quotation marks, parantheses account for the ratio of total character number;
(9) code path number characteristic index, for representing simple path number possible in code unit, wherein simple path refers to code and does not repeat, and namely loop body occurs 0 or 1 time;
(10) cyclomatic complexity characteristic index, for representing that in code unit, branch judges that the number of (conditional statement and loop statement) adds 1 again;
(11) input variable number characteristic index, for representing the number of input parameter in code unit, and the global variable number sum quoted;
(12) output variable number characteristic index, for representing the number of output parameter in code unit, and the global variable number sum of amendment.
Therefore, based on above-mentioned 12 characteristic indexs, respectively for each history collapse code unit, history is collapsed the proper vector that code unit is converted into the eigenwert composition of its corresponding 12 characteristic indexs, namely each history collapse code unit is converted into proper vector be made up of the eigenwert of its corresponding 12 characteristic indexs, so obtain each history collapse code unit to distinguish characteristic of correspondence vectorial.
Step 003., according to history codes maintenance record, distinguish characteristic of correspondence in conjunction with each history collapse code unit institute vectorial, is judged that each history is collapsed code unit and whether comprised defect respectively; Then for each history collapse code unit comprising defect, obtain and collapse by this each history the eigenvectors matrix that corresponding to code unit, proper vector forms, composing training collection is as shown in table 1 below, then enters step 004.
Table 1
Wherein, n represents the number of collected history collapse stack data, and m represents the number based on first history collapse stack data acquisition history collapse code unit; BugStack represents history collapse stack data; CU represents history collapse code unit.
Step 004. application training collection, trains for AdaBoost sorter, obtains trained AdaBoost sorter, as defect code forecast model, and enter step 005, wherein, the quantity N=100 of base sorter in AdaBoost sorter, base sorter adopts decision tree strategy.
Step 005. is based on the same principle of above-mentioned steps a01 to step a03, for each target collapse stack data, same based on above-mentioned 12 characteristic indexs, perform following steps b01 respectively to step b03, obtain each target collapse code unit corresponding to each target collapse stack data difference, form the target collapse code unit set corresponding to all targets collapse stack data, and enter step 006.
Step b01. application call link analysis method, analysis expansion is carried out for the code unit related in target collapse stack data, obtain the whole code units involved by this target collapse stack data, and build the static call figure corresponded, then enter step b02;
Step b02. application controls flow analysis method, based on software control stream order, deletes software in static call figure and performs inaccessible code unit, and enter step b03;
Step b03. applies reverse microtomy, based on software control stream order, delete in static call figure and collapse with this target the code unit that in stack data, collapse point variable reference is irrelevant, finally, in static call figure, remaining code unit is each target collapse code unit corresponding to this target collapse stack data.
Step 006. for each target collapse code unit in the set of target collapse code unit, obtains the eigenwert of each default characteristic index of target collapse code unit respectively; Then respectively for each target collapse code unit, target is collapsed the proper vector that code unit is converted into the eigenwert composition of each default characteristic index corresponding to it, obtaining each target collapse code unit institute, distinguish characteristic of correspondence vectorial, formation target prediction collection, and enter step 007.
Step 007. adopts defect code forecast model, predict for target prediction collection, predict whether each target collapse code unit comprises defect, determine each final goal collapse code unit comprising defect in each target collapse stack data respectively, then enter step 008.
Step 008., according to history codes maintenance record, is evaluated for each final goal collapse code unit, is specifically comprised the steps:
Step 00801. is according to following 5 default defect tendency indexs, and desired value x icomputing formula, for each final goal collapse code unit, obtains the desired value x of each default defect tendency index of final goal collapse code unit respectively i, and enter step 00802; Wherein, 1≤i≤I, I is the number of default defect tendency index, I=5, i.e. 1≤i≤5.
x 1 = 10 1 + F r a m e + D i s e
X 1represent reverse calling distance defect tendency index, for weigh final goal collapse code unit distance collapse point call distance; Frame represents that final goal collapse code unit is positioned at the number of plies position of corresponding target collapse stack data, wherein, the number of plies residing for collapse point is 0, if when final goal collapse code unit does not appear in corresponding target collapse stack data, then Frame equals the maximum number of plies of corresponding target collapse stack data and adds 1; Dise represent final goal collapse code unit call the degree of depth, be one of each default characteristic index above-mentioned, namely call depth characteristic index.
x 2=log(LOC+1)
X 2represent final goal collapse code unit unit length defect tendency index, for weighing the relative length of final goal collapse code unit, LOC represents the code line sum that final goal collapse code unit comprises, and is one of each default characteristic index above-mentioned, i.e. lines of code characteristic index.
x 3 = 10 l o g ( D a y + 1 )
X 3represent final goal collapse code unit defect perdurability tendency index, for weighing final goal collapse code unit with the last time gap of repairing or upgrading; Day represents the nearest number of days once repaired or upgrade of final goal collapse code unit.
x 4 = 10 × N d e f e c t N
X 4represent final goal collapse code unit defect rate tendency index, for weighing final goal collapse code unit predicted ratio comprising defect in AdaBoost sorter; N represents the quantity of base sorter in AdaBoost sorter; N defectrepresent in AdaBoost sorter and predict that final goal collapse code unit comprises the quantity of the base sorter of defect.
x 5 = 100 × No d e f e c t N o
X 5representing final goal collapse code unit historic defects ratio tendency index, in history collapse stack data, being predicted to be the ratio comprising defect for weighing final goal collapse code unit; No represents the number of the history collapse stack data relating to final goal collapse code unit; No defectrepresent the quantity of the target collapse stack data comprising defect according to history codes maintenance record determination final goal collapse code unit.
Step 00802., according to following formula, for each final goal collapse code unit, obtains the defect tendency scoring Score of each final goal collapse code unit respectively, and enters step 00803.
S c o r e = 1 1 + e - Σ i = 1 I x i
Step 00803. is according to the defect tendency scoring Score of each final goal collapse code unit, descending sort is carried out for each final goal collapse code unit, and final descending sort result is submitted to software developer and software maintenance staff, comprise the code unit of defect in auxiliary positioning software.
The software defect Code location method based on collapse stack data of technique scheme design, in conjunction with history collapse stack data and history codes maintenance record, applied for machines learning art, build defect code forecast model, each final goal collapse code unit of defect is comprised in forecasting software, thus in quick position software, comprise the code unit of defect, and evaluate for each final goal collapse code unit, effectively improve the work efficiency that software code is repaired; And method for designing of the present invention is simple, be applicable to dissimilar programming language, and the computer software of different scales, there is extendability and adaptability, conveniently apply parallel algorithm, can collapse stack data that fast and effeciently treatment and analysis is a large amount of, improve the usefulness of software defect location, to the test of large software system and maintenance work in can be used for.
Be explained in detail for embodiments of the present invention in conjunction with Figure of description above, but the present invention is not limited to above-mentioned embodiment, in the ken that those of ordinary skill in the art possess, can also make a variety of changes under the prerequisite not departing from present inventive concept.

Claims (8)

1., based on a software defect Code location method for collapse stack data, it is characterized in that, comprise the steps:
Step 001. collects history collapse stack data and the history codes maintenance record of software systems, and respectively for each history collapse stack data, obtain each history collapse code unit corresponding to history collapse stack data, form the history collapse code unit set corresponding to all history collapse stack data, and enter step 002;
Step 002. for each history collapse code unit in the set of history collapse code unit, obtains the eigenwert of each default characteristic index of history collapse code unit respectively; Then respectively for each history collapse code unit, history is collapsed the proper vector that code unit is converted into the eigenwert composition of each default characteristic index corresponding to it, obtaining each history collapse code unit institute, to distinguish characteristic of correspondence vectorial, and enter step 003;
Step 003., according to history codes maintenance record, distinguish characteristic of correspondence in conjunction with each history collapse code unit institute vectorial, is judged that each history is collapsed code unit and whether comprised defect respectively; Then for each history collapse code unit comprising defect, obtain and collapse by this each history the eigenvectors matrix that corresponding to code unit, proper vector forms, composing training collection, and enter step 004;
Step 004. application training collection, trains for default sorter, obtains trained sorter, as defect code forecast model, and enters step 005;
Step 005., for each target collapse stack data, obtains each target collapse code unit corresponding to each target collapse stack data difference, forms the target collapse code unit set corresponding to all targets collapse stack data, and enters step 006;
Step 006. for each target collapse code unit in the set of target collapse code unit, obtains the eigenwert of each default characteristic index of target collapse code unit respectively; Then respectively for each target collapse code unit, target is collapsed the proper vector that code unit is converted into the eigenwert composition of each default characteristic index corresponding to it, obtaining each target collapse code unit institute, distinguish characteristic of correspondence vectorial, formation target prediction collection, and enter step 007;
Step 007. adopts defect code forecast model, predicts for target prediction collection, predicts whether each target collapse code unit comprises defect, determines each final goal collapse code unit comprising defect in each target collapse stack data respectively.
2. a kind of software defect Code location method based on collapse stack data according to claim 1, is characterized in that: also comprise the steps 008 after described step 007:
Step 008., according to history codes maintenance record, is evaluated for each final goal collapse code unit.
3. a kind of software defect Code location method based on collapse stack data according to claim 2, is characterized in that: described step 008 specifically comprises the steps:
Step 00801., for each final goal collapse code unit, obtains the desired value x of each default defect tendency index of final goal collapse code unit respectively i, and enter step 00802; Wherein, 1≤i≤I, I is the number of default defect tendency index;
Step 00802., according to following formula, for each final goal collapse code unit, obtains the defect tendency scoring Score of each final goal collapse code unit respectively, and enters step 00803;
Step 00803., according to the defect tendency scoring Score of each final goal collapse code unit, sorts for each final goal collapse code unit.
4. a kind of software defect Code location method based on collapse stack data according to claim 3, is characterized in that: the number I=5 of described default defect tendency index, in described step 00701, according to following 5 default defects tendency indexs, and desired value x icomputing formula, for each final goal collapse code unit, obtains the desired value x of each default defect tendency index of final goal collapse code unit respectively i;
X 1represent reverse calling distance defect tendency index, for weigh final goal collapse code unit distance collapse point call distance; Frame represents that final goal collapse code unit is positioned at the number of plies position of corresponding target collapse stack data, wherein, the number of plies residing for collapse point is 0, if when final goal collapse code unit does not appear in corresponding target collapse stack data, then Frame equals the maximum number of plies of corresponding target collapse stack data and adds 1; Dise represent final goal collapse code unit call the degree of depth;
x 2=log(LOC+1)
X 2represent final goal collapse code unit unit length defect tendency index, for weighing the relative length of final goal collapse code unit, LOC represents the code line sum that final goal collapse code unit comprises;
X 3represent final goal collapse code unit defect perdurability tendency index, for weighing final goal collapse code unit with the last time gap of repairing or upgrading; Day represents the nearest number of days once repaired or upgrade of final goal collapse code unit;
X 4represent final goal collapse code unit defect rate tendency index, for weighing final goal collapse code unit predicted ratio comprising defect in default sorter; N represents the quantity of base sorter in default sorter; N defectrepresent to preset in sorter and predict that final goal collapse code unit comprises the quantity of the base sorter of defect;
X 5representing final goal collapse code unit historic defects ratio tendency index, in history collapse stack data, being predicted to be the ratio comprising defect for weighing final goal collapse code unit; No represents the number of the history collapse stack data relating to final goal collapse code unit; No defectrepresent the quantity of the target collapse stack data comprising defect according to history codes maintenance record determination final goal collapse code unit.
5. a kind of software defect Code location method based on collapse stack data according to claim 1 or 4, is characterized in that: described default sorter is AdaBoost sorter.
6. a kind of software defect Code location method based on collapse stack data according to claim 1, it is characterized in that: in described step 001, respectively for each history collapse stack data, perform following steps a01 to step a03, obtain each history collapse code unit corresponding to each history collapse stack data difference, form the history collapse code unit set corresponding to all history collapse stack data;
Step a01. application call link analysis method, analysis expansion is carried out for the code unit related in history collapse stack data, obtain the whole code units involved by this history collapse stack data, and build the static call figure corresponded, then enter step a02;
Step a02. application controls flow analysis method, based on software control stream order, deletes software in static call figure and performs inaccessible code unit, and enter step a03;
Step a03. applies reverse microtomy, based on software control stream order, delete in static call figure and collapse with this history the code unit that in stack data, collapse point variable reference is irrelevant, finally, in static call figure, remaining code unit is each history collapse code unit corresponding to this history collapse stack data.
7. a kind of software defect Code location method based on collapse stack data according to claim 1, it is characterized in that: in described step 005, for each target collapse stack data, perform following steps b01 respectively to step b03, obtain each target collapse code unit corresponding to each target collapse stack data difference, form the target collapse code unit set corresponding to all targets collapse stack data;
Step b01. application call link analysis method, analysis expansion is carried out for the code unit related in target collapse stack data, obtain the whole code units involved by this target collapse stack data, and build the static call figure corresponded, then enter step b02;
Step b02. application controls flow analysis method, based on software control stream order, deletes software in static call figure and performs inaccessible code unit, and enter step b03;
Step b03. applies reverse microtomy, based on software control stream order, delete in static call figure and collapse with this target the code unit that in stack data, collapse point variable reference is irrelevant, finally, in static call figure, remaining code unit is each target collapse code unit corresponding to this target collapse stack data.
8. a kind of software defect Code location method based on collapse stack data according to claim 1, it is characterized in that: in described step 002 and described step 006, the eigenwert of each default characteristic index is respectively and calls depth characteristic index, lines of code characteristic index, executable code line number characteristic index, statement lines of code characteristic index, annotated code line number characteristic index, annotation ratio characteristic index, space ratio characteristic index, punctuate ratio characteristic index, code path number characteristic index, cyclomatic complexity characteristic index, input variable number characteristic index, output variable number characteristic index.
CN201510714252.5A 2015-10-28 2015-10-28 A kind of software defect Code location method based on crash stack data Active CN105224463B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510714252.5A CN105224463B (en) 2015-10-28 2015-10-28 A kind of software defect Code location method based on crash stack data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510714252.5A CN105224463B (en) 2015-10-28 2015-10-28 A kind of software defect Code location method based on crash stack data

Publications (2)

Publication Number Publication Date
CN105224463A true CN105224463A (en) 2016-01-06
CN105224463B CN105224463B (en) 2018-02-02

Family

ID=54993448

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510714252.5A Active CN105224463B (en) 2015-10-28 2015-10-28 A kind of software defect Code location method based on crash stack data

Country Status (1)

Country Link
CN (1) CN105224463B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294134A (en) * 2016-07-29 2017-01-04 腾讯科技(深圳)有限公司 The collapse localization method of code and device
CN106502909A (en) * 2016-11-07 2017-03-15 南京大学 A kind of aacode defect Forecasting Methodology in smart mobile phone application and development
CN107066302A (en) * 2017-04-28 2017-08-18 北京邮电大学 Defect inspection method, device and service terminal
CN109144879A (en) * 2018-09-03 2019-01-04 腾讯科技(深圳)有限公司 Method for testing and analyzing and device
CN109815152A (en) * 2019-01-31 2019-05-28 科大讯飞股份有限公司 Program crashing type prediction method and system
CN110413509A (en) * 2019-06-27 2019-11-05 武汉大学 A kind of software crash replay method and system based on Self -adaptive
CN111522676A (en) * 2020-04-01 2020-08-11 五八有限公司 Application program repairing method and device
CN111679971A (en) * 2020-05-20 2020-09-18 北京航空航天大学 Adaboost-based software defect prediction method
CN112035345A (en) * 2020-08-20 2020-12-04 国家电网有限公司信息通信分公司 Mixed depth defect prediction method based on code segment analysis
CN117009127A (en) * 2023-08-23 2023-11-07 航电所(成都)科技有限公司 Software upgrading method and system for cloud system of thermal power plant

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090073051A (en) * 2007-12-28 2009-07-02 충북대학교 산학협력단 Mmethod and system to on-the-fly testing of embedded software using Aspect component
CN103678091A (en) * 2013-12-19 2014-03-26 北京奇虎科技有限公司 Method and device for processing crash data of application software

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090073051A (en) * 2007-12-28 2009-07-02 충북대학교 산학협력단 Mmethod and system to on-the-fly testing of embedded software using Aspect component
CN103678091A (en) * 2013-12-19 2014-03-26 北京奇虎科技有限公司 Method and device for processing crash data of application software

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
BENOIT BAUDRY 等: "Improving Test Suites for Efficient Fault Localization", 《28TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING》 *
王新平 等: "基于执行轨迹的软件缺陷定位方法研究", 《计算机科学》 *

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294134A (en) * 2016-07-29 2017-01-04 腾讯科技(深圳)有限公司 The collapse localization method of code and device
CN106294134B (en) * 2016-07-29 2018-02-23 腾讯科技(深圳)有限公司 The collapse localization method and device of code
CN106502909A (en) * 2016-11-07 2017-03-15 南京大学 A kind of aacode defect Forecasting Methodology in smart mobile phone application and development
CN106502909B (en) * 2016-11-07 2019-04-23 南京大学 A kind of aacode defect prediction technique in smart mobile phone application exploitation
CN107066302A (en) * 2017-04-28 2017-08-18 北京邮电大学 Defect inspection method, device and service terminal
CN107066302B (en) * 2017-04-28 2019-11-05 北京邮电大学 Defect inspection method, device and service terminal
CN109144879A (en) * 2018-09-03 2019-01-04 腾讯科技(深圳)有限公司 Method for testing and analyzing and device
CN109815152A (en) * 2019-01-31 2019-05-28 科大讯飞股份有限公司 Program crashing type prediction method and system
CN110413509A (en) * 2019-06-27 2019-11-05 武汉大学 A kind of software crash replay method and system based on Self -adaptive
CN110413509B (en) * 2019-06-27 2021-08-03 武汉大学 Software crash reproduction method and system based on test generation
CN111522676A (en) * 2020-04-01 2020-08-11 五八有限公司 Application program repairing method and device
CN111522676B (en) * 2020-04-01 2021-10-01 五八有限公司 Application program repairing method and device
CN111679971A (en) * 2020-05-20 2020-09-18 北京航空航天大学 Adaboost-based software defect prediction method
CN111679971B (en) * 2020-05-20 2021-07-20 北京航空航天大学 Adaboost-based software defect prediction method
CN112035345A (en) * 2020-08-20 2020-12-04 国家电网有限公司信息通信分公司 Mixed depth defect prediction method based on code segment analysis
CN117009127A (en) * 2023-08-23 2023-11-07 航电所(成都)科技有限公司 Software upgrading method and system for cloud system of thermal power plant

Also Published As

Publication number Publication date
CN105224463B (en) 2018-02-02

Similar Documents

Publication Publication Date Title
CN105224463A (en) A kind of software defect Code location method based on collapse stack data
CN101866316B (en) Software defect positioning method based on relative redundant test set reduction
CN101231614B (en) Method for locating software unsoundness based on execution track block semblance
CN110502361A (en) Fine granularity defect positioning method towards bug report
Crippa et al. A systematic review of BIM usage for life cycle impact assessment
CN103294594A (en) Test based static analysis misinformation eliminating method
CN113157564B (en) Cross-project defect prediction method based on feature distribution alignment and neighborhood instance selection
CN110515826A (en) A kind of software defect positioning method based on number frequency spectrum and neural network algorithm
CN106951565B (en) File classification method and the text classifier of acquisition
CN105701013A (en) Software defect data feature selection method based on mutual information
CN110163532A (en) Methods of risk assessment, risk management method, device, equipment and storage medium
CN103309811A (en) Method for quickly positioning software code defects based on test execution record
CN103136103A (en) Test case reduction method for error locating demand
CN108279013B (en) Method and device for checking and correcting incremental data of electronic map and navigation system
CN107203469B (en) Compiler test acceleration method based on machine learning
CN106095663B (en) Program based on hierarchical model returns location of mistake method
JPH09160949A (en) Design supporting method in mixed system of hardware and software
CN113377962B (en) Intelligent process simulation method based on image recognition and natural language processing
CN109002723A (en) A kind of segmented symbolic excution methodology
CN109685453B (en) Method for intelligently identifying effective paths of workflow
CN105117331B (en) Coincidence correctness test case recognition methods and device towards location of mistake
CN103150254B (en) Error locating method for software based on state-dependent probabilistic modeling
CN114935918A (en) Performance evaluation method, device and equipment of automatic driving algorithm and storage medium
CN109857675A (en) A kind of program error localization method using statement type
CN110032319A (en) The recognition methods and its application of specific position in a kind of screen interface

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant