CN1282085C - Method of parallel regulating multi-task of imbedding system - Google Patents

Method of parallel regulating multi-task of imbedding system Download PDF

Info

Publication number
CN1282085C
CN1282085C CN 200410026825 CN200410026825A CN1282085C CN 1282085 C CN1282085 C CN 1282085C CN 200410026825 CN200410026825 CN 200410026825 CN 200410026825 A CN200410026825 A CN 200410026825A CN 1282085 C CN1282085 C CN 1282085C
Authority
CN
China
Prior art keywords
function
stack trace
recording areas
storehouse
trace recording
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.)
Expired - Fee Related
Application number
CN 200410026825
Other languages
Chinese (zh)
Other versions
CN1564137A (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN 200410026825 priority Critical patent/CN1282085C/en
Publication of CN1564137A publication Critical patent/CN1564137A/en
Application granted granted Critical
Publication of CN1282085C publication Critical patent/CN1282085C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

The present invention relates to a parallel multitask debug method for an embedded system, which comprises the following steps: at least one stack trace record area is set and initialized for every stack in a memory; a print information record function is executed; a print content saving function is called during a print process for storing print information to the stack trace record areas. Respectively, an entry trace record function is executed at an entry, and an exit trace record function is executed at an exit; stubbing is respectively carried out at the entry and the exit of an application program. An analysis debug function for the stack trace record areas is called for displaying the basic information of all stack trace record areas, the function call process of an appointed stack trace record area, and the saved print content of the appointed stack trace record area. The method of the present invention does not influence the task dispatching process of debugged software and can smoothly execute parallel multitask debugging. The information recorded in the stack trace record areas is directly utilized for analyzing abnormal software without need to analyze hardware; thus, the present invention has the advantages of simple realization and easy use.

Description

A kind of method of embedded system Multi-task Concurrency debugging
Technical field
The present invention relates to the method for a kind of embedded system Multi-task Concurrency debugging in the communication field.
Background technology
In the software of on embedded OS, developing, as communication software, a large amount of user mode machine treatment mechanisms, traditional adjustment method can be summarized as following process: breaking, and--program halt--procedures of observation state--continues operation.But traditional the method that breakpoint debugs is set wastes time and energy, whether arrive, need in the processing function of this message, breakpoint be set as seeing a piece of news, wait for that this message arrives, when message arrived, program was firmly disconnected, whether single step is followed the tracks of again, observe consistent with design.And after breakpoint stopped, because the concurrency of multitask system, the environment when disconnected firmly back of program and program full speed running may be inconsistent; When program occurs unusual or meet information dropout such as table, breakpoint just can not be set generally in addition again, debug and just can not continue.
On the other hand, some commercial embedded software Coverage Testing Tool are arranged at present, as CodeTEST, it is a kind of general test and performance analysis tool, but can not be applicable to the program debug stage well, because: at first, the cost of CodeTEST is relatively more expensive, can not each developer all come debugged program with CodeTEST; Secondly, CodeTEST needs hardware to cooperate, and operation is also inconvenient.
Therefore, prior art also has defective, and awaits improving and development.
Summary of the invention
Technical matters to be solved by this invention is: can not be applicable to the Multi-task Concurrency debugging well in order to overcome existing software debugging technology; And overcome carry out ex-post analysis under the unusual situation of running software need be by the shortcoming of hardware analysis.
Technical scheme of the present invention is as follows:
A kind of method of embedded system Multi-task Concurrency debugging, it may further comprise the steps:
A) in storer, each storehouse is provided with a pile stack trace recording areas at least, and initialization, track record district essential information filled in;
B) carry out type information record function, in print procedure, call print What and preserve function preservation type information to described stack trace recording areas;
C) carry out outlet track record function respectively at porch execution inlet track record function with in the exit, carry out pitching pile respectively in the function entrance place and the exit of application program;
D) call the analysis debug function that is used for the stack trace recording areas, identify function call process that shows all stack trace recording areas essential informations, appointment stack trace recording areas and the print What of specifying the preservation of stack trace recording areas according to tracked storehouse.
Described method, wherein, described step a) also comprises
A1) internal memory of the whole stack trace recording areas of planning, corresponding at least one the stack trace recording areas of each storehouse is determined the core position of stack trace recording areas, the size of function call recording areas;
A2) to each storehouse, at least one stack trace recording areas of initialization is filled in basic information region content, the function depth of nesting, current print record index, and to the zero clearing of current function recording indexes.
Described method, wherein, described step a2) preserves the pointer of stack trace recording areas at bottom of stack in.
Described method, wherein, described step b) also comprises:
B1) according to the pointer of the pointer location stack trace recording areas of the local variable of type information record function;
B2) according to the current print record index of stack trace recording areas, preserve the print What conservation zone of the character string content of printing to recording areas, upgrade current print record index simultaneously, and the print What conservation zone is designed to ring-like formation mode.
Described method, wherein, described step b) also comprises:
Described method, wherein, described analysis debug function comprises:
First debug function shows all tracked storehouse signs, storehouse operation function;
Second debug function according to the storehouse sign, shows the function of specifying the nearest operation in the storehouse, and each function printed contents;
The 3rd debug function according to the storehouse sign, shows the 1K content of specifying storehouse to print recently.
Described method, wherein, described stack trace recording areas is placed in the reserved memory district.
Described method wherein, is provided with two stack trace recording areas to each storehouse in the described step a), and when powering on, switches the stack trace recording areas at every turn, to keep operation information last time.
The method of a kind of embedded system Multi-task Concurrency debugging provided by the present invention, owing to open up a stack trace recording areas by in the reserved memory of veneer, giving each storehouse, there is not the mutual exclusion requirement, therefore do not influence the task scheduling process of tested software, and can the smooth execution Multi-task Concurrency debug; In the debug process analysis of software anomaly is directly utilized the information of this stack trace recording areas record, need not, therefore realize simple, easy to use hardware analysis.
Description of drawings
Fig. 1 is the function calling relationship synoptic diagram that takes place in the storehouse of the inventive method;
Fig. 2 is that the depth of nesting of the function implementation of the inventive method changes synoptic diagram;
Fig. 3 is the form synoptic diagram of the stack trace recording areas of the inventive method.
Embodiment
Below in detail the inventive method is described.
The present invention opens up a stack trace recording areas by give each storehouse in the reserved memory of veneer, in the nearest function of in this storehouse, carrying out of circle queue record of stack trace recording areas and the information of printing, give one of debugging person Message Processing flow process clearly, can save a large amount of debug times; Under the situation that storehouse is destroyed fully, common debugging method does not show the function call process, can pass through this stack trace recording areas explicit function invoked procedure yet; The present invention can also by powering on once more, observe the stack trace recording areas information of operation last time in the veneer reserved memory under the situation that program fleet resets, the function that flies is run in the location rapidly.
Enforcement of the present invention is divided into 4 major parts:
1. call relevant initialization function when powering on and in the reserved memory of veneer, carry out the distribution and the initialization of stack trace recording areas.
2. in print procedure, call print What and preserve function preservation type information to the stack trace recording areas.
In the function entrance place of application program and exit respectively the call entry call the record function and the record function is called in outlet, carry out pitching pile; If compiler is pitching pile automatically, manual pitching pile just.
4. call the print What that the analysis debug function that is used for the stack trace recording areas shows the function call process of all stack trace recording areas essential informations, appointment stack trace recording areas and specifies the preservation of stack trace recording areas.
The general more complicated of the software of developing on embedded OS is generally the concurrent execution of a plurality of tasks, uses traditional method that breakpoint is debugged that is provided with, and can not satisfy the demands fully sometimes.The present invention can follow the tracks of nearest several functions and the type information of carrying out on each storehouse thereof, remedies the deficiency of traditional debugging mode, can be used as the strong help of software debugging.
In the software of embedded OS, usually each task all has an independently storehouse, as shown in Figure 1, the function of carrying out under a certain task generally all will take internal memory in the storehouse, the storehouse internal memory of release busy when being finished, along with the increase of function nesting allocation, storehouse is begun to increase to the bottom by the top.As shown in fig. 1, in this storehouse, function f 1 call function f2, function f 2 is called f3, and so on.
The implementation of the function in the inventive method as shown in Figure 2, longitudinal axis representative function is nested, transverse axis representative function implementation.At t0 constantly, begin to enter function f 1, the depth of nesting is 1; At t1 constantly, enter function f 2, the depth of nesting is 2; At t2 constantly, enter function f 3, the depth of nesting is 3; At t3 constantly, withdraw from function f 2, the depth of nesting is 2; At t4 constantly, withdraw from function f 1, the depth of nesting is 1; At t5 constantly, withdraw from function f 1, the depth of nesting reverts to 0.
The structure of stack trace recording areas is basic information region, print What conservation zone, function call recording areas as shown in Figure 3 from top to bottom successively.Basic information region is preserved tracked stack information, as at the bottom of storehouse title, sign, stack top, the stack, storehouse length etc., the current function depth of nesting that calls, current function recording indexes, current print record index; The print What conservation zone is kept at the nearest character string content of printing of function of this storehouse operation, and the operated by rotary motion size is 1K; The function call recording areas is kept at this storehouse function information of operation recently, according to memory size decision recorded area size, generally writes down 32 functions at least.
For the record of type information, do not need to change application program, only need in printf, increase a type information record function, in this function, preserve the print record district of type information to the stack trace recording areas.For the call function record, need application program at local variable of the porch of each function definition, can be DWORD, fill a particular value, as Fig. 1 the function mark, again with function marked address and function name character string as parameter call inlet track record function, call outlet track record function in the function exit, so just can finish the function that writes down call function in the function call recording areas.
The stack trace recording areas can be placed in the reserved memory district, flies even software runs, and also is not destroyed.Also can open up two stack trace recording areas, when powering on, switch the stack trace recording areas at every turn, thereby realize keeping the purpose of operation information last time each storehouse.
The method of embedded system Multi-task Concurrency debugging of the present invention is as follows:
The first step: the initialization of described stack trace recording areas.This step is to finish in software power-up initializing process, and its key step is as follows:
1. plan the internal memory in whole stack record district by the principle of corresponding at least one the stack trace recording areas of each storehouse.Mainly be the core position of determining the stack record district, the size of the function call recording areas in stack record district etc.
2. to each storehouse, distribute and at least one stack trace recording areas of initialization, and in this stack trace recording areas, fill in as data such as basic information region content, the function depth of nesting, current print record index, and to the zero clearing of current function recording indexes.In order to improve the efficient of inlet track record function and outlet track record function, can preserve the pointer of stack trace recording areas at bottom of stack.
Second step: the execution in step of type information record function.
1. at first navigate to the pointer of stack trace recording areas according to the pointer of the local variable of type information record function.
2. according to the current print record index of stack trace recording areas, preserve the print What conservation zone of the character string content of printing to recording areas, upgrade current print record index simultaneously, described print What conservation zone is designed to ring-like formation mode, and new like this print What will cover old print What.
The 3rd step: the execution in step of inlet track record function.Inlet track record function is to call at the function entrance place of application program, and inlet track record function key step is as follows:
1. navigate to the pointer of described stack trace recording areas according to the local variable pointer of inlet track record function.
2. whether discriminant function calls recording areas expires, if full, then abandon the function call number and adds 1, and withdraw from.Otherwise, enter following step 3.
3. according to current function recording indexes, in the function call recording areas, write down the relevant information of call function: as information such as function tag address, function call time, function name, the depths of nesting.The current function recording indexes of final updating is pointed to next function call record.
The 4th step: the execution in step of outlet track record function.Outlet track record function calls execution in the function exit of application program, and it may further comprise the steps:
1. locate the pointer of stack trace recording areas according to the local variable pointer of outlet track record function.
2. whether be empty to discriminant function if calling recording areas, as be sky, then withdraws from.Otherwise enter following step 3.
3. whether discriminant function calls recording areas expires, and as full, judges that more whether abandon the function call number is 0, as not being 0, then abandoning the function call number and subtracts 1, and withdraw from.Otherwise continue following step 4.
4. recall according to current function recording indexes, find the recording indexes of call function, according to the current time, calculate and the preservation function timing in the recording areas of this call function, the recording areas that call function is set is an invalid flag.
5. the function depth of nesting of stack trace recording areas subtracts 1, if the function depth of nesting is not 0, withdraws from.Otherwise continue following step 6.
6. it is current function recording indexes that function home record index value is set, so that the function call track record of a beginning new round.
If the CPU Interrupt Process is used independently interrupt stack, the inventive method can also be followed the tracks of the function that moves in interrupt stack.If the interruption of CPU takies application heap, and require to follow the tracks of the function that moves in the Interrupt Process,, need in inlet track record function and outlet track record function, close interruption momently for realizing the mutual exclusion requirement.
At last, also to provide several to analyze the debug function of stack trace recording areas.Mainly contain:
First debug function: show all tracked storehouse signs, storehouse operation function (comprise and whether move the mark that finishes).Can roughly reflect the whole software operation conditions like this.All whether as normally or not quilt breaks in operation.
Second debug function: according to the storehouse sign, show the function of specifying the nearest operation in the storehouse, and each function printed contents.If the function of operation is printed too much recently, then show the 1K content of printing recently at most; If the function of operation is not printed recently, then do not show print What.
The 3rd debug function:, show the 1K content of specifying storehouse to print recently according to the storehouse sign.
To sum up, the method for embedded system Multi-task Concurrency debugging of the present invention, its advantage is very obvious, and is specific as follows:
Adopt the method for the invention,,, therefore can carry out efficiency analysis the code of the nearest time of running because described stack trace recording areas records the recorded information in the debug process if hardware provides a high-resolution counter;
Adopt the inventive method,, need only not power down of veneer, can also inquire about the operational process of program fleet last time if hardware provides enough reserved memories;
Adopt the method for the invention, compare, can reduce interference to greatest extent, under many circumstances, breakpoint can be set debug, save a large amount of debug times tested program with existing traditional debugging breakpoints technology that is provided with; Can also check the tested program state of operation recently, whether analysis process is consistent with design, is beneficial to early and pinpoints the problems, and this is that traditional debugging breakpoints technology is difficult to accomplish; By the mode in stack record district, storehouse operation function call process is done a backup, even storehouse is destroyed, also can observe function calling relationship;
Adopt the method for the invention, compare, have more real-time and the little advantage of tested software influence with the software realization mode of business software CodeTEST etc.; Compare with the hardware implementation mode of business software CodeTEST etc., the inventive method has and realizes advantages such as simple, easy to use.
Should be understood that; the inventive method for those of ordinary skills; can make various possible changes or replacement according to technical scheme of the present invention and technical conceive thereof, and all these changes or replacement all should belong to the protection domain of claims of the present invention.

