CN106201896A - Adjustment method based on checkpoint, system and device under a kind of embedded environment - Google Patents
Adjustment method based on checkpoint, system and device under a kind of embedded environment Download PDFInfo
- Publication number
- CN106201896A CN106201896A CN201610595940.9A CN201610595940A CN106201896A CN 106201896 A CN106201896 A CN 106201896A CN 201610595940 A CN201610595940 A CN 201610595940A CN 106201896 A CN106201896 A CN 106201896A
- Authority
- CN
- China
- Prior art keywords
- instruction
- checkpoint
- application program
- debugging
- module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
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)
- Retry When Errors Occur (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses adjustment method based on checkpoint, system and device under a kind of embedded environment.Described adjustment method includes that host sends the first instruction to target machine, makes the application program on described target machine bring into operation;Host is from external reception order, and judges the type of described order;If described order is for preserving order, then enter next step;If described order is debug command, then enter step (5);If described order is for recovering order, then enter step (6);If described order is for exiting command, then enter step (8);Otherwise enter step (7);Judge described application program whether end of run, be to enter step (8), otherwise enter next step;Until debugging terminates.The present invention is mutual by host and target machine, Checkpointing on target machine so that when restarting debugging, and application program can be directly returned to operation at checkpoint, is effectively shortened the debugging cycle of application program under embedded environment.
Description
Technical field
The invention belongs to computer application program debugging method, more particularly, under a kind of embedded environment based on
The adjustment method of checkpoint, system and device.
Background technology
Along with informationization, intelligent, the development of networking, embedded system technology obtains development space widely.Example
As, at key areas such as finance, traffic, electric power and military affairs, embedded software is widely used, and has become as and affects state
Family's development and the important infrastructure of safety.The completing of the task that many of which is crucial all relies on built-in application program, as
Really these application programs break down, can on life and produce produce many impact, improve Embedded Application stability and can
Become particularly important by property.
The operation time having a lot of large-scale built-in application program is the longest, and once these programs run into fault, start anew
Debugging can waste the substantial amounts of waiting time.In order to reduce the waiting time and make mistake can accurate reproduction, program perform
Definitiveness needs to be guaranteed.Owing to embedded system is more simplified than conventional system, real-time is had higher requirement, embedding
In embedded system, checkpoint function needs the real-time performing speed quickly to meet embedded system, accordingly, with respect to general
For way system, it is achieved get up more difficult.
Checkpoint technology under existing embedded environment is typically individual process Checkpointing, and concurrent to it
Subprocess is when being arranged on checkpoint it cannot be guaranteed that global coherency, and each process saves multiple checkpoint literary composition the most in the same time
Part, it is possible that repeat rollback when of recovery in checkpoint, finally makes application recovery run to application program
The state that original state rather than checkpoint preserve, so that checkpoint recovery operation failure.
Summary of the invention
For disadvantages described above or the Improvement requirement of prior art, the invention provides a kind of debugging side based on checkpoint
Method, Apparatus and system, its object is to by host and target machine is mutual, Checkpointing on target machine, and with inspection
Make an inventory of file and preserve the contextual information of process corresponding to application program so that when restarting debugging, application program can be straight
Connect and return to run at checkpoint, without the execution of the program that starts anew, thus waiting time when decreasing debugging, permissible
Effectively shorten the debugging cycle of application program.
For achieving the above object, according to one aspect of the present invention, it is provided that a kind of adjustment method based on checkpoint, bag
Include following steps:
(1) host sends the first instruction to target machine, makes the application program on target machine bring into operation, makes checkpoint
Sequence number i=1;
(2) order outside host reception, and judge the type of described order;If described order is for preserving order,
Then enter step (3);If described order is debug command, then enter step (4);If described order is for recovering order, then
Enter step (5);If described order is for exiting command, then enter step (7);Otherwise enter step (6);
(3) host sends the second instruction to target machine, makes target machine create the i-th inspection in the current location of application program
Point, and the contextual information of process corresponding for described application program is stored in the i-th check point file of corresponding i-th checkpoint
In;I=i+1, returns step (2);Described process includes parent process and the subprocess of described parent process;
(4) host sends the 3rd instruction to target machine, makes described target machine debug in the current location of application program, and
Returning debugging result to host, described debugging result is exported by host, returns step (2);
(5) host sends the 4th instruction to target machine, makes described target machine recover to apply journey from jth check point file
The contextual information of the process that ordered pair is answered, and the current location recovery run by application program is to jth checkpoint, j is 1~i
Integer, returns step (2);
(6) host sends the instruction that reports an error to outside, returns step (2);
(7) host sends the 5th instruction to target machine, the operation of application program on target end machine.
Preferably, also included before described step (1), host is connected to target machine.
Preferably, described application program includes destination application and concurrent application program.
Preferably, the contextual information in described step (3) includes that state of a process, the user-variable of process, process exist
Address in depositor, process address in the user stack and kernel stack of process list item.
As it is further preferred that described state of a process includes the father and son of the thread of process head, the thread of process, process
Relation, the shared data of thread of process and private data.
Preferably, described step (4) specifically includes following sub-step:
(4.1) according to the kind of debug command, host sends the 3rd instruction to target machine, makes described target machine in application
The current location that program is run carries out the debugging of corresponding kind;
(4.2) in the time period Δ t set, host judges whether to receive the debugging result that target machine returns, and is then
Enter step (4.3), otherwise return step (4.1);
(4.3) described debugging result is fed back to outside by host, returns step (2).
As it is further preferred that the kind of described debug command includes conditional breakpoint, enters function, jumps out function, sets
Put point of observation, the binding of thread core, insert breakpoint, inquiry breakpoint, single step perform, continuously carry out, perform to terminate, delete breakpoint,
Check variable, check that thread runs core, obtains core active thread or statistics thread operation time.
It is another aspect of this invention to provide that additionally provide a kind of debugging system based on checkpoint, including host and
Target machine, described target machine includes parsing module, runs module, checkpoint module and debugging module;
Described host is for sending the first instruction, the second instruction, the 3rd instruction, the 4th instruction and the to parsing module
Five instructions, receive operation result and debugging result that parsing module returns simultaneously;
Described parsing module is for being sent to run module, the second instruction and the 4th by the first instruction and the 5th instruction
Instruction is sent to checkpoint module, and the 3rd instruction is sent to debugging module;And operation result and debugging result are fed back to place
Main frame;
Described operation module is used for according to the first instruction operation application program, and according to the 5th order fulfillment application journey
Sequence;And when application program end of run, export operation result to parsing module;Simultaneously according to recovering instruction, by application program
The current location run is recovered to checkpoint;
Described checkpoint module is for according to the second instruction, in the establishment checkpoint, current location of application program, and by institute
The contextual information stating process corresponding to application program is stored in check point file, simultaneously according to the 4th instruction, from checkpoint
File recovers the contextual information of process corresponding to application program, and sends recovery instruction to running module;
Described debugging module is for debugging in the current location of application program, and debugs result to parsing module output.
It is another aspect of this invention to provide that additionally provide a kind of debugging apparatus for above-mentioned debugging apparatus, including resolving
Module, operation module, checkpoint module and debugging module;
Described parsing module is for being sent to run module, the second instruction and the 4th by the first instruction and the 5th instruction
Instruction is sent to checkpoint module, and the 3rd instruction is sent to debugging module;And operation result and debugging result are fed back to place
Main frame;
Described operation module is used for according to the first instruction operation application program, and according to the 5th order fulfillment application journey
Sequence;And when application program end of run, export operation result to parsing module;Simultaneously according to recovering instruction, by application program
The current location run is recovered to checkpoint;
Described checkpoint module is for according to the second instruction, in the establishment checkpoint, current location of application program, and by institute
The contextual information stating process corresponding to application program is stored in check point file, simultaneously according to the 4th instruction, from checkpoint
File recovers the contextual information of process corresponding to application program, and sends recovery instruction to running module;
Described debugging module is for debugging in the current location of application program, and debugs result to parsing module output.
In general, by the contemplated above technical scheme of the present invention compared with prior art, due in debugging process
Middle Checkpointing, it is possible to obtain following beneficial effect:
1, mutual by host and target machine, and directly Checkpointing and create checkpoint literary composition on target machine
Part so that when debugging under embedded environment, application program can be directly returned to application program corresponding to checkpoint
Position is run, without the execution application program that starts anew, thus waiting time when decreasing debugging, can effectively contract
The debugging cycle of short application program;
2, the present invention by state of a process, the user-variable of process, process address in a register, process at plan
Address in the user stack of item and kernel stack is all stored in check point file as contextual information so that the present invention disobeys
Relying in operating system, target machine both may operate on the intel chips frameworks such as X86, it is also possible to operates in domestic Godson
Deng on mips framework, there is wide applicability;
3, the present invention can send multiple debug command, it is adaptable to multiple debug-type according to external command to target machine;
4, the present invention can arrange multiple checkpoint, and carries out selecting to recover from different check point files, thus has
Pointedly level of application is debugged, further shorten the debugging time;
5, the contextual information that the present invention preserves in check point file, not only includes the process that destination application is corresponding
Contextual information, also include the process context information of the concurrent application program concurrently run with destination application, and
When carrying out the recovery operation of checkpoint, recover all of application program, to keep global coherency state, it is achieved thereby that many
Process cooperative check point operates.
Accompanying drawing explanation
Fig. 1 is debugging apparatus structural representation of the present invention;
Fig. 2 is the schematic flow sheet of the embodiment of the present invention 1 adjustment method;
Fig. 3 is that the embodiment of the present invention 1 runs application flows schematic diagram;
Fig. 4 is the embodiment of the present invention 1 Checkpointing schematic flow sheet;
Fig. 5 is the embodiment of the present invention 1 debugging utility schematic flow sheet;
Fig. 6 is that the embodiment of the present invention 1 recovers checkpoint schematic flow sheet.
Detailed description of the invention
In order to make the purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, right
The present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, and
It is not used in the restriction present invention.If additionally, technical characteristic involved in each embodiment of invention described below
The conflict of not constituting each other just can be mutually combined.
The invention discloses a kind of adjustment method based on checkpoint and debugging system, described debugging system includes host
Machine and target machine, described target machine includes parsing module, runs module, checkpoint module and debugging module;Host is even
Connecing parsing module, parsing module is connected with operation module, checkpoint module and debugging module respectively, runs module and checkpoint
Module and debugging module are connected;
Described adjustment method specifically includes following steps:
(0) remotely connect host and target machine, specifically include following sub-step:
(0.1) host is from the order of external reception telnet, and sends link order to target machine, described remotely steps on
The parameter of the order in land is user name and the IP address of described target machine;
(0.2) order that host is deciphered from external reception, and send decryption instructions to target machine, build with described target machine
Vertical remotely connection;
(1) host sends the first instruction to parsing module, and parsing module is sent to fortune after described first instruction being resolved
Row module, makes the application program on described target machine bring into operation;Described application program includes destination application and concurrent
Application program, the process number of destination application will be recorded in the process number of target machine by destination application while running
In file, and concurrent application program not necessarily runs with destination application simultaneously, but as long as bringing into operation, this is concurrently applied
Program will send signal to destination application, thus leaves described concurrent application program in the process number file of target machine
The process number of corresponding process;
(2) order outside host reception, and judge the type of described order;If described order is for preserving order,
Then enter step (3);If described order is debug command, then enter step (4);If described order is for recovering order, then
Enter step (5);If described order is for exiting command, then enter step (7);Otherwise the type host of this order cannot be known
Not, step (6) is entered;
(3) host sends the second instruction to parsing module, and parsing module is sent to inspection after described first instruction being resolved
Make an inventory of module, make checkpoint module create the i-th checkpoint in the current location of application program, and remembered according in process number file
The process number of record, is stored in the contextual information of process corresponding for described application program in the i-th check point file;Described process
Including parent process and the subprocess of described parent process;I=i+1, returns step (2);Described contextual information includes process
State (such as process head, the thread of process, the filiation of thread of process, shared data and private data), the user of process
Variable, process address in a register, process address in the user stack and kernel stack of process list item;Due to described
Step (2)
(4) host sends the 3rd instruction to target machine, makes described target machine debug in the current location of application program, and
Returning debugging result to host, the output of described debugging result to outside, is returned step (2) by host;Specifically include as follows
Sub-step:
(4.1) according to the kind of debug command, host sends the 3rd instruction to parsing module, and parsing module is by described
Three instructions are sent to debugging module after resolving, and make described debugging module carry out corresponding kind in the current location that application program runs
Debugging, it is thus achieved that exporting to parsing module after debugging result, parsing module is sent to host after the parsing of debugging result;Described
The kind of debug command include conditional breakpoint, enter function, jump out function, arrange point of observation, thread core binding, insert breakpoint,
Inquiry breakpoint, single step perform, continuously carry out, perform to terminating, delete breakpoint, checking variable, check that thread runs core, acquisition core
Active thread or statistics thread run the time;
(4.2) in 0.3s~1.0s, host judges whether to receive the debugging result that parsing module returns, and is to enter
Step (4.3), otherwise returns step (4.1);
(4.3) described debugging result is fed back to outside by host, returns step (2);
(5) host sends the 4th instruction to parsing module, and parsing module is sent to inspection after described 4th instruction being resolved
Make an inventory of module, make described checkpoint module recover the contextual information of process corresponding to application program from jth check point file,
And sending recovery instruction to running module, the current location that operation module makes application program run is recovered to jth checkpoint, and j is 1
~the integer of i, return step (2);
(6) host sends the instruction that reports an error to outside, returns step (2);
(7) host sends the 5th instruction to parsing module, and parsing module is sent to fortune after described 5th instruction being resolved
Row module, runs module and terminates the operation of application program.
During whole debugging, except carrying out debugging and recovering the moment of checkpoint, remaining moment application program continues
Run, until end of run;The selection checkpoint, position of the application program that can recover as required in step (5);If should
After having been running for certain position by program, but when needing in this position to create checkpoint and do not create, can return to step
(1), start anew application program to run.Embodiment 1
The test environment of this embodiment is as follows:
Host: CPU is Intel i5-4590@3.30GHz, internal memory 8G, and operating system is Ubuntu 14.04;Target
Machine: CPU is Godson 3A, has multi core chip, internal memory model DDR2 800Mhz (1G), operating system Debian.
Main flow debugger such as GDB under Linux, can only operate in x86 system.Mips framework is embedding in the present embodiment
Embedded system, uses reduced instruction set computer, compares and realizes the difficult point of checkpoint system on the conventional system of x86 framework and be: 1, needs
Will be while the checkpoint system process simplified, it is ensured that the function of checkpoint can realize;2, the faster speed of service is needed,
Meet embedded system requirement higher to real-time.The ground such as 3, mips framework is different with the instruction set of x86 framework, depositor
Location is different, causes realizing checkpoint function on mips framework more difficult.
As in figure 2 it is shown, the present embodiment is the once debugging process to debugged application program test.c, mainly include setting up
Remotely connect, run the steps such as application program, Checkpointing, debugging utility, recovery checkpoint, specific as follows:
(1) remotely connection is set up, including following sub-step:
(1.1) being remotely connected with target machine foundation by the input ssh order of host order line, the parameter of order is target
The user name of machine and IP address, then go to step (1.2);
(1.2) commissioning staff inputs the login password of target machine on host so that host and target machine complete to build
Vertical remotely connection, then goes to step (2);
(2) application program is run, as it is shown on figure 3, include following sub-step:
(2.1) the most load check point kernel module epcr_imports.ko and epcr.ko is judged on target machine,
The most directly go to step (2.2) if loaded, if not then utilize target machine order line to perform load check point kernel mould
Block script ./sh epcr_module.sh, is loaded into kernel by checkpoint kernel module, then goes to step (2.2);
(2.2) judge whether the secondary server server_for_checkpoint of checkpoint on target machine runs, if
Run and the most directly gone to step (2.3), the most just utilized target machine order line terminal to perform order ./server_for_
Checkpoint starts secondary server, then goes to step (2.3);
(2.3) utilize target machine order line to perform application program executable file ./test, start application program, then turn
Step (2.4);
(2.4) start checkpoint client ./client_for_checkpoint on host, be connected on target machine
Checkpoint server end server_for_checkpoint, the filename test of the application program that forwarding step (2.3) performs arrive
Checkpoint server end, is searched the process number of corresponding application program on target machine by checkpoint server end, then by process number
It is sent to checkpoint client _ for_checkpoint, then goes to step (3);
(3) command determination that target machine inputs according to commissioning staff is the need of Checkpointing;When commissioning staff needs
During Checkpointing, then enter next step, otherwise enter step (5);
(4) Checkpointing, as shown in Figure 4, including following sub-step:
(4.1) host is to target machine input checking dot command ./checkpoint pid backup, creates checkpoint and protects
Depositing into journey, it is the process number pid that step (2.4) obtains that described checkpoint preserves the parameter of process, the process that this process number is corresponding
For first object process, then go to step (4.2);
(4.2) checkpoint on target machine preserves process order row of obeying the order and reads in step (4.1) incoming parameter, will include the
At the beginning of the parameters such as the process number pid of one target process, record check point range, check point file context.pid descriptor are carried out
Beginningization, and the value of described parameter is assigned to structure variable cr_args, is formatted into checkpoint dynamic link library libcr and can recognize that
Parameter, then go to step (4.3);
(4.3) parameter initialization in step (4.2) is become kernel to can recognize that cri_info_t by checkpoint dynamic link library
Structure form, then with kernel communication;Meanwhile open/proc file system in ctrl file acquisition correspondence proving point
The descriptor of file, and perform ioctl operation and checkpoint preserved process be registered as Phase2 process, then registration one based on
The call back function Phase1 of thread, then goes to step (4.4);
(4.4) checkpoint dynamic link library sends checkpoint to kernel and preserves request, and kernel preserves request according to checkpoint
In cr_scope, construct process relational tree structure, obtain and need first object corresponding to application program preserving checkpoint to enter
Journey, is then wake up Phase1 call back function, and this call back function transmission parameter CR_OP_HAND_CHKPT, to kernel, starts first
Target process carries out checkpoint preservation, then goes to step (4.5);
(4.5) kernel starts to write in check point file context.pid the contextual information of first object process;First
First, kernel preserves the file header of check point file, then by all processes in the scope of first object process record check point
Contextual information is saved into check point file, including current state, whole user-variables of process and the data structure of process
Content in value, the value of actual registers, the value being saved in process list item and its user stack and kernel stack;, then turn
Step (4.6);
(4.6) checkpoint preserves process and checks that in step (4.5), checkpoint preserves work by event loop mechanism poll
Whether complete, if completed, closing/proc node, allowing application program continue to run with, then go to step (5), otherwise block straight
Preserve work to complete to checkpoint;
(5) debugging utility step, as it is shown in figure 5, include following sub-step:
(5.1) starting the debugging server end on target machine, parameter is the filename of application program in step (2.4);Fortune
Debugging client on row host, parameter is IP address and the middle debugged application program obtained of step (2.4) of target machine
Process number pid, then go to step (5.2);
(5.2) first debugging server end creates a thread, calls ptrace function, debugging server end in thread
Being tracked the subprocess corresponding to pid: call ptrace function, its functional parameter is PTRACE_ATTACH, and thread number is
Pid, address parameter and data parameters are 0, then carry out sub-step (5.3);
(5.3) the internal loading application programs of the thread that debugging server end creates in step (5.2), and additionally for application
Program sets up symbol table, and the thread of loading application programs placed in a suspend state, is parked in code current location, carries out sub-step
(5.4);
(5.4) debugging client initiates remote connection request to debugging server end, after being adapted server end confirmation, connects
Manage debugged process, set up and remotely connect;During setting up the whole debugging after remotely connecting, debugging server end one
Directly it is in listening state, is ready at all times to accept the RSP packet that debugging client sends.Then (5.5) are gone to step;
(5.5) debugging client can send various RSP packet and debugs application program, when receiving debugging people
After the debug command of member's input, it is judged that whether the command type of described debug command, for exit command (quit), is to terminate to adjust
Examination, otherwise carries out sub-step (5.6);
(5.6) the debug command collection of traversal debugger definition, searches the command type of described debug command in debug command
Concentrate and whether exist, be, carry out sub-step (5.7), otherwise export information to outside, point out debug command input error,
Rotor step (5.5);Debug command collection, in addition to including the debugging operations that main flow debugger has, also includes the following of debug command
Command type: the binding of thread core, insert breakpoint, inquiry breakpoint, single step perform, continuously carry out, perform to terminate, delete breakpoint,
Check variable, check that thread runs core, obtains core active thread, statistics thread operation time;
(5.7) using described debug command as data, it is packaged into RSP packet, is sent to target machine debugging server end,
If receiving the execution result of target machine debugging server end in 0.5 second, then carry out sub-step (5.9), otherwise rotor step
(5.5);
(5.9) debugging client resolves and performs result, obtains debugging result, and this debugging result feeds back to commissioning staff;
Commissioning staff judges whether to have positioned mistake in application program according to the debugging result of feedback, is to send termination to host
The instruction of debugging, returns step (5.5), otherwise goes to step (6);
(6) checkpoint step is recovered, as shown in Figure 6, including following sub-step:
(6.1) checkpoint that the process number pid of the debugged application program obtained according to step (2.4) or user specify
File context.pid, utilizes target machine to perform checkpoint recovering process ./cr_restart context.pid, and parameter is for wanting
The check point file context.pid recovered, then goes to step (6.2);
(6.2) check point file that the checkpoint recovering process on target machine is incoming from order line read step (6.1)
Parameter;This parameter includes the signal that the path of check point file and recovering process to send after running to checkpoint recovering process
Deng, then go to step (6.3);
(6.3) parameter initialization of check point file in step (6.2) is become kernel can recognize that by checkpoint dynamic link library
Cri_info_t structure form, then obtains communication with kernel;Meanwhile, open/proc file system in ctrl literary composition
Part, obtains respective file descriptor, it is performed ioctl operation and checkpoint recovering process is registered as Phase2 process, then
For checkpoint recovering process one call back function Phase1 based on thread of registration of first object process, then go to step
(6.4);
(6.4) checkpoint dynamic link library sends checkpoint recovery request to kernel, and kernel reads checkpoint recovery request
In structure cr_rstrt_args data, and call the variable req that function distributes and initializes checkpoint recovery request, so
The path of rear acquisition check point file, and from check point file, read contextual information, and judge checkpoint server end
The contextual information that version, architecture residing for first object process and kernel version are the most corresponding with in this checkpoint system
Keep consistent, the most directly terminate if inconsistent, otherwise go to step (6.5);
(6.5) kernel reads contextual information from check point file context.pid, is then write from kernel by process head
Access customer layer, is then present in the process of Wait-to-Restore in check point file for determining, checkpoint recovering process is entered as father
Journey is called fork () and is created subprocess, and subprocess starts checkpoint recovery operation, calls clone () system and calls, and creates second
Target process, subprocess calls ioctl () function and obtains communication with kernel, sends parameter CR_OP_RSTRT_CHILD to kernel
Layer, inner nuclear layer recovers in the check point file that first object process is corresponding in all progress informations in the second target process
Hold, then go to step (5.6);
(6.6) checkpoint recovering process is by event loop mechanism, and the checkpoint waiting the recovery operation of pending checkpoint is extensive
The subprocess of multiple process completes checkpoint recovery operation, when the second target process completes after checkpoint resumes work, and checkpoint is extensive
Multiple process carries out the cleaning work being correlated with, some related data structures during the recovering process of release checkpoint, then makes the
One target process is the second target process, goes to step (5.1), without from the beginning performing application program, thus when shortening debugging
Waiting time.
Embodiment 2
The test environment of embodiment 2 is with embodiment 1
As in figure 2 it is shown, the present embodiment is the once debugging process to debugged application program sigtest1.c, mainly include
Set up remotely connection, run the steps such as application program, Checkpointing, debugging utility, recovery checkpoint, specific as follows:
(1) remotely connection is set up, including following sub-step:
(1.1) being remotely connected with target machine foundation by the input ssh order of host order line, the parameter of order is target
The user name of machine and IP address, then go to step (1.2);
(1.2) commissioning staff inputs the login password of target machine on host so that host and target machine complete to build
Vertical remotely connection, then goes to step (2);
(2) operational objective application program and concurrent application program, including following sub-step:
(2.1) the most load check point kernel module epcr_imports.ko and epcr.ko is judged on target machine,
The most directly go to step (2.2) if loaded, if not then utilize target machine order line to perform load check point kernel mould
Block script ./sh epcr_module.sh, is loaded into kernel by checkpoint kernel module, then goes to step (2.2);
(2.2) judge whether the secondary server server_for_checkpoint of checkpoint on target machine runs, if
Run and the most directly gone to step (2.3), the most just utilized target machine order line terminal to perform order ./server_for_
Checkpoint starts secondary server, then goes to step (2.3);
(2.3) utilize target machine order line to run mapcreate program, create a file, be used for preserving needs and carry out
The process number of checkpointed;
(2.4) utilizing target machine order line performance objective application program executable file ./sigtest1, starting target should
By program, it is thus achieved that the first object process that destination application is corresponding, perform concurrently to apply also with target machine order subsequently
Executable ./sigtest2 80, starts concurrent application program, and obtains corresponding concurrently the entering of concurrent application program
Journey, now concurrently runs between first object process and concurrent process;In concurrent application program executable file 80 are concurrent
The signal that process sends to first object process, the most operating first object process receives this signal;Due to intended application
Program and concurrent application program are all linked with libsigqueue.so dynamic link library;Now, this dynamic link library rewrites
Sigqueue function, concurrent process call sigqueue function send signal, run concurrent application program time, this function will also
The process of sending out and process number corresponding to first object process, be saved in step (2.3) file created with the form of structure
In, then go to step (2.5);
(2.5) start checkpoint client ./client_for_checkpoint on host, be connected on target machine
Checkpoint server end server_for_checkpoint, the filename of the destination application that forwarding step (2.4) performs
Sigtest1, to checkpoint server end, is searched corresponding first of first object process on target machine by checkpoint server end
Process number, is then sent to this process number checkpoint client _ for_checkpoint, then goes to step (3);
(3) command determination that target machine inputs according to commissioning staff is the need of Checkpointing;When commissioning staff needs
During Checkpointing, then enter next step, otherwise enter step (5);
(4) Checkpointing, including following sub-step:
(4.1) host is to target machine input checking dot command ./checkpoint pid backup, creates checkpoint and protects
Depositing into journey, it is the first process number that step (2.5) obtains that described checkpoint preserves the parameter of process;Meanwhile, traversal step is passed through
(2.3) structure preserved in step (2.4) in the file created obtains the second process number that concurrent process is corresponding, then turns step
Suddenly (4.2);
(4.2) checkpoint on target machine preserves process order row of obeying the order and reads in step (4.1) incoming parameter, will include the
The parameter of one target process and concurrent process initializes, and the value of described parameter is assigned to structure and becomes, and is formatted into inspection
Make an inventory of the discernible parameter of dynamic link library libcr, then go to step (4.3);
(4.3) parameter in step (4.2) is initialized to kernel and can recognize that cri_ by checkpoint dynamic link library respectively
Info_t structure form, then with kernel communication;Meanwhile open/proc file system in ctrl file acquisition corresponding
The descriptor of check point file, and perform ioctl operation and checkpoint is preserved process be registered as Phase2 process, note the most respectively
Two call back function Phase1 based on thread of volume, then go to step (4.4);
(4.4) checkpoint dynamic link library sends checkpoint to kernel and preserves request, and kernel preserves request according to checkpoint
In cr_scope, construct process relational tree structure, obtain and need first object corresponding to application program preserving checkpoint to enter
Journey and concurrent process, be then wake up Phase1 call back function, this call back function send parameter CR_OP_HAND_CHKPT to kernel,
Start first object process and concurrent process are carried out checkpoint preservation, then go to step (4.5);
(4.5) kernel starts the contextual information of first object process and concurrent process is respectively written into check point file
In context.pid;First, kernel preserves the file header of check point file, then by first object process and concurrent process
Contextual information be saved into check point file, including state, whole user-variables of process and data structure that process is current
Value, the value of actual registers, the value being saved in process list item and its user stack and kernel stack in content;, then
Go to step (4.6);
(4.6) checkpoint preserves process and checks that in step (4.5), checkpoint preserves work by event loop mechanism poll
Whether completing, if completed, closing/proc node, allow destination application and concurrent program continue to run with, then turn step
Suddenly (5), otherwise block until checkpoint preserves work and completes;
(5) debugging utility step, as it is shown in figure 5, include following sub-step:
(5.1) starting the debugging server end on target machine, parameter is the file of destination application in step (2.5)
Name;Running the debugging client on host, parameter is IP address and the middle intended application journey obtained of step (2.5) of target machine
The process number pid of sequence, then goes to step (5.2);
(5.2) first debugging server end creates a thread, calls ptrace function, debugging server end in thread
Being tracked the subprocess corresponding to pid: call ptrace function, its functional parameter is PTRACE_ATTACH, and thread number is
Pid, address parameter and data parameters are 0, then carry out sub-step (5.3);
(5.3) the internal loaded targets application program of the thread that debugging server end creates in step (5.2), and be additionally
Destination application sets up symbol table, and the thread of loaded targets application program placed in a suspend state, is parked in code current location, enters
Row sub-step (5.4);
(5.4) debugging client initiates remote connection request to debugging server end, after being adapted server end confirmation, connects
Manage debugged process, set up and remotely connect;During setting up the whole debugging after remotely connecting, debugging server end one
Directly it is in listening state, is ready at all times to accept the RSP packet that debugging client sends.Then (5.5) are gone to step;
(5.5) debugging client can send various RSP packet and debugs destination application, when receiving tune
After the debug command of examination personnel input, it is judged that whether the command type of described debug command, for exit command (quit), is to tie
Bundle debugging, otherwise carries out sub-step (5.6);
(5.6) the debug command collection of traversal debugger definition, searches the command type of described debug command in debug command
Concentrate and whether exist, be, carry out sub-step (5.7), otherwise export information to outside, point out debug command input error,
Rotor step (5.5);Debug command collection, in addition to including the debugging operations that main flow debugger has, also includes the following of debug command
Command type: the binding of thread core, insert breakpoint, inquiry breakpoint, single step perform, continuously carry out, perform to terminate, delete breakpoint,
Check variable, check that thread runs core, obtains core active thread, statistics thread operation time;
(5.7) using described debug command as data, it is packaged into RSP packet, is sent to target machine debugging server end,
If receiving the execution result of target machine debugging server end in 0.5 second, then carry out sub-step (5.9), otherwise rotor step
(5.5);
(5.9) debugging client resolves and performs result, obtains debugging result, and this debugging result feeds back to commissioning staff;
Commissioning staff judges whether to have positioned mistake in application program according to the debugging result of feedback, is to send termination to host
The instruction of debugging, returns step (5.5), otherwise goes to step (6);
(6) checkpoint step is recovered, as shown in Figure 6, including following sub-step:
(6.1) check point file in the first process number obtained according to step (2.4) or step (4.3)
Context.pid, utilizes target machine to perform checkpoint recovering process ./restart context.pid, and parameter is to be recovered
Check point file context.pid, then goes to step (6.2);
(6.2) check point file that the checkpoint recovering process on target machine is incoming from order line read step (6.1)
Parameter;This parameter includes the signal that the path of check point file and recovering process to send after running to checkpoint recovering process
Deng, then go to step (6.3);
(6.3) parameter initialization of check point file in step (6.2) is become kernel can recognize that by checkpoint dynamic link library
Cri_info_t structure form, then obtains communication with kernel;Meanwhile, open/proc file system in ctrl literary composition
Part, obtains respective file descriptor, it is performed ioctl operation and checkpoint recovering process is registered as Phase2 process, then
Checkpoint recovering process for first object process and concurrent process registers call back function based on thread respectively, then turns step
Suddenly (6.4);
(6.4) checkpoint dynamic link library sends checkpoint recovery request to kernel, and kernel reads checkpoint recovery request
In structure cr_rstrt_args data, and call the variable req that function distributes and initializes checkpoint recovery request, so
The path of rear acquisition check point file, and from check point file, read contextual information, and judge checkpoint server end
Version, architecture and kernel version residing for first object process and concurrent process are the most corresponding with in this checkpoint system
Contextual information keep consistent, the most directly terminate if inconsistent, otherwise go to step (6.5);
(6.5) kernel reads contextual information from check point file context.pid, then by first object process with
And concurrent process process head writes client layer from kernel, then for determining that being present in Wait-to-Restore in check point file enters
Journey, checkpoint recovering process as parent process call fork () create subprocess, subprocess starts checkpoint recovery operation, calls
Clone () system is called, and creates the second target process and the 3rd target process, and subprocess calls ioctl () function and kernel
Obtaining communication, transmission parameter CR_OP_RSTRT_CHILD is to inner nuclear layer, and inner nuclear layer is respectively at the second target process and the 3rd mesh
Recover the content of all progress informations in first object process and check point file corresponding to concurrent process in mark process, then
Go to step (5.6);
(6.6) checkpoint recovering process is by event loop mechanism, and the checkpoint waiting the recovery operation of pending checkpoint is extensive
The subprocess of multiple process completes checkpoint recovery operation, when the second target process completes after checkpoint resumes work, and checkpoint is extensive
Multiple process carries out the cleaning work being correlated with, some related data structures during the recovering process of release checkpoint, then makes the
One target process is the second target process, and concurrent process is the 3rd target process, goes to step (5.1), without from the beginning performing to answer
By program, thus waiting time when shortening debugging.
When concurrent process starts, and when sending signal to first object process, check point file can record concurrent process and send out
The state of the number of delivering letters;When making the present embodiment that process carry out checkpoint preservation operation, first object process and all participations
The concurrent process concurrently run all maintains global coherency state so that check point file record to the most relevant state
It is to synchronize;And when carrying out the recovery operation of checkpoint, recover all concurrent processes, to keep global coherency state,
It is achieved thereby that the operation of multi-process cooperative check point.
As it will be easily appreciated by one skilled in the art that and the foregoing is only presently preferred embodiments of the present invention, not in order to
Limit the present invention, all any amendment, equivalent and improvement etc. made within the spirit and principles in the present invention, all should comprise
Within protection scope of the present invention.
Claims (9)
1. an adjustment method based on checkpoint, it is characterised in that comprise the following steps:
(1) host sends the first instruction to target machine, makes the application program on target machine bring into operation, makes the sequence number of checkpoint
I=1;
(2) order outside host reception, and judge the type of described order;If described order is for preserving order, then enter
Enter step (3);If described order is debug command, then enter step (4);If described order is for recovering order, then enter
Step (5);If described order is for exiting command, then enter step (7);Otherwise enter step (6);
(3) host sends the second instruction to target machine, makes target machine create the i-th checkpoint in the current location of application program,
And the contextual information of process corresponding for described application program is stored in the i-th check point file;I=i+1, returns step
(2);
(4) host sends the 3rd instruction to target machine, makes described target machine debug in the current location of application program, and to place
Main frame returns debugging result, and described debugging result is exported by host, returns step (2);
(5) host sends the 4th instruction to target machine, makes described target machine recover application program pair from jth check point file
The contextual information of the process answered, and the current location recovery run by application program is to jth checkpoint, j is the integer of 1~i,
Return step (2);
(6) host sends the instruction that reports an error to outside, returns step (2);
(7) host sends the 5th instruction, the operation of the application program on target end machine to target machine.
2. adjustment method as claimed in claim 1, it is characterised in that also included before described step (1), by host even
It is connected to target machine.
3. adjustment method as claimed in claim 1, it is characterised in that the contextual information in described step (3) includes process
State, the user-variable of process, process address in a register, process is in the user stack and kernel stack of process list item
Address.
4. adjustment method as claimed in claim 3, it is characterised in that described state of a process includes the line of process head, process
Journey, the filiation of thread of process, shared data and private data.
5. adjustment method as claimed in claim 1, it is characterised in that described step (4) specifically includes following sub-step:
(4.1) according to the kind of debug command, host sends the 3rd instruction to target machine, makes described target machine at application program
The current location run carries out the debugging of corresponding kind;
(4.2) in the time period Δ t set, host judges whether to receive the debugging result that target machine returns, and is to enter
Step (4.3), otherwise returns step (4.1);
(4.3) described debugging result is fed back to outside by host, returns step (2).
6. adjustment method as claimed in claim 5, it is characterised in that the kind of described debug command includes conditional breakpoint, enters
Enter function, jump out function, arrange point of observation, the binding of thread core, insert breakpoint, inquiry breakpoint, single step perform, continuously carry out, hold
Walk to terminate, delete breakpoint, check variable, check thread run core, obtain core active thread or statistics thread run the time.
7. adjustment method as claimed in claim 5, it is characterised in that the described time period Δ t set is as 0.3s~1.0s.
8. a debugging system based on checkpoint, it is characterised in that include that host and target machine, described target machine include
Parsing module, operation module, checkpoint module and debugging module;
Described host is for sending the first instruction, the second instruction, the 3rd instruction, the 4th instruction and the five fingers to parsing module
Order, receives operation result and debugging result that parsing module returns simultaneously;
Described parsing module is for being sent to run module, the second instruction and the 4th instruction by the first instruction and the 5th instruction
Being sent to checkpoint module, the 3rd instruction is sent to debugging module;And operation result and debugging result are fed back to host;
Described operation module is used for according to the first instruction operation application program, and according to the 5th order fulfillment application program;And
When application program end of run, export operation result to parsing module;Simultaneously according to recovering instruction, application program is run
Current location is recovered to checkpoint;
Described checkpoint module is for according to the second instruction, in the establishment checkpoint, current location of application program, and answers described
It is stored in check point file with the contextual information of process corresponding to program, simultaneously according to the 4th instruction, from check point file
The contextual information of the process that middle recovery application program is corresponding, and send recovery instruction to running module;
Described debugging module is for debugging in the current location of application program, and debugs result to parsing module output.
9. the debugging apparatus for debugging apparatus described in claim 8, it is characterised in that include parsing module, run mould
Block, checkpoint module and debugging module;
Described parsing module is for being sent to run module, the second instruction and the 4th instruction by the first instruction and the 5th instruction
Being sent to checkpoint module, the 3rd instruction is sent to debugging module;And operation result and debugging result are fed back to host;
Described operation module is for according to the first instruction operation application program, according to the 5th order fulfillment application program, and is answering
During with program end of run, export operation result to parsing module;Simultaneously according to recovering instruction, that is run by application program is current
Position is recovered to checkpoint;
Described checkpoint module is for according to the second instruction, in the establishment checkpoint, current location of application program, and answers described
It is stored in check point file with the contextual information of process corresponding to program, simultaneously according to the 4th instruction, from check point file
The contextual information of the process that middle recovery application program is corresponding, and send recovery instruction to running module;
Described debugging module is for debugging in the current location of application program, and debugs result to parsing module output.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610595940.9A CN106201896A (en) | 2016-07-26 | 2016-07-26 | Adjustment method based on checkpoint, system and device under a kind of embedded environment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610595940.9A CN106201896A (en) | 2016-07-26 | 2016-07-26 | Adjustment method based on checkpoint, system and device under a kind of embedded environment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106201896A true CN106201896A (en) | 2016-12-07 |
Family
ID=57496724
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610595940.9A Pending CN106201896A (en) | 2016-07-26 | 2016-07-26 | Adjustment method based on checkpoint, system and device under a kind of embedded environment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106201896A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111124488A (en) * | 2019-12-11 | 2020-05-08 | 山东超越数控电子股份有限公司 | Debian system transplanting method based on Loongson processor |
CN111813578A (en) * | 2020-07-13 | 2020-10-23 | 艾普阳科技(深圳)有限公司 | Method and assembly for debugging 64-bit application program by 32-bit IDE (integrated development environment), and debugging system |
CN112035346A (en) * | 2020-08-25 | 2020-12-04 | 华东计算技术研究所(中国电子科技集团公司第三十二研究所) | Automatic testing method, system and medium based on embedded DSP operating system |
CN112073356A (en) * | 2019-06-10 | 2020-12-11 | 海信视像科技股份有限公司 | Data transmission method and display device |
WO2021047585A1 (en) * | 2019-09-12 | 2021-03-18 | 安徽寒武纪信息科技有限公司 | Program debugging method, apparatus, debugging tool and computer device |
CN112711527A (en) * | 2020-12-16 | 2021-04-27 | 北京科银京成技术有限公司 | Debugging method and device of real-time process, target machine and storage medium |
CN112925700A (en) * | 2019-12-06 | 2021-06-08 | 西安诺瓦星云科技股份有限公司 | Program debugging method, device and system and embedded equipment |
CN114253837A (en) * | 2021-11-22 | 2022-03-29 | 杭州加速科技有限公司 | Multithreading debugging method and system for ATE (automatic test equipment) tester program and tester table |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1490724A (en) * | 2002-10-18 | 2004-04-21 | 上海贝尔有限公司 | Virtual machine for embedded systemic software development |
US6983460B1 (en) * | 1999-11-17 | 2006-01-03 | Cp8 Technologies | Method for loading applications into a multiapplication embedded system equipped with data processing resources, corresponding embedded system and execution method |
US7020872B1 (en) * | 1999-07-01 | 2006-03-28 | Cp8 Technologies | Method for verifying code transformers for an incorporated system, in particular in a chip card |
CN102129408A (en) * | 2011-04-14 | 2011-07-20 | 电子科技大学 | Record playback technology-based embedded software debugging device and method |
CN102270121A (en) * | 2010-06-07 | 2011-12-07 | 上海为舟网络科技有限公司 | Software development of virtual embedded system in rich Internet deployment system |
CN103729288A (en) * | 2013-11-01 | 2014-04-16 | 华中科技大学 | Application program debugging method under embedded multi-core environment |
CN105224454A (en) * | 2015-09-25 | 2016-01-06 | 华为技术有限公司 | A kind of adjustment method, polycaryon processor and commissioning device |
-
2016
- 2016-07-26 CN CN201610595940.9A patent/CN106201896A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7020872B1 (en) * | 1999-07-01 | 2006-03-28 | Cp8 Technologies | Method for verifying code transformers for an incorporated system, in particular in a chip card |
US6983460B1 (en) * | 1999-11-17 | 2006-01-03 | Cp8 Technologies | Method for loading applications into a multiapplication embedded system equipped with data processing resources, corresponding embedded system and execution method |
CN1490724A (en) * | 2002-10-18 | 2004-04-21 | 上海贝尔有限公司 | Virtual machine for embedded systemic software development |
CN102270121A (en) * | 2010-06-07 | 2011-12-07 | 上海为舟网络科技有限公司 | Software development of virtual embedded system in rich Internet deployment system |
CN102129408A (en) * | 2011-04-14 | 2011-07-20 | 电子科技大学 | Record playback technology-based embedded software debugging device and method |
CN103729288A (en) * | 2013-11-01 | 2014-04-16 | 华中科技大学 | Application program debugging method under embedded multi-core environment |
CN105224454A (en) * | 2015-09-25 | 2016-01-06 | 华为技术有限公司 | A kind of adjustment method, polycaryon processor and commissioning device |
Non-Patent Citations (1)
Title |
---|
郑渤龙: "基于嵌入式多核环境的检查点系统研究与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112073356A (en) * | 2019-06-10 | 2020-12-11 | 海信视像科技股份有限公司 | Data transmission method and display device |
CN112073356B (en) * | 2019-06-10 | 2022-07-19 | 海信视像科技股份有限公司 | Data transmission method and display device |
WO2021047585A1 (en) * | 2019-09-12 | 2021-03-18 | 安徽寒武纪信息科技有限公司 | Program debugging method, apparatus, debugging tool and computer device |
CN112925700A (en) * | 2019-12-06 | 2021-06-08 | 西安诺瓦星云科技股份有限公司 | Program debugging method, device and system and embedded equipment |
CN112925700B (en) * | 2019-12-06 | 2024-05-10 | 西安诺瓦星云科技股份有限公司 | Program debugging method, device and system and embedded equipment |
CN111124488A (en) * | 2019-12-11 | 2020-05-08 | 山东超越数控电子股份有限公司 | Debian system transplanting method based on Loongson processor |
CN111813578A (en) * | 2020-07-13 | 2020-10-23 | 艾普阳科技(深圳)有限公司 | Method and assembly for debugging 64-bit application program by 32-bit IDE (integrated development environment), and debugging system |
CN112035346A (en) * | 2020-08-25 | 2020-12-04 | 华东计算技术研究所(中国电子科技集团公司第三十二研究所) | Automatic testing method, system and medium based on embedded DSP operating system |
CN112711527A (en) * | 2020-12-16 | 2021-04-27 | 北京科银京成技术有限公司 | Debugging method and device of real-time process, target machine and storage medium |
CN112711527B (en) * | 2020-12-16 | 2024-02-06 | 北京科银京成技术有限公司 | Debugging method and device for real-time process, target machine and storage medium |
CN114253837A (en) * | 2021-11-22 | 2022-03-29 | 杭州加速科技有限公司 | Multithreading debugging method and system for ATE (automatic test equipment) tester program and tester table |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106201896A (en) | Adjustment method based on checkpoint, system and device under a kind of embedded environment | |
CN103729288B (en) | The adjustment method of application program under a kind of embedded multi-core environment | |
Yang et al. | MODIST: Transparent model checking of unmodified distributed systems | |
US8589881B2 (en) | Web-based software debugging apparatus and method for remote debugging | |
WO2016004657A1 (en) | Device for automatically generating test cases for embedded software and method thereof | |
CN106506283B (en) | Business test method and device of bank and enterprise docking system | |
CN102346235A (en) | Automatic test system and method for hardware device function | |
CN106506243A (en) | A kind of webmaster method for diagnosing faults based on daily record data | |
CN105512044A (en) | Method and system for updating object base used for keyword drive test | |
CN107025167A (en) | The method and apparatus for carrying out data-flow analysis using compiler type information in processor trace log | |
CN110704314B (en) | Fault injection method for embedded software test | |
CN102004692B (en) | Process debugged method and device | |
Zheng et al. | An efficient greybox fuzzing scheme for linux-based iot programs through binary static analysis | |
CN113722020A (en) | Interface calling method, device and computer readable storage medium | |
CN109857391A (en) | Processing method and processing device, storage medium and the electronic device of data | |
CN112084802A (en) | RFID tag chip verification system | |
CN109743233A (en) | A kind of pair of strong identity authentication system carries out the method and computer equipment of data acquisition | |
CN114024871A (en) | Chip verification method, system, computer equipment and readable storage medium | |
CN110704315B (en) | Fault injection device for embedded software test | |
CN105630664A (en) | Reverse debugging method and device as well as debugger | |
CN108009086B (en) | System automation test method based on case decomposition and function learning | |
Ma et al. | Phoenix: Detect and locate resilience issues in blockchain via context-sensitive chaos | |
CN106708488A (en) | Multi-application debugging system and method | |
de la Cámara et al. | Model checking software with well-defined apis: the socket case | |
CN101727388A (en) | Remote debugging method and device for system behavior of network computer |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20161207 |