CN101615158A - A kind of adjustment method of computer program - Google Patents

A kind of adjustment method of computer program Download PDF

Info

Publication number
CN101615158A
CN101615158A CN200910090813A CN200910090813A CN101615158A CN 101615158 A CN101615158 A CN 101615158A CN 200910090813 A CN200910090813 A CN 200910090813A CN 200910090813 A CN200910090813 A CN 200910090813A CN 101615158 A CN101615158 A CN 101615158A
Authority
CN
China
Prior art keywords
code
computer program
procedure information
data structure
debugged
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
CN200910090813A
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.)
Beijing Jiaotong University
Original Assignee
Beijing Jiaotong 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 Beijing Jiaotong University filed Critical Beijing Jiaotong University
Priority to CN200910090813A priority Critical patent/CN101615158A/en
Publication of CN101615158A publication Critical patent/CN101615158A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses the adjustment method of a kind of computer program in the technical field of computer software development.Comprise: the data structure of overall importance of setting up an all spendable record operational scheme information in all operational schemees of debugged computer program; When program is moved and produced failure stopping, near termination code, add code that adds procedure information and the code of monitoring procedure information under source code level debugging enironment; When program stops at the failure code place once more, the flow trace code is inserted in appropriate location before the program mal code segment, the appropriate location of program before operational scheme breaks down suspended, adopt stepping method commonly used close gradually then, finally determine failure cause and make corresponding modify to failure code; After code is revised, leave out the code of monitoring procedure information.The present invention is fault location code and the operational scheme when breaking down fast and accurately, determines the generation reason of program run fault easily.

Description