Claims (7)

1, a kind of method of embedded system Multi-task Concurrency debugging, it may further comprise the steps:
A) in storer, each storehouse is provided with a pile stack trace recording areas at least, and initialization, the basic information region content filled in;
B) carry out type information record function, in print procedure, call print What and preserve function preservation type information to described stack trace recording areas;
C) carry out outlet track record function respectively at porch execution inlet track record function with in the exit;
D) call the analysis debug function that is used for the stack trace recording areas, according to used tracked storehouse sign, show all stack trace recording areas essential informations, specify the function call process of stack trace recording areas and specify the print What of the preservation of stack trace recording areas.
2, method according to claim 1 is characterized in that, described step a) also comprises
A1) internal memory of the whole stack trace recording areas of planning, corresponding at least one the stack trace recording areas of each storehouse is determined the core position of stack trace recording areas, the size of function call recording areas;
A2) to each storehouse, at least one stack trace recording areas of initialization is filled in basic information region content, the function depth of nesting, current print record index, and to the zero clearing of current function recording indexes.
3, method according to claim 2 is characterized in that, described step a2) in preserve the pointer of stack trace recording areas at bottom of stack.
4, method according to claim 2 is characterized in that, described step b) also comprises:
B1) according to the pointer of the pointer location stack trace recording areas of the local variable of type information record function;
B2) again according to the current print record index of stack trace recording areas, preserve the print What conservation zone of the character string content of printing to recording areas, upgrade current print record index simultaneously, and the print What conservation zone is designed to ring-like formation mode, preserve up-to-date printed contents.
5, method according to claim 4 is characterized in that, described analysis debug function comprises:
First debug function shows all tracked storehouse signs, storehouse operation function;
Second debug function according to the storehouse sign, shows the function of specifying the nearest operation in the storehouse, and each function printed contents;
The 3rd debug function according to the storehouse sign, shows the 1K content of specifying storehouse to print recently.
According to claim 1,2,3,4 or 5 described methods, it is characterized in that 6, described stack trace recording areas is placed in the reserved memory district.
7, method according to claim 6 is characterized in that, in the described step a) each storehouse is provided with two stack trace recording areas, and when powering on, switches the stack trace recording areas at every turn, to keep operation information last time.
CN 200410026825 2004-04-09 2004-04-09 Method of parallel regulating multi-task of imbedding system Expired - Fee Related CN1282085C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200410026825 CN1282085C (en) 2004-04-09 2004-04-09 Method of parallel regulating multi-task of imbedding system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200410026825 CN1282085C (en) 2004-04-09 2004-04-09 Method of parallel regulating multi-task of imbedding system

