CN106557300A - A kind of function stack information of wild pointer determines method, device and electronic equipment - Google Patents

A kind of function stack information of wild pointer determines method, device and electronic equipment Download PDF

Info

Publication number
CN106557300A
CN106557300A CN201510618656.4A CN201510618656A CN106557300A CN 106557300 A CN106557300 A CN 106557300A CN 201510618656 A CN201510618656 A CN 201510618656A CN 106557300 A CN106557300 A CN 106557300A
Authority
CN
China
Prior art keywords
function
memory
stack information
region
wild pointer
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
CN201510618656.4A
Other languages
Chinese (zh)
Other versions
CN106557300B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201510618656.4A priority Critical patent/CN106557300B/en
Publication of CN106557300A publication Critical patent/CN106557300A/en
Application granted granted Critical
Publication of CN106557300B publication Critical patent/CN106557300B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the present invention provides a kind of function stack information of wild pointer and determines method, device and electronic equipment, and wherein method includes:Hook internal memory call function, when internal memory call function is called, to determine the stack information of internal memory call function;Determine the stack information of the region of memory that internal memory call function is pointed to, region of memory determined by record and the internal memory call function corresponding to region of memory;When application crashes are caused by wild pointer, the region of memory pointed by wild pointer is determined;From the stack information of the internal memory call function corresponding to the region of memory and region of memory for being recorded, determine the stack information of the region of memory pointed by wild pointer, obtain the function stack information of wild pointer.The embodiment of the present invention it is determined that wild pointer function stack information when, greatly simplify process logic so that the determination of the function stack information of wild pointer is relatively simple.

Description

