CN100530126C - Method for recording function for leading to system abnormity - Google Patents
Method for recording function for leading to system abnormity Download PDFInfo
- Publication number
- CN100530126C CN100530126C CNB2007101875509A CN200710187550A CN100530126C CN 100530126 C CN100530126 C CN 100530126C CN B2007101875509 A CNB2007101875509 A CN B2007101875509A CN 200710187550 A CN200710187550 A CN 200710187550A CN 100530126 C CN100530126 C CN 100530126C
- Authority
- CN
- China
- Prior art keywords
- function
- task
- address
- pointer
- internal memory
- 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.)
- Active
Links
Images
Landscapes
- Retry When Errors Occur (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a method for recording a function causing a system to halt or reset. The method comprises firstly allocating a function pointer array element for recording a function address for each task in a memory recording area, defining a global function pointer for tracking the currently operating task, and adding a hook function calling function in a file to be operated by the system; when switching a task, assigning the global function pointer to the address of the function pointer array element corresponding to the newly switched task in a task switch hook function; and recording the address of the currently called function in the current task in the global function pointer in the hook function calling function. The invention can capture the function causing system to halt or reset and capture the task operating the function, so as to provide effective recorded information for locating system failure afterwards, and shorten trouble shooting range, thereby facilitating to locate the system.
Description
Technical field
The present invention relates to data communication technology field, relate in particular to the method for the function that a kind of record leads to system abnormity.
Background technology
In data communication field, product can lead to system abnormity when using for a certain reason, for example causes system reset or deadlock.Because system restarts or crashes, so after restarting, can not use common positioning means to check to wait and locate reason such as memory variable, task status or CPU usage, this just causes the failure cause that afterwards is difficult to definitely find system, also just be not easy to locate the problem of product, thereby improve product stability.
Data communication products generally all is real-time embedded system, is based on all that task or process dispatch, and in other words, task or process are the minimum operation unit that the various system resources of set realize specific functions.When system reset or deadlock, if can catch the task of last operation and its working time, so, just can provide information for locate the reason that resets or crash afterwards, dwindle seek scope.
But, only capture causing system in case of system halt or resetting of task sometimes and still be difficult to find basic reason.In order further to dwindle seek scope, if can write down the function that causes system in case of system halt or reset, so just can navigate to the function one-level to the reason that causes fault, help more finding and cause crashing or the basic reason of the fault that resets.Because function calls very frequent in a real-time system, if the monitoring means of being taked occupying system resources too just will inevitably cause system performance decline, and then also can influence the operation of system's major function.
Summary of the invention
Technical matters to be solved by this invention is, the method of the function that a kind of record leads to system abnormity is provided, realize that record causes system in case of system halt or unusual function such as reset, and record calls the purpose of the task of described function, be used for dwindling the troubleshooting scope, so that the positioning system problem improves system stability according to recorded information.
The invention provides that a kind of record causes system in case of system halt or the method for the function that resets, this method is to be the embedded system of user's reserve part internal memory based on operating system, and in the data communication products that has non-power-off restoration or have the characteristic that non-outage content do not lose when crashing, comprise the steps:
Be used to write down the function pointer array element of function address in the internal memory recording areas for one of each Task Distribution, and define an overall situation function pointer of following the tracks of current operation task, in the file that system will move, add the function call Hook Function;
When task is switched, switch in the Hook Function with described overall situation function pointer assignment the address of the function pointer array element that be the task correspondence newly cut in task;
The current function address that calls records in the described overall situation function pointer current task at function call Hook Function place.
Described method further comprises:
After system restart, task, the function information copying and saving of preserving in the described internal memory recording areas are used for analyzing to other places.
Described method further comprises:
After copying and saving, the zero clearing of described internal memory recording areas is used to catch the information of this subsystem operation.
Described method further comprises:
After the information of analyzing system reset last time of catching or deadlock, described information is kept on the medium that power down do not lose with document form.
Use the present invention, can utilize some characteristic of data communication products software and hardware to capture function that causes system reset or deadlock and the task of moving this function, thereby for positioning system fault afterwards provides effective record of information, dwindled the troubleshooting scope, so that the positioning system problem improves the stability of product in market.
Description of drawings
Fig. 1 is the process flow diagram that writes down the function that causes system in case of system halt or reset in the embodiment of the invention;
Fig. 2 is the record function pointer of the overall situation in the embodiment of the invention switches assignment with task a variation synoptic diagram.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, the present invention is described in further detail below in conjunction with accompanying drawing.
For realizing purpose of the present invention, need utilize some characteristic of data communication products software and hardware to capture function that causes system reset or deadlock and the task of moving this function.In data communication products, have following software and hardware characteristic usually:
(1) data communication products in have non-power-off restoration or when crashing, internal memory has the characteristic that non-outage content is not lost.
After existing the non-power-off restoration of equipment also to start once more in product facility is employed, the information that is write down in the internal memory can not lost, or the initial value that keeps before the hold reset, this is just for catching the failure message that crashes or reset in some location, provide the medium of a high speed, and internal memory can not influence the normal operation of system because of adding monitor message.
(2) embedded system has the characteristic that can be user's reserve part internal memory.
The operating system of using in the data communication products is generally embedded system, generally can use for user oneself for the user keeps a part of internal memory, and operating system can not controlled this piece internal memory.So, after non-power-off restoration of equipment or deadlock and starting once more, the task of catching before resetting or crashing and its working time just can not be operated system and clean out, for the user determines to cause the task of last reset or deadlock and support is provided start-up time about the task relevant information according to these.
(3) embedded system generally can be monitored some critical events of embedded system internal operation for the user provides some Hook Function interfaces.
Though the user can not add debugging method by the source code of direct change embedded system, detect required location code but can add access customer, thereby catch the information of some systems' operations by Hook Function and adding user's location code wherein by the Hook Function that embedded system provided.
In an embodiment of the present invention, for the relevant information of task or process, can utilize existing " task is switched the Hook Function interface " to catch non-power-off restoration or the task and the working time thereof of the preceding operation of crashing.As long as it is just passable to switch that task that record will switch in the Hook Function in task, each always switching the, the task of last operation just forever that records like this overriding of former record.
In order to utilize Hook Function to search and obtain to cause the reason that crashes or reset, the present invention not only will write down the task and the relevant information of current operation, also will write down function and relevant information that this task is moved at last or called.
The invention provides the method for the function that a kind of record leads to system abnormity, it realizes that mainly thinking is:
Utilize the task of system to switch the Hook Function interface, and in system, add the function call Hook Function by instrument, more the overall situation function pointer of the current function that is moving of new record is the recording areas of current task correspondence in task switching Hook Function, the overall situation function pointer that each switching always will be write down the current function that is moving is updated to the function of minute book task, like this in the function call Hook Function as long as function pointer recorded in overall situation function pointer of the current function that is moving of this record just passable, can not cause system performance to decline to a great extent like this, improve the high efficiency of monitoring because of adding the function hook.
As shown in Figure 1, provide a specific embodiment of technical scheme of the present invention, be divided into following steps:
Step 101: in system, add function call and return hook processing function.Add fashionablely, add the function call Hook Function in the file that tool using will move system, in the function pointer of an overall situation that in the function call Hook Function address of this function is recorded predefined.Among the present invention, system only can provide task to switch the function that hook adds, and must carry out to add to switch Hook Function, and adding function call Hook Function can be replaced some instructions according to the executable file characteristics and get final product.
Step 102: keep a memory field A during os starting and be used for recorded information.Operating system keeps a region of memory and leaves last task of system log (SYSLOG) and the information of working time thereof for when initialization, operating system can not controlled this part content.
Step 103: after the system start-up, the information reproduction that internal memory A is preserved is provided with post analysis to internal memory B, internal memory A zero clearing.The preceding system acquisition information that will reset after the system start-up is duplicated portion and is used for analyzing to other places from internal memory A, then, elder generation is used for catching the information that this subsystem moves with recording areas A zero clearing.
Step 104: at recording areas A is a record of each Task Distribution function pointer address, the global address of reallocating.Function pointer array of structure is used for writing down function address on recording areas A, and corresponding one by one each element of this array and a task then, the function pointer that defines an overall situation simultaneously is used for following the tracks of the task of current operation.
Step 105: in task switching hook, refresh overall recording address is used to write down current function for this task recording address.
Particularly, switch in the Hook Function in task definition is used for following the tracks of the address of that overall situation function pointer assignment of current task for the array of pointers element of the task correspondence of new incision, the task with regard to guaranteeing forever to follow the tracks of current operation like this.
Step 106:, so just can guarantee to monitor the current function that calls of this task in that the current function address that calls or use records in the overall situation record function pointer current task in the function call hook.
Step 107: analyze system reset last time of catching of preserving among the internal memory B or the information of deadlock, draw reset or crashes before the task and the function that move at last and form file, be kept on the medium (for example flash) that power down do not lose.
As shown in Figure 2, the record function pointer that has provided the overall situation in the present embodiment switches the situation of change of assignment with task.
Range of application of the present invention is not limited to the fault that positioning system resets or crashes, and also can come other of supervisory system unusual with reference to above-mentioned embodiment, and the failure message that is monitored all is task and/or function level.
Described herein is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Therefore, all any modifications of being done within the spirit and principles in the present invention, be equal to replacement, improve and upgrade or the like, all should be included within protection scope of the present invention.
Claims (4)
1, a kind of record causes system in case of system halt or the method for the function that resets, it is characterized in that, this method is to be the embedded system of user's reserve part internal memory based on operating system, and in the data communication products that has non-power-off restoration or have the characteristic that non-outage content do not lose when crashing, comprise the steps:
Be used to write down the function pointer array element of function address in the internal memory recording areas for one of each Task Distribution, and define an overall situation function pointer of following the tracks of current operation task, in the file that system will move, add the function call Hook Function;
When task is switched, switch in the Hook Function with described overall situation function pointer assignment the address of the function pointer array element that be the task correspondence newly cut in task;
The current function address that calls records in the described overall situation function pointer current task at function call Hook Function place.
2, the method for claim 1 is characterized in that, described method further comprises:
After system restart, task, the function information copying and saving of preserving in the described internal memory recording areas are used for analyzing to other places.
3, method as claimed in claim 2 is characterized in that, described method further comprises:
After copying and saving, the zero clearing of described internal memory recording areas is used to catch the information of this subsystem operation.
4, method as claimed in claim 2 is characterized in that, described method further comprises:
After the information of analyzing system reset last time of catching or deadlock, described information is kept on the medium that power down do not lose with document form.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2007101875509A CN100530126C (en) | 2007-11-26 | 2007-11-26 | Method for recording function for leading to system abnormity |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2007101875509A CN100530126C (en) | 2007-11-26 | 2007-11-26 | Method for recording function for leading to system abnormity |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101169753A CN101169753A (en) | 2008-04-30 |
CN100530126C true CN100530126C (en) | 2009-08-19 |
Family
ID=39390385
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2007101875509A Active CN100530126C (en) | 2007-11-26 | 2007-11-26 | Method for recording function for leading to system abnormity |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100530126C (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101950260B (en) * | 2010-09-10 | 2014-04-30 | 中兴通讯股份有限公司 | Processor program dispatching method and device |
CN102141947B (en) * | 2011-03-30 | 2013-04-24 | 东方通信股份有限公司 | Method and system for processing abnormal task in computer application system adopting embedded operating system |
CN103123601B (en) * | 2011-11-17 | 2016-05-25 | 北京神州泰岳软件股份有限公司 | The method and apparatus of the software development trouble shoot based on Symbian system |
CN102622300B (en) * | 2012-04-18 | 2015-03-25 | 迈普通信技术股份有限公司 | Infinite loop or similar infinite loop detection method in multitask system |
CN106371996B (en) * | 2016-09-07 | 2019-05-28 | 东信和平科技股份有限公司 | A kind of power failure test method and system |
CN107590015A (en) * | 2017-09-11 | 2018-01-16 | 北京京东尚科信息技术有限公司 | The method and apparatus for monitoring the obstruction of main thread |
CN112434045A (en) * | 2020-12-10 | 2021-03-02 | 深圳市亿联无限科技有限公司 | Method and device for inter-process big data communication of embedded system |
CN113672424B (en) * | 2021-08-19 | 2024-06-14 | 支付宝(杭州)信息技术有限公司 | Method and device for repairing abnormal task |
-
2007
- 2007-11-26 CN CNB2007101875509A patent/CN100530126C/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN101169753A (en) | 2008-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100530126C (en) | Method for recording function for leading to system abnormity | |
Weiner et al. | TMO: Transparent memory offloading in datacenters | |
JP5140633B2 (en) | Method for analyzing failure occurring in virtual environment, management server, and program | |
US7434105B1 (en) | Selective self-healing of memory errors using allocation location information | |
US7900011B2 (en) | Apparatus, system, and method for improving system performance in a large memory heap environment | |
US8762667B2 (en) | Optimization of data migration between storage mediums | |
CN101169752A (en) | Method for capturing function for resulting in memory rewriting by wild pointer | |
RU2671049C2 (en) | Flushing in file system | |
US7243266B2 (en) | Computer system and detecting method for detecting a sign of failure of the computer system | |
US20180329779A1 (en) | Checkpoint triggering in a computer system | |
JP2007157131A (en) | Automatic prediction of future out of memory exception in garbage collected virtual machine, computer readabgle medium and computing device | |
US7900003B2 (en) | System, method and computer program product for storing an information block | |
CN101420459B (en) | Method, application system and memory device for managing application configuration information | |
CN106776147B (en) | Differential data backup method and differential data backup device | |
CN102567184A (en) | Journal storage method based on Flash | |
CN101201770A (en) | Method and system for storing important information before system collapse | |
CN105607973B (en) | Method, device and system for processing equipment fault in virtual machine system | |
CN103019890A (en) | Block-level disk data protection system and method thereof | |
CN104899071A (en) | Recovery method and recovery system of virtual machine in cluster | |
Wu et al. | Proactive data migration for improved storage availability in large-scale data centers | |
WO2023226380A1 (en) | Disk processing method and system, and electronic device | |
JP6522168B2 (en) | Method and apparatus for managing a storage device | |
JP2007133544A (en) | Failure information analysis method and its implementation device | |
CN110413565A (en) | A kind of method, equipment and the medium of more storages equipment synchronisation snapshot | |
US20120011319A1 (en) | Mass storage system and method of operating thereof |
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 |