Movatterモバイル変換


[0]ホーム

URL:


CN104035829A - Lock debugging method and module - Google Patents

Lock debugging method and module
Download PDF

Info

Publication number
CN104035829A
CN104035829ACN201410225366.9ACN201410225366ACN104035829ACN 104035829 ACN104035829 ACN 104035829ACN 201410225366 ACN201410225366 ACN 201410225366ACN 104035829 ACN104035829 ACN 104035829A
Authority
CN
China
Prior art keywords
lock
mistake
suffix
prefix
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.)
Granted
Application number
CN201410225366.9A
Other languages
Chinese (zh)
Other versions
CN104035829B (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.)
Opzoon Technology Co Ltd
Original Assignee
Opzoon Technology Co Ltd
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 Opzoon Technology Co LtdfiledCriticalOpzoon Technology Co Ltd
Priority to CN201410225366.9ApriorityCriticalpatent/CN104035829B/en
Publication of CN104035829ApublicationCriticalpatent/CN104035829A/en
Application grantedgrantedCritical
Publication of CN104035829BpublicationCriticalpatent/CN104035829B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

Translated fromChinese

本发明本涉及计算机技术,提供了一种调试锁的方法及模块,包括:在锁的数据结构中添加长度固定的第一前缀;生成锁时,给所述第一前缀所在字段赋一特定值,并所述特定值与锁的代号对应存储;锁出现错误时,判断该锁在所述第一前缀所在字段的值是否与存储的特定值相等,若相等则判定该错误属于锁自身的错误。本发明主要在锁的数据结构中添加一段用于校验的前缀,来判断出现错误时的锁的数据结构是否被破坏,继而可以有效区分锁自身的错误和内存错误所导致的锁的异常。

The present invention relates to computer technology, and provides a method and module for debugging a lock, including: adding a first prefix with a fixed length to the data structure of the lock; when generating a lock, assigning a specific value to the field where the first prefix is located , and the specific value is stored corresponding to the code name of the lock; when an error occurs in the lock, it is judged whether the value of the lock in the field where the first prefix is located is equal to the stored specific value, and if they are equal, it is judged that the error belongs to the lock itself . The present invention mainly adds a prefix for verification to the data structure of the lock to judge whether the data structure of the lock is damaged when an error occurs, and then can effectively distinguish the error of the lock itself from the abnormality of the lock caused by the memory error.

Description

Translated fromChinese
一种调试锁的方法及模块A method and module for debugging lock

技术领域technical field

本发明涉及计算机技术,具体涉及一种调试锁的方法及模块。The invention relates to computer technology, in particular to a method and module for debugging a lock.

背景技术Background technique

锁是各种操作系统都提供的基础的接口,其用来保证多核处理器任务执行的正确性。在使用上,锁是配套使用的,有加锁操作就必须对应有解锁操作,如果加锁了但是没有解锁,那么就会造成严重的死锁问题。同时由于使用不当,可能造成锁的数据结构被破坏,这就导致无法进行加锁操作。因此在锁的使用过程中,需要获知哪里加锁了而没有解锁,同时判断该锁是否已经被破坏。Lock is a basic interface provided by various operating systems, which is used to ensure the correctness of multi-core processor task execution. In use, locks are used in conjunction with each other. If there is a lock operation, there must be an unlock operation. If the lock is locked but not unlocked, it will cause a serious deadlock problem. At the same time, due to improper use, the data structure of the lock may be destroyed, which makes it impossible to perform locking operations. Therefore, in the process of using the lock, it is necessary to know where the lock is locked but not unlocked, and at the same time determine whether the lock has been broken.

现有技术方案通常在加锁的接口中增加一个行号,当死锁时查找对应的锁的加锁的代码,找到对应的行号,从而获知具体哪个位置加锁了,然后通过查代码的方法来找出没有解锁的地方。Existing technical solutions usually add a line number to the locked interface. When a deadlock occurs, look up the corresponding lock code and find the corresponding line number, so as to know which position is locked, and then check the code Ways to find out where it's not unlocked.

