A kind of method and apparatus that data are handled
Technical field
The present invention relates to Commissioning Analysis technology, more particularly to a kind of method and apparatus that data are handled.
Background technology
In system in case of system halt, i.e., when system is not run according to normal logic function, the reason of in order to obtain system in case of system halt,
The data in the module in acquisition system are needed, data are analyzed, and analysis result is exported.
In the prior art, it is realized by running code:Data in acquisition module analyze the data of acquisition, with
And analysis result is exported according to the format of setting.
If necessary to change the processing mode to data(Change the content of analysis and/or needs to change the analysis of output
As a result and/or need change output analysis result format), it is required for first changing code, then recompilated, then again
Run modified code.
For example need to change the content analyzed, i.e., the code run before is analyzed the part A in data, now
When needing to analyze the part B in data, the code for needing modification to run, and need to recompilate and run modification
Code afterwards;For example need to change the analysis result exported, i.e., the code run before is to realize output to the part A in data
Analysis result after being analyzed when not needing the analysis result of the part A in output data now, needs modification to run
Code, and need to recompilate and run modified code;For example need to change the format of the analysis result exported, i.e.,
The code run before is to realize that the analysis result of output is separated with space, now need not be the analysis result space of output
It separates, the code for needing modification to run, and needs to recompilate and run modified code.
In conclusion being handled at present data by running code, if necessary to change the processing mode of data, then
It needs to remodify, compile code corresponding with operation so that process is comparatively laborious, needs to expend long time, cannot be fast
Speed shows the operation result of modified code.
Invention content
A kind of method and apparatus that data are handled provided in an embodiment of the present invention, to solve in the prior art when
When needing to expend when changing the data analyzed, change the analysis result of output or changing the format of the analysis result of output
Between, the problem of cannot quickly showing the operation result of modified code.
A kind of method that data are handled provided in an embodiment of the present invention, including:
Determine the script file of processing data;
The mould of acquisition data in the block are handled by determining script file.
A kind of equipment that data are handled provided in an embodiment of the present invention, including:
Determining module, the script file for determining processing data;
Processing module, for being handled the mould of acquisition data in the block by determining script file.
In embodiments of the present invention, the script file of processing data is determined;By determining script file to the mould of acquisition
Data in the block are handled.Due to when needs change the data analyzed, the analysis result of change output or change defeated
When the format of the analysis result gone out, it is only necessary to change the partial order sentence in script, code need not be changed, also there is no need to
It recompilates and runs modified code, and modified script can run and show as a result, to realize immediately
Simplify the process for showing result, quickly shows the operation result of modified script.
Description of the drawings
Fig. 1 is the method flow schematic diagram that the embodiment of the present invention handles data;
Fig. 2 is that the embodiment of the present invention is alternately performed script file and generation by the way that breakpoint realization is arranged in obtaining data code
The flow diagram of code;
Fig. 3 is the method detailed flow diagram that the embodiment of the present invention handles data;
Fig. 4 is the device structure schematic diagram that the embodiment of the present invention handles data.
Specific implementation mode
The embodiment of the present invention determines the script file of processing data;By determining script file in the module of acquisition
Data handled.Need to change the data analyzed, the analysis result for changing output or change output due to working as
When the format of analysis result, it is only necessary to change the partial order sentence in script, code need not be changed, also there is no need to again
Compiling and the modified code of operation, and modified script can run and show as a result, to realize letter immediately
Change the process for showing result, quickly shows the operation result of modified script.
Wherein, the module of the embodiment of the present invention has the characteristics that following two:
1, module-external does not know the data structure of inside modules;
2, module-external can only obtain mould data in the block by executing the external interface that code call module provides.
The embodiment of the present invention is described in further detail with reference to the accompanying drawings of the specification.
As shown in Figure 1, the method that the embodiment of the present invention handles data includes the following steps:
Step 101, the script file for determining processing data;
Step 102 is handled the mould of acquisition data in the block by determining script file.
Preferably, before being handled the mould of acquisition data in the block by determining script file, further include:
The data in data code acquisition module are obtained by execution.
Wherein, before the data in data code acquisition module are obtained by execution, data code is obtained by execution and is obtained
The address of data in the module obtained to storage, the address that then and preservation determining by perform script file obtains;
Correspondingly, in step 102, by perform script file, data are obtained from determining address, and to the number of acquisition
According to being handled.
Preferably, mould data in the block can be directly acquired, can also be obtained in module by backed stamper data in the block
Data duplicate, the present invention is introduced with directly acquiring mould data instance in the block, by backed stamper data in the block, obtained
Embodiment to the duplicate of mould data in the block is similar with the embodiment of the embodiment of the present invention, and details are not described herein.
Wherein it is possible to by backed stamper data in the block, the duplicate of mould data in the block is obtained;It can also be simultaneous by module
The other modes of appearance obtain the duplicate of mould data in the block.
Wherein, when obtaining the data in data code acquisition module by execution, can be in an acquisition module it is all
After data, data are handled;Partial data that can also every time in acquisition module, as soon as after obtaining time data, logarithm
According to being handled.Two kinds of situations are introduced respectively below.
After all data in one, acquisition module of situation, data are handled;
The global variable of data in the module that storage obtains is defined by execution acquisition data code and is obtained described complete
The address of office's variable;
The address for the global variable that determining and preservation obtains by perform script file;
All data in data code acquisition module are obtained by execution, and executes and is stored in all data of acquisition
In the address of obtained global variable;
By perform script file, data are obtained from determining address, and handle the data of acquisition.
Partial data in situation two, each acquisition module, as soon as after obtaining time data, carrying out processing to data includes
The following steps:
S1, the local variable of data in the module that storage obtains is defined by execution acquisition data code and is obtained described
The address of local variable;
The address for the local variable that S2, and preservation determining by perform script file obtain;
S3, the partial data in data code acquisition module is obtained by execution, and execute and deposit the partial data of acquisition
Storage is in the address of obtained local variable;
S4, by perform script file, data are obtained from determining address, and handle the data of acquisition;
S5, the data for whether needing also exist for obtaining in data code judgment module are obtained by execution, and if it exists, then hold
Row step S3;Otherwise, terminate to handle data.
Since, there is no when the data for needing to obtain, module can return to message, and instruction terminates to data in module
Reason obtains data so after being handled the mould of acquisition data in the block by determining script file by execution
Whether code judgment module returns to message, if it is, there is no the data for needing to obtain in determining module, otherwise, it determines mould
There are the data for needing to obtain in block.
In situation two, due to the partial data in each acquisition module, so as to reduce data cached capacity.
Preferably, in situation two, the mould data in the block obtained by local variable storage can be flexibly true as needed
The size for determining memory headroom, saves memory headroom.
Preferably, the mould of acquisition data in the block are handled, including:
After being analyzed the mould of acquisition data in the block by determining script file, analysis result is exported;Or
The mould data in the block obtained by determining script file output, and the data of output are analyzed.
Preferably, can first analyze the mould of acquisition data in the block, then export;It can be without analysis, directly
Output;The mould of acquisition data in the block can first be exported, then analyzed;It can also be analyzed, not exported, specifically,
It can be arranged as required to.
Breakpoint can be arranged in obtaining data code by perform script file in the embodiment of the present invention, and realization is alternately performed
Script file and code.
It is introduced by taking situation two as an example below, the embodiment of situation one is similar with the embodiment of situation two, herein
It repeats no more.
As shown in Fig. 2, three breakpoints are provided in obtaining data code by perform script file, and in fig. 2, boundary
The side of line is to execute to obtain data code, and the other side in line of demarcation is perform script file, utilizes three breakpoint realities of setting
The process for being now alternately performed script file and code is as follows:
201, data code is obtained by execution and obtains the address of data in the module that storage obtains;
When 202, going at the first breakpoint obtained in data code, stops executing acquisition data code, start to execute
Script file;
203, the address that and preservation determining by perform script file obtains, and stop perform script file, start to hold
Row obtains data code;
204, the partial data in the external interface acquisition module of data code calling module is obtained by execution;
When 205, going at the second breakpoint obtained in data code, stops executing acquisition data code, start to execute
Script file;
206, by perform script file, data are obtained from determining address, the mould of acquisition data in the block are carried out
Processing, and stop perform script file, start to execute acquisition data code;
207, whether judgment module returns to message, if so, thening follow the steps 208, otherwise, executes step 204;
208, there is no the data for needing to obtain in determining module;
When 209, going at the third breakpoint obtained in data code, stops executing acquisition data code, start to execute
Script file;
210, it by perform script file, determines and terminates to execute acquisition data code.
Preferably, realizing the address of local variable that is determining and preserving by the first breakpoint of setting;By setting
The second breakpoint set realizes and obtains data from determining address, and handles the data of acquisition;Pass through the of setting
Three breakpoints, which realize, determines that obtaining data code terminates to execute.
Preferably, the embodiment of the present invention is introduced for three breakpoints are arranged in obtaining data code, specifically,
One breakpoint can be set, four breakpoints can also be set, specifically can as needed depending on.
Preferably, the main body handled data can be processor, it can be simulator, can also be that can execute foot
Any equipment of this and code.
Below with script file for trace32 practice(Practice is the batch processing that trace32 debuggers are supported
Language)For script file, describe in detail to the solution of the present invention.
As shown in figure 3, the method detailed that the embodiment of the present invention handles data includes the following steps:
Step 301, the script file for determining the code and processing data that obtain data;
Step 302 is broken by executing the setting three in the code for obtaining data of trace32 practice script files
Point, and execute the information that three breakpoints being arranged in code are stored in trace32 practice script files;And stop
Trace32 practice script files are only executed, start to execute the code for obtaining data;
Preferably, by the way that the entry address that PC values are the code for obtaining data is arranged, realizes and stop executing trace32
Practice script files start to execute the code for obtaining data.
Trace32 debuggers are by Lauterbach(German labor spy Bach)A emulation testing work that company develops
Tool has full modularization, modular construction, can support JTAG(Combined testing action group)And BDM(Background debugging mode)
Interface and all CPU(Central processing unit), it is capable of providing the work(such as software analysis, port analysis, waveform analysis and software test
Energy.Trace32 debuggers are provided with practice script functions, can carry out Script Programming, debugging and processing routine
Variable and order.Using practice scripts, easily data can be handled.
The embodiment of the present invention will be illustrated by taking the script file that Trace32 debuggers provide as an example, support data processing
Other script files be equally applicable to the present invention.
Preferably, three can be arranged in the code for obtaining data by executing trace32practice script files
Two breakpoints can be arranged by executing trace32practice script files in breakpoint in the code for obtaining data, can also
By executing trace32practice script files, four breakpoints of setting specifically can basis in the code for obtaining data
It needs to determine, the embodiment of the present invention is introduced for three breakpoints are arranged, and the embodiment and the present invention of other situations are real
The embodiment for applying example is similar.
Preferably, breakpoint can be arranged in the code for obtaining data by executing trace32practice script files
It realizes that cycle alternation executes code and script, obtains mould data in the block to realize, and to the mould of acquisition data in the block
It is handled.
Preferably, three breakpoints are arranged in the code for obtaining data by executing trace32practice script files
Further include before:
The code that data are obtained by execution determines address at three.
In specific implementation, address is the entry address of code at first;Address is the data in memory module at second
The address of next Codabar code row after local variable stacking;Address is next Codabar code row of the data in acquisition module at third
Address.
Preferably, address can be next Codabar code row after the local variable stacking of the data in memory module at second
Address, can be memory module in data local variable stacking after lower two Codabar codes row address, or deposit
The address of lower three Codabar codes row after the local variable stacking of Chu Mo data in the block can be specifically local variable stacking
Afterwards, and in local variable the address of any Codabar code row before the mould data update in the block stored.
Preferably, after the local variable stacking of definition, the memory address of local variable can be obtained, i.e., in memory module
Data address.
Preferably, obtaining address at the three of the code determination of data according to execution, passes through and execute trace32practice feet
Three breakpoints are arranged in this document in the code for obtaining data:
First breakpoint is set at address at first, second breakpoint is set at address at second, and in third
Locate that third breakpoint is arranged at address.
Step 303, the code that data are obtained by execution obtain the address of data in the module that storage obtains;
Preferably, perform script text can be stopped by the order of modification PC value of program counter in perform script file
Part, and start to execute the code for obtaining data.
Preferably, the code for obtaining data by execution obtains also wrapping before the address of data in the module that storage obtains
It includes:
The code for obtaining data is executed, is arranged and the number for needing to obtain is not present in returning to message determination module according to module
In the case of, the return address of code is the address at the first breakpoint.
Step 304, go to obtain data code in second breakpoint at when, stop execute obtain data generation
Code starts perform script file;
Preferably, the wait in script!Run orders are activated, and control stops executing the code for obtaining data, starts to execute
Script file.
Step 305, perform script file judge whether current PC value is equal to second be arranged in the code for obtaining data
Corresponding address thens follow the steps 307 if equal at breakpoint;Otherwise, 306 are thened follow the steps;
Step 306, perform script file judge whether current PC value is equal to first be arranged in the code for obtaining data
Flow is terminated in corresponding address if equal at breakpoint;Otherwise, step 312 is executed;
It is step 307, determining by perform script file and preserve the address of setting, and stop perform script file, it opens
Begin to execute the code for obtaining data;
Preferably, the go orders in script are activated, control stops perform script file, starts to execute the generation for obtaining data
Code.
Step 308 passes through the partial data in the external interface acquisition module of the code call module of execution acquisition data;
Preferably, the mould partial data in the block that the code for obtaining data by execution obtains substitutes in memory module
The mould data in the block stored originally in the local variable of data.
Step 309, go to obtain data code in third breakpoint at when, stop execute acquisition data generation
Code starts perform script file;
Step 310, perform script file judge whether current PC value is equal to the third being arranged in the code for obtaining data
Corresponding address thens follow the steps 312 if equal at breakpoint;Otherwise, 311 are thened follow the steps;
Step 311, perform script file judge whether current PC value is equal to first be arranged in the code for obtaining data
Flow is terminated in corresponding address if equal at breakpoint;Otherwise, step 307 is executed;
Step 312, by perform script file, obtain data from determining address;
Step 313 is handled the mould of acquisition data in the block by perform script file, in the mould for having handled acquisition
After data in the block, stop perform script file, starts to execute the code for obtaining data;
Preferably, it includes some or all of in following situation to carry out processing to the mould of acquisition data in the block:
The mould data in the block obtained are analyzed, the analysis result after analyzing the mould of acquisition data in the block is exported.
Preferably, the analysis result after can analyzing the data in the block of the mould to acquisition of output is saved in file
In.
Whether the data that obtain are needed also exist in step 314, judgment module, and if it exists, then return to step 308;Otherwise,
Execute step 315;
Preferably, when there is no the return values that when data for needing to obtain, the external interface of module provides to make in module
The code that calling interface obtains data returns at first breakpoint, and control obtains the code ends operation of data.
Preferably, when, there is no when the data for needing to obtain, it is sky that the external interface of module, which provides return value, is obtained in module
When the code of access evidence goes to null statement, the data for being not present in the code determining module of data and needing to obtain, and root are obtained
It is returned at the first breakpoint according to pre-set return address.
Step 315 is executed back at first breakpoint of the code for obtaining data, stops executing the generation for obtaining data
Code starts perform script file;
Step 316, perform script file judge whether current PC value is equal to first be arranged in the code for obtaining data
Flow is terminated in corresponding address if equal at breakpoint;Otherwise, step 317 is executed;
Step 317, perform script file judge whether current PC value is equal to second be arranged in the code for obtaining data
Corresponding address thens follow the steps 307 if equal at breakpoint;Otherwise, step 312 is executed.
Preferably, passing through the wait in script in the embodiment of the present invention!Run orders are alternately performed script with go orders control
File and the code for obtaining data.
Based on same inventive concept, a kind of equipment handled data is additionally provided in the embodiment of the present invention, due to
The principle that the equipment solves the problems, such as is similar to the method for the embodiment of the present invention, therefore the implementation of the equipment may refer to the reality of method
It applies, overlaps will not be repeated.
Fig. 4 is the device structure schematic diagram that the embodiment of the present invention handles data, as shown, the embodiment of the present invention
The equipment that data are handled include:
Determining module 401, the script file for determining processing data;
Processing module 402, for being handled the mould of acquisition data in the block by determining script file.
Preferably, processing module 402 is additionally operable to:
The data in data code acquisition module are obtained by execution.
Preferably, the partial data in acquisition module;
Processing module 402 is additionally operable to:
Whether the data that obtain are needed also exist in judgment module, and if it exists, are then passed back through execution and obtained data code
The step of data in acquisition module;Otherwise, terminate to handle data.
Preferably, processing module 402 is specifically used for:
Data code, which is obtained, by execution obtains the address of data in the module that storage obtains;It is true by perform script file
Surely the address obtained;By perform script file, data are obtained from determining address, and handle the data of acquisition.
Preferably, processing module 402 is specifically used for:
After being analyzed the mould of acquisition data in the block by determining script file, analysis result is exported;Or pass through
The mould data in the block that determining script file output obtains, and the data of output are analyzed.
The present invention be with reference to according to the method for the embodiment of the present invention, equipment(System)And the flow of computer program product
Figure and/or block diagram describe.It should be understood that can be realized by computer program instructions every first-class in flowchart and/or the block diagram
The combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be provided
Instruct the processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine so that the instruction executed by computer or the processor of other programmable data processing devices is generated for real
The device for the function of being specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that instruction generation stored in the computer readable memory includes referring to
Enable the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device so that count
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, in computer or
The instruction executed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic
Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as
It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
God and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to include these modifications and variations.