A kind of function stack information of wild pointer determines method, device and electronic equipment
Technical field
The present invention relates to technical field of data processing, and in particular to a kind of function stack information of wild pointer determines Method, device and electronic equipment.
Background technology
Wild pointer is directed to the pointer of unavailable region of memory, if application is operationally grasped to wild pointer Make, will cause (to collapse) using crash;Wild pointer causes the principle using (such as IOS applications etc.) crash Predominantly, after an object (example of the object for class) of application is released, its corresponding region of memory Disabled region of memory will be become, and other objects will be when pointer (i.e. the wild pointer) of the object will be held, If being continuing with the pointer, will cause to apply crash.Caused the problem using crash for positioning by wild pointer Code, determines that the function call information involved by wild pointer seems particularly necessary.
Determine that the mode of the function call information involved by wild pointer is mainly at present, reproduction is led by wild pointer The application crash scenes of cause, so as to the function call information involved by wild pointer is navigated to by aid; However, reappear to need to expend great workload using crash scenes by caused by wild pointer, logic is realized It is relatively complicated, and success rate cannot ensure;Therefore how simply and accurately to determine the function of wild pointer Recalls information, becomes the problem that those skilled in the art need to consider.
The content of the invention
In view of this, a kind of function stack information of wild pointer of embodiment of the present invention offer determines method, device And electronic equipment, simply and accurately to determine the function call information of wild pointer.
For achieving the above object, the embodiment of the present invention provides following technical scheme:
A kind of function stack information of wild pointer determines method, including:
Hook internal memory call function, when internal memory call function is called, to determine the stack of internal memory call function Information;
Determine the region of memory that internal memory call function is pointed to, region of memory and region of memory determined by record The stack information of corresponding internal memory call function;
When application crashes are caused by wild pointer, the region of memory pointed by wild pointer is determined;
From the stack information of the internal memory call function corresponding to the region of memory and region of memory for being recorded, really Determine the stack information of the region of memory pointed by wild pointer, obtain the function stack information of wild pointer.
The embodiment of the present invention also provides a kind of function stack information determining means of wild pointer, including:
Hook module, for hook internal memory call function, with when internal memory call function is called, it is determined that interior Deposit the stack information of call function;
Module is determined and recorded, for determining the region of memory of internal memory call function sensing, record is determined Region of memory and region of memory corresponding to internal memory call function stack information;
Collapse determining module, causes application crashes by wild pointer for determining;
Region of memory determining module is pointed to, for when application crashes are caused by wild pointer, determining wild pointer Pointed region of memory;
Stack information determination module, for adjusting from the internal memory corresponding to the region of memory and region of memory for being recorded With in the stack information of function, determine the stack information of the region of memory pointed by wild pointer, obtain wild pointer Function stack information.
The embodiment of the present invention also provides a kind of electronic equipment, including the function stack letter of wild pointer described above Breath determining device.
Based on above-mentioned technical proposal, the function stack information of wild pointer provided in an embodiment of the present invention determines method, Can be by hook (hook) internal memory call function, record obtains the memory field operated by internal memory call function Domain, and the stack information of the corresponding internal memory call function of region of memory, so as to cause application to be collapsed by wild pointer When routed, the region of memory pointed by wild pointer can be passed through, from the region of memory and region of memory institute for having recorded In the stack information of corresponding internal memory call function, the function stack information of wild pointer is determined;The present invention is implemented The determination method of the function stack information of the wild pointer that example is provided, when being related to the internal memory call function of hook and calling Data record, the determination of the region of memory pointed by wild pointer, with recorded data search open country refer to The operation of the function stack information of pin, can determine wild pointer when application crashes are caused by wild pointer Function stack information, is not required to reappear by application crashes scene caused by wild pointer, greatly simplify determination open country and refers to Involved process logic in the function stack information process of pin so that the determination of the function stack information of wild pointer It is relatively simple.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to reality Apply accompanying drawing to be used needed for example or description of the prior art to be briefly described, it should be apparent that, below Accompanying drawing in description is only embodiments of the invention, for those of ordinary skill in the art, not On the premise of paying creative work, can be with according to the other accompanying drawings of accompanying drawing acquisition for providing.
Fig. 1 is the flow chart that the function stack information of wild pointer provided in an embodiment of the present invention determines method;
Fig. 2 is another flow chart that the function stack information of wild pointer provided in an embodiment of the present invention determines method;
Fig. 3 is the determination method flow diagram caused by wild pointer using crash provided in an embodiment of the present invention;
Fig. 4 is another stream for being caused the determination method using crash by wild pointer provided in an embodiment of the present invention Cheng Tu;
Recorded content schematic diagrams of the Fig. 5 for crash log;
Fig. 6 is another flow chart that the function stack information of wild pointer provided in an embodiment of the present invention determines method;
Fig. 7 is the structured flowchart of the function stack information determining means of wild pointer provided in an embodiment of the present invention;
Fig. 8 is the structured flowchart of hook module provided in an embodiment of the present invention;
Fig. 9 is the structured flowchart of collapse determining module provided in an embodiment of the present invention;
Figure 10 is the structured flowchart for pointing to region of memory determining module provided in an embodiment of the present invention;
Figure 11 is another structured flowchart of collapse determining module provided in an embodiment of the present invention;
Figure 12 is another structured flowchart for pointing to region of memory determining module provided in an embodiment of the present invention;
Figure 13 is another structural frames of the function stack information determining means of wild pointer provided in an embodiment of the present invention Figure;
Figure 14 is the structured flowchart of logger module provided in an embodiment of the present invention;
Figure 15 is the hardware block diagram of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out Clearly and completely describe, it is clear that described embodiment is only a part of embodiment of the invention, and It is not all, of embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art are not doing The every other embodiment obtained under the premise of going out creative work, belongs to the scope of protection of the invention.
Fig. 1 is the flow chart that the function stack information of wild pointer provided in an embodiment of the present invention determines method, the party Method can be applicable to the electronic equipment for being mounted with application, such as be mounted with the electronic equipment of IOS applications, electronic equipment The such as user equipment such as mobile phone, panel computer;With reference to Fig. 1, the method can include:
Step S100, hook internal memory call function, when internal memory call function is called, to determine that internal memory is adjusted With the stack information of function;
Hook also known as Hook Technique, by redirecting or Modification growth function table is realizing in system or third party's letter Number goes to the function for setting before calling;
What the stack information (also referred to as function stack information) of internal memory call function was represented is stack when function is called State, (such as trace back to function upper one is can to trace back to the caller of function by function stack information To first caller);Optionally, the embodiment of the present invention can pass through when internal memory call function is called Hook technologies, add stack backtracking instruction, so as to trace back to the stack information of called internal memory call function;
In embodiments of the present invention, the function call information involved by wild pointer, is primarily referred to as wild pointer institute The stack information (i.e. the function stack information of wild pointer) of the internal memory call function of the region of memory of sensing, passes through The function stack information of wild pointer, the distribution of the region of memory that can be apparent from pointed by wild pointer, release Involved code, consequently facilitating the positioning of problem code;
It is object distribution, the operation of releasing memory using existing in running by internal memory call function; Optionally, internal memory call function can include:For the memory allocation function in object storage allocation region, and/ Or, the internal memory for object releasing memory region discharges function;Accordingly, the stack information of internal memory call function Can include:For the stack information in object storage allocation region, and/or, it is the stack in object releasing memory region Information;
The embodiment of the present invention can be adjusted by hook internal memories in the called execution of each internal memory call function With function, with before in internal memory call function as object release or storage allocation region, execution stack backtracking instruction, So as to trace back to the stack information of internal memory call function,
Step S110, the region of memory for determining the sensing of internal memory call function, region of memory determined by record And the stack information of the internal memory call function corresponding to region of memory;
The stack information of the internal memory call function corresponding to region of memory refers to, operates the internal memory of the region of memory The stack information of call function;Such as distribute the stack information of the memory allocation function of the region of memory, and release should The internal memory of region of memory discharges the stack information of function;
The stack information of the internal memory call function traced back to by step S100 will be with internal memory call function existing object Release or the region of memory for distributing are associated, so as to recorded the memory field of internal memory call function existing object Domain, and the corresponding stack information of internal memory call function;
Optionally, region of memory can be memory address;
By the operation of step S100, the embodiment of the present invention can record each region of memory and be released or dividing Timing, corresponding stack information, record obtain function (letter involved when region of memory is released or distributes Number is by stack message reflection).
Step S120, when being caused using crash by wild pointer, determine the region of memory pointed by wild pointer;
When using crash, the embodiment of the present invention can pass through to analyze the top layer function using during crash, or different Often keyword is determined whether by crash is applied caused by wild pointer;If using top layer function during crash with Preset function correspondence, or, it is corresponding with preset keyword using abnormal keyword during crash, then can determine that Be by caused by wild pointer apply crash;
Wherein, preset function can be being caused using top layer letter during crash by wild pointer of analyzing in advance Number, preset keyword can be being caused using abnormal keyword during crash by wild pointer of analyzing in advance;
If corresponding with preset function using top layer function during crash, then the embodiment of the present invention can be in application During crash, the region of memory pointed by wild pointer is obtained from the depositor corresponding to the top layer function; The corresponding depositor of top layer function may be considered the deposit that storage top layer function performs data and result data Device;
If corresponding with preset keyword using abnormal keyword during crash, then the embodiment of the present invention can be from The region of memory pointed by wild pointer is parsed in the abnormal keyword.
Step S130, from the stack of the internal memory call function corresponding to the region of memory and region of memory for being recorded In information, determine the stack information of the region of memory pointed by wild pointer, obtain the function stack information of wild pointer.
The function stack information of wild pointer provided in an embodiment of the present invention determines method, including:Hook internal memories are adjusted With function, when internal memory call function is called, to determine the stack information of internal memory call function, while determining The region of memory that internal memory call function is pointed to, corresponding to region of memory determined by record and region of memory The stack information of internal memory call function;When being caused using crash by wild pointer, the embodiment of the present invention can determine that Region of memory pointed by wild pointer, and then from corresponding to the region of memory and region of memory for being recorded Deposit in the stack information of call function, determine the stack information of the region of memory pointed by wild pointer, obtain open country and refer to The function stack information of pin, so that it is determined that going out the function call information of the region of memory pointed by wild pointer, be Positioning is caused using the problem code of crash there is provided possible by wild pointer.
As can be seen that the function stack information of wild pointer provided in an embodiment of the present invention determines method, can pass through Hook internal memory call functions, record obtain the region of memory operated by internal memory call function, and region of memory The stack information of corresponding internal memory call function, so as to when being caused using crash by wild pointer, open country can be passed through Region of memory pointed by pointer, calls from the internal memory corresponding to the region of memory and region of memory for having recorded In the stack information of function, the function stack information of wild pointer is determined;Wild pointer provided in an embodiment of the present invention Function stack information determination method, the data record being related to when the internal memory call function of hook is called is wild The determination of the region of memory pointed by pointer, with the function stack information that wild pointer is searched in recorded data Operation, when being caused using crash by wild pointer, that is, can determine the function stack information of wild pointer, no Need to reappear by crash scenes are applied caused by wild pointer, greatly simplify the function stack information for determining wild pointer During involved process logic so that the determination of the function stack information of wild pointer is relatively simple.
Optionally, internal memory call function is primarily directed to the object of application program and carries out the distribution of region of memory Operate with release, and when the function of a class is called (such as internal memory call function), finally can all call To the function of such parent;Therefore the embodiment of the present invention is in hook internal memory call functions, to determine internal memory During the stack information of call function, can hook parent objects internal memory call function, such as hook parent objects Memory allocation function and internal memory release function, with when memory allocation function is called each time, it may be determined that go out The stack information of memory allocation function, when internal memory release function is called each time, it may be determined that go out internal memory release The stack information of function;
By taking IOS applications as an example, the class of object-C has a parent of oneself, and NSObject is exactly most Whole parent (NSObject classes are the parents of each object in object-C);Object-C is being called such as During the constructed fuction of class, the constructed fuction of NSObject classes will be finally called;Same object-C classes Release function call, the release function that can be also related to NSObject classes is called;
Therefore in IOS applications, the embodiment of the present invention can hook NSObject objects memory allocation function (alloc functions), and internal memory release function (dealloc functions) of hook NSObject objects, so as to In alloc function calls each time, by stack back tracking operation, the stack information of alloc functions is determined, every During dealloc function call, by stack back tracking operation, the stack information of dealloc functions is determined.
Optionally, internal memory call function can include memory allocation function and internal memory release function, the present invention Embodiment can hook memory allocation functions, determine the stack information of memory allocation function, the release of hook internal memories Function, determines that internal memory discharges the stack information of function;Accordingly, the function stack letter of wild pointer determined by Cease the stack information of the memory allocation function of region of memory that can be pointed by wild pointer, and internal memory release letter Several stack information;
Based on this, Fig. 2 shows that the function stack information of wild pointer provided in an embodiment of the present invention determines method Another flow chart, with reference to Fig. 2, the method can include:
Step S200, hook memory allocation function, when memory allocation function is called, to determine internal memory point Stack information with function;And hook internal memories release function, with when internal memory release function is called, it is determined that interior Deposit the stack information of release function;
Can determine that by the stack information of memory allocation function, the memory field operated by memory allocation function Correlation function involved by domain;The stack information for discharging function by internal memory can determine that internal memory discharges letter Correlation function involved by the operated region of memory of number;
Step S210, the region of memory for determining memory allocation function and internal memory release function sensing, in record The stack information of region and corresponding memory allocation function is deposited, and internal memory discharges the stack information of function;
Optionally, the embodiment of the present invention can arrange global table, with by global table record region of memory and right The stack information of the memory allocation function answered, and the stack information of internal memory release function.
Step S220, when being caused using crash by wild pointer, determine the region of memory pointed by wild pointer;
Step S230, from the stack information of the corresponding memory allocation function of region of memory for being recorded, and internal memory In the stack information of release function, determine that the stack of the memory allocation function of the region of memory pointed by wild pointer is believed Breath, and the stack information of internal memory release function.
Optionally, Fig. 3 shows the determination side caused by wild pointer using crash provided in an embodiment of the present invention Method flow chart, with reference to Fig. 3, the method can include:
Step S300, when using crash, analysis using top layer function during crash whether with preset function Correspondence;
Step S310, if it is determined that corresponding with preset function using top layer function during crash, it is determined that be by Crash is applied caused by wild pointer.
Preset function can be being caused using top layer function during crash by wild pointer of analyzing in advance;With As a example by IOS applications, in one implementation, if apply crash, top layer function is Objc_msgSend, it is determined that be by caused by wild pointer apply crash;In another kind of implementation, If during using crash, top layer function is objc_release, it is determined that applied by caused by wild pointer crash;Top layer function objc_msgSend, and objc_release for preset function can preferred form of this.
Optionally, the embodiment of the present invention can also judge to be using abnormal keyword during crash by analysis It is no by caused by wild pointer apply crash;Fig. 4 show it is provided in an embodiment of the present invention by wild pointer cause should With another flow chart of the determination method of crash, with reference to Fig. 4, the method can include:
Step S400, when using crash, analysis using abnormal keyword during crash whether with preset pass Key word correspondence;
Step S410, if it is determined that corresponding with preset keyword using abnormal keyword during crash, it is determined that Be by caused by wild pointer apply crash.
Preset keyword can be that being caused by wild pointer of analyzing in advance is crucial using exception during crash Word;By taking IOS applications as an example, abnormal keyword can be unrecognized selector sent to instance (not selected device is sent to example), if apply crash, abnormal keyword is unrecognized Selector sent to instance, then can determine that be by caused by wild pointer apply crash.
Optionally, when applying crash caused by by wild pointer, if top layer function is corresponding with preset function, The embodiment of the present invention can extract the memory field pointed by wild pointer by the corresponding depositor of top layer function Domain;
Specifically, the embodiment of the present invention can be when using crash, from top layer function corresponding with preset function Data corresponding with preset function are recognized in corresponding depositor, so as to carry from the data for recognizing Character feature data corresponding with the region of memory pointed by wild pointer are got, the data visualization for being extracted is Region of memory pointed by wild pointer;
By taking IOS applications as an example, during using crash, if top layer function is objc_msgSend, can be from top The data of the region of memory pointed by wild pointer are extracted in the corresponding depositor of layer functions (such as depositor RO), To realize the determination of the region of memory pointed by wild pointer;During using crash, if top layer function is Objc_release, then can extract wild pointer institute from the corresponding depositor of top layer function (such as depositor R0) The data of the region of memory of sensing, to realize the determination of the region of memory pointed by wild pointer;
Optionally, when applying crash caused by by wild pointer, if abnormal keyword and preset keyword pair Should, then the embodiment of the present invention can parse the region of memory pointed by wild pointer from the abnormal keyword;
Under IOS application scenarios, during using crash, if abnormal keyword is unrecognized selector Sent to instance 0x1222c0, then the embodiment of the present invention can parse the abnormal keyword, extremely close from this The region of memory data (0x1222c0) of carrying are extracted in key word, so that it is determined that going out pointed by wild pointer Region of memory;It should be noted that region of memory 0x1222c0 herein is only used for what is illustrated Can preferred form of this.
Optionally, it is all in have recorded using running due to the crash log (crash log) for applying Stack information, can clearly know using operation code situation during crash therefore general by crash log The problem code using crash can be navigated to by crash log using crash;However, being caused by wild pointer During using crash, the release of wild pointer necessarily occurs in the synchronization using crash, therefore nothing at present Method navigates to the problem code caused by wild pointer using crash by crash log;
It is active file of the positioning using the problem code of crash based on crash log, the embodiment of the present invention can be by Determined by wild pointer function stack information record in crash log so that staff is by wild pointer When causing using crash, there can be the crash log of the function stack information of wild pointer by record, navigate to open country and refer to The distribution of the region of memory that pin is pointed to and release code, are caused to apply crash by wild pointer in order to analyze Problem code;
Optionally, Fig. 5 shows the recorded content of crash log, as shown in figure 5, each line in crash log Journey has a call stack, and in Fig. 5, uppermost Thread23 is thread sequence number, and Thread23 is presented herein below tune Use stack;The embodiment of the present invention can by determined by wild pointer function stack information as a thread, it is out of office The Memory Allocation letter of region of memory pointed by specific wild pointer is recorded under the thread of the function stack information of pointer Several stack information, and the stack information of internal memory release function, and the setting position of crash log is inserted in (such as crash The end of log files);By such setting, then can pass through crash log and the function stack of wild pointer is believed Breath is parsed as thread, with consistent with current crash log resolution logics, is not required to the function in wild pointer Make extra work in the parsing of stack information;
Optionally, the thread of the function stack information of the wild pointer being inserted in crash log, can set name Name (being such as named as mallochistor xx), in order to the function stack of wild pointer is found from crash log Information;
Specifically, when the function stack information record by wild pointer is in crash files, the embodiment of the present invention Can in crash log using the function stack information of wild pointer as thread, to set thread described in naming, The stack information of the memory allocation function of region of memory pointed by wild pointer, and internal memory are recorded under the thread The stack information of release function.
Preferably, Fig. 6 shows that the function stack information of wild pointer provided in an embodiment of the present invention determines method Another flow chart, with reference to Fig. 6, the method can include:
The memory allocation function of step S500, hook NSObject objects, and hookNSObject objects Internal memory discharges function, with when memory allocation function is called, by stack back tracking operation, determines internal memory point Stack information with function, when internal memory release function is called, by stack back tracking operation, determines that internal memory is released Put the stack information of function;
Step S510, the region of memory for determining memory allocation function and internal memory release function sensing, in the overall situation The stack information of region of memory and the corresponding memory allocation function of region of memory, and internal memory release letter are recorded in table Several stack information;
The stack information of the corresponding memory allocation function of region of memory, and the stack information of internal memory release function, be Refer to, operate the stack information and internal memory of the memory allocation function of the region of memory to discharge the stack information of function.
Step S520, when using crash, if top layer function be objc_msgSend, it is determined that be by Crash is applied caused by wild pointer, is extracted from the corresponding depositor of top layer function in pointed by wild pointer Deposit region;
Optionally, step S520 can be replaced using following manner:When using crash, if top layer function For objc_release, it is determined that be by crash is applied caused by wild pointer, from the corresponding deposit of top layer function The region of memory pointed by wild pointer is extracted in device;
Step S520 may also be employed following manner replacement:When using crash, if abnormal keyword is Unrecognized selector sent to instance, it is determined that be by caused by wild pointer using crash, from The region of memory pointed by wild pointer is extracted in abnormal keyword;
The stack of step S530, the record region of memory recorded from global table and corresponding memory allocation function In information, and the stack information of internal memory release function, the internal memory point of the region of memory pointed by wild pointer is determined Stack information with function, and the stack information of internal memory release function;
Wherein, the stack information of the memory allocation function of the region of memory pointed by wild pointer determined by, and Internal memory discharges the stack information of function, as the function stack information of wild pointer.
Step S540, in crash log using the function stack information of wild pointer as thread, to set name life The name thread, records the stack of the memory allocation function of region of memory pointed by wild pointer under the thread Information, and the stack information of internal memory release function, by the function stack information record of wild pointer in crash log, The crash log positioning for having the function stack information of wild pointer will pass through record is caused to apply crash by wild pointer Problem code.
The determination method of the function stack information of wild pointer provided in an embodiment of the present invention, processes logic significantly simple Change so that the determination of the function stack information of wild pointer is relatively simple.
Below the function stack information determining means of wild pointer provided in an embodiment of the present invention are introduced, under The function stack information determining means of the wild pointer of text description can be with the function stack information of above-described wild pointer Determine method mutually to should refer to.
Fig. 7 is the structured flowchart of the function stack information determining means of wild pointer provided in an embodiment of the present invention, should Device can be applicable to be mounted with the electronic equipment of application, and with reference to Fig. 7, the device can include:
Hook module 100, for hook internal memory call functions, with when internal memory call function is called, really Determine the stack information of internal memory call function;
Module 200 is determined and recorded, for determining the region of memory of internal memory call function sensing, record institute is really The stack information of the internal memory call function corresponding to fixed region of memory and region of memory;
Collapse determining module 300, is caused to apply crash by wild pointer for determining;
Region of memory determining module 400 is pointed to, for when being caused using crash by wild pointer, it is determined that wild Region of memory pointed by pointer;
Stack information determination module 500, for from the internal memory corresponding to the region of memory and region of memory for being recorded In the stack information of call function, determine the stack information of the region of memory pointed by wild pointer, obtain wild pointer Function stack information.
Optionally, hook module 100 can pass through the internal memory call function of hook parent objects, to realize hook Internal memory call function;
Optionally, Fig. 8 shows a kind of alternative construction of hook module provided in an embodiment of the present invention 100, With reference to Fig. 8, hook module 100 can include:
First hook unit 110, for hook memory allocation functions, with when memory allocation function is called, Determine the stack information of memory allocation function;
Second hook subelement 120, for hook internal memories discharge function, with call internal memory release function when, Determine that internal memory discharges the stack information of function;
It is corresponding, the stack information of the region of memory determined by stack information determination module 400 pointed by wild pointer Can include:The stack information of the memory allocation function of the region of memory pointed by wild pointer, and internal memory release The stack information of function.
Optionally, Fig. 9 shows a kind of alternative construction of collapse determining module 300, and with reference to Fig. 9, collapse is true Cover half block 300 can include:
First collapse determining unit 310, for, when using crash, analysis is using top layer function during crash It is whether corresponding with preset function, however, it is determined that corresponding with preset function using top layer function during crash, then really Surely be by caused by wild pointer apply crash;
Corresponding, Figure 10 shows a kind of alternative construction for pointing to region of memory determining module 400, reference picture 10, pointing to region of memory determining module 400 can include:
First points to region of memory determining unit 410, during for applying crash caused by by wild pointer, if Top layer function is corresponding with preset function, then extract wild pointer indication from the corresponding depositor of top layer function To region of memory.
Optionally, Figure 11 shows the another kind of optional of collapse determining module 300 provided in an embodiment of the present invention Structure, with reference to Figure 11, collapse determining module 300 can include:
Second breakdown determining unit 320, for, when using crash, analysis is crucial using exception during crash Whether word is corresponding with preset keyword, however, it is determined that using abnormal keyword during crash and preset keyword pair Should, it is determined that be by caused by wild pointer apply crash;
Corresponding, Figure 12 shows the another of sensing region of memory determining module provided in an embodiment of the present invention 400 A kind of alternative construction, with reference to Figure 12, pointing to region of memory determining module 400 can include:
Second points to region of memory determining unit 420, during for applying crash caused by by wild pointer, If abnormal keyword is corresponding with preset keyword, wild pointer indication is parsed from the abnormal keyword To region of memory.
Optionally, Figure 13 shows the function stack information determining means of wild pointer provided in an embodiment of the present invention Another structured flowchart, with reference to shown in Fig. 7 and Figure 13, the device can also include:
Logger module 600, for by the function stack information record of the wild pointer for obtaining in crash log.
Optionally, Figure 14 shows a kind of optional knot of logger module provided in an embodiment of the present invention 600 Structure, with reference to Figure 14, logger module 600 can include:
Record performance element 610, in crash log using the function stack information of wild pointer as thread, To set thread described in naming, the internal memory of wild pointer pointed by region of memory is recorded under the thread The stack information of partition function, and the stack information of internal memory release function.
The embodiment of the present invention also provides a kind of electronic equipment, the electronic equipment can include it is described above really Determine the device of the function stack information of wild pointer;Open country is carried out using electronic equipment provided in an embodiment of the present invention to refer to The determination of the function stack information of pin, is capable of achieving process logic and significantly simplifies, and relatively simple wild pointer The determination of function stack information.
Electronic equipment provided in an embodiment of the present invention such as mobile phone, panel computer, notebook computer etc. can be used Family equipment;Figure 15 shows the hardware block diagram of electronic equipment provided in an embodiment of the present invention, reference picture 15, the electronic equipment can include:Processor 1, communication interface 2, memorizer 3 and communication bus 4;
Wherein processor 1, communication interface 2, memorizer 3 complete mutual communication by communication bus 4;
Optionally, communication interface 2 can be the interface of communication module, the such as interface of gsm module;
Processor 1, for configuration processor;
Memorizer 3, for depositing program;
Program can include program code, and described program code includes computer-managed instruction.
The possibly central processor CPU of processor 1, or specific integrated circuit ASIC (Application Specific Integrated Circuit), or be arranged to implement the embodiment of the present invention One or more integrated circuits.
Memorizer 3 may include high-speed RAM memorizer, it is also possible to also including nonvolatile memory (non-volatile memory), for example, at least one disk memory.
Wherein, program can be specifically for:
Hook internal memory call function, when internal memory call function is called, to determine the stack of internal memory call function Information;
Determine the region of memory that internal memory call function is pointed to, region of memory and region of memory determined by record The stack information of corresponding internal memory call function;
When application crashes are caused by wild pointer, the region of memory pointed by wild pointer is determined;
From the stack information of the internal memory call function corresponding to the region of memory and region of memory for being recorded, really Determine the stack information of the region of memory pointed by wild pointer, obtain the function stack information of wild pointer.
In this specification, each embodiment is described by the way of progressive, and each embodiment is stressed The difference with other embodiment, between each embodiment identical similar portion mutually referring to. For device disclosed in embodiment, as which corresponds to the method disclosed in Example, so description It is fairly simple, related part is referring to method part illustration.
Professional further appreciates that, with reference to respectively showing for the embodiments described herein description The unit and algorithm steps of example, can with electronic hardware, computer software or the two be implemented in combination in, It is in order to clearly demonstrate the interchangeability of hardware and software, general according to function in the above description Describe the composition and step of each example.These functions actually with hardware or software mode performing, Depending on the application-specific and design constraint of technical scheme.Professional and technical personnel can be specific to each Application using different methods to realize described function, but this realize it is not considered that beyond this The scope of invention.
With reference to the embodiments described herein description method or directly can use the step of algorithm hardware, The software module of computing device, or the combination of the two is implementing.Software module can be placed in and deposit at random Reservoir (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electric erasable can Well known in programming ROM, depositor, hard disk, moveable magnetic disc, CD-ROM or technical field In any other form of storage medium.
The foregoing description of the disclosed embodiments, enables professional and technical personnel in the field to realize or use The present invention.Various modifications to these embodiments will be aobvious and easy for those skilled in the art See, generic principles defined herein can without departing from the spirit or scope of the present invention, Realize in other embodiments.Therefore, the present invention is not intended to be limited to the embodiments shown herein, And it is to fit to the most wide scope consistent with principles disclosed herein and features of novelty.

Claims (10)

1. a kind of function stack information of wild pointer determines method, it is characterised in that include:
Hook internal memory call function, when internal memory call function is called, to determine the stack of internal memory call function Information;
Determine the region of memory that internal memory call function is pointed to, region of memory and region of memory determined by record The stack information of corresponding internal memory call function;
When application crashes are caused by wild pointer, the region of memory pointed by wild pointer is determined;
From the stack information of the internal memory call function corresponding to the region of memory and region of memory for being recorded, really Determine the stack information of the region of memory pointed by wild pointer, obtain the function stack information of wild pointer.
2. the function stack information of wild pointer according to claim 1 determines method, it is characterised in that The hook internal memory call function includes:The internal memory call function of hook parent object.
3. the function stack information of wild pointer according to claim 1 determines method, it is characterised in that The hook internal memory call function includes:
Hook memory allocation function, when memory allocation function is called, to determine the stack of memory allocation function Information;And hook internal memory release function, when internal memory release function is called, to determine internal memory release function Stack information;
The stack information of the region of memory pointed by the determination wild pointer includes:
Determine the stack information of the memory allocation function of region of memory pointed by wild pointer, and internal memory release letter Several stack information.
4. the function stack information of the wild pointer according to any one of claim 1-3 determines method, and which is special Levy and be, it is described to cause the determination process of application crashes to include by wild pointer:
When application crashes, whether top layer function when analyzing application crashes is corresponding with preset function, if really Top layer function when determining application crashes is corresponding with preset function, it is determined that be by caused by wild pointer using collapsing Burst;
Or, when application crashes, abnormal keyword when analyzing application crashes whether with preset keyword pair Should, however, it is determined that abnormal keyword during application crashes is corresponding with preset keyword, it is determined that be by wild pointer Caused application crashes.
5. the function stack information of wild pointer according to claim 4 determines method, it is characterised in that Region of memory pointed by the determination wild pointer includes:
Caused by by wild pointer during application crashes, if top layer function is corresponding with preset function, from top layer The region of memory pointed by wild pointer is extracted in the corresponding depositor of function;
Or, caused by by wild pointer during application crashes, if abnormal keyword is corresponding with preset keyword, Region of memory wild pointer pointed by is parsed from the abnormal keyword then.
6. the function stack information of wild pointer according to claim 1 determines method, it is characterised in that Also include:
By the function stack information record of the wild pointer for obtaining in crash log.
7. the function stack information of wild pointer according to claim 6 determines method, it is characterised in that The function stack information of the wild pointer includes:The memory allocation function of the region of memory pointed by wild pointer Stack information, and the stack information of internal memory release function;
It is described that the function stack information record of the wild pointer for obtaining is included to crash log:
Using the function stack information of wild pointer as thread in crash log, to set line described in naming Journey, records the stack information of the memory allocation function of region of memory pointed by wild pointer under the thread, and Internal memory discharges the stack information of function.
8. function stack information determining means of a kind of wild pointer, it is characterised in that include:
Hook module, for hook internal memory call function, with when internal memory call function is called, it is determined that interior Deposit the stack information of call function;
Module is determined and recorded, for determining the region of memory of internal memory call function sensing, record is determined Region of memory and region of memory corresponding to internal memory call function stack information;
Collapse determining module, causes application crashes by wild pointer for determining;
Region of memory determining module is pointed to, for when application crashes are caused by wild pointer, determining wild pointer Pointed region of memory;
Stack information determination module, for adjusting from the internal memory corresponding to the region of memory and region of memory for being recorded With in the stack information of function, determine the stack information of the region of memory pointed by wild pointer, obtain wild pointer Function stack information.
9. function stack information determining means of wild pointer according to claim 8, it is characterised in that The hook module includes:
First hook unit, for hook memory allocation function, with when memory allocation function is called, really Determine the stack information of memory allocation function;
Second hook subelement, for hook internal memory discharge function, with call internal memory release function when, really Determine the stack information that internal memory discharges function;
The function stack information of the wild pointer includes:The Memory Allocation letter of the region of memory pointed by wild pointer Several stack information, and the stack information of internal memory release function;
Described device also includes:Logger module, remembers for the function stack information by the wild pointer for obtaining Record in crash log;
The logger module includes:Record performance element, in crash log by wild pointer Function stack information records wild pointer as thread under the thread to set thread described in naming The stack information of the memory allocation function of pointed region of memory, and the stack information of internal memory release function.
10. a kind of electronic equipment, it is characterised in that including the wild pointer described in any one of claim 8-9 Function stack information determining means.
CN201510618656.4A 2015-09-24 2015-09-24 Function stack information determination method and device of wild pointer and electronic equipment Active CN106557300B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510618656.4A CN106557300B (en) 2015-09-24 2015-09-24 Function stack information determination method and device of wild pointer and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510618656.4A CN106557300B (en) 2015-09-24 2015-09-24 Function stack information determination method and device of wild pointer and electronic equipment

Publications (2)

Publication Number Publication Date
CN106557300A true CN106557300A (en) 2017-04-05
CN106557300B CN106557300B (en) 2020-04-07

Family

ID=58415681

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510618656.4A Active CN106557300B (en) 2015-09-24 2015-09-24 Function stack information determination method and device of wild pointer and electronic equipment

Country Status (1)

Country Link
CN (1) CN106557300B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301095A (en) * 2017-06-14 2017-10-27 北京小度信息科技有限公司 System operation method and operating system
CN108762920A (en) * 2018-05-18 2018-11-06 四川斐讯信息技术有限公司 The determination of wild pointer and localization method in a kind of Dram
CN109376074A (en) * 2018-09-14 2019-02-22 浙江口碑网络技术有限公司 Obtain method and device, the storage medium, electronic device of log
CN111338864A (en) * 2020-02-18 2020-06-26 上海闻泰电子科技有限公司 Memory problem detection method and device, computer equipment and storage medium
CN111813663A (en) * 2020-06-19 2020-10-23 北京字节跳动网络技术有限公司 Pointer type identification method, device, medium and equipment
CN111813664A (en) * 2020-06-19 2020-10-23 北京字节跳动网络技术有限公司 Method, device, medium and equipment for collecting crash information
CN113535143A (en) * 2020-04-21 2021-10-22 腾讯科技(深圳)有限公司 Stack information processing method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101169752A (en) * 2007-11-26 2008-04-30 中兴通讯股份有限公司 Method for capturing function for resulting in memory rewriting by wild pointer
CN101515242A (en) * 2009-03-16 2009-08-26 中兴通讯股份有限公司 Method and system for searching and rewriting the task of internal memory
CN101788949A (en) * 2010-03-10 2010-07-28 中兴通讯股份有限公司 Method and device for realizing embedded type system function monitoring
CN102831068A (en) * 2011-06-13 2012-12-19 阿里巴巴集团控股有限公司 Memory operating record processing method and device
CN103678109A (en) * 2012-09-25 2014-03-26 腾讯科技(深圳)有限公司 Dump document analysis method, device and system
CN104346267A (en) * 2013-08-08 2015-02-11 腾讯科技(深圳)有限公司 Method and device for generating program bug positioning information

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101169752A (en) * 2007-11-26 2008-04-30 中兴通讯股份有限公司 Method for capturing function for resulting in memory rewriting by wild pointer
CN101515242A (en) * 2009-03-16 2009-08-26 中兴通讯股份有限公司 Method and system for searching and rewriting the task of internal memory
CN101788949A (en) * 2010-03-10 2010-07-28 中兴通讯股份有限公司 Method and device for realizing embedded type system function monitoring
CN102831068A (en) * 2011-06-13 2012-12-19 阿里巴巴集团控股有限公司 Memory operating record processing method and device
CN103678109A (en) * 2012-09-25 2014-03-26 腾讯科技(深圳)有限公司 Dump document analysis method, device and system
CN104346267A (en) * 2013-08-08 2015-02-11 腾讯科技(深圳)有限公司 Method and device for generating program bug positioning information

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301095A (en) * 2017-06-14 2017-10-27 北京小度信息科技有限公司 System operation method and operating system
CN108762920A (en) * 2018-05-18 2018-11-06 四川斐讯信息技术有限公司 The determination of wild pointer and localization method in a kind of Dram
CN109376074A (en) * 2018-09-14 2019-02-22 浙江口碑网络技术有限公司 Obtain method and device, the storage medium, electronic device of log
CN111338864A (en) * 2020-02-18 2020-06-26 上海闻泰电子科技有限公司 Memory problem detection method and device, computer equipment and storage medium
CN111338864B (en) * 2020-02-18 2023-08-18 上海闻泰电子科技有限公司 Memory problem detection method, device, computer equipment and storage medium
CN113535143A (en) * 2020-04-21 2021-10-22 腾讯科技(深圳)有限公司 Stack information processing method and device, electronic equipment and storage medium
CN111813663A (en) * 2020-06-19 2020-10-23 北京字节跳动网络技术有限公司 Pointer type identification method, device, medium and equipment
CN111813664A (en) * 2020-06-19 2020-10-23 北京字节跳动网络技术有限公司 Method, device, medium and equipment for collecting crash information
CN111813664B (en) * 2020-06-19 2024-02-13 北京字节跳动网络技术有限公司 Crash information collection method, device, medium and equipment
CN111813663B (en) * 2020-06-19 2024-03-22 北京字节跳动网络技术有限公司 Pointer type identification method, device, medium and equipment

Also Published As

Publication number Publication date
CN106557300B (en) 2020-04-07

Similar Documents

Publication Publication Date Title
CN106557300A (en) A kind of function stack information of wild pointer determines method, device and electronic equipment
US10567249B1 (en) Network path visualization using node grouping and pagination
CN107423070B (en) Page generation method and device
US10268690B2 (en) Identifying correlated content associated with an individual
CN109120794B (en) message display method and device and electronic equipment
WO2018212879A1 (en) Calendar range searching
CN107870860A (en) Bury a checking system and method
CN108399072A (en) Five application page update method and device
US8984030B2 (en) Journaling and integrity in mobile clouded collaborative spaces
CN105446827A (en) Data storage method and device for database at failure
CN107704604A (en) A kind of information persistence method, server and computer-readable recording medium
CN106528894A (en) Method and device for setting label information
CN110532107A (en) Interface call method, device, computer equipment and storage medium
CN109240769A (en) A kind of method and terminal device of start by set date application page
CN105573756B (en) A kind of script language extensions method and event bus framework
CN103685668B (en) Method and a system for quickly inputting contact persons in local address books
CN109118172A (en) Note based reminding method and device
US20160098440A1 (en) Validation of segmented data entries
EP3385872B1 (en) Anti-counterfeiting method, device, storage medium and apparatus based on invalid map data
US11620437B2 (en) Semantic correction of messages for groups
CN104951920A (en) Device and method for service interface processing
CN114173175A (en) Media resource playing method, device, equipment and storage medium
US20160098391A1 (en) Segmenting data with included separators
CN109284259A (en) File storage method, device, computer equipment and storage medium
CN107908516A (en) A kind of data display method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant