CN108664380A - Software debugging system and adjustment method after a kind of execution shown with performance - Google Patents

Software debugging system and adjustment method after a kind of execution shown with performance Download PDF

Info

Publication number
CN108664380A
CN108664380A CN201611154067.6A CN201611154067A CN108664380A CN 108664380 A CN108664380 A CN 108664380A CN 201611154067 A CN201611154067 A CN 201611154067A CN 108664380 A CN108664380 A CN 108664380A
Authority
CN
China
Prior art keywords
program
debugger
called program
execution
instruction
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
CN201611154067.6A
Other languages
Chinese (zh)
Other versions
CN108664380B (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.)
Xian Aeronautics Computing Technique Research Institute of AVIC
Original Assignee
Xian Aeronautics Computing Technique Research Institute of AVIC
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 Xian Aeronautics Computing Technique Research Institute of AVIC filed Critical Xian Aeronautics Computing Technique Research Institute of AVIC
Priority to CN201611154067.6A priority Critical patent/CN108664380B/en
Publication of CN108664380A publication Critical patent/CN108664380A/en
Application granted granted Critical
Publication of CN108664380B publication Critical patent/CN108664380B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/3648Software debugging using additional hardware
    • G06F11/3652Software debugging using additional hardware in-circuit-emulation [ICE] arrangements
    • 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/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • 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
    • 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/3644Software debugging by instrumenting at runtime
    • 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/366Software debugging using diagnostics

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

Disclosure of the present invention is related to the computer program of execution on the computing device, belongs to computer system software professional skill field, is more particularly absorbed in the software debugging system and adjustment method of detection computer program error.The present invention provides software debugging system frameworks after a kind of execution shown with performance, including called program, called program runs operating system, called program source code file, called program mapped file show equipment, track and record module, trace analysis module, instruction address value database, software simulator, event analysis module, performance evaluation module, covering analyzing module, debugger.The present invention is based on the above software debugging systems to propose the method debugged, and realizes the execution post debugging ability to software, helps to solve to find out reproducible bug and not reproducible bug in computer program.

Description