但是,现有技术方案仅仅是通过添加行号来找具体加锁位置,只能调试死锁时的情况,当锁被破坏时,该方案中并不能检测到这一情况,因而不能正确地做出处理。However, the prior art solution only finds the specific locking position by adding the line number, and can only debug the situation when the deadlock is broken. When the lock is destroyed, this situation cannot be detected in this solution, so it cannot be done correctly. out processing.

发明内容Contents of the invention

(一)解决的技术问题(1) Solved technical problems

针对现有技术的不足,本发明提供一种调试锁的方法及模块,其主要在锁的数据结构中添加一段用于校验的前缀,来判断出现错误时的锁的数据结构是否被破坏,继而可以有效区分锁自身的错误和内存错误所导致的锁的异常。Aiming at the deficiencies of the prior art, the present invention provides a method and module for debugging a lock, which mainly adds a prefix for verification to the data structure of the lock to determine whether the data structure of the lock is destroyed when an error occurs, Then it can effectively distinguish the error of the lock itself and the exception of the lock caused by the memory error.

(二)技术方案(2) Technical solution

为实现以上目的,本发明通过以下技术方案予以实现:To achieve the above object, the present invention is achieved through the following technical solutions:

一种调试锁的方法,其特征在于,该方法包括:A method for debugging locks, characterized in that the method comprises:

在锁的数据结构中添加长度固定的第一前缀;Add a fixed-length first prefix to the lock data structure;

生成锁时,给所述第一前缀所在字段赋一特定值,并所述特定值与锁的代号对应存储;When generating a lock, assign a specific value to the field where the first prefix is located, and store the specific value corresponding to the code name of the lock;

锁出现错误时,判断该锁在所述第一前缀所在字段的值是否与存储的特定值相等,若相等则判定该错误属于锁自身的错误。When an error occurs in the lock, it is judged whether the value of the lock in the field where the first prefix is located is equal to the stored specific value, and if they are equal, it is judged that the error belongs to the lock itself.

优选地,该方法还包括:在锁的数据结构中添加长度固定的第一后缀;调用加锁时,将所用加锁函数的函数名存入所述第一后缀;锁出现错误时,若该错误被判定属于锁自身的错误,则通过该锁在所述第一后缀存储的内容找到所用的加锁函数。Preferably, the method further includes: adding a first suffix with a fixed length to the data structure of the lock; when calling the lock, storing the function name of the locking function used in the first suffix; when an error occurs in the lock, if the If the error is judged to be an error of the lock itself, the locking function used is found through the content stored in the first suffix of the lock.

优选地,所述第一前缀的长度固定为4字节。Preferably, the length of the first prefix is fixed at 4 bytes.

优选地,该方法还包括:在锁的数据结构中添加长度固定的第二后缀;调用加锁时,将调用语句所在行号存入所述第二后缀;锁出现错误时,若该错误被判定属于锁自身的错误,则通过该锁在所述第二后缀存储的内容找到调用语句所在位置。Preferably, the method further includes: adding a second suffix with a fixed length to the data structure of the lock; when calling lock, storing the line number of the calling statement into the second suffix; when an error occurs in the lock, if the error is If it is determined that the error belongs to the lock itself, the location of the calling statement is found through the content stored in the second suffix of the lock.

优选地,该方法还包括:锁出现错误时,若该锁在所述第一前缀所在字段的值与存储的特定值不相等,则使用内存检测的方法定位错误位置。Preferably, the method further includes: when an error occurs in the lock, if the value of the lock in the field where the first prefix is located is not equal to the stored specific value, using a memory detection method to locate the error location.

一种调试锁的模块,其特征在于,该模块包括:A module for debugging a lock, characterized in that the module includes:

第一前缀添加单元,用于在锁的数据结构中添加长度固定的第一前缀;The first prefix adding unit is used to add a fixed-length first prefix to the data structure of the lock;

赋值存储单元,用于在生成锁时,给所述第一前缀所在字段赋一特定值,并所述特定值与锁的代号对应存储;The assignment storage unit is used to assign a specific value to the field where the first prefix is located when the lock is generated, and store the specific value corresponding to the code name of the lock;

错误识别单元,用于在锁出现错误时,判断该锁在所述第一前缀所在字段的值是否与存储的特定值相等,若相等则判定该错误属于锁自身的错误。The error identification unit is configured to determine whether the value of the lock in the field where the first prefix is located is equal to the stored specific value when an error occurs in the lock, and if they are equal, determine that the error belongs to the lock itself.

