CN108932263B - Associated object tracking method and device - Google Patents

Associated object tracking method and device Download PDF

Info

Publication number
CN108932263B
CN108932263B CN201710383370.1A CN201710383370A CN108932263B CN 108932263 B CN108932263 B CN 108932263B CN 201710383370 A CN201710383370 A CN 201710383370A CN 108932263 B CN108932263 B CN 108932263B
Authority
CN
China
Prior art keywords
current
associated object
temporary
current object
strong reference
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710383370.1A
Other languages
Chinese (zh)
Other versions
CN108932263A (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 CN201710383370.1A priority Critical patent/CN108932263B/en
Publication of CN108932263A publication Critical patent/CN108932263A/en
Application granted granted Critical
Publication of CN108932263B publication Critical patent/CN108932263B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3005Arrangements for executing specific machine instructions to perform operations for flow control
    • G06F9/30069Instruction skipping instructions, e.g. SKIP

Abstract

The embodiment of the invention discloses a method for tracking an associated object, which comprises the following steps: calling an open source tool to dynamically modify a plurality of entry functions in an operating system bottom layer for realizing the associated objects; acquiring a current object, and adding a strong reference identifier into the current object; creating a temporary associated object corresponding to the current object through a plurality of entry functions; searching a key value corresponding to the temporary associated object from a preset associated object mapping table, and determining whether the key value exists in a hash storage table for storing the associated object; if yes, determining whether the strong reference identifier in the current object is transmitted into the temporary association object; and if the strong reference identifier in the current object is transmitted into the temporary associated object, determining that the temporary associated object is the strong reference associated object of the current object. The embodiment of the invention also discloses a related object tracking device. By adopting the embodiment of the invention, the efficiency of inquiring the associated object can be improved, and the accuracy of acquiring the associated object can be improved.

Description

Associated object tracking method and device
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method and an apparatus for tracking an associated object.
Background
In the mobile device operating system iOS, object-C is a set of Object-oriented languages, which have the characteristics of Object-oriented languages (encapsulation, inheritance and polymorphism), static languages, and dynamic characteristics (dynamic type, dynamic binding and dynamic loading). In order to improve the programming efficiency by using the Object-C language, the associated objects corresponding to the objects need to be queried and the reference relationship attributes of the objects need to be analyzed. However, the manual query and analysis of the object association attributes adopted in the prior art lead to low efficiency, and the associated object with strong reference cannot be accurately obtained.
Disclosure of Invention
The embodiment of the invention provides a method and a device for tracking a related object. The efficiency of inquiring the associated object can be improved, and the accuracy of acquiring the associated object can be improved.
The invention provides a method for tracking an associated object, which comprises the following steps:
calling an open source tool to dynamically modify a plurality of entry functions in an operating system bottom layer for realizing the associated objects;
acquiring a current object, and adding a strong reference identifier into the current object;
creating a temporary associated object corresponding to the current object through the plurality of entry functions;
searching a key value corresponding to the temporary associated object from a preset associated object mapping table, and determining whether the key value exists in a hash storage table for storing the associated object;
if yes, determining whether the strong reference identifier in the current object is transmitted into the temporary association object;
and if the strong reference identifier in the current object is transmitted into the temporary associated object, determining that the temporary associated object is the strong reference associated object of the current object.
Before creating the temporary associated object corresponding to the current object through the plurality of entry functions, the method further includes:
determining whether an associated object exists in the current object.
Wherein the determining whether the current object has an associated object comprises:
acquiring a structure body pointer of the current object, and searching a value of a target variable in the structure body pointer;
and determining whether the current object has a related object or not according to the value of the target variable.
Wherein the creating the temporary associated object corresponding to the current object by the plurality of entry functions includes:
acquiring a correlation object value corresponding to the current object;
judging whether the correlation object value is null or not;
and if the associated object value is not null, creating a temporary associated object corresponding to the current object through the plurality of entry functions.
Wherein the obtaining the current object comprises:
acquiring all objects, and adding the objects into an object message stack;
and popping all objects in the object message stack to acquire the current object.
Before the invoking the open source tool dynamically modifies the plurality of entry functions in the operating system bottom layer for implementing the associated object, the method further includes:
and acquiring a symbol table system of the bottom layer of the operating system, wherein the symbol table system comprises all the objects.
Accordingly, a second aspect of the present invention provides an associated object tracking apparatus, comprising:
the function modification module is used for calling an open source tool to dynamically modify a plurality of entry functions used for realizing the associated objects in the bottom layer of the operating system;
the object acquisition module is used for acquiring a current object and adding a strong reference identifier into the current object;
the object creating module is used for creating a temporary associated object corresponding to the current object through the plurality of entry functions;
an object determining module, configured to search a preset associated object mapping table for a key value corresponding to the temporary associated object, and determine whether the key value exists in a hash storage table used for storing the associated object;
an identification determination module, configured to determine whether the strong reference identifier in the current object is transmitted into the temporary association object if the strong reference identifier exists;
and the association determining module is used for determining that the temporary associated object is the strong reference associated object of the current object if the strong reference identifier in the current object is transmitted into the temporary associated object.
Wherein the content of the first and second substances,
the object determination module is further configured to determine whether an associated object exists in the current object.
Wherein the object determination module is specifically configured to:
acquiring a structure body pointer of the current object, and searching a value of a target variable in the structure body pointer;
and determining whether the current object has a related object or not according to the value of the target variable.
Wherein the object creation module is specifically configured to:
acquiring a correlation object value corresponding to the current object;
judging whether the correlation object value is null or not;
and if the associated object value is not null, creating a temporary associated object corresponding to the current object through the plurality of entry functions.
The object acquisition module is specifically configured to:
acquiring all objects, and adding the objects into an object message stack;
and popping all objects in the object message stack to acquire the current object.
The object obtaining module is further configured to obtain a symbol table system of the operating system bottom layer, where the symbol table system includes all the objects.
Accordingly, a third aspect of the present invention provides an associated object tracking apparatus, comprising an interface circuit, a memory and a processor, wherein the memory stores a set of program codes, and the processor is configured to call the program codes stored in the memory to perform the following operations:
calling an open source tool to dynamically modify a plurality of entry functions in an operating system bottom layer for realizing associated objects;
acquiring a current object, and adding a strong reference identifier into the current object;
creating a temporary associated object corresponding to the current object through the plurality of entry functions;
searching a key value corresponding to the temporary associated object from a preset associated object mapping table, and determining whether the key value exists in a hash storage table for storing the associated object;
if so, determining whether the strong reference identifier in the current object is transmitted into the temporary associated object;
and if the strong reference identifier in the current object is transmitted into the temporary associated object, determining that the temporary associated object is the strong reference associated object of the current object.
Yet another aspect of the present application provides a computer-readable storage medium having stored thereon a plurality of instructions adapted to be loaded by a processor and to perform the method of the above-described aspects.
Yet another aspect of the present application provides a computer program product containing instructions which, when run on a computer, cause the computer to perform the method of the above-described aspects.
In the embodiment of the invention, a plurality of entry functions for realizing the associated objects in the bottom layer of the operating system are dynamically modified by calling the open source tool, so that the implementation mode of redirecting the three entry functions is dynamically realized; and a strong reference identifier is added into the current object, the strong reference identifier realizes the thread safety strong reference judgment, and then the associated objects of all the objects are traversed, so that the efficiency and the accuracy of obtaining the associated objects of the strong reference are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for tracking an associated object according to an embodiment of the present invention;
fig. 2 is a schematic flowchart illustrating a tracking method for an associated object according to another embodiment of the present invention;
fig. 3 is a schematic structural diagram of an associated object apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an associated object apparatus according to another embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a method for tracking an associated object according to an embodiment of the present invention. As shown in the figure, the method in the embodiment of the present invention includes:
s101, calling an open source tool to dynamically modify a plurality of entry functions used for realizing associated objects in an operating system bottom layer.
In a specific implementation, when a program is started, an open source tool may be loaded first, where the open source tool may be fishook, and the fishook is an open source tool for dynamically modifying a linked Mach-O symbol table, where the Mach-O is an abbreviation of a Mach Object file format, and a file format of an executable file, object code, a dynamic library, or a kernel dump. And after the open source tool is loaded successfully, acquiring a symbol table system of the bottom layer of the operating system, wherein the symbol table system comprises all the objects, and the symbol table system also comprises a data type, a scope, a memory address and the like. And finally, calling an open source tool to dynamically modify a plurality of entry functions used for realizing the associated objects in the bottom layer of the operating system, thereby dynamically realizing the implementation mode of redirecting the plurality of entry functions.
Wherein the plurality of entry functions may include an obj _ setassassociatedobject, an obj _ removeAssociatedObject, and an obj _ getassassociatedobject. Wherein, the obj _ setAssatedObject is used to add the associated object to the object, and if nil is transmitted, the existing associated object can be removed; the obj _ removeAssociatedObjectt is used to remove all associated objects of an object; the obj _ getAssatedObject is used to obtain the associated object.
S102, obtaining a current object, and adding a strong reference identifier into the current object.
In a specific implementation, all objects may be obtained first, and all the objects are added to an object message stack; and then all the objects in the object message stack are popped to acquire the current object. Wherein the strong reference identifier may be ASSOCIATION _ SAFE.
Optionally, after the current object is obtained, it may be determined whether an associated object exists in the current object. Further, a structure pointer of the current object may be obtained, and a value of a target variable may be searched for in the structure pointer; and determining whether the current object has a related object or not according to the value of the target variable. For example, the isa _ t structure pointer of the a object may be first obtained, and then the value of the variable has _ assoc is searched for in the isa _ t structure pointer, if the value of the variable has _ assoc is false, it is proved that the object a has no associated object, and then the object is deleted, and if the value of the variable has _ assoc is true, it is proved that the object a has an associated object.
S103, creating a temporary associated object corresponding to the current object through the plurality of entry functions.
In specific implementation, a correlation object value corresponding to the current object may be obtained; judging whether the correlation object value is null or not; if the associated object value is not null, creating a temporary associated object corresponding to the current object through the plurality of entry functions, for example, creating a temporary associated object corresponding to the current object through the entry function obj _ setassocciatedobject, and if the associated object value is null, deleting the associated object.
S104, searching a key value corresponding to the temporary associated object from a preset associated object mapping table, and determining whether the key value exists in a hash storage table for storing the associated object.
In specific implementation, a retain operation may be performed on the associated object to obtain the hash storage table, where the retain operation is a mode of applying for a memory, and the reference count is incremented by 1. The hash storage table is a data structure directly accessed according to a key value, and the associated object mapping table comprises a plurality of corresponding relations between the associated object and the key value. And if the key value is determined not to exist in the hash storage table for storing the associated object, the current object has no associated object.
S105, if the strong reference identifier exists, determining whether the strong reference identifier in the current object is transmitted into the temporary associated object.
In a specific implementation, it may be determined whether a strong reference identifier ASSOCIATION _ SAFE exists in the temporary ASSOCIATION object, if so, it is determined that the strong reference identifier in the current object is transferred into the temporary ASSOCIATION object, and if not, it is determined that the strong reference identifier in the current object is not transferred into the temporary ASSOCIATION object, and the temporary ASSOCIATION object is not a strong reference ASSOCIATION object of the current object, and is deleted.
It should be noted that if the object a and the object B have an association relationship, the strong reference identifier in the object a will be transmitted into the object B when the function call is performed, and if the object a and the object B have no association relationship, the strong reference identifier in the object a will not be transmitted into the object B.
S106, if the strong reference identifier in the current object is determined to be transmitted into the temporary associated object, the temporary associated object is determined to be the strong reference associated object of the current object, wherein the strong reference associated object cannot be released, and even if the memory space is insufficient, the virtual machine throws an OutOfMemoryError error to cause the program to be abnormally terminated, the object with the strong reference cannot be randomly recycled.
Optionally, after the associated object corresponding to the current object is obtained, the process may jump to S102, and continue to obtain other objects from the object message stack for analysis.
In the embodiment of the invention, a plurality of entry functions for realizing the associated objects in the bottom layer of the operating system are dynamically modified by calling the open source tool, so that the realization mode of redirecting the three entry functions is dynamically realized; and a strong reference identifier is added into the current object, the strong reference identifier realizes the thread-safe strong reference judgment, and then the associated objects of all the objects are traversed, so that the efficiency and the accuracy of obtaining the associated objects of the strong reference are improved.
Referring to fig. 2, fig. 2 is a schematic flow chart illustrating a method for tracking an associated object according to another embodiment of the present invention. As shown in the figure, the method in the embodiment of the present invention includes:
s201, loading an open source tool architecture, and acquiring a symbol table system at the bottom layer of an operating system.
The open source tool can be a fisherhook which is an open source tool for dynamically modifying a linked Mach-O symbol table, wherein the Mach-O is an abbreviation of a Mach Object file format, the file format of an executable file, object code, a dynamic library or a kernel dump, and a symbol table system comprises all objects.
S202, calling the open source tool to dynamically modify a plurality of entry functions used for realizing the associated objects in the bottom layer of the operating system.
Wherein the plurality of entry functions may include an obj _ setassailatedobject, an obj _ removeassailatedobject, and an obj _ getassailatedobject. Wherein, the obj _ setassiatedobject is used to add the associated object to the object, and if nil is transmitted, the existing associated object can be removed; the obj _ removeAssociatedObjectt is used to remove all associated objects of an object; the obj c _ getAssatedObject is used to obtain the associated object.
S203, all objects are obtained and added into the object message stack.
S204, popping all objects in the object message stack, acquiring the current object, and adding a strong reference identifier into the current object, wherein the strong reference identifier may be ASSOCIATION _ SAFE.
S205, obtaining the structure body pointer of the current object, and searching the value of the target variable in the structure body pointer.
S206, determining whether the current object has a related object according to the value of the target variable.
For example, the isa _ t structure pointer of the a object may be obtained first, then the value of the variable has _ assoc is looked up in the isa _ t structure pointer, if the value of the variable has _ assoc is false, the object a is proved to have no associated object, then the object is deleted, and if the value of the variable has _ assoc is true, the object a is proved to have an associated object.
And S207, if the value of the target variable is false, deleting the current object.
And S208, if the value of the target variable is true, acquiring an associated object value corresponding to the current object.
S209, judging whether the correlation object value is null.
And S210, if the associated object value is null, deleting the associated object.
And S211, if the associated object value is not null, creating a temporary associated object corresponding to the current object.
S212, searching a preset associated object mapping table for a key value corresponding to the temporary associated object. The associated object mapping table comprises a plurality of corresponding relations between the associated objects and key values.
S213, determine whether the key exists in the hash storage table.
Specifically, a retain operation may be performed on the associated object to obtain the hash storage table, where the retain operation is a mode of applying for a memory, the reference count is incremented by 1, and the hash storage table is a data structure directly accessed according to a key value.
S214, if the key value does not exist in the hash storage table, it indicates that there is no associated object.
S215, if the key value exists in the hash storage table, determining whether the strong reference identifier in the current object is transmitted into the temporary associated object.
In a specific implementation, it may be determined whether a strong reference identifier ASSOCIATION _ SAFE exists in the temporary ASSOCIATION object, and if so, it is determined that the strong reference identifier in the current object is transferred into the temporary ASSOCIATION object, and if not, it is determined that the strong reference identifier in the current object is not transferred into the temporary ASSOCIATION object.
It should be noted that if there is an association relationship between the object a and the object B, the strong reference identifier in the object a will be transmitted to the object B when the function call is performed, and if there is no association relationship between the object a and the object B, the strong reference identifier in the object a will not be transmitted to the object B.
S216, if the strong reference identifier in the current object is not transmitted into the temporary associated object, the associated object is deleted.
S217, if the strong reference identifier in the current object is transmitted into the temporary associated object, storing the associated object, and jumping to S204 to continue to acquire other objects from the object message stack for analysis.
In the embodiment of the invention, a plurality of entry functions for realizing the associated objects in the bottom layer of the operating system are dynamically modified by calling the open source tool, so that the realization mode of redirecting the three entry functions is dynamically realized; and a strong reference identifier is added into the current object, the strong reference identifier realizes the thread-safe strong reference judgment, and then the associated objects of all the objects are traversed, so that the efficiency and the accuracy of obtaining the associated objects of the strong reference are improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an associated object tracking apparatus according to an embodiment of the present invention. As shown in the figures, the apparatus in the embodiment of the present invention includes:
and the function modification module 301 is used for calling the open-source tool to dynamically modify a plurality of entry functions for realizing the associated objects in the bottom layer of the operating system.
In a specific implementation, when a program is started, an open source tool may be loaded first, where the open source tool may be a fishook, and the fishook is an open source tool for dynamically modifying a linked Mach-O symbol table, where the Mach-O is an abbreviation of a Mach Object file format, and is a file format of an executable file, object code, a dynamic library, or a kernel dump. And after the open source tool is loaded successfully, acquiring a symbol table system of the bottom layer of the operating system, wherein the symbol table system comprises all the objects, and the symbol table system also comprises a data type, a scope, a memory address and the like. And finally, calling an open source tool to dynamically modify a plurality of entry functions used for realizing the associated objects in the bottom layer of the operating system, thereby dynamically realizing the implementation mode of redirecting the plurality of entry functions.
Wherein the plurality of entry functions may include an obj _ setassassociatedobject, an obj _ removeAssociatedObject, and an obj _ getassassociatedobject. Wherein, the obj _ setassiatedobject is used to add the associated object to the object, and if nil is transmitted, the existing associated object can be removed; the obj _ removeAssociatedObjectt is used to remove all associated objects of an object; the obj c _ getAssatedObject is used to obtain the associated object.
An object obtaining module 302, configured to obtain a current object, and add a strong reference identifier to the current object.
In specific implementation, all objects can be obtained first, and all the objects are added into an object message stack; and then all the objects in the object message stack are popped to acquire the current object. Wherein the strong reference identifier may be ASSOCIATION _ SAFE.
Optionally, after the current object is obtained, it may be determined whether an associated object exists in the current object. Further, a structure pointer of the current object may be obtained, and a value of a target variable may be searched for in the structure pointer; and determining whether the current object has a related object or not according to the value of the target variable. For example, the isa _ t structure pointer of the a object may be obtained first, then the value of the variable has _ assoc is looked up in the isa _ t structure pointer, if the value of the variable has _ assoc is false, the object a is proved to have no associated object, then the object is deleted, and if the value of the variable has _ assoc is true, the object a is proved to have an associated object.
An object creating module 303, configured to create a temporary associated object corresponding to the current object through the plurality of entry functions.
In specific implementation, an associated object value corresponding to the current object may be obtained; judging whether the correlation object value is null or not; if the associated object value is not null, creating a temporary associated object corresponding to the current object through the plurality of entry functions, for example, creating a temporary associated object corresponding to the current object through the entry function obj _ setassocciatedobject, and if the associated object value is null, deleting the associated object.
An object determining module 304, configured to search a preset associated object mapping table for a key value corresponding to the temporary associated object, and determine whether the key value exists in a hash storage table used for storing the associated object.
In specific implementation, a retain operation may be performed on the associated object to obtain the hash storage table, where the retain operation is a mode of applying for a memory, and the reference count is incremented by 1. The hash storage table is a data structure directly accessed according to a key value, and the associated object mapping table comprises a plurality of corresponding relations between the associated object and the key value. And if the key value is determined not to exist in the hash storage table for storing the associated object, the current object has no associated object.
An identification determination module 305, configured to determine whether the strong reference identifier in the current object is transferred into the temporarily associated object, if any.
In a specific implementation, it may be determined whether a strong reference identifier ASSOCIATION _ SAFE exists in the temporary ASSOCIATION object, if so, it is determined that the strong reference identifier in the current object is transferred into the temporary ASSOCIATION object, and if not, it is determined that the strong reference identifier in the current object is not transferred into the temporary ASSOCIATION object, and the temporary ASSOCIATION object is not a strong reference ASSOCIATION object of the current object, and is deleted.
It should be noted that if there is an association relationship between the object a and the object B, the strong reference identifier in the object a will be transmitted to the object B when the function call is performed, and if there is no association relationship between the object a and the object B, the strong reference identifier in the object a will not be transmitted to the object B.
An association determining module 306, configured to determine that the temporary associated object is a strong reference associated object of the current object if it is determined that the strong reference identifier in the current object is transmitted into the temporary associated object. The strong reference associated object cannot be released, and even if the virtual machine throws an outofmemoryreror error to cause the abnormal termination of the program when the memory space is insufficient, the object with the strong reference cannot be randomly recycled.
In a specific implementation, after the associated object corresponding to the current object is obtained, the method may jump to the object obtaining module 302, and continue to obtain other objects from the object message stack for analysis.
In the embodiment of the invention, a plurality of entry functions for realizing the associated objects in the bottom layer of the operating system are dynamically modified by calling the open source tool, so that the realization mode of redirecting the three entry functions is dynamically realized; and a strong reference identifier is added into the current object, the strong reference identifier realizes the thread safety strong reference judgment, and then the associated objects of all the objects are traversed, so that the efficiency and the accuracy of obtaining the associated objects of the strong reference are improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an associated object tracking apparatus according to another embodiment of the present invention. As shown, the apparatus may include: at least one processor 401, e.g., a CPU, at least one communication interface 402, at least one memory 403, at least one bus 404. Bus 404 is used to enable, among other things, connectivity communications between these components. The communication interface 402 of the apparatus in the embodiment of the present invention is a wired transmission port, and may also be a wireless device, for example, including an antenna apparatus, for performing signaling or data communication with other node devices. The memory 403 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 403 may optionally be at least one storage device located remotely from the processor 401. A set of program codes is stored in the memory 403 and the processor 401 is used to call the program codes stored in the memory for performing the following operations:
calling an open source tool to dynamically modify a plurality of entry functions in an operating system bottom layer for realizing the associated objects;
acquiring a current object, and adding a strong reference identifier into the current object;
creating a temporary associated object corresponding to the current object through the plurality of entry functions;
searching a key value corresponding to the temporary associated object from a preset associated object mapping table, and determining whether the key value exists in a hash storage table for storing the associated object;
if so, determining whether the strong reference identifier in the current object is transmitted into the temporary associated object;
and if the strong reference identifier in the current object is transmitted into the temporary associated object, determining that the temporary associated object is the strong reference associated object of the current object.
Wherein, the processor 401 is further configured to execute the following operation steps:
determining whether an associated object exists for the current object.
Wherein, the processor 401 is further configured to execute the following operation steps:
acquiring a structure body pointer of the current object, and searching a value of a target variable in the structure body pointer;
and determining whether the current object has a related object or not according to the value of the target variable.
Wherein, the processor 401 is further configured to perform the following operation steps:
acquiring a correlation object value corresponding to the current object;
judging whether the correlation object value is null or not;
and if the associated object value is not null, creating a temporary associated object corresponding to the current object through the plurality of entry functions.
Wherein, the processor 401 is further configured to perform the following operation steps:
acquiring all objects, and adding the objects into an object message stack;
and popping all objects in the object message stack to acquire the current object.
Wherein, the processor 401 is further configured to perform the following operation steps:
and acquiring a symbol table system of the bottom layer of the operating system, wherein the symbol table system comprises all the objects.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It should be noted that, for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts or combinations, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art will appreciate that the embodiments described in this specification are presently preferred and that no acts or modules are required by the invention.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
The content downloading method, the related device and the system provided by the embodiment of the present invention are described in detail above, and a specific example is applied in the text to explain the principle and the embodiment of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (12)

1. A method for tracking an associated object, the method comprising:
calling an open source tool to dynamically modify a plurality of entry functions in an operating system bottom layer for realizing the associated objects;
acquiring a current object, and adding a strong reference identifier into the current object;
acquiring an associated object value corresponding to the current object, and if the associated object value is not empty, creating a temporary associated object corresponding to the current object through the plurality of entry functions;
searching a key value corresponding to the temporary associated object from a preset associated object mapping table, and determining whether the key value exists in a hash storage table for storing the associated object;
if the strong reference identifier exists, determining whether the strong reference identifier in the current object is transmitted into the temporary associated object, wherein if the current object and the temporary associated object have an association relationship, the strong reference identifier in the current object is transmitted into the temporary associated object when function calling is carried out;
and if the strong reference identifier in the current object is transmitted into the temporary associated object, determining that the temporary associated object is the strong reference associated object of the current object.
2. The method of claim 1, wherein before creating the temporary associated object corresponding to the current object through the plurality of entry functions, further comprising:
determining whether an associated object exists in the current object.
3. The method of claim 2, wherein the determining whether the current object has an associated object comprises:
acquiring a structure body pointer of the current object, and searching a value of a target variable in the structure body pointer;
and determining whether the current object has a related object or not according to the value of the target variable.
4. The method of claim 1, wherein the obtaining the current object comprises:
acquiring all objects, and adding the objects into an object message stack;
and popping all objects in the object message stack to acquire the current object.
5. The method of claim 4, wherein prior to the calling the open-source utility dynamically modifying the plurality of entry functions in the operating system infrastructure for implementing the associated object, further comprising:
and acquiring a symbol table system of the bottom layer of the operating system, wherein the symbol table system comprises all the objects, and all the objects comprise the current object.
6. An associated object tracking apparatus, the apparatus comprising:
the function modification module is used for calling an open source tool to dynamically modify a plurality of entry functions used for realizing the associated objects in the bottom layer of the operating system;
the object acquisition module is used for acquiring a current object and adding a strong reference identifier into the current object;
an object creating module, configured to obtain an associated object value corresponding to the current object, and if the associated object value is not null, create a temporary associated object corresponding to the current object through the plurality of entry functions;
an object determining module, configured to search a preset associated object mapping table for a key value corresponding to the temporary associated object, and determine whether the key value exists in a hash storage table used for storing the associated object;
the identification determining module is used for determining whether the strong reference identifier in the current object is transmitted into the temporary associated object or not if the strong reference identifier in the current object exists, wherein if the current object and the temporary associated object have an association relationship, the strong reference identifier in the current object is transmitted into the temporary associated object when function calling is carried out;
and the association determining module is used for determining that the temporary associated object is the strong reference associated object of the current object if the strong reference identifier in the current object is transmitted into the temporary associated object.
7. The apparatus of claim 6,
the object determination module is further configured to determine whether an associated object exists in the current object.
8. The apparatus of claim 7, wherein the object determination module is specifically configured to:
acquiring a structure body pointer of the current object, and searching a value of a target variable in the structure body pointer;
and determining whether the current object has a related object or not according to the value of the target variable.
9. The apparatus of claim 6, wherein the object acquisition module is specifically configured to:
acquiring all objects, and adding the objects into an object message stack;
and popping all objects in the object message stack to acquire the current object.
10. The apparatus of claim 9, wherein the object acquisition module is further configured to acquire a symbol table system underlying the operating system, the symbol table system including the all objects, the all objects including the current object.
11. An associated object tracking apparatus, comprising an interface circuit, a memory, and a processor, wherein the memory stores a set of program code, and wherein the processor is configured to call the program code stored in the memory to perform the following:
calling an open source tool to dynamically modify a plurality of entry functions in an operating system bottom layer for realizing associated objects;
acquiring a current object, and adding a strong reference identifier into the current object;
acquiring an associated object value corresponding to the current object, and if the associated object value is not empty, creating a temporary associated object corresponding to the current object through the plurality of entry functions;
searching a key value corresponding to the temporary associated object from a preset associated object mapping table, and determining whether the key value exists in a hash storage table for storing the associated object;
if the strong reference identifier exists, determining whether the strong reference identifier in the current object is transmitted into the temporary associated object, wherein if the current object and the temporary associated object have an association relationship, the strong reference identifier in the current object is transmitted into the temporary associated object when function calling is carried out;
and if the strong reference identifier in the current object is transmitted into the temporary associated object, determining that the temporary associated object is the strong reference associated object of the current object.
12. A computer-readable storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to perform the method according to any one of claims 1 to 5.
CN201710383370.1A 2017-05-26 2017-05-26 Associated object tracking method and device Active CN108932263B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710383370.1A CN108932263B (en) 2017-05-26 2017-05-26 Associated object tracking method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710383370.1A CN108932263B (en) 2017-05-26 2017-05-26 Associated object tracking method and device

Publications (2)

Publication Number Publication Date
CN108932263A CN108932263A (en) 2018-12-04
CN108932263B true CN108932263B (en) 2023-01-10

Family

ID=64451568

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710383370.1A Active CN108932263B (en) 2017-05-26 2017-05-26 Associated object tracking method and device

Country Status (1)

Country Link
CN (1) CN108932263B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015006798A1 (en) * 2013-07-15 2015-01-22 Cocoon Data Holdings Limited Secure data object generation and management
CN104317795A (en) * 2014-08-28 2015-01-28 华为技术有限公司 Two-dimensional filter generation method, query method and device
CN105808399A (en) * 2016-03-14 2016-07-27 百度在线网络技术(北京)有限公司 Method and device for remote debugging

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8626795B2 (en) * 2010-11-05 2014-01-07 Apple Inc. Dynamic data association

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015006798A1 (en) * 2013-07-15 2015-01-22 Cocoon Data Holdings Limited Secure data object generation and management
CN104317795A (en) * 2014-08-28 2015-01-28 华为技术有限公司 Two-dimensional filter generation method, query method and device
WO2016029664A1 (en) * 2014-08-28 2016-03-03 华为技术有限公司 Two-dimensional filter generation method, query method and device
CN105808399A (en) * 2016-03-14 2016-07-27 百度在线网络技术(北京)有限公司 Method and device for remote debugging

Also Published As

Publication number Publication date
CN108932263A (en) 2018-12-04

Similar Documents

Publication Publication Date Title
CN109558525B (en) Test data set generation method, device, equipment and storage medium
CN108279940B (en) Module loading method and device in web container
WO2020177429A1 (en) Method and apparatus for embedding codes in application, and electronic device
CN115562992A (en) File detection method and device, electronic equipment and storage medium
US20170249143A1 (en) Detecting open source components built into mobile applications
CN111124480A (en) Application package generation method and device, electronic equipment and storage medium
CN111045698A (en) Redundant picture deleting method and device, electronic equipment and storage medium
CN112286706B (en) Remote and rapid acquisition method for application information of android application and related equipment
CN106156050B (en) Data processing method and device
CN112612489B (en) Method and device for constructing upgrade package of software and electronic equipment
US9575750B2 (en) Generic annotation seeker
WO2019041891A1 (en) Method and device for generating upgrade package
CN110442353B (en) Installation package management method and device and electronic equipment
CN108932263B (en) Associated object tracking method and device
CN115080114B (en) Application program transplanting processing method, device and medium
CN110941443A (en) Method and device for modifying file name in SDK and electronic equipment
CN111045746A (en) Code expansion method and framework
CN114625373A (en) Application conversion method and device, electronic equipment and storage medium
CN112835609A (en) Method and device for modifying dependent package download address
CN114579520B (en) Mirror image data processing method, mirror image data loading method and device
CN111562940B (en) Project data construction method and device
CN113709154B (en) Browser security processing method and device, computer equipment and storage medium
CN117056030B (en) Method and device for determining escape of container
CN114629954B (en) Content distribution method, system, device and storage medium
CN109918895B (en) Method, electronic device, and computer-readable medium for outputting data

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