Software debugging system and adjustment method after a kind of execution shown with performance
Technical field
The content of the invention is related to the computer program of execution on the computing device, belongs to computer system software profession Technical field is more particularly absorbed in the software debugging system and adjustment method of detection computer program error.
Background technology
Software running device helps many computer programmers to find the mistake in computer program.These mistakes are generally termed “bugs”.Bug most commonly be computer program do not do it support do.For programmer, it is typically one to find bug Intractable task.
Find bug difficult one the reason is that:One bug may be very one section long after the computer instruction for causing it executes Time just shows.For example, first computer instruction execute calculate output as a result, but the result after the instruction execution Millions of a instruction executions after just can by second computer instruct use.
If bug is a reproducible bug, computer programmer usually can quickly determine bug's using debugger Immediate cause.A common technical ability in this skill be understanding term " reproducible bug ", it mean program every time with Identical input executes, and bug can show.
Debugger can be used for determining questions and prospect, however traditional debugger has energy power limit.Use traditional debugging Device often spends the time of programmer's a couple of days or a few weeks longer could reappear or not replicable bug for a long time to look for.
Invention content
The purpose of the present invention:
The purpose of the invention is to better helper developers to find out the bug in program, including reproducible Bug and not reproducible bug.
Technical scheme of the present invention:
1. software debugging system after a kind of execution shown with performance, including:Debugger, software simulator, track record It is module, trace analysis module, event analysis module, performance evaluation module, covering analyzing module, instruction address value database, soft Part simulator, wherein;
A) track record module is the software module or hardware device for recording called program tracking data.It can The memory of register, instruction access that instruction Starting Executing Time when called program is executed, IA, instruction access Location, instruction read or write the information such as Warning Mark, memory or register data and are organized into tracking data, then record, in case Analysis module uses.Track record module is not required, and computer processor where called program can export record tracking When data or software simulator execute called program, tracking data is recorded by software simulator.
B) trace analysis module generates instruction address value database for the analysis of tracking data.When initial, trace analysis Module saves as unknowable value in being arranged.Trace analysis module is filled in unknowable value to database, like that given In time cycle, the value of each internal storage location is just stored in instruction address value database.Trace analysis module is not required , its function is desirably integrated into track record module, is completed by track record module.
C) instruction address value database is for preserving IA, instruction machine code, instruction access register number, instruction Access the value of register, instruction accesses memory address, instruction accesses a database of memory value.These data preserved are referred to as For instruction address value.
D) software simulator is used for simulating the software of called program execution.It can be according to certain moment memory or register Value simulates the execution of called program machine instruction, it can parse machine instruction, and read-write register is wanted also when analyzing machine instruction It is memory, and the change of caused memory or register value after execution is recorded in instruction address value database.Software is simulated Device can also record tracking data when executing called program.
E) event analysis module is to carry out the software module of event analysis.It can analyze OS Events generation Moment address, executes the information such as time, and these information is organized into event data.Event data can transfer to debugger, It can be directly output to output equipment.A series of characteristic information when event analysis module occurs according to OS Events come Tracking data is analyzed, identifies task of including in called program operational process, finds task run in called program implementation procedure The OS Events occurred, such as task handover event, interrupt event.
F) performance evaluation module is the software mould for carrying out one machine instruction sequence of called program and executing time performance analysis Block.It can analyze the execution time performance data of a machine instruction sequence.Usual debugger can correspond to source code lines A machine instruction sequence transfer to its performance of performance evaluation module analysis.It is had recorded in tracking data first in instruction sequence The Starting Executing Time of item instruction and the Starting Executing Time of instruction sequence subsequent instructions, are opened with instruction sequence subsequent instructions The Starting Executing Time that execution time beginning subtracts first instruction in instruction sequence has just obtained the time that instruction sequence executes.
G) covering analyzing module is to carry out the software module of one machine instruction sequence covering analyzing of called program.It can Analyze whether a machine instruction sequence was performed.Usual debugger can be by the corresponding machine instruction sequence of source code lines Row transfer to whether covering analyzing module analysis executed.Covering analyzing module searches for specified instruction sequence in tracking data, If it is what is executed, it will be able to be searched in tracking data.
H) debugger is a program, its responder commissioning staff is instructed by the debugging operations that input equipment inputs, After processing, output debugging output data to output equipment.Debugger can be controlled, be checked, change quilt by debugging request It debugs.Called program and debugger can be in the same computers, can also be in different computers.If by tune journey Not in same computer, two computers are connected by a connecting path for sequence and debugger, and debugger is logical by the connection Road carries out cross debugging to called program.Debugger can add breakpoint to called program, when called program execution encounters breakpoint When, debugger, which can control called program, to be stopped executing.Debugger reads current called program source generation when called program stops Output equipment is transferred to show in the programs scenes such as code row, actual registers, variate-value.When carrying out execution post debugging, debugger will be by Instruction of debugging transfers to software simulator to execute, and obtain from software simulator execute after program scene transfer to output equipment Display.When carrying out execution post debugging, debugger can obtain source program and correlated performance data from performance evaluation module, can The data whether source program executes are obtained from covering analyzing module, will be transferred in these data integrations to program scene, are exported Equipment is shown.
2. including step based on the adjustment method that software debugging system framework after the execution shown with performance is proposed:
Step 1:Computer program is executed according to the record simulation in tracking data;
Step 1.1:Track and record module periodic logging tracking data from the execution of called program.
Step 1.2:Program debugging personnel operate debugger by input equipment, and a large amount of execute is arranged in called program and breaks Point.
Step 1.3:Software simulator presses tracking data, the execution of analog portion called program, until a large amount of conditions are (disconnected Point) in some stop simulation when meeting and execute.
Step 2:Event is shown;
Step 2.1:Event debugging personnel select the event to be debugged by input equipment and transfer to debugger, and debugger will The event of selection passes to event analysis module, and event analysis module determines corresponding called program according to event memory access feature Run operating system machine instruction sequence, and referred to as event correlation machine instruction sequence.
Step 2.2:Event analysis module by tracking data searched events correlation machine instruction sequence may search for To event.
Step 2.3:Event analysis module determines thing according to the execution time of the event correlation machine instruction sequence found The execution time of part.
Step 2.4:Event analysis module search instruction address value database finds certain associated data of moment task.
Step 2.5:Event analysis module calculates event data, which is transferred to debugger.
Step 2.6:Event data is organized into output data and output equipment is transferred to show by debugger.
Step 3:Performance is shown;
Step 3.1:Called program mapped file may have access to.
Step 3.2:Performance evaluation module or debugger are according to the information in called program mapped file, by called program Source code file source code lines are converted to machine instruction sequence.
Step 3.3:Performance evaluation block search tracking data, until finding machine instruction sequence.
Step 3.4:Performance evaluation module determines the execution time point of lower machine instruction sequence.
Step 3.5:Performance evaluation module subtracts this machine instruction sequence from the execution time point of lower machine instruction sequence The execution time point of row calculates and executes this instruction the time it takes performance, which is transferred to debugger.
Step 3.6:Debugger shows the corresponding execution time performance of source code lines by output equipment.
Step 4:Show coverage rate analysis data.
Step 4.1:Called program mapped file may have access to.
Step 4.2:Covering analyzing module or debugger are according to the information in called program mapped file, by called program Source code file source code lines are converted to machine instruction sequence.
Step 4.3:Covering analyzing block search tracking data is to determine whether called program source code file source code lines Corresponding every machine instruction is all performed.It is taken as performing if searched, which is transferred into debugger.
Step 4.4:Debugger indicates that the corresponding machine of source code lines refers to by showing a mark in output equipment Order is all performed.
Further, called program operation operating system is computer system where called program in the step 2.1 Operating system, the hardware resource of computer system where it manages called program provide necessary resource for called program execution; Inside it, the memory virtual address of computer system has been managed to the mapped file of physical address translations.
Further, in the step 3.2 called program source code file be called program source files of program;By tune journey The source files of program of sequence is usually high-level language source text file, can also be assembler source program text file, and And it is likely to more than one file;The source files of program of called program is converted to comprising machine instruction by compiler by tune journey Sequence binary file, called program binary file are attached positioning by connector and generate and can run in computer systems Called program.
Further, called program mapped file is to preserve called program source code file to mesh in the step 3.1 The file of coding mapping relations data;It is generally generated in the compiling of called program and connection procedure, dedicated for for program It is used when developer's debugging routine.By it can obtain the correspondence of source code and object code, global variable address, The information such as the position of the address of function or method, function local variable type and title, function local variable in function stack frame.
Further, input equipment inputs debugging control for program debugging personnel to debugging system in the step 2.1 Operational order;Can be keyboard, mouse, touch screen, microphone etc..
Further, output number of the output equipment for being generated in debugging system output debugging process in the step 2.6 According to;Defeated output equipment can be display screen, loud speaker etc..
The present invention has the advantage that effect:
The bug of reproduction to be taken a long time to can preferably be handled.
It can preferably handle and take a long time reproduction but not reproducible bug so that the not reproducible usual energy of bug It is found faster, contributes to the random bug for excluding to perplex many complicated processes, glitch, conflict.
It can help the bug for finding to show after the connection of those debuggers.
Description of the drawings
Fig. 1, software debugging system framework figure after a kind of execution shown with performance
Fig. 2, computer and debugger and the realization block diagram of software simulator interaction
Fig. 3, debugger are stored in the specific implementation of same computer
The schematic internal view of Fig. 4, Fig. 2 block diagram
Fig. 5, the configuration of virtual address to physical address map
The simulation of Fig. 6, the computer program recorded in tracking data execute flow
Fig. 7, an event analysis configuration, the tracking data that wherein tracking module or other mechanism are collected be used to show thing Part relevant information
Fig. 8, an event debugging system
Fig. 9, when user's debugging routine, check an event
How Figure 10, debugger analyze multitask
Figure 11, the debugging process that event is shown
Figure 12, a performance display configure, on an output device display performance data
Figure 13, a performance on an output device are shown
Figure 14, performance flow for displaying
Figure 15, coverage rate analysis configuration
Figure 16, coverage rate on an output device are shown
Figure 17, covering analyzing data flow for displaying
Specific implementation mode
In Fig. 2, executing post debugging environment 100 allows programmer's debugging routine 101.Object-computer 102 is in memory Program 101 is stored in 111.There are one processor 110, processors 110 can read/write memory 111 for object-computer 102.One In a realization, object-computer 102 is connected to an operable input equipment 106, in another realization, object-computer 102 sensors for being connected to input equipment 106 by one are communicated with input equipment 106.During one is realized, object-computer 102 are connected to an operable output equipment 108, and in another realization, object-computer 102 is connected to output by one The sensor of equipment 108 is communicated with output equipment 108.Object-computer 102 is substantially user's normal operation computer The computer of program 101.
It includes a host computer 124 to execute post debugging environment 100 also, contains a debugging computer program thereon 101 debugger 112.Debugger 112 is stored in memory 120.Software simulator 114 is also stored in memory 120.Host counts Calculation machine 124 also has processor 118, it being capable of read/write memory 120.During one is realized, there are one output equipments for host computer 124 116, in another realization, host computer 124 has input equipment 122.
In order to execute a specific function, computer 102 will run program 101, and program 101 is an instruction and data Set.Program 101 is stored in the special memory address of a memory 111.
Most of programs are all that programmer is write using high-level programming language.In general, high-level programming language is as C, C+ +, the language of Ada 95, Java or a hardware description language, which depict the operations of a hardware device, as Verilog Or VHDL (Very high-speed integrated circuit Hardware Description Language).Program The program that member writes is called source code.The line of text that source code includes is called source code lines.
Compiler is a software program, it can be stored in computer 102, and the source code for writing high-level language turns Change the machine instruction for allowing processor 110 to execute being stored in memory 111 into.Programmer usually pays no attention to those subordinate machines and refers to The presence of order.Programmer prefers to think deeply program by advanced source code lines.Hardware description language can be compiled into hardware design Or the instruction run on hardware description language emulator.A kind of realization is that compiler is stored on computer 124, another Realization is that compiler is stored on the third party's computer for being different from computer 102 and computer 124.
Processor 110 accesses memory 111 to execute the machine instruction of program 101, and program 101 is stored in memory 111.One A realization is that processor 110 executes every machine instruction with millions of speed per second.One realization is that processor 110 has one To multiple registers, they are the memory blocks for the high speed being located in processor 110.In general, processor 110 is able to access that memory The data of the data or the two in data, register in 111.Furthermore, it is understood that in general, in processor 110 can read 111 data are deposited, and/or write data to memory 111.
One realization is that processor 110 and memory 111 are located at a host.Another realization is that computer 102 is meaned It and is suitable for any equipment for thering is processor 110 to be embedded.Such as one family apparatus, wherein containing embedded processing Device, it can be seen that being computer 102.In addition, a mobile phone, jet plane, the round-trip device in space, helicopter, train, Or any other vehicles, as long as having being construed as with computer 102 of embeded processor.Further For, any communication equipment can be considered as computer 102 as cell phones.In addition, personal digital assistant can be considered as Computer 102.In general, computer 102 covers the equipment that those futures are operatively connected to processor 110.Term " calculates Machine " typically includes any equipment for possessing processor 110.Memory 111 can be internal, external, or even long-range. Input equipment 106 and output equipment 108 are not that computer 102 is essential.
One realization is that processor 110 is a phy chip.When another kind is realized, object-computer 102 is one soft Part program, it has imitated physical computer.In this case, its essence is processor 110 is a part of program 101.
Computer 102 receives the input of one or more external input devices 106.External input can be processor processing Instruction and/or data.One realization is that input equipment 106 receives one or more external inputs from human manipulation.It is another A realization is that input equipment 106 receives one or more external inputs from other computers.Input equipment 106 is not essential, Because the data pre-entered are stored in computer 102, and can be used automatically, as clock data.
Input equipment 106 includes various hardware.One realization is that input equipment 106 is keyboard.One realization is to input Equipment 106 is touch screen.One realization is that input equipment 106 is computer mouse.One realization is that input equipment 106 is to connect The microphone of phonetic order is received, it is provided with speech processing module.One realization is that input equipment 106 is communication equipment, as adjusting Modulator-demodulator, it is from other computer receiving datas.
Computer 102 can also send internal data to outside by output equipment 108.The number exported by output equipment 108 According to the result that may be the execution of processor 110.One realization is that output equipment 108 is a display equipment, for example, a screen Curtain, seems liquid crystal display (LCD, liquid crystal display), plasma display (plasma display), this It can act as output equipment 108.One realization is that output equipment 108 can be printer.Another realization is that output is set Standby 108 be audio tweeter, it passes through audio signal output data.Another realization is that output equipment 108 is debugging demodulation Device, it is by communicating to connect to another computer output data.
Any different realization or the variation of computer discussed above 102, are suitable for computer 124.Any difference Realization or input equipment discussed above 106 variation, be suitable for input equipment 122.Any different realization or on Face discusses the variation of output equipment 108, is suitable for output equipment 116.
Debugger 112 is a program, its energy helper person finds the bug in target machine program 101.One realization It is that debugger 112 allows programmer by controlling the execution of program 101 interactively to find the bug in program 101.One Realization is that debugger 112 is stored in the memory 120 of host computer 124.Usual debugging enironment is shown in output equipment 116 Show.In some cases, programmer is debugged by changing called program state.It is once executed in general, program state is program The numerical value set of the certain region of memory of storage in memory when the period.One realization is to be debugged the program that device 112 controls 101 are stored on computer 102.Computer 124 and the communication of computer 102 control program 101 to allow debugging 112. One realization is that it is feasible that host computer 124, which is connected to object-computer 102,.For example, host computer 124 passes through string Mouth, LAN, USB are connected to object-computer 102.Another realization is that computer 124 and computer 102 are connected by network It connects.Another realization is that computer 124 is connected with computer 102 by wireless network.One realization is computer 124 and calculating Machine 102 is connected by signal, as infrared signal.
Debugger 112 has control, inspection, modification target program 101, processor 110, memory 111 and object-computer 102 ability.Debugger 112 is by providing one or more orders to target program 101 come control targe program 101.
One realization is that user inputs mode order to debug on target machine computer 102 on host computer 124 Program 101.User can be inputted by the input equipment 122 in Fig. 2 and be ordered.User can by input character, click icon, Button, mobile mouse, voice command or other any knowledges is clicked to be inputted otherwise.Debugger 112 includes for debugging The control command of program 101, display command, modification order, modification order.One example of debugger 112 is Lv Shan companies MULTI Integrated Development Environment.However, debugger 112 is not limited to some specific product.
The control command of debugger 112 includes starting order and the stopping target program of the startup that target program 101 is run 101 operations are ceased and desisted order.Debugger 112 allows user to place machine instruction or source generation of the execution breakpoint to program 101 In code row.No matter when, program attempts execution and the associated machine instruction of breakpoint or source code lines, and debugger 112 will be program One is provided to cease and desist order.In other words, debugger 112 store with the associated instruction of breakpoint, and before every instruction execution It checks whether and is associated with execution breakpoint.In order to find out bug, programmer may have the program of bug to be placed around breakpoint suspecting.When When program encounters breakpoint and stops, programmer can show the state of program 101, to determine whether bug occurs or will occur. If bug Producing reason unobvious, programmer can input startup order and arrive debugger 112, and debugger 112 can be sent out to program Go out one and start order to continue to execute program, just stops until encountering next breakpoint program.Programmer can be after reforwarding Multiple breakpoints are set before line program.
One realization is that debugger 112 need not store the associated instruction of breakpoint.After user setting breakpoint, debugger 112 It is searched in every break-poing instruction by the machine code of compiling and is made marks on it, show that this is specific if attempting execution with this Instruction, should suspend.When realizing breakpoint, a large amount of different configurations can be used.
Programmer can accelerate debugging process using breakpoint.It can be weighed for example, breakpoint can help computer programmer to find Existing bug.Computer programmer can determine most the underlying cause of repeatable bug using binary search method.It calculates Machine programmer initially determines that the immediate cause of mistake.Then, computer programmer attempts before the immediate cause addition of mistake Breakpoint and rear breakpoint.Preceding breakpoint is located at the position of programmer's addition before the direct triggering reason for leading to mistake to be shut down procedure. Breakpoint is located at the position of programmer's addition after the direct triggering reason for leading to mistake to be shut down procedure afterwards.Program is restarted Run to preceding breakpoint location.A new middle discontinuous point is then arranged in programmer between forward terminal and rear breakpoint.Program is then Run to middle discontinuous point.If mistake shows, mistake be located in before between breakpoint and middle discontinuous point.In just being used in debugging process Breakpoint after discontinuous point is replaced.On the other hand, if mistake does not show, mistake is just between middle discontinuous point and rear breakpoint.It is debugging Breakpoint before discontinuous point is replaced in just using in the process.No matter which kind of situation, the immediate cause of bug will be from half length interval before It is middle to be come out by isolated.The debugging process will repeat until the error span being reduced to a line source code.
Upon identifying the source code being responsible for incorrect behavior.Bug may be apparent or unconspicuous.Sometimes, it marks The source code of knowledge is that do not have vicious, and incorrect behavior may be due to incorrect data.Next programmer needs to track The source code of the data is changed to the end.Read breakpoint, write breakpoint and conditional breakpoint can helper which tracked influencing not just The source code of exact figures evidence.
It reads breakpoint to be associated with one or more memory headrooms, rather than is associated with instruction.101 will be shut down procedure by reading breakpoint, As long as no matter program runs where program 101 desires access to be associated with some internal storage location with reading breakpoint.
Breakpoint is write to be associated with one or more memory headrooms, rather than some instruction association.Writing breakpoint will shut down procedure 101, as long as no matter program runs where program 101 wants modification and writes some associated internal storage location of breakpoint.Programmer is true Determine bug be due to data collision rather than after instruction causes, program setting one can write breakpoint on conflict memory, enabled Programmer restarts program in the case of breakpoint.When memory changes change every time, program will all stop, and programmer is assured that Whether source code, which is data, produces conflict.
Programmer would generally assume to include certain bug in source code, but bug only the operation of source code associated machine code at It can show after hundred thousands of times.On the source code add breakpoint be unpractical because this may need it is hundreds and thousands of A order can just cause mistake.Conditional breakpoint is such breakpoint, it and a mathematical formulae or with an a small amount of sources Associated codes.After program reaches conditional breakpoint, debugger calculates assessment mathematical formulae or source code, see whether some value can To be generated.If condition is not true, debugger 112, which automatically continues, executes program without programmer's interference.
Debugger 112 equally has state of the display command to display target program 101.After reaching certain particular point, program Member can provide display command to debugger 112 to check the content in particular memory address.For example, when program 101 encounters When breakpoint stops, programmer can check the variable being stored in memory 111.
Software simulator 114 is a program, its simulation program executes operation.The program being modeled is stored in computer In 124 memory, executed by processor 110.A kind of realization is that software simulator 114 is according to the speed different with processor 110 Carry out simulation program execution.It is in office why not with realization or the variation that discussed in, software simulator 114 can be calculated with target Machine 102 communicates, with this as the communication between computer 102 and debugger 112.
Fig. 3 depicts debugger 112 and is stored in and a realization in 101 identical computer of program.One realization is, Debugger 112, software simulator 114, program 101 are stored in memory 120.Computer 130 is both host computer and mesh Computer is marked, input equipment 122 and output equipment 116 are connected to different realizations or above-mentioned variant on computer 130, with This is as object-computer 102 and host computer 124.One realization is to make the program of a storage on a computer 102 101 copy is placed on host computer 124.
One realization is 114 analog theory computer system of software simulator, to JVM (Java Virtual Machine).Another realization is that software simulator 114 is a hardware description language simulation device, as Verilog and VHDL.
Fig. 4 shows the schematic internal view of Fig. 2 block diagrams.One realization is to possess the object-computer 102 of processor 110 It is interacted with memory 111, to execute program 101.110 read/write memory 111 of processor.Program 101 includes special instruction 302.Debugger 112 controls the execution of program 101, to find the mistake in program 101.
One realization is that computer 102 is configured to when a change occurs, what output processor 110 and memory 111 changed Record in detail.Record is called tracking data in detail.When computer 102 suspends due to mistake, processor 110 and memory 111 State can be recorded in tracking data so as to subsequent analysis.One realization is that tracking data includes that a processor 110 executes The machine instruction sequence of program 101.Tracking data is very useful to programmer, because individually source code is compiled device in terms of source code Compile the usual unobvious of execution number that execution sequence or single of the machine instruction being converted on processor 110 execute.Example Such as, source code lines have modified a variable when starting if condition meets.Although these instructions appear in source code lines Start, but if condition is not met, they will not occur in tracking data.
Another realizes that source code may have the code line of printing variate-value in the circulating cycle.In the example, variate-value is printed Source code lines only occur in source code lines it is primary.On the other hand, tracking data offer lists processor 110 and executes printing True number.
Another is realized, starts to define a function in source code.At source code end, there are one call the function Function source code.So function is listed in source code before function call.Processor 110 is executed in the machine for executing function really The preceding machine instruction for executing function tune, and equitably execute two adjoining machine instruction set.Tracking data reflects Processor 110 executes the real sequence of machine instruction.
Machine instruction is stored in memory 111.Processor 110 then accesses memory 111, finds machine instruction, in execution Deposit the read write command of 111 certain position.One realization is that tracking data includes memory address list.Memory address can be with storage machine The variate-value that device is instructed or can be changed by machine instruction.
One realization is that track record module 212 records the tracking data exported from processor 110.Track and record mould Block 212 at least stores the part tracking data listed in tracking data 213.Tracking data 213 lists a large amount of memory access and refers to 216 are enabled, they are the machine instructions of the sequential storage actually executed according to processor 110.IA is exactly that machine instruction is deposited The address that storage is done in memory.Machine instruction may be performed a number of times, so being likely to occur in tracking data list 213 more It is secondary.Further, the processor 110 that machine instruction in every memory is listed in tracking data list 213 executes the time. One realization is that tracking data list 213 also lists the memory address of every machine instruction access.In addition, tracking data arranges Table 213 is labeled with reading with a mark.For example, a symbol picture " R " can be used for identifying rdma read.Another reality It is now that tracking data list 213 also lists every machine instruction and writes memory address.For example, a symbol picture " W " can be used for Mark writes memory.
One realization is that track record module 212 provides tracking data list 213 and arrives trace analysis module 214, tracking point Analysis module 214 generates a database 310 from tracking data list 213.One realization is that individual module may be performed simultaneously Track and record the function of module 212 and trace analysis module 214.Processor 110 is had recorded in database 310 executes read-write every time Memory value when memory 111 instructs.When initial, trace analysis module 214 can be arranged in save as unknowable value.Trace analysis mould Block 214 is filled in unknowable value to database 310, is stored in database 310 in the given time cycle like that each The value of the storage unit of memory 111.
There is different methods to fill unknowable value for database 310.One realization is that trace analysis module 214 is returned Database 310 is cared for determine when that instruction is read in processing.The reading instruction in some time can give the specific list of memory 111 in given time Member provides some value.Trace analysis module 214 can after reading database 310 with the specific time period review internal storage location with Determine whether to be unknowable value.It if it is unknowable value, is not written after a read, trace analysis module 214 stores The value of reading is unknowable value.The value of storage is likely to the actual value of internal storage location at this time now, because before reading Internal storage location this period there is no any modification.
Another realization is that trace analysis module 214 is unknown to have determined by being searched in tracking data list 213 Whether the internal storage location of value is written into before unknown-value.If internal storage location is written into when earlier, with the value being written before Replace unknown-value.
Another realization is the 111 all storage units of stored memory when processor 110 is hung up of trace analysis module 214 Value.Because saving the value of all storage units in memory 111, track record module 212 can be by searching for database 310 To determine whether there is unknown-value.If there is any unknown-value, tracking module will fill the last state of value of internal storage location, Because if not writing internal storage location instruction modification by any, end-state will not change.Another realization is processor 110 Value in register can also be obtained by analyzing the ageing given in tracking data list 213 and database.
One realization is that database 310 comes from least partly tracking data list 213.Tracking data list 213 is potential can There can be billions of instructions.Construction has the database of mass data as database 310, potential to use larger numbers of memory And processing time.If only using a small part of tracking data list 213 in neighbouring position, guessed by programmer The immediate cause of survey problem, programmer can use less resource quickly constructs database 310.For example, programmer can be with The opposite for selecting 20,000 5 thousand instructions to be instructed as 1,000,000,000 from 1,000,000,000 instructions of tracking data list 213.If 20,000 5000 instructions, which cannot meet, finds this wrong condition, and the part bigger in tracking data list 213 can be arranged in programmer A bit, such as 100,000 instruct.One realization is that database 310 is stored in the memory 111 of object-computer 102.Another reality It is now that database 310 is stored in computer-readable intermediate medium, such as floppy disk, calculator memory, hard disk, USB JUMP Disk or other storage devices.Computer-readable intermediate medium can be except computer 124 or object-computer 102.
One realization is that database 310 is not necessary.It is simple according to front subsequent instructions in tracking data list 213 It is labelled with memory value.It is labeled, shows in addition, the instruction of simulation can instruct every in tracking data list 213 It is how to move backward to previous item from an instruction to instruct.
One realization is that track record module 212 is attached to an operable hardware device on processor 110. Another realization is that tracking module is a part of processor 110.Another realization is that tracking module is a software journey Sequence, processor 110 run it to record tracking data.
One realization is, track record module 212 is the hardware device except a computer 102, as logic analyser, In-circuit emulator, tracking probe.The operation that track record module 212 does not need interrupt coprocessor 110 can monitor processor 110 Execution.
One realization is need not to track and record module 212.Processor 110 oneself output tracking data.Processor 110 Oneself output tracking data.One realization is 110 direct output tracking data of processor to software simulator 114.One realization It is 110 direct output tracking data of processor to debugger 112.If software simulator will execute in tracking data Instruction will, debugger 112 can then output tracking data to software simulator 114.One realization is, the output of processor 110 with Track data are to output equipment 108.Output equipment can by output tracking data to debugger 112, software simulator 114 or it is other in terms of Calculation machine.
One realization is not need tracking module 112.Since when software simulator executes a program, software simulation Device 114 records tracking data.The tracking data recorded in simulator can also be used to analyze.
One realization is that processor 110 is converted according to the machine instruction execution sequence being stored in track record module 212 A large amount of memory address 216.One realization is that a large amount of memory address 216 being stored in track record module 212 is one By the memory address set of the practical machine instruction sequence for executing program of processor 110.It is every in a large amount of memory address 216 Machine instruction is all converted from the source code of program 110.It is completed by compiler by the conversion of source code to machine instruction.
Software simulator 114 is substantially to have rebuild processor 110 and memory 111 in different times according to tracking data State.Software simulator 114 instructs the lower item recorded in tracking data and simulator 114 itself is about instruction influence Change caused by knowledge and applied, simulator can carry out the execution of lower item instruction in simulation program using tracking data.One Realization is that simulator 114 accesses database 310 to rebuild the state of given time.For example, if simulator 114 attempt from Track data list 213 starts to simulate, simulator 114 can access database 310 with determine memory 111 certain internal storage location when Between t.sub.1 when value, the value is in database 310.It is these that associated analog internal storage location, which can be then arranged, in simulator 114 Value.
One realization is that debugger 112 controls simulator 114.Simulator 114 describes in tracking data list 213 Approximation state of the program 101 of record in time t.sub.1.Come in the time if debugger 112 provides an operation order T.sub.1 executes machine instruction, and it is to be stored in database 310 in time t.sub.1 that correspondence memory unit, which is arranged, in simulator 114 When value.Debugger 112 provides an operation order to simulator 114, and simulator 114 can be simulated since the dotted state and be executed Machine instruction.Therefore, the state in some time for the program 101 that simulator 114 is initially described, passes through the lower item at the reproduction program moment Instruction executes lower item instruction to simulate.
For example, simulator 114 can pass through reproduction program with the state at the moment at moment t.sub.1 of reproduction program 101 101 lower the execution of instruction when the state of moment t.sub.2 to simulate in moment t.sub.2.Therefore, simulator 114 The value that respective memory unit is arranged is to be stored in database 310 internal storage location in the value of moment t.sub.2.As a result, simulation Variation of 115 simulation system of device in moment t.sub.2 states caused by machine instruction.One realization is simulator 114 The internal storage location of t.sub.1 at the time of modification simulation, the internal storage location reflection of t.sub.2 is in data at the time of simulation like that The value of t.sub.2 at the time of library 310 stores.Simulator 114 can reappear each machine instruction sequence state, and in breakpoint or arrive Stop when up to tracking data 213 end of list.
If debugger 112, which is simulator 114, provides the order moved forwards, simulator 114 will be before reproduction program 101 The state at one moment.For example, if the current positive reproduction program 101 of simulator 114 is in the state of moment t.sub.1, debugger 112 provide a backward operation order, state of the simulator 114 by reproduction program 101 in moment t.sub.99.In fact, soft Part simulator 114 can eliminate the finger of the last item program 101 by cancelling the practical execution of machine instruction in tracking data Order executes influence.
One realization is that, when simulator is hung up, debugger 112 responds display command by display data.When forward When simulating or simulating backward, debugger 112 responds display command by display data.
One realization is that software program 101 and software simulator 114 are debugged the control of device 112.Debugger 112 provides one The interface of a simplicity instructs 208 to analyze a large amount of of source code of program 101.Programmer can be in the source code of program 101 A large amount of breakpoints are placed just as programmer uses traditional debugging device.Once programmer has selected plus the instruction of breakpoint, debugger 112 just can determine that at breakpoint processor 110 executes what machine instruction be associated with source code instruction be.Debugger 112 is logical Backtracking conversion table is crossed to check how source code instruction is converted to machine instruction by compiler.One realization is, conversion table be What compiler compiling source code generated when being machine code instruction.Conversion table can be accessed in debugger 112 in one file.
Debugger 112 provides machine instruction memory address, and simulator 114 places breakpoint at the address.One realization is, A large amount of memory address 216 of storage machine instruction in 114 search and track data list 213 of simulator are found in selected Deposit address.One realization is that debugger 112 is with searching for the memory received by a large amount of memory address 216 of storage machine instruction Location.Once selected address is found, debugger 112 is substantially just put on the special memory address of a large amount of memory address 216 Set breakpoint.
The mapping that Fig. 5 shows a physical address to virtual address configures.The configuration is used to execute in some systems Suspend simulator when to breakpoint.
In a kind of realization, software simulator 114 can be given to provide a read access breakpoint.Some systems only for degree or The list for the physical memory addresses write, therefore, user can be one memory address of read access Cut Selection, this read access is disconnected Point can be supplied to emulator 114 by debugger 112.In a kind of realization, emulator 114 in the form of a list stored memory address and Other breakpoints.To which emulator 114 can check every instruction to be emulated of emulator 114 before emulation, to determine whether With the relevant memory address of read access breakpoint to go out in the form of giving a read operation of instruction in tracking data list 213 It is existing.For example, tracking data list 213 can include " R ".If there is the memory address, emulator in tracking data list 213 114 suspend before the emulating of given instruction and execute.
A kind of realization is software simulator 114 can be given to provide a write access breakpoint.Some systems include only for reading Take or be written physical memory addresses list.Therefore, user can be one memory address of write access Cut Selection, this write access Breakpoint can be debugged device 112 and be supplied to emulator 114.A kind of realization is, the stored memory in the form of a list of emulator 114 Location and other breakpoints.To which emulator 114 can check every instruction to be emulated of emulator 114 before emulation, to determine Whether with the relevant memory address of write access breakpoint in tracking data list 213 in the form of a write operation of given instruction Occur.For example, tracking data list 213 can include " W ".If there is the memory address in tracking data list 213, emulate Device 114 suspends before the emulating of given instruction to be executed.
But some computer systems use physical memory addresses and virtual memory address simultaneously.Although tracking data one As only list physical memory addresses, with these computer systems associated working debugger 112 will likely provide the user with physics Memory address and virtual memory address two ways.According to noun virtual memory address, those skilled in the art are it is to be appreciated that behaviour A kind of form of system offer is provided or memory 111 organizes organization data in a specific way, or there are one additional core positions Set.These virtual memory address are associated with physical memory addresses.A kind of realization is that these virtual memory address are provided from interior Find the information of storage data in the where for depositing 111 other places.In other implementations, these virtual memory address are provided from hard disk Where find storage data information.When processor 110 needs to read or a virtual memory address is written, processor 110 access the physical memory addresses that virtual memory address is connected to by operating system 320.
Once programming personnel is to access one core position of Cut Selection, debugger 112 executes one from virtual memory Mapping of the address to physical memory addresses.When programming personnel provides to debugger 112 accesses breakpoint, programming personnel provides One virtual memory address.But the physical address that processor 110 will read or be written only is listed in tracking data list 213.Cause This, debugger 112 executes a mapping.
In a kind of realization, debugger 112 is by searching for 310 maps virtual memory address of database to corresponding physical memory Address, and scan the memory address that conversion table is stored for operating system 320.Operating system provides a mapping table, storage operation System is the information what physical address is particular virtual address be assigned with.Mapping table in 112 scan operation system of debugger comes It converts and accesses the relevant virtual memory address that breaks as a physical address.In a kind of realization, debugger 112 then provides object Memory address is managed to software simulator 114, emulator 114 is arranged one and accesses point absolutely so that emulator 114 is whenever feeling emerging Pause executes when the memory address of interest is accessed.
In a kind of realization, mapping table is stored on an outer computer readable medium.In other implementations, mapping table It is stored in a file.If mapping value can access Fileview mapping table by permanent assignment.
In a kind of realization, it is a read access breakpoint to access breakpoint, for temporary when each memory address is read Stop the execution of emulation.In other implementations, one write access breakpoint when accessing breakpoint, for what is be written into each memory address When pause emulation execution.
In one implementation, when constituting database 310, tracing record module 212 is inserted into breakpoint in database 310. Tracing record module 212 receives physical memory addresses from debugger 212.The memory in tracking data list 213 is accessed every time When address, tracing record module 212 is inserted into a label into database 310 to suspend emulation.If emulator 114 attempts to set Set simulated memory value be database 310 in value when, software simulator 114 then pause emulation.
In other implementations, tracking data list 213 is labeled so that virtual memory address quilt corresponding with physical address It lists.Tracing record module 212 provides tracking data list 213 to debugger 212, then debugger 212 searches for tracking number Determine there is which physical memory addresses in tracking data list 213 according to list 213.Debugger 112 converts each physics Memory address is physical memory addresses.In a kind of realization, the label tracking data list 213 of debugger 112, and a label is provided Tracking data list 213 give tracing record module 212.In other implementations, debugger 112 provides the conversion to be executed row Table, tracing record module 212 actually execute the label of tracking data list 213.
In a kind of realization, debugger 112 provides an operation order to software simulator 114, is opened from current simulation time Beginning, in tracking data, (these tracking data were broken there are one having at memory address date until software simulator attempts execution machine Point) in instruction when, or until track data end when, the execution of 114 emulator command of emulator.In another realization In, debugger 112 provides one, and retrospect order is to software simulator 114 backward, until 114 view of software simulator executes tracking Machine instruction in data (there are one these tracking data tools and the relevant breakpoint of source-code instruction), or track number until reaching According to initial position.In another realization, debugger 112 receives multibreak.In one implementation, the breakpoint in multibreak It is all different.For example, two different execution breakpoints can be arranged, an execution breakpoint can also be set and a write access is disconnected Point.General technical staff is it is to be appreciated that can be many different types of breakpoints as multibreak.114 view of emulator Emulation is stored in more machine instructions in odd memory address 216, until reaching one of multibreak.
In fact, debugger 112 is supplied to the interface of one 110 executive condition of record given time inner treater of user. User can use the appearance of traditional debugging device known to user oneself.While user is supplied to 112 same commands of debugger, The order that similar user provides to traditional debugging device, debugger 112 actually handle the record of debugged program, rather than control The execution of debugged program.Therefore, actual implementation procedure is still transparent for users.
Debugger 112 has higher robustness than traditional debugging utensil.Especially similar with VCR, debugger 112 allows user The record of data is tracked in backtracking and quickly processing.It finds to be more difficult to send out in addition, debugger 112 can greatly improve programming personnel The ability of existing bug.
Therefore, debugger 112 is reappeared by alloing that bug can not be reappeared, and can not be reappeared to assist finding bug.Find can not reappear bug most of difficulty be can not reappear bug seldom have after program crashing it is suggested.It is collapsing When, programming personnel can only debugging routine current state or reset routine to attempt to determine bug using breakpoint tool.When program collapses The difficulty of debugging current state when occurring of bursting is the instruction before the means that are not much allow programming personnel to analyze and memory before Value.The problem of reset routine, which is bug, to be reappeared, while may also be within a very long time all without prompt message.It is practical On can not reappear the prompt message of bug after program is restarted and be lost.
The processor 110 of tracing module 212 executes record and effectively prevents the loss that can not reappear bug prompt messages.Journey The state before state and collapse when sequence is collapsed is displayed in tracking data, and can not be reappeared bug and just probably chased after Among track data.Programming personnel can execute playback or playback emulation until bug is found.
In a kind of realization, debugger 112 provides programming personnel and debugs binary ability, this is that traditional debugging device is not accomplished 's.Traditional debugging device requires programming personnel that breakpoint is arranged in source code, and then from the beginning reset routine, program are executed until reaching one Then a or multiple breakpoints may collapse between breakpoint or generate an abnormal results.Programming personnel again last reset some Breakpoint reduces the scope, it is necessary to reset routine and from the beginning execute program to newly-installed breakpoint location again.
The binary system processing method of enhancing does not require programming personnel's reset routine from the beginning.It is guided by executing record It debugs rather than guides debugging, debugger 112 not to be needed in program crashing or generation abnormal results by actual execution Reset routine.
In a kind of realization, a preposition breakpoint, backtracking operation journey is arranged in programmer before the determining position for causing bug Sequence is to preposition breakpoint location.Then one postposition breakpoint is set after the positions bug, in the general of preposition breakpoint and postposition breakpoint A middle discontinuous point is arranged in centre position.Instruction execution between preposition breakpoint and middle discontinuous point will be simulated.If preposition Occur wrong phenomenon between breakpoint and middle discontinuous point, backtracking is emulated into preposition breakpoint location.Middle discontinuous point becomes postposition Breakpoint, and a new middle discontinuous point is set.Next can not reset routine emulate process from preposition breakpoint location. If there is mistake between middle discontinuous point and postposition breakpoint, backtracking is emulated into intermediate breakpoint location.Interruption in so Point will be arranged to preposition breakpoint, and probably intermediate one new centre of setting between new preposition breakpoint and postposition breakpoint Breakpoint.Therefore it can not have to reset routine and realize emulation, and binary system processing can reduce half and need the size of code debugged.
Another debugger 112 can help the bug reappeared to be reproducible but take a long time just replicable bug.In order to reappear a reproducible bug, it may be necessary to and identical condition when bug generations.For example, the weight of some bug Now possibly rely on the specific time in one day.Therefore, perhaps take a long time weight using the programming personnel of traditional debugging device Existing bug.Debugger 112 can guide bug by the record comprising required condition.When bug occurs or programming personnel Selection is shut down procedure or program stops due to bug.In one implementation, tracking data are persistently recorded until occurring bug.In a kind of realization, tracking data are sent to host 124 for the processing of tracing record module 212, then can use The binary system that debugger 112 executes enhancing is handled to efficiently find reproducible bug, is reappeared without being lot more time to.
The bug that another debugger 112 is can be found that is the bug that only just will appear in program full speed running.Tradition Not all right debugger method is because once reaching traditional breakpoint, program is not just executed in full speed, and bug may not occur. Using tracing record module 212, the full speed implementation procedure of processor 110 can be recorded.Then debugger 112 can lead to Cross tracing record module 212 record guiding debugging because comprising bug be recorded.Unlike traditional debugging device, Debugger 112 can find such bug using breakpoint, because the simulation velocity of tracking data does not influence whether bug goes out Existing, bug has been recorded in tracking data.Therefore, programming personnel can execute debugging forward or backward using debugger 112 Record, even if at low speeds it has also been discovered that bug.Even if the simulation run of artificial debugging processing routine and emulation stop, Bug can reappear as under the practical executive condition of program to be come out.Therefore, debugger 112 allows those only in program full speed The lower bug occurred of operation, is debugged as common bug.
Debugger 112 may also help in the data of analysis damage.Sometimes there is bug and be not as bug but because processing The data to be used when device executes instruction, the i.e. data are damaged in code line before.This bug may be it is reproducible, May not also be.When programming personnel encounters this bug, the setting of traditional debugging device can be used to access breakpoint, reset routine is forward It executes until accessing breakpoint location.But data may be afterwards implementation procedure in do not damage because bug is can not to weigh It is existing or take a long time to reappear.
No matter whether bug is not reproducible, or takes a long time to reappear, debugger 112 allows programming personnel efficient The reason of finding damage data.In a kind of realization, programming personnel is arranged one in damage core position using debugger 112 and writes visit Ask breakpoint, then programming personnel emulates process backward, from the appearance position of bug to write operation breakpoint location, without Reset routine.Emulation can execute every instruction before the emulation of write operation breakpoint stop backward, until bug is found.
Debugger 112 can also help programming personnel's simplification setting breakpoint location and the strategy of the how many a breakpoints of setting to ask Topic.Traditional debugging device programming personnel is not desired to setting one apart from far breakpoint, because program may miss bug when executing. Can only waste time from the beginning to restart program if missing bug.Similarly, if programming personnel needs to be arranged very much Breakpoint just can determine that bug can reappear before some breakpoint, and debugging process will very slowly.Debugger 112 allows to program Personnel are freely arranged breakpoint, and without considering that very hesitation breakpoint misses the position of bug and reset routine.If breakpoint is in source The position being arranged in code is too far, and programming personnel can use a breakpoint of the debugger 112 to post-simulation up to date, setting one Then the breakpoint of a or multiple near points emulates forward new breakpoint and does not have to reset routine.
Debugger 112 additionally aids the path for determining source code.For example, breakpoint is arranged in programming personnel in source code sometimes Determine whether the function has invoked certain function call, but source code might have the multiple calling to the same function.With tradition Which time debugger, which finds in function, has invoked function and is not easy to, and programming personnel can analyze program state, or even need every Breakpoint, and reset routine are set at a function call.Debugger 112 simplifies the process in the path of determining source code selection.For example, When a breakpoint is arranged in function, programming personnel can use debugger 112 to post-simulation until the calling in function Place, therefore, debugger 112 provide the path that a quick and simple mode searches source code selection.
Although tracking data generally provide the ordered list of the machine instruction of a processor 110 execution, tracking data are logical A part can often be lacked.When the data volume of the tracking data of record becomes larger, it may occur that overflow, this allows to tracking There is missing in data.Moreover, some machine instructions may be unordered, currently there is corresponding software tool to solve these mistakes Accidentally, even if mistake occurs, most tracking data are all reliable.
In one implementation, tracking the missing of data can be made up by modification method.First, tracking data are analyzed uses To decide whether to have missing.When the execution of 212 recording processor 110 of tracing record module, tracing record module 212 is one Machine instruction and memory value are stored in a extra buffer, constitute the tracking data in tracking data list 213.In some examples In, extra buffer is full, and tracing record module 212 cannot record one or more machine instructions and/or memory value.Although chasing after Track logging modle 212 is unable to recording, tracking data after Buffer Overflow, and tracing record module 212 can record and give instruction Overflow problem.Therefore, tracing record module 212 will be performed until what is instructed, but without the record of the instruction execution.One During kind is realized, debugger 112 accesses database 310 to determine the state for overflowing preceding program.Then software simulator 114 determines, Due to overflowing, how be not carried out the execution of instruction will influence the register of memory 111 and processor 110.Tracing record mould The record value in database 310 of block 212 overflows value when occurring.
Fig. 6 shows the process that computer program 101 is executed according to the record simulation in tracking data.In procedure block 352 In, the periodic logging tracking data from the execution of program 101.In next procedure block 354, process 350 is arranged greatly in program 101 Amount executes breakpoint.Finally, in procedure block 356, by tracking data, the execution of analog portion program 101, until in a large amount of conditions Some stop when meeting executing.One realization is, some condition in a large amount of conditions is intended to the machine instruction executed and big Some breakpoint meets in amount breakpoint.
Fig. 7 shows the structural map 400 of an event analysis.Wherein, it tracks and records module 212 or other recording mechanisms is received The tracking data of collection be used to show the information about OS Events.One OS Events, which is operating system 320, to be needed The event responded is handled by executing machine instruction.
Fig. 8 is an event debugging system.One realization is that event analysis program 408 accesses track record module 212, Refer in the operating system machine of track record list 213 search and those event matches being listed in selection list of thing 412 Enable address.If the machine for having found and being listed in the event matches of selection list of thing 412 in tracking and recording list 213 refers to It is the machine of tracking data record record to enable address, the time that processor 110 executes the operating system machine instruction of selected event Instruction time.
Event analysis program 408 is according to memory address, register, parameter and certain other relevant description information of moment event It is write.Event analysis program 408 from database 310 by searching phase at the time of operating system handles event inside the Pass Value, register value are deposited come value and the other description informations about event of getting parms.
One realization is that the ID of 320 current task of operating system is housed in a memory address or register.Event point The instruction for writing the address has been found in analysis 408 search and track data list 213 of program.The request for each writing the address represents currently The change of operation task.Be using a realization of the information, event debugging system 500 in tracking data list 213 for Every machine instruction in track data records which task is currently running.Another realization is that event debugging system 500 is in independence List in logger task.Another realization is the logger task in database 310 of event debugging system 500.Another is realized It is that current task can be determined by the machine instruction of the search operation system context switching function in tracking data list 213, Operating system context switching function is responsible for current task switching.Event analysis program 408 is worked as by being asked from database 310 Operating system context passes to the register of operating system context switching function when switching or memory value acquisition starts to execute Task ID.
In the data organization to event data that event analysis module 408 extracts event analysis module 408, then by event Data are supplied to output equipment 108.For example, when event data can be event title, the task names of execution, event execution Between, pass to operating system code to execute the parameter of event.Output equipment 108 can be graphic user interface, which carries It is shown for event data, and user is allowed to check and browsing event data.One realization is that event analysis program 408 provides thing Number of packages is according to debugger 112 is given, and the offer event data of debugger 112 is to output equipment 108.Another realization is event analysis mould Block 408 is a part of debugger 112.Another realization is that event analysis module 408 is a part of debugger 112. Event analysis module 408 is not required, because debugger 112 completes the function of event analysis module 408.
Fig. 9 is that the event that user can check in debugging routine 101 is shown.Once event data is in output equipment Shown on 108, user can by event data come with debugging routine 101.Event shows with leveled time line 604, it from The left-to-right time for indicating that operation is used.With timeline 604, a viewer can determine the time that an event occurs.Thing One horizontal line of display indicates all tasks and interruption during part shows 600, they are event analysis programs 408 from tracking number It is obtained according to middle analysis.Each horizontal line represents a task and is just carrying out at the time that timeline 604 indicates.One reality The line for being now the task that indicates is that green expression task is carrying out, and indicates that it is not carried out for black.Various symbols can be used for table Show event data.For example, a square 606 is for indicating that an event occurs in some time.If event is associated with task, as appointing Business request operating system service, event identifier will be shown to case point nearby and on the relevant line of task.Task execution has temporarily Stopping is because there is interruption.After the completion of interruption interrupts execution, task continues to run with.After the completion of one task, times in addition Business brings into operation.One realization is that there are one special symbols for each event to indicate that the event of the type is executed.Example Such as, a triangle can be placed task nearby to indicate that the task has the event for executing IO.One realization is, event can by Different types of event is indicated at different colors.For example, task by green indicating that task is carrying out IO.
Figure 10 shows how a debugger 112 carries out multitask analysis.Multiwindow will be used to show each task debugging. Each windows associate display shows the source code of a particular task.Tracking data provides task context switching, and allows Every instruction and each value in tracking data are identified the executing the instruction of the task.112 use of debugger executes instruction Task knowledge, debugger 112 update and simulator simulation execute the associated correct window of program 101.
Figure 11 shows the process that realization event is shown.In process 702,320 object code of operating system quilt in memory 111 It accesses.In process 704, operating system machines instruction address is chosen event and determines.Later, in process 706, in tracking data list Search events correlation machine instructs in 213.Address by searching machine instruction in tracking data list 213 can find machine Device instructs.In process 708, the execution time of event is determined.In addition, in process 710, search database 310 finds task The data of association in time.In process 712, calculates outgoing event and show content.In process 714, user selects event to debug.
Figure 12 shows performance display configuration 800.It shows performance data on an output device.Performance data includes Processor 110 execute be recorded in function in tracking data list 213, task, source code, instruction time.Performance data can To be quantitative one score of figure drawn either processor total time percentage.
Figure 13 illustrates the performance carried out on output equipment 108 and shows.Performance, which is shown, lists a band performance data Instruction sequence.Performance data goes out mark in instruction blank.
What Figure 14 was drawn is the process that performance is shown.In process 1002, mapped file 804 may have access to.One realization is, In process 1004, performance evaluation module 806 converts source code instruction as machine instruction.In process 1008, performance evaluation module 806 search and track data lists 213, until finding machine instruction.In process 1010, performance evaluation module 806 determines lower item The execution time point of machine instruction.Finally, performance evaluation module 806 subtracts this machine from the execution time point of lower machine instruction The execution time point of device instruction calculates processor 110 and executes this instruction the time it takes.
Figure 15 is coverage rate analysis configuration.The statistics source code of coverage rate analysis module 1102 is how many machine instruction, has more Few relevant machine instruction of source code executes time non-zero in tracking data list 213, therefrom calculates and is arranged in tracking data Machine instruction executes percentage in table 213.One realization is that 806 statistical function of performance evaluation module contains that how many machine refer to Enable, in tracking data list 213 functional dependence machine instruction how many be performed, therefrom calculate functional machine instruction execution Percentage.One source code lines or function should be every machine instruction be performed at least once, without one instruction quilt It executes or some machine instruction segments is performed.One realization is that performance evaluation module 806 is able to carry out coverage rate analysis 1102 described function of module.
The coverage rate that Figure 16 is illustrated on output equipment 108 is shown.One realization is, source code lines in program by occurring Sequence list, and mark out the coverage data of source code lines, and mark out those source code lines and be not performed.One reality It is now to be distinguished on output display unit 108 and show the source code lines being performed, machine instruction, function, task.One reality It is now that the source code lines that display is not performed are distinguished on output equipment 108.One realization is distinguished on output equipment 108 Show the function not being performed.
Figure 17 is the display process of coverage rate analysis data.In process 1302, the machine of 1300 recording processor of process execution Device instruction is tracking data.In process 1304,1300 access map file of process.In addition, in process 1306,1300 basis of process Source code lines are converted to a large amount of machine instruction by the mapping relations found in mapped file.In process 1308, process 1300 At least partly tracking data is searched for determine whether that every machine instruction is all performed.Finally, in process 1310, process 1300 is aobvious Show that indicates whether the mark that any machine instruction is all performed.
Above description includes many details, they cannot be construed as limiting the scope of the invention, and should be Realize the preferred example of the present invention.The present invention includes the different details disclosed here or realizes any joint of element or son connection It closes.In general, these characteristics and range of the present invention are being stated and are being equal to explain.

Claims (8)

1. software debugging system framework after a kind of execution shown with performance, it is characterised in that including following structural unit:
A) track record module is the software module or hardware device for recording called program tracking data;It can will be by Debug execute when instruction Starting Executing Time, IA, instruction access register, instruction access memory address, Instruction reads or writes the information such as Warning Mark, memory or register data and is organized into tracking data, then records, in case analysis Module uses;Track record module is not required, and computer processor where called program can export record tracking data, Or when software simulator execution called program, tracking data is recorded by software simulator;
B) trace analysis module generates instruction address value database for the analysis of tracking data;When initial, trace analysis module Unknowable value is saved as in being arranged;Trace analysis module is filled in unknowable value to database, like that in the given time In period, the value of each internal storage location is just stored in instruction address value database;Trace analysis module is not required, it Function be desirably integrated into track record module in, completed by track record module;
C) instruction address value database is that IA, instruction machine code, instruction accesses register number, instruction accesses for preserving The value of register, instruction access memory address, instruction accesses a database of memory value;These data preserved referred to as refer to Enable address value;
D) software simulator is used for simulating the software of called program execution;It can according to the value of certain moment memory or register, The execution of called program machine instruction is simulated, it can parse machine instruction, and read-write register is wanted still when analyzing machine instruction Memory, and the change of caused memory or register value after execution is recorded in instruction address value database.Software simulator Tracking data can also be recorded when executing called program;
E) event analysis module is to carry out the software module of event analysis;It can analyze OS Events generation when Quarter address, executes the information such as time, and these information is organized into event data;Event data can transfer to debugger, also may be used To be directly output to output equipment;A series of characteristic information when event analysis module occurs according to OS Events come point Tracking data is analysed, identifies task of including in called program operational process, finds task run institute in called program implementation procedure The OS Events of generation, such as task handover event, interrupt event;
F) performance evaluation module is the software module for carrying out one machine instruction sequence of called program and executing time performance analysis;It The execution time performance data of a machine instruction sequence can be analyzed;Usual debugger can be one corresponding by source code lines Machine instruction sequence transfers to its performance of performance evaluation module analysis;First instruction in instruction sequence is had recorded in tracking data Starting Executing Time and instruction sequence subsequent instructions Starting Executing Time, start to execute with instruction sequence subsequent instructions The Starting Executing Time that time subtracts first instruction in instruction sequence has just obtained the time that instruction sequence executes;
G) covering analyzing module is to carry out the software module of one machine instruction sequence covering analyzing of called program;It can be analyzed Go out whether a machine instruction sequence was performed;Usual debugger can hand over the corresponding machine instruction sequence of source code lines Whether executed by covering analyzing module analysis;Covering analyzing module searches for specified instruction sequence in tracking data, if It executed, it will be able to be searched in tracking data;
H) debugger is a program, its responder commissioning staff is instructed by the debugging operations that input equipment inputs, processing Later, output debugs output data to output equipment;Debugger can be controlled, be checked, be changed by tune journey by debugging request Sequence;Called program and debugger can be in the same computers, can also be in different computers;If called program and Debugger is not in same computer, and two computers are connected by a connecting path, and debugger passes through the connecting path pair Called program carries out cross debugging;Debugger can add breakpoint to called program, when called program execution encounters breakpoint, adjust Examination device, which can control called program, to be stopped executing;Debugger read when called program stops current called program source code lines, Output equipment is transferred to show in the programs such as actual registers, variate-value scene;When carrying out execution post debugging, debugger is by called program Instruction transfers to software simulator to execute, and obtain from software simulator execute after program scene transfer to output equipment to show; When carrying out execution post debugging, debugger can obtain source program and correlated performance data from performance evaluation module, can be from covering The data whether source program executes are obtained in lid analysis module, will be transferred in these data integrations to program scene, output equipment Display.
2. the adjustment method proposed based on software debugging system framework after the execution shown with performance, it is characterised in that:Including Step:
Step 1:Computer program is executed according to the record simulation in tracking data;
Step 1.1:Track and record module periodic logging tracking data from the execution of called program;
Step 1.2:Program debugging personnel operate debugger by input equipment, and a large amount of execution breakpoints are arranged in called program;
Step 1.3:Software simulator presses tracking data, the execution of analog portion called program, until some in a large amount of conditions Stop simulation when meeting to execute;
Step 2:Event is shown;
Step 2.1:Event debugging personnel select the event to be debugged by input equipment and transfer to debugger, and debugger will select Event pass to event analysis module, event analysis module determines corresponding called program operation according to event memory access feature Operating system machine instruction sequence, referred to as event correlation machine instruction sequence;
Step 2.2:Event analysis module by tracking data searched events correlation machine instruction sequence may search for thing Part;
Step 2.3:Event analysis module determines event according to the execution time of the event correlation machine instruction sequence found Execute the time;
Step 2.4:Event analysis module search instruction address value database finds certain associated data of moment task;
Step 2.5:Event analysis module calculates event data, which is transferred to debugger;
Step 2.6:Event data is organized into output data and output equipment is transferred to show by debugger;
Step 3:Performance is shown;
Step 3.1:Called program mapped file may have access to;
Step 3.2:Performance evaluation module or debugger are according to the information in called program mapped file, by called program source generation Code file source code row is converted to machine instruction sequence;
Step 3.3:Performance evaluation block search tracking data, until finding machine instruction sequence;
Step 3.4:Performance evaluation module determines the execution time point of lower machine instruction sequence;
Step 3.5:Performance evaluation module subtracts this machine instruction sequence from the execution time point of lower machine instruction sequence Time point is executed, calculates and executes this instruction the time it takes performance, which is transferred into debugger;
Step 3.6:Debugger shows the corresponding execution time performance of source code lines by output equipment;
Step 4:Show coverage rate analysis data;
Step 4.1:Called program mapped file may have access to;
Step 4.2:Covering analyzing module or debugger are according to the information in called program mapped file, by called program source generation Code file source code row is converted to machine instruction sequence;
Step 4.3:Covering analyzing block search tracking data is to determine whether that called program source code file source code lines correspond to Every machine instruction be all performed;It is taken as performing if searched, which is transferred into debugger;
Step 4.4:Debugger indicates called program source code file source code by showing a mark in output equipment The corresponding machine instruction of row is all performed.
3. the adjustment method that software debugging system framework is proposed after the execution according to claim 2 shown with performance, It is characterized in that:Called program is the debugging system and the computer program to be debugged of method that the present invention describes in the step 1, Wherein may include reproducible or not reproducible bug, the debugging system and method described through the invention can help journey Sequence developer finds out bug therein;Called program is made of machine instruction sequence and program data, it is stored in it and holds It is run in the memory of capable computer system.
4. the adjustment method that software debugging system framework is proposed after the execution according to claim 2 shown with performance, It is characterized in that:Called program operation operating system is the operating system of computer system where called program in the step 2.1, The hardware resource of computer system where it manages called program provides necessary resource for called program execution;Inside it, The memory virtual address of computer system has been managed to the mapped file of physical address translations.
5. the adjustment method that software debugging system framework is proposed after the execution according to claim 2 shown with performance, It is characterized in that:Called program source code file is the source files of program of called program in the step 3.2;The source journey of called program Preface part is usually high-level language source text file, can also be assembler source program text file, and be likely to More than one file;The source files of program of called program is converted to the called program binary system comprising machine instruction by compiler File, called program binary file by connector be attached positioning generate can run in computer systems by tune journey Sequence.
6. the adjustment method that software debugging system framework is proposed after the execution according to claim 2 shown with performance, It is characterized in that:Called program mapped file is to preserve called program source code file to map to object code in the step 3.1 The file of relation data;It is generally generated in the compiling of called program and connection procedure, dedicated for for application developer It is used when debugging routine;The correspondence of source code and object code, the address of global variable, function or side can be obtained by it The information such as position of address, function local variable type and the title, function local variable of method in function stack frame.
7. the adjustment method that software debugging system framework is proposed after the execution according to claim 2 shown with performance, It is characterized in that:Input equipment is keyboard, mouse, touch screen, microphone in the step 2.1.
8. the adjustment method that software debugging system framework is proposed after the execution according to claim 2 shown with performance, It is characterized in that:Output equipment is display screen, loud speaker in the step 2.6.
CN201611154067.6A 2017-03-30 2017-03-30 After-execution software debugging system with performance display and debugging method Active CN108664380B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611154067.6A CN108664380B (en) 2017-03-30 2017-03-30 After-execution software debugging system with performance display and debugging method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611154067.6A CN108664380B (en) 2017-03-30 2017-03-30 After-execution software debugging system with performance display and debugging method