优选地,所述模块还包括:第一后缀添加单元,用于在锁的数据结构中添加长度固定的第一后缀;函数名存储单元,用于在调用加锁时,将所用加锁函数的函数名存入所述第一后缀;函数查找单元,用于在锁出现错误时,若该错误被判定属于锁自身的错误,则通过该锁在所述第一后缀存储的内容找到所用的加锁函数。Preferably, the module further includes: a first suffix adding unit, which is used to add a fixed-length first suffix to the data structure of the lock; a function name storage unit, which is used to add the lock function used when calling the lock The function name is stored in the first suffix; the function search unit is used to find the added value used by the lock based on the content stored in the first suffix if the error is determined to be an error of the lock itself when an error occurs in the lock. lock function.

优选地,所述第一前缀的长度固定为4字节。Preferably, the length of the first prefix is fixed at 4 bytes.

优选地,所述模块还包括:第二后缀添加单元,用于在锁的数据结构中添加长度固定的第二后缀;行号存储单元,用于在调用加锁时,将调用语句所在行号存入所述第二后缀;语句定位单元,用于在锁出现错误时,若该错误被判定属于锁自身的错误,则通过该锁在所述第二后缀存储的内容找到调用语句所在位置。Preferably, the module further includes: a second suffix adding unit, which is used to add a second suffix with a fixed length to the data structure of the lock; a line number storage unit, which is used to add the line number of the calling statement when calling lock Stored in the second suffix; the statement positioning unit is used to find the location of the calling statement through the content stored in the second suffix of the lock when an error occurs in the lock, if the error is determined to be an error of the lock itself.

优选地,所述模块还包括:错误处理单元,用于在锁出现错误时,若该锁在所述第一前缀所在字段的值与存储的特定值不相等,则使用内存检测的方法定位错误位置。Preferably, the module further includes: an error processing unit, configured to use a memory detection method to locate the error if the value of the lock in the field where the first prefix is located is not equal to the stored specific value when an error occurs in the lock Location.

(三)有益效果(3) Beneficial effects

本发明至少具有如下的有益效果:The present invention at least has the following beneficial effects:

本发明通过在锁的数据结构中增加一段长度固定的第一前缀,并在生成锁时给所述第一前缀所在字段赋一特定值,并对应地存储起来,用于对锁的数据结构进行校验,判断锁的相关数据是否已经被破坏。In the present invention, a fixed-length first prefix is added to the lock data structure, and a specific value is assigned to the field where the first prefix is located when the lock is generated, and correspondingly stored to perform lock data structure Check to determine whether the relevant data of the lock has been destroyed.

相对于现有技术而言,其在进行错误处理之前,先区分了锁自身的错误和内存错误所导致的锁的异常,所以可以在确定锁自身并不存在问题的情况下再进行对应的处理,因而总体上来说其处理的成功率更高。Compared with the existing technology, it distinguishes between the error of the lock itself and the abnormality of the lock caused by the memory error before performing error handling, so the corresponding processing can be performed after confirming that there is no problem with the lock itself , so the overall success rate of its processing is higher.

当然,实施本发明的任一产品或方法并不一定需要同时达到以上所述的所有优点。Of course, implementing any product or method of the present invention does not necessarily need to achieve all the above-mentioned advantages at the same time.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单的介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will give a brief introduction to the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1是本发明一个实施例中一种调试锁的方法的流程图;Fig. 1 is a flow chart of a method for debugging a lock in one embodiment of the present invention;

图2是本发明一个实施例中添加了第一前缀magic、第一后缀name以及第二后缀line的锁的数据结构示意图;Fig. 2 is a schematic diagram of the data structure of a lock with the first prefix magic, the first suffix name and the second suffix line added in one embodiment of the present invention;

图3是本发明一个实施例中一种调试锁的模块的结构框图。Fig. 3 is a structural block diagram of a module of a debugging lock in an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

实施例1Example 1

本发明实施例提出了一种调试锁的方法,参见图1,该方法包括:The embodiment of the present invention proposes a method for debugging a lock, referring to Fig. 1, the method includes:

步骤101:在锁的数据结构中添加长度固定的第一前缀;Step 101: Add a fixed-length first prefix to the lock data structure;

步骤102:生成锁时,给所述第一前缀所在字段赋一特定值,并所述特定值与锁的代号对应存储;Step 102: When generating the lock, assign a specific value to the field where the first prefix is located, and store the specific value corresponding to the code number of the lock;

步骤103:锁出现错误时,判断该锁在所述第一前缀所在字段的值是否与存储的特定值相等,若相等则判定该错误属于锁自身的错误。Step 103: When an error occurs in the lock, determine whether the value of the lock in the field where the first prefix is located is equal to the stored specific value, and if they are equal, determine that the error belongs to the lock itself.

也就是说,其主要是在锁的数据结构中增加一段长度固定的第一前缀,并在生成锁时给所述第一前缀所在字段赋一特定值,并对应地存储起来,用于对锁的数据结构进行校验,判断锁的相关数据是否已经被破坏,继而可以有效区分锁自身的错误和内存错误所导致的锁的异常。优选地取4字节为所述第一前缀的长度(对应的特定值就可以是0x5AA59527或0x12345678这样的数值),其既可以达到足够的校验精度,又不至于占用太多空间,且与一般的编译环境相适应,易于实现。That is to say, it mainly adds a fixed-length first prefix to the data structure of the lock, and assigns a specific value to the field where the first prefix is located when the lock is generated, and stores it correspondingly, which is used for locking Check the data structure of the lock to determine whether the relevant data of the lock has been destroyed, and then can effectively distinguish the error of the lock itself from the abnormality of the lock caused by the memory error. Preferably, 4 bytes are used as the length of the first prefix (the corresponding specific value can be a value such as 0x5AA59527 or 0x12345678), which can achieve sufficient verification accuracy without taking up too much space, and is consistent with Compatible with the general compilation environment and easy to implement.

优选地,在判断出错误不属于锁自身的错误,也就是该锁在所述第一前缀所在字段的值是否与存储的特定值不相等时,使用内存检测的方法来定位错误位置。也就是说,若校验没有通过,则说明锁的数据结构已经被破坏,需要从内存中找到可能破坏其数据的操作,因而需要使用存储检测的方法。这样的设计同上述方法一样,可以有效区分锁自身的错误和内存错误所导致的锁的异常,在此基础上还可以进一步针对错误类型进行处理,因而相较现有技术有更高的处理成功率和处理效率。Preferably, when it is judged that the error does not belong to the lock itself, that is, whether the value of the lock in the field where the first prefix is located is not equal to the stored specific value, a memory detection method is used to locate the error location. That is to say, if the verification fails, it means that the data structure of the lock has been damaged, and operations that may destroy its data need to be found from the memory, so the storage detection method needs to be used. This design is the same as the above method, which can effectively distinguish between the error of the lock itself and the exception of the lock caused by the memory error. On this basis, it can further deal with the error type, so it has a higher processing success than the existing technology. rate and processing efficiency.

优选地,在上述方案的基础之上,再给锁的数据结构中增加一段长度固定的第一后缀,其主要用于在调用锁时存储所有函数的函数名,并在锁自身出现错误时快速定位调用函数。当然,这里也可以再增加一段长度固定的第二后缀,用于在调用锁时存储调用语句的行号。以上两点都有利于在锁自身出现错误时对调用位置进行快速定位,便于错误调试的高效进行。Preferably, on the basis of the above scheme, add a fixed-length first suffix to the data structure of the lock, which is mainly used to store the function names of all functions when the lock is called, and to quickly update the lock itself when an error occurs. Locate the calling function. Of course, a second suffix with a fixed length can also be added here to store the line number of the calling statement when calling the lock. The above two points are conducive to quickly locating the call location when the lock itself has an error, which facilitates efficient error debugging.

结合了上述第一前缀magic、第一后缀name以及第二后缀line字段的锁的数据结构如图2所示,这样相当于将锁进行了拓展。其主要通过下述过程完成:The data structure of the lock combined with the above-mentioned first prefix magic, first suffix name and second suffix line fields is shown in Figure 2, which is equivalent to expanding the lock. It is mainly done through the following process:

在生成锁时,给锁的magic字段付一个特殊的值,比如0x5aa59527或者0x12345678之类的数值,同时将name和line字段赋值为0。当调用加锁时,通过字符串复制函数strncpy(name,__FUNCTION__,63)将函数名复制到锁的结构中,其中__FUNCTION__表示函数名,由编译器保证对应正确的函数名,在本例中对应调用锁的函数命令。同时,添加行号到line字段line=__LINE__,其中__LINE__表示行号,由编译器保证对应具体的行号,在本例中对应调用锁的地方的行号。When generating a lock, assign a special value to the magic field of the lock, such as 0x5aa59527 or 0x12345678, and set the name and line fields to 0. When calling lock, the function name is copied to the lock structure through the string copy function strncpy(name,__FUNCTION__,63), where __FUNCTION__ represents the function name, and the compiler guarantees the correct function name. In this example Corresponds to the function command that calls the lock. At the same time, add the line number to the line field line=__LINE__, where __LINE__ represents the line number, which is guaranteed by the compiler to correspond to the specific line number, in this example corresponding to the line number where the lock is called.

当出现锁的错误时,首先找到magic字段,看看是否是之前设定的特殊值,如果不是,说明锁的相关数据已经被破坏了,需要使用内存检测的方法来定位。如果magic没有被破坏,那么通过查看name和line字段,就能找到具体函数以及具体行号了。然后通过阅读代码,就可以找到错误的地方。When a lock error occurs, first find the magic field to see if it is the special value set before. If not, it means that the relevant data of the lock has been destroyed, and you need to use the method of memory detection to locate it. If the magic is not destroyed, then by looking at the name and line fields, you can find the specific function and the specific line number. Then by reading the code, you can find the wrong place.

在现有技术的方案下,其仅仅是通过添加行号来找具体加锁位置,因而如果每个锁在不同的文件中加锁地方的行号是一样的,那么方案就没有效果了。而在本发明实施例中,其又以函数名来进一步定位加锁语句的位置,不仅更为精确,而且定位速度也更快。Under the scheme of the prior art, it is only to find the specific locking position by adding the line number, so if the line numbers of each lock in different files are the same, the scheme has no effect. However, in the embodiment of the present invention, the function name is used to further locate the position of the locking statement, which is not only more accurate, but also faster in positioning speed.

总体来说,使用上述方法可以有效的发现锁问题的基本原因是区分锁本身的错误和内存错误导致锁的异常。同时对于锁的问题,可以快速的找到具体的函数名以及行号,也就是可以快速的和源代码对应上,因此在使用上相对简便,效率较高。Generally speaking, the basic reason why lock problems can be effectively discovered by using the above method is to distinguish between errors in the lock itself and exceptions caused by memory errors. At the same time, for the lock problem, you can quickly find the specific function name and line number, that is, you can quickly correspond to the source code, so it is relatively easy to use and has high efficiency.

实施例2Example 2

本发明实施例提出了一种调试锁的模块,参见图3,该模块包括:The embodiment of the present invention proposes a module for debugging the lock, as shown in Fig. 3, the module includes:

第一前缀添加单元301,用于在锁的数据结构中添加长度固定的第一前缀;The first prefix adding unit 301 is configured to add a fixed-length first prefix to the data structure of the lock;

赋值存储单元302,用于在生成锁时,给所述第一前缀所在字段赋一特定值,并所述特定值与锁的代号对应存储;The assignment storage unit 302 is configured to assign a specific value to the field where the first prefix is located when generating the lock, and store the specific value corresponding to the code name of the lock;

错误识别单元303,用于在锁出现错误时,判断该锁在所述第一前缀所在字段的值是否与存储的特定值相等,若相等则判定该错误属于锁自身的错误。The error identification unit 303 is configured to determine whether the value of the lock in the field where the first prefix is located is equal to the stored specific value when an error occurs in the lock, and if they are equal, determine that the error belongs to the lock itself.

优选地,所述模块还包括:第一后缀添加单元,用于在锁的数据结构中添加长度固定的第一后缀;函数名存储单元,用于在调用加锁时,将所用加锁函数的函数名存入所述第一后缀;函数查找单元,用于在锁出现错误时,若该错误被判定属于锁自身的错误,则通过该锁在所述第一后缀存储的内容找到所用的加锁函数。其有利于在锁自身出现错误时对调用位置进行快速定位,便于错误调试的高效进行。Preferably, the module further includes: a first suffix adding unit, which is used to add a fixed-length first suffix to the data structure of the lock; a function name storage unit, which is used to add the lock function used when calling the lock The function name is stored in the first suffix; the function search unit is used to find the added value used by the lock based on the content stored in the first suffix if the error is determined to be an error of the lock itself when an error occurs in the lock. lock function. It is beneficial to quickly locate the calling location when an error occurs in the lock itself, and facilitates efficient error debugging.

优选地,所述第一前缀的长度固定为4字节。其既可以达到足够的校验精度,又不至于占用太多空间,且与一般的编译环境相适应,易于实现。Preferably, the length of the first prefix is fixed at 4 bytes. It can achieve sufficient verification accuracy without occupying too much space, and is compatible with the general compilation environment and is easy to implement.

优选地,所述模块还包括:第二后缀添加单元,用于在锁的数据结构中添加长度固定的第二后缀;行号存储单元,用于在调用加锁时,将调用语句所在行号存入所述第二后缀;语句定位单元,用于在锁出现错误时,若该错误被判定属于锁自身的错误,则通过该锁在所述第二后缀存储的内容找到调用语句所在位置。其同样地有利于在锁自身出现错误时对调用位置进行快速定位,便于错误调试的高效进行。Preferably, the module further includes: a second suffix adding unit, which is used to add a second suffix with a fixed length to the data structure of the lock; a line number storage unit, which is used to add the line number of the calling statement when calling lock Stored in the second suffix; the statement positioning unit is used to find the location of the calling statement through the content stored in the second suffix of the lock when an error occurs in the lock, if the error is determined to be an error of the lock itself. It is also conducive to quickly locating the calling location when an error occurs in the lock itself, and facilitates efficient error debugging.

优选地,所述模块还包括:错误处理单元,用于在锁出现错误时,若该锁在所述第一前缀所在字段的值与存储的特定值不相等,则使用内存检测的方法定位错误位置。其可以有效区分锁自身的错误和内存错误所导致的锁的异常,在此基础上还可以进一步针对错误类型进行处理,因而相较现有技术有更高的处理成功率和处理效率。Preferably, the module further includes: an error processing unit, configured to use a memory detection method to locate the error if the value of the lock in the field where the first prefix is located is not equal to the stored specific value when an error occurs in the lock Location. It can effectively distinguish the error of the lock itself and the exception of the lock caused by the memory error, and on this basis, it can further deal with the error type, so it has a higher processing success rate and processing efficiency than the existing technology.

所述模块用于执行如实施例1所述的调试锁的方法,从而其具有对应的结构、功能和有益效果。The module is used to execute the method for debugging a lock as described in Embodiment 1, so it has corresponding structures, functions and beneficial effects.

综上所述,本发明提出了一种调试锁的方法及模块,可以高效的定位具体哪个文件,哪一行的代码加锁了,但是没有解锁,同时可以有效的判断锁是否被破坏的情况。其主要在锁的数据结构中添加一段用于校验的前缀,来判断出现错误时的锁的数据结构是否被破坏,继而可以有效区分锁自身的错误和内存错误所导致的锁的异常。In summary, the present invention proposes a method and module for debugging locks, which can efficiently locate specific files and lines of code that are locked but not unlocked, and can effectively determine whether the lock is broken. It mainly adds a prefix for verification to the data structure of the lock to determine whether the data structure of the lock is damaged when an error occurs, and then can effectively distinguish the error of the lock itself from the abnormality of the lock caused by the memory error.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be described in the foregoing embodiments Modifications are made to the recorded technical solutions, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

CN201410225366.9A2014-05-262014-05-26A kind of method and module for debugging lockExpired - Fee RelatedCN104035829B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201410225366.9ACN104035829B (en)2014-05-262014-05-26A kind of method and module for debugging lock

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201410225366.9ACN104035829B (en)2014-05-262014-05-26A kind of method and module for debugging lock

Publications (2)