Publications (2)

Publication Number Publication Date
CN1564137A CN1564137A (en) 2005-01-12
CN1282085C true CN1282085C (en) 2006-10-25

Family

ID=34480752

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200410026825 Expired - Fee Related CN1282085C (en) 2004-04-09 2004-04-09 Method of parallel regulating multi-task of imbedding system

Country Status (1)

Country Link
CN (1) CN1282085C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10503629B2 (en) 2015-09-25 2019-12-10 Huawei Technologies Co., Ltd. Debugging method, multi-core processor, and debugging device

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4738948B2 (en) * 2005-09-13 2011-08-03 キヤノン株式会社 Information processing apparatus, image processing method, and computer program
CN101408862B (en) * 2007-10-12 2012-08-22 李周 Embedded system test method
CN101441588B (en) * 2007-11-22 2010-09-08 英业达股份有限公司 Memory body test method
CN101183330B (en) * 2007-12-13 2010-05-19 东信和平智能卡股份有限公司 Online debugging system of embedded system and debug method thereof
CN101246449B (en) * 2008-02-25 2011-08-10 华为技术有限公司 Tracking function invocation track method and device
CN101262498B (en) * 2008-04-22 2011-01-05 华为技术有限公司 A distributed message call method and device
CN102043707B (en) * 2009-10-16 2014-12-31 腾讯科技(深圳)有限公司 Performance test method of embedded application, embedded terminal equipment and network system
CN102053906A (en) * 2009-10-30 2011-05-11 国际商业机器公司 System and method for collecting program runtime information
CN101741850B (en) * 2009-12-25 2012-05-30 北京邮电大学 Multitask concurrent executive system and method for hybrid network service
CN102214138A (en) * 2011-05-19 2011-10-12 福建星网视易信息系统有限公司 Network concentrated debugging method for embedded system software
CN103034497A (en) * 2012-12-13 2013-04-10 中国航空无线电电子研究所 Method capable of recording operational process of embedded system
CN103902346B (en) * 2012-12-27 2017-09-29 上海鼎为电子科技(集团)有限公司 The implementation method and device of grand control are simulated in precompile
CN104252402B (en) * 2014-09-05 2018-04-27 深圳创维数字技术有限公司 A kind of program debugging method and device
CN105630479A (en) * 2014-11-28 2016-06-01 中兴通讯股份有限公司 Processing method and apparatus for exception in program running process
CN107665113B (en) * 2017-09-07 2020-12-04 广东博立科技有限公司 Software method for preventing program system from crashing due to pointer running
CN108959069A (en) * 2018-06-11 2018-12-07 北京奇艺世纪科技有限公司 A kind of method for tracing and device of function operation
CN109597383B (en) * 2018-12-08 2021-10-08 顾满洲 Lightweight small system reliability structural design
CN111367588B (en) * 2018-12-25 2023-05-16 杭州海康威视数字技术股份有限公司 Method and device for obtaining stack usage

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10503629B2 (en) 2015-09-25 2019-12-10 Huawei Technologies Co., Ltd. Debugging method, multi-core processor, and debugging device

Also Published As

Publication number Publication date
CN1564137A (en) 2005-01-12

Similar Documents

Publication Publication Date Title
CN1282085C (en) Method of parallel regulating multi-task of imbedding system
Bhansali et al. Framework for instruction-level tracing and analysis of program executions
Xu et al. Software bloat analysis: Finding, removing, and preventing performance problems in modern large-scale object-oriented applications
CN1308825C (en) System and method for CPI load balancing in SMT processors
CN1845120A (en) Automatic analysis system and method for malicious code
US9417935B2 (en) Many-core process scheduling to maximize cache usage
CN100397347C (en) System and method for CPI scheduling on SMT processors
US20080243968A1 (en) Method and system for object age detection in garbage collection heaps
CN101344865B (en) CPU occupancy rate measuring method and apparatus
CN1577290A (en) System and method for facilitating profiling an application
CN1540517A (en) Just-My-Code modulation tech
CN1677364A (en) Method and apparatus for autonomic test case feedback using hardware assistance for code coverage
CN102779047A (en) Embedded software support platform
CN101446918A (en) Method for realizing debugging of single function by user state debugger and system thereof
CN1641590A (en) Method and data processing system optimizing performance through reporting of thread-level hardware resource utilization
CN101299192B (en) Non-aligning access and storage processing method
EP1652094B1 (en) Method and apparatus for improving the performance of garbage collection using stack trace cache
CN1248116C (en) General purpose testing arrangement for embedded module and subsystem based on host machine platform
CN101154185A (en) Method for performing recovery and playback when running software
CN1361489A (en) Automatic circular daily record information storing method and system
CN1963762A (en) Method and system for managing stack
WO2020248510A1 (en) Terminal application behaviour reflection processing method
CN102411513B (en) Garbage collection method for mixed mode execution engine
Schneider et al. Migration of automotive real-time software to multicore systems: First steps towards an automated solution
CN1650266A (en) Time-multiplexed speculative multi-threading to support single-threaded applications

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20061025

Termination date: 20140409