Publications (2)

Publication Number Publication Date
CN108664380A true CN108664380A (en) 2018-10-16
CN108664380B CN108664380B (en) 2021-08-03

Family

ID=63785286

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611154067.6A Active CN108664380B (en) 2017-03-30 2017-03-30 After-execution software debugging system with performance display and debugging method

Country Status (1)

Country Link
CN (1) CN108664380B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582376A (en) * 2018-12-04 2019-04-05 中国航空工业集团公司西安航空计算技术研究所 A kind of lightweight apparatus control method
CN110597705A (en) * 2019-07-30 2019-12-20 广东工业大学 Program debugging method and device capable of repeatedly obtaining test data
CN111025166A (en) * 2019-12-27 2020-04-17 深圳市新威尔电子有限公司 Debugger for battery detection system
CN112416790A (en) * 2020-11-30 2021-02-26 中国航空工业集团公司西安航空计算技术研究所 Embedded software offline replay debugging method and device
CN114896173A (en) * 2022-07-12 2022-08-12 北京云枢创新软件技术有限公司 Data processing system for target data path display
CN115470751A (en) * 2022-09-22 2022-12-13 沐曦科技(北京)有限公司 Tracking information generation system based on memory database
CN116975129A (en) * 2023-09-14 2023-10-31 成都融见软件科技有限公司 Signal tracing method based on source file window, electronic equipment and medium
CN117762889A (en) * 2024-02-20 2024-03-26 成都融见软件科技有限公司 Same-file multi-window state synchronization method, electronic equipment and medium
CN117909160A (en) * 2024-03-19 2024-04-19 华中科技大学 Firmware crash analysis method and device based on Internet of things

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8261242B2 (en) * 2008-06-09 2012-09-04 International Business Machines Corporation Assisting debug memory tracing using an instruction array that tracks the addresses of instructions modifying user specified objects
CN104679653A (en) * 2015-02-13 2015-06-03 航天科工深圳(集团)有限公司 Method and system for debugging software of distribution automation terminal
CN104991857A (en) * 2015-06-08 2015-10-21 小米科技有限责任公司 Method and apparatus for trace debugging

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8261242B2 (en) * 2008-06-09 2012-09-04 International Business Machines Corporation Assisting debug memory tracing using an instruction array that tracks the addresses of instructions modifying user specified objects
CN104679653A (en) * 2015-02-13 2015-06-03 航天科工深圳(集团)有限公司 Method and system for debugging software of distribution automation terminal
CN104991857A (en) * 2015-06-08 2015-10-21 小米科技有限责任公司 Method and apparatus for trace debugging

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
田丹等: "基于Eclipse 的嵌入式软件交叉调试", 《现代电子技术》 *

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582376A (en) * 2018-12-04 2019-04-05 中国航空工业集团公司西安航空计算技术研究所 A kind of lightweight apparatus control method
CN110597705B (en) * 2019-07-30 2023-01-20 广东工业大学 Program debugging method and device capable of repeatedly acquiring test data
CN110597705A (en) * 2019-07-30 2019-12-20 广东工业大学 Program debugging method and device capable of repeatedly obtaining test data
CN111025166A (en) * 2019-12-27 2020-04-17 深圳市新威尔电子有限公司 Debugger for battery detection system
CN112416790A (en) * 2020-11-30 2021-02-26 中国航空工业集团公司西安航空计算技术研究所 Embedded software offline replay debugging method and device
CN114896173A (en) * 2022-07-12 2022-08-12 北京云枢创新软件技术有限公司 Data processing system for target data path display
CN114896173B (en) * 2022-07-12 2022-09-16 北京云枢创新软件技术有限公司 Data processing system for target data path display
CN115470751A (en) * 2022-09-22 2022-12-13 沐曦科技(北京)有限公司 Tracking information generation system based on memory database
CN116975129A (en) * 2023-09-14 2023-10-31 成都融见软件科技有限公司 Signal tracing method based on source file window, electronic equipment and medium
CN116975129B (en) * 2023-09-14 2023-11-24 成都融见软件科技有限公司 Signal tracing method based on source file window, electronic equipment and medium
CN117762889A (en) * 2024-02-20 2024-03-26 成都融见软件科技有限公司 Same-file multi-window state synchronization method, electronic equipment and medium
CN117762889B (en) * 2024-02-20 2024-04-19 成都融见软件科技有限公司 Same-file multi-window state synchronization method, electronic equipment and medium
CN117909160A (en) * 2024-03-19 2024-04-19 华中科技大学 Firmware crash analysis method and device based on Internet of things

Also Published As

Publication number Publication date
CN108664380B (en) 2021-08-03

Similar Documents

Publication Publication Date Title
CN108664380A (en) Software debugging system and adjustment method after a kind of execution shown with performance
US9342437B2 (en) Backward post-execution software debugger
US7653899B1 (en) Post-execution software debugger with performance display
US8914777B2 (en) Forward post-execution software debugger
EP3785124B1 (en) Memory validity states in time-travel debugging
US8584097B2 (en) Post-execution software debugger with event display
CN112074817A (en) Execution control with cross-level trace mapping
CN1716264B (en) Methods, systems for annotating system traces with control program information and presenting annotated system traces
US9262299B1 (en) Simulation observability and control of all hardware and software components of a virtual platform model of an electronics system
US8015552B1 (en) Post-execution software debugger with coverage display
US9262305B1 (en) Simulation observability and control of all hardware and software components of a virtual platform model of an electronics system
CN104750603A (en) Multi-core DSP (Digital Signal Processor) software emulator and physical layer software testing method thereof
US7409602B2 (en) Methodology for debugging RTL simulations of processor based system on chip
WO2019209494A1 (en) Visualizing last/next known data values in time travel traces
KR20180096780A (en) Method and apparatus for data mining from core trace
CN109032947A (en) For the test method of operating system, device, equipment and storage medium
US8078590B2 (en) Data processing system
JP2017162130A (en) Hardware/software cooperative verification device and hardware/software cooperative verification method
US20210299579A1 (en) Videogame telemetry data and game asset tracker for session recordings
Liu et al. End-to-end automation of feedback on student assembly programs
CN106528414A (en) Processor chip simulator
US11928045B1 (en) System and method for non-intrusive debugging at an embedded software breakpoint
WO1991000575A1 (en) Computer operations recorder and training system
JPH096646A (en) Program simulation device
US20070038431A1 (en) Data processing apparatus simulation

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
GR01 Patent grant
GR01 Patent grant