Publication NumberPublication Date
CN104035829Atrue CN104035829A (en)2014-09-10
CN104035829B CN104035829B (en)2018-01-12

Family

ID=51466603

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201410225366.9AExpired - Fee RelatedCN104035829B (en)2014-05-262014-05-26A kind of method and module for debugging lock

Country Status (1)

CountryLink
CN (1)CN104035829B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6922821B1 (en)*2001-11-152005-07-26Cypress Semiconductor Corp.System and a method for checking lock step consistency between an in circuit emulation and a microcontroller while debugging process is in progress
CN101403979A (en)*2008-10-272009-04-08成都市华为赛门铁克科技有限公司Locking method for self-spinning lock and computer system
US7526422B1 (en)*2001-11-132009-04-28Cypress Semiconductor CorporationSystem and a method for checking lock-step consistency between an in circuit emulation and a microcontroller
CN101425677A (en)*2008-08-132009-05-06曲娜Anti-fraud induction motor protector
CN101820368A (en)*2010-04-082010-09-01华为技术有限公司Ethernet link failure detection method and device
CN103293949A (en)*2013-06-082013-09-11杭州和利时自动化有限公司On-off output channel redundancy fault-tolerant control method and redundancy on-off output channels

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7526422B1 (en)*2001-11-132009-04-28Cypress Semiconductor CorporationSystem and a method for checking lock-step consistency between an in circuit emulation and a microcontroller
US6922821B1 (en)*2001-11-152005-07-26Cypress Semiconductor Corp.System and a method for checking lock step consistency between an in circuit emulation and a microcontroller while debugging process is in progress
CN101425677A (en)*2008-08-132009-05-06曲娜Anti-fraud induction motor protector
CN101403979A (en)*2008-10-272009-04-08成都市华为赛门铁克科技有限公司Locking method for self-spinning lock and computer system
CN101820368A (en)*2010-04-082010-09-01华为技术有限公司Ethernet link failure detection method and device
CN103293949A (en)*2013-06-082013-09-11杭州和利时自动化有限公司On-off output channel redundancy fault-tolerant control method and redundancy on-off output channels

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张予现等: "一种链状数据结构细粒度自动加锁方法", 《小型微型计算机系统》*

Also Published As

Publication numberPublication date
CN104035829B (en)2018-01-12

Similar Documents

PublicationPublication DateTitle
US8930324B2 (en)Guarded file descriptors
JP2005322246A5 (en)
CN101308471B (en)Method and device for data restoration
CN106775937A (en)A kind of order line method of calibration and device
CN104133733B (en)A kind of detecting memory errors method
CN112579591B (en)Data verification method, device, electronic equipment and computer readable storage medium
CN104992083A (en)Code obfuscation method and system for application program
CN106528071A (en)Selection method and device for target code
US8799716B2 (en)Heap dump occurrence detection
US9870314B1 (en)Update testing by build introspection
CN116841906A (en)Intelligent contract detection method and device and electronic equipment
CN107357619B (en)Method, device, equipment and storage medium for generating card configuration file
CN106407104B (en)It is a kind of for detecting the method and system for discharging relevant defect to memory headroom
CN114490327B (en) Error detection method and device
CN108959390B (en) Resource area synchronization method and device after shared file system node failure
CN104035829B (en)A kind of method and module for debugging lock
CN114282268A (en)Database integrity checking method and device based on SM3 algorithm
CN105955971B (en)A kind of implementation method and device of key assignments caching
US9354870B2 (en)Maintaining integrity of output of code generators
CN105786714B (en)Process detection method and device
US10719379B2 (en)Fault isolation in transaction logs
CN108052405A (en)Method and device for checking spatial data
US20180150405A1 (en)Data type management
CN107256252A (en) A third-party multi-dimensional data migration method and device
CN107479910B (en) Document restoration method, system, readable storage medium and computer device

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
PP01Preservation of patent right
PP01Preservation of patent right

Effective date of registration:20180528

Granted publication date:20180112

PD01Discharge of preservation of patent
PD01Discharge of preservation of patent

Date of cancellation:20240528

Granted publication date:20180112

CF01Termination of patent right due to non-payment of annual fee
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20180112


[8]ページ先頭

©2009-2025 Movatter.jp