A kind of adjustment method of computer program
Technical field
The invention belongs to technical field of computer software development, relate in particular to a kind of adjustment method of computer program.
Background technology
Program debug is one of important step of develop computer software, its objective is the variety of issue that exists in the discovery procedure code, improves correctness, security, the reliability of program run.Traditional program debugging method adopts breakpoint setting and code tracking technology, as VC++, Borland C++ etc.For direct compilation type language (as C/C++, Java etc.), what write is the program of directly carrying out, because the program implementation flow process is more single, this method is more effective.Yet complicated and changeable for some implementations, have probabilistic program, same section code may normally also may break down under the different system service condition, and the position of only finding failure code is the accurate reason that produces of fault location usually.Adopt the method for code tracking not only loaded down with trivial details but also time-consuming, particularly produce fault when program after having carried out a large amount of flow processs on the same section code, the method for breakpoint tracking almost can't fault location.Therefore, adopt Fault-Locating Test fast and effectively, have crucial meaning for debugging efficiency that improves the complex process computer program and improvement code quality.
Summary of the invention
The objective of the invention is to, a kind of adjustment method of computer program is provided, the computer program that is used to solve complicated operational scheme is the problem of fault location quick and precisely.
Technical scheme of the present invention is that a kind of adjustment method of computer program is characterized in that described method comprises the following steps:
Step 1: the data structure that is based upon all spendable record procedure information in all operational schemees of computer program;
Step 2: the operation of debugged computer program, judge whether to produce fault, if, then record trouble code position and execution in step 3; Otherwise, execution in step 9;
Step 3: in the failure code front, add the code that is used to add procedure information, by adding the code of procedure information, the procedure information that writes down in the refresh data structure;
Step 4: at the failure code place, add the code that is used to monitor procedure information, the code by the monitoring procedure information obtains specific procedure information;
Step 5: rerun debugged computer program, when debugged computer program stops at the failure code place once more, obtain the monitoring procedure information;
Step 6:, insert the tracking code of procedure information in the front at failure code place according to the monitoring procedure information;
Step 7: move debugged computer program once more, make debugged computer program when breaking down, suspend the tracking code place before failure code;
Step 8: from following the trail of code, adopt step-by-step system commonly used, continue to carry out debugged computer program, determine failure cause and make corresponding modify; Afterwards, return step 2;
Step 9: after revising, deletion is used to monitor the monitor code of procedure information.
Described data structure is a data structure of overall importance.
Described data structure is independent of described computer program.
The procedure information of described data structure records comprises: level counting, conditional expression counting, task counting, task decomposition method counting, action counting, the plan counting of passing the rule algorithm.
The procedure information of described data structure records can be expanded according to debugged computer program.
Described specific procedure information preestablishes according to debugged computer program.
The present invention is fault location code and the operational scheme when breaking down fast and accurately, determines the generation reason of program run fault easily, improves the quality and the efficient of code revision.
Description of drawings
Fig. 1 is the graph of a relation of procedure information data structure and debugged computer program;
Fig. 2 is the data structure synoptic diagram of procedure information;
Fig. 3 is the schematic diagram of intelligent planning software systems;
Fig. 4 is the flow process tree construction of HTN search;
Fig. 5 is the adjustment method process flow diagram of the computer program that provides of the embodiment of the invention.
Embodiment
Below in conjunction with accompanying drawing, preferred embodiment is elaborated.Should be emphasized that following explanation only is exemplary, rather than in order to limit the scope of the invention and to use.
The present invention is that the invention will be further described for embodiment with the debugging of level task net (Hierarchical Task Network is called for short HTN) intelligent planning device program.
Intelligent planning problem (Artificial Intelligent planning) is one of major issue of artificial intelligence study (list of references: Song river rising in Ningxia and flowing into central Shaanxi barge, look into and build, Lu Yiping, intelligent planning Review Study-one an application oriented visual angle, the intelligence system journal, 2007,2 (2)), its objective is according to given initial world state (initial world state) and given dbjective state (goal state) or goal task (goal task), ask for the action sequence of realizing target according to predefined set of actions, this action sequence of trying to achieve just forms a plan (plan).HTN planning is a kind ofly to use the practical intelligent planning technology that proposes towards engineering, by task successively decompose the generation that realizes a plan, can greatly improve planner and find the solution performance.The programming of HTN intelligent planning algorithm and execution and traditional programming one is important not to be both: the flow process of traditional its execution of programmed method written program is pre-designed, not many, the easy prediction of the quantity of flow process branch, traditional breakpoint tracer technique ratio are easier to control.And the HTN planning algorithm time is planned the influence of uncertain task decomposition method (method) and problem-instance (problem instance) in the territory (a kind of driving model) in operation, find the solution flow process and have many uncertain branches, especially when problem scale was bigger, the uncertain varied number of finding the solution flow process branch was very huge.When algorithm execution appearance is unusual, be very difficult with traditional adjustment method failure judgement reason that breakpoint and tracking code implementation status are set.The adjustment method that adopts the present invention to propose can be carried out the exploitation debugging of this type systematic effectively.
Fig. 1 is the graph of a relation of procedure information data structure and debugged computer program.The data structure of record operational scheme information is independent of debugged computer program and makes up separately.This data structure is added procedure information by being used to of adding in debugged computer program code segment constantly refreshes, the relevant information of record flow process.Procedure information monitor code Duan Ze obtains specific procedure information, for the tracking of flow process provides breakpoint information.Described specific procedure information preestablishes according to debugged computer program.
Fig. 2 is the data structure synoptic diagram of procedure information.Among Fig. 2, the data structure of record procedure information comprises the recorded information item relevant with flow process, as level counting, conditional expression counting, task counting, task decomposition method counting, action counting, the plan of passing the rule algorithm are counted etc.The complicated procedure information of described data structure records can be according to the difference of debugged computer program, and the recorded information item is made amendment and expanded.
Fig. 3 is the schematic diagram of intelligent planning software systems.Among Fig. 3, the basic structure of universal HTN planning system comprises the planning territory that formed by certain intelligent planning language and text, world state description, HTN planner, the plan of planning problem.The text of planning territory and planning problem comprises that the description of initial world state, planning territory are described, object of planning task description.The planning territory comprises the description of planning domain knowledge such as operation (operator), task decomposition method (method), axiom (axiom).The HTN planning system world state of packing into from the initial world state of text is described, and pack into from text planning territory and goal task of planner described.Advise processing through passing of serial task decomposition algorithm, world state is constantly refreshed, and the final action sequence that generates is planned from planner output formation.Planning domain model and problem-instance adopt the SHOP2 language set up (referring to document: Nau D., et al, Documentation for SHOP2, https: //sourceforge.net/projects/shop).Universal HTN planning system is by the tailored version planning system of planning and model and problem-instance formation at a certain application of packing into.
The serial task decomposition algorithm is that efficient, the universal HTN planning algorithm that proposes in recent years is (referring to document: Nau D., Au T., SHOP2:An HTN Planning System.Journal of ArtificialIntelligence Research, 20 (2003), pp.:379-404), this algorithm is one and passs the rule algorithm.Since the different and same domain model of the SHOP2 domain model of packing at the difference of problem-instance, the execution flow process of same section code exists uncertain greatly in the serial task decomposition algorithm.
Fig. 4 is the flow process tree construction of HTN search.Among Fig. 4, the program execution flow that serial task is decomposed can be described as from left to right, the tree-like ergodic process of top-down.Different initial world states, different planning territories and different goal tasks will produce different flow process trees.The generation position of fault also changes because of the difference of problem-instance.
In C Plus Plus, the data structure that writes down complicated procedure information is CPR with " class " formal definition, be Complex Process Record, such is defined as static class (static), so that be applied to the each several part of debugged code and keep the consistance of information.
Fig. 5 is the adjustment method process flow diagram of the computer program that provides of the embodiment of the invention.Among Fig. 5, the debugging of passing the rule process with uncertainty is an example, and under the source code debugging enironment of VC++6.0, implementation process of the present invention is as follows:
Step 101: the data structure that is based upon all spendable record procedure information in all operational schemees of computer program.
Step 102: whether debugged computer program hinders for some reason and stops, if, record trouble code position and execution in step 103; Otherwise, execution in step 109.
Step 103:, add the code that is used to add procedure information, by the procedure information that writes down in this code refreshing data structure at the failure code place.Be like this operation in the present embodiment, the first trip in passing the rule function adds statement CPR::ri++, and the increase of rule layer passed in record; At the next line of passing the rule call statement, add statement CPR::ri--, the minimizing of rule layer passed in record.
Step 104: at the failure code place, add the code that is used to monitor procedure information, obtain specific procedure information by this code, specific procedure information preestablishes according to debugged computer program.In this city example, before failure code, add following statement: int ri=CPR::ri, in order to obtain the value of CPR::ri.
Step 105: rerun debugged computer program, when debugged computer program stops at the failure code place once more, obtain the monitoring procedure information.In the present embodiment, promptly observe the value of CRP::ri, suppose that observed value is 968.
Step 106:, insert the tracking code in the front at failure code place according to the monitoring procedure information.In the present embodiment, between code that step 104 is inserted and failure code, add following two line statements:
The 1st row: if (ri==968)
The 2nd row: int stop=0; (this row does not have specific meaning, only is used to debug the breakpoint setting) also will debug breakpoint and be located at the 2nd row.
Step 107: move debugged computer program once more, making debugged computer program is 968 o'clock time-outs in the value of ri.
Step 108: adopt step-by-step system commonly used, the value that continues executive routine and observe correlated variables is determined failure cause and is made corresponding modify; Afterwards, return step 102.
Step 109: after revising, deletion is used to monitor the monitor code of procedure information.
The adjustment method of a kind of computer program provided by the invention is managed concentratedly the descriptor of complex process, and use is simple, convenient, applicable to the different code section and the various software program of software.Simultaneously, this method is fault location code and the operational scheme when breaking down fast and accurately, determines the generation reason of program run fault easily, improves the quality and the efficient of code revision.At last, this method can help to find the defective in modeling mechanism and the modelling in the software systems of model-driven, improve the quality and the efficient of model construction.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.

Claims (6)

1. the adjustment method of a computer program is characterized in that described method comprises the following steps:
Step 1: the data structure that is based upon all spendable record procedure information in all operational schemees of computer program;
Step 2: the operation of debugged computer program, judge whether to produce fault, if, then record trouble code position and execution in step 3; Otherwise, execution in step 9;
Step 3: in the failure code front, add the code that is used to add procedure information, by adding the code of procedure information, the procedure information that writes down in the refresh data structure;
Step 4: at the failure code place, add the code that is used to monitor procedure information, the code by the monitoring procedure information obtains specific procedure information;
Step 5: rerun debugged computer program, when debugged computer program stops at the failure code place once more, obtain the monitoring procedure information;
Step 6:, insert the tracking code of procedure information in the front at failure code place according to the monitoring procedure information;
Step 7: move debugged computer program once more, make debugged computer program when breaking down, suspend the tracking code place before failure code;
Step 8: begin from following the trail of code, adopt step-by-step system commonly used, continue to carry out debugged computer program, determine failure cause and make corresponding modify; Afterwards, return step 2;
Step 9: after revising, deletion is used to monitor the monitor code of procedure information.
2. the adjustment method of a kind of computer program according to claim 1 is characterized in that described data structure is a data structure of overall importance.
3. the adjustment method of a kind of computer program according to claim 1 is characterized in that described data structure is independent of described computer program.
4. the adjustment method of a kind of computer program according to claim 1 is characterized in that the procedure information of described data structure records comprises: level counting, conditional expression counting, task counting, task decomposition method counting, action counting, the plan counting of passing the rule algorithm.
5. the adjustment method of a kind of computer program according to claim 1 is characterized in that the procedure information of described data structure records can be expanded according to debugged computer program.
6. the adjustment method of a kind of computer program according to claim 1 is characterized in that described specific procedure information preestablishes according to debugged computer program.
CN200910090813A 2009-08-10 2009-08-10 A kind of adjustment method of computer program Pending CN101615158A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910090813A CN101615158A (en) 2009-08-10 2009-08-10 A kind of adjustment method of computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910090813A CN101615158A (en) 2009-08-10 2009-08-10 A kind of adjustment method of computer program

Publications (1)

Publication Number Publication Date
CN101615158A true CN101615158A (en) 2009-12-30

Family

ID=41494809

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910090813A Pending CN101615158A (en) 2009-08-10 2009-08-10 A kind of adjustment method of computer program

Country Status (1)

Country Link
CN (1) CN101615158A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309809A (en) * 2013-06-21 2013-09-18 宁夏新航信息科技有限公司 Intelligent debugging method of computer software
CN103377118A (en) * 2012-04-23 2013-10-30 腾讯科技(深圳)有限公司 Method and device for testing Flash engine
CN113296765A (en) * 2021-05-28 2021-08-24 成都谐盈科技有限公司 Module code memory method and terminal based on model drive

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103377118A (en) * 2012-04-23 2013-10-30 腾讯科技(深圳)有限公司 Method and device for testing Flash engine
CN103377118B (en) * 2012-04-23 2017-07-25 腾讯科技(深圳)有限公司 A kind of method and device for testing Flash engine
CN103309809A (en) * 2013-06-21 2013-09-18 宁夏新航信息科技有限公司 Intelligent debugging method of computer software
CN113296765A (en) * 2021-05-28 2021-08-24 成都谐盈科技有限公司 Module code memory method and terminal based on model drive
CN113296765B (en) * 2021-05-28 2023-11-03 成都谐盈科技有限公司 Module code memorizing method and terminal based on model driving

Similar Documents

Publication Publication Date Title
US9021440B1 (en) System and method for automated test script generation
CN106021103B (en) A kind of mobile application test script automatic maintenance method based on code change
CN104407971A (en) Method for automatically testing embedded software
CN101794224B (en) Software run-time property monitoring method based on property specification mode
CN104699601A (en) Injecting Faults at Select Execution Points of Distributed Applications
US10635555B2 (en) Verifying a graph-based coherency verification tool
CN102567164A (en) Instruction set batch testing device and method for processor
CN105740120A (en) Shared memory based real-time monitoring and control method and system for software running process
CN106650149B (en) Modelica model-based runtime fault injection system and method
CN103631719A (en) Web automated testing method and device
CN107968833A (en) A kind of cloud application performance monitoring method based on execution route
Fourneret et al. Selective test generation method for evolving critical systems
CN101609429A (en) A kind of method and apparatus of debugging embedded operating system
CN108959058B (en) Configuration debugger implementation method of virtual controller
CN101615158A (en) A kind of adjustment method of computer program
CN101685420A (en) Multithreading debugging method and device
Belli et al. Event-based GUI testing and reliability assessment techniques--An experimental insight and preliminary results
US7664997B2 (en) Failure handling and debugging with causalities
CN117076296A (en) Control system, method, equipment and medium of network embedded equipment
CN110955411A (en) Software integration interactive design method
Clerissi et al. Test driven development of web applications: A lightweight approach
CN108897535A (en) The method that primary compiling generates multiple configuration figures
Savchuk et al. Modeling of software development process with the markov processes
Leroy et al. Monilogging for executable domain-specific languages
Bachir et al. MVC-IMASAM: Model-View-Controller inspired modeling approach for system adaptation management

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20091230