CN110688245B - Information acquisition method, device, storage medium and equipment - Google Patents

Information acquisition method, device, storage medium and equipment Download PDF

Info

Publication number
CN110688245B
CN110688245B CN201910951262.9A CN201910951262A CN110688245B CN 110688245 B CN110688245 B CN 110688245B CN 201910951262 A CN201910951262 A CN 201910951262A CN 110688245 B CN110688245 B CN 110688245B
Authority
CN
China
Prior art keywords
information
preset
system function
application program
output stream
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
CN201910951262.9A
Other languages
Chinese (zh)
Other versions
CN110688245A (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.)
Bigo Technology Singapore Pte Ltd
Original Assignee
Guangzhou Baiguoyuan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Baiguoyuan Information Technology Co Ltd filed Critical Guangzhou Baiguoyuan Information Technology Co Ltd
Priority to CN201910951262.9A priority Critical patent/CN110688245B/en
Publication of CN110688245A publication Critical patent/CN110688245A/en
Application granted granted Critical
Publication of CN110688245B publication Critical patent/CN110688245B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging

Abstract

The embodiment of the invention discloses an information acquisition method, an information acquisition device, a storage medium and information acquisition equipment. Wherein the method comprises the following steps: when the preset application program is detected to enter a preset blocking state, a pointer of a first system function of a running time object is obtained, wherein the first system function comprises a function for backing up running time information when an application program unresponsive event occurs, the running time object calls the first system function and transmits an output stream into the first system function, and information contained in the output stream is obtained to obtain blocking context information. According to the technical scheme provided by the embodiment of the invention, when the application program is detected to be blocked, the blocking context information is acquired by calling the function called by the system when the unresponsive event of the application program occurs, so that the system limit can be broken through, the more comprehensive blocking context information can be acquired, and the accurate positioning and the blocking problem solving are facilitated.

Description

Information acquisition method, device, storage medium and equipment
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to an information acquisition method, an information acquisition device, a storage medium and information acquisition equipment.
Background
At present, the intelligent terminal has become a necessary electronic device in the daily life of most users. Along with the rapid development of intelligent terminal technology and the internet, functions in the intelligent terminal are more and more perfect, various application programs can be installed, and functions realized by the application programs are more and more complex.
In the use process of the intelligent terminal, the fluency of the application program is one of key performances focused by a user, and the complexity of the application program has higher and higher requirements on hardware resources, so that the application program is easy to be blocked or even unresponsive on the intelligent terminal, and the user experience is seriously affected. In order to reduce the occurrence of the application program jamming as much as possible, it is necessary to acquire and analyze the relevant information when the application program jamming occurs, however, in the related art, the acquired information is not comprehensive and needs to be improved.
Disclosure of Invention
The embodiment of the invention provides an information acquisition method, an information acquisition device, a storage medium and information acquisition equipment, which can optimize a scheme for acquiring relevant information when an application program is blocked.
In a first aspect, an embodiment of the present invention provides an information acquisition method, including:
when the preset application program is detected to enter a preset blocking state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program unresponsive event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
and acquiring information contained in the output stream to obtain the katon context information.
In a second aspect, an embodiment of the present invention provides an information acquisition apparatus, including:
the function pointer acquisition module is used for acquiring a pointer of a first system function of a runtime object when the preset application program is detected to enter a preset katon state, wherein the first system function comprises a function for backing up runtime information when an application program unresponsive event occurs;
the function calling module is used for calling the first system function through the runtime object and transmitting an output stream into the first system function;
and the information acquisition module is used for acquiring the information contained in the output stream so as to obtain the katon context information.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements an information acquisition method as provided by the embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention provides an intelligent terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements an information obtaining method provided in the embodiment of the present invention when executing the computer program.
According to the information acquisition scheme provided by the embodiment of the invention, when the preset application program is detected to enter the preset katon state, the pointer of the first system function of the running object is acquired, wherein the first system function comprises a function for backing up the running information when an unresponsive event of the application program occurs, the first system function is called through the running object, an output stream is transmitted into the first system function, and the information contained in the output stream is acquired so as to obtain katon context information. By adopting the technical scheme, when the application program is detected to be blocked, the blocking context information is acquired by calling the function called by the system when the application program does not respond to the event, so that the system limit can be broken through, the more comprehensive blocking context information can be acquired, and the accurate positioning and the blocking problem solving are facilitated.
Drawings
Fig. 1 is a flow chart of an information obtaining method according to a first embodiment of the present invention;
fig. 2 is a flow chart of an information obtaining method according to a second embodiment of the present invention;
fig. 3 is a flow chart of an information obtaining method according to a third embodiment of the present invention;
fig. 4 is a flowchart of an information obtaining method for a high-version operating system according to a third embodiment of the present invention;
fig. 5 is a flowchart of an information obtaining method for a low-version operating system according to a third embodiment of the present invention;
fig. 6 is a block diagram of an information acquisition device according to a fourth embodiment of the present invention;
fig. 7 is a block diagram of an intelligent terminal device according to a sixth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings. Furthermore, embodiments of the invention and features of the embodiments may be combined with each other without conflict.
Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts steps as a sequential process, many of the steps may be implemented in parallel, concurrently, or with other steps. Furthermore, the order of the steps may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example 1
Fig. 1 is a flow chart of an information acquisition method according to an embodiment of the present invention, where the method may be performed by an information acquisition device, where the device may be implemented by software and/or hardware, and may be generally integrated in an intelligent terminal device. As shown in fig. 1, the method includes:
step 101, when a preset application program is detected to enter a preset clamping state, a pointer of a first system function of a runtime object is obtained, wherein the first system function comprises a function for backing up runtime information when an application program unresponsive event occurs.
By way of example, smart terminal devices may include smart phones, tablet computers, notebook computers, and smart appliances, among others, that are capable of hosting an operating system. The type of the operating system loaded in the intelligent terminal equipment is not limited, and for example, the operating system can be an Android operating system, a window (Windows) operating system, a Linux operating system and the like.
The preset application program may include any one of application programs installed in the smart terminal device, or may include a preset partial application program, for example. The technical scheme provided by the embodiment of the invention can be realized by utilizing a software development kit (Software Development Kit, SDK), an application program developer writes the SDK, and the SDK is accessed into a preset application program, so that the related functions of the technical scheme of the embodiment of the invention are realized in the SDK.
The preset click state may be a state in which an abnormal condition occurs in the interface display of the preset application program, and generally, for a display effect, the display may be that the user interface is switched to be stagnant, slow or skip, the user interface cannot be matched with sound, a phenomenon that a smear occurs in the content of the user interface, and the like, and an index for evaluating the click state may be set according to actual requirements. Alternatively, the stuck state may be evaluated based on a frame rate of the application program, for example, a frame rate of a preset application program in a running process is obtained, and when the current frame rate is detected to be smaller than a preset frame rate threshold, it is determined that the preset application program is detected to enter the preset stuck state. The preset frame rate threshold may be freely set, for example, it may be 30Hz, i.e. 30 frames per second. In addition, the stuck state can be judged according to the drawing time of the picture, the drawing interval of two adjacent frames of pictures, other items and the like.
In the related art, when the application program is blocked, the context information of the main thread of the application program can be obtained through the exposed interface, but the information is not enough for analyzing and solving the blocking problem. In addition, when an unresponsive (Application Not Responding, ANR) event occurs in the application program, a trace file, such as a trace file in the Android system, is generated in the operating system, and relevant information of the current process when the ANR occurs, such as a stack of the current process and some state information of the current virtual machine, is recorded in the trace file to form trace information. However, the application program in the intelligent terminal device, especially the third party application program, has no read-write authority of the file, and therefore, the related information in the trace back file cannot be obtained for analyzing and locating the stuck problem.
According to the embodiment of the invention, when the preset application program is blocked, the limitation of the system on the application program is broken through, and the trace information collection scene when the ANR occurs is simulated, so that the blocking context information is obtained more comprehensively, and the method is used for helping the preset application program to solve the blocking problem in a targeted manner. When the preset application program is detected to enter a preset clamping state, a pointer of a first system function of a run-time (run) object is obtained so as to call the first system function later. The first system function includes a function for backing up (dump) runtime information when an application unresponsive event occurs, and in the Android system, the first system function is a dumpforsigquery function. For convenience of explanation, an Android system will be described below as an example.
For example, a Native (Native) method may be pre-written, a call of a Java Native interface (Java Native Interface, JNI) layer may be made by calling the Native method, and then a pointer to the first system function may be obtained. Specifically, a first dynamic link library may be opened, and a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object may be obtained. The first dynamic link library may be, for example, a libart. So dynamic link library, which may be opened by a dlopen function, and a handle is returned to the dlsym function, where the handle may include an address of the libart. So dynamic link library. The pointer to the system unique run time object is obtained by a dlsym function that can access a symbol (symbol) table to obtain the pointer to the run time object. After the pointer to the Runtime object is obtained, the pointer to the DumpForSigQuit function of the Runtime object may continue to be obtained by the dlsym function.
Step 102, calling the first system function through the runtime object, and transmitting an output stream into the first system function.
By way of example, by calling the first system function, the system when the application program generates the ANR event can be simulated to obtain the related information of the current process, namely trace information, by calling the first system function. The output stream may be regarded as an output channel, and the output stream may be a byte output stream or a character output stream, such as OutputStream, writer or OutputStreamWriter, etc. By introducing the output stream into the first system function, the trace information obtained by calling the first system function can be written into the output stream.
Step 103, obtaining information contained in the output stream to obtain the katon context information.
For example, the katon context information may include relevant information for analyzing katon, such as may include Java layer stack information, kernel (Kernel) stack information, native stack information, and other relevant information. Stack call information may be included in the stack information, such as attribute information (e.g., number) of the called stack, the location of the call, the time of the call, and so forth. The stuck context information may be obtained by obtaining information contained in the output stream, from the trace information obtained by calling the first system function.
According to the information acquisition method provided by the embodiment of the invention, when the preset application program is detected to enter the preset katon state, the pointer of the first system function of the running object is acquired, wherein the first system function comprises a function for backing up the running information when an unresponsive event of the application program occurs, the first system function is called through the running object, an output stream is transmitted into the first system function, and the information contained in the output stream is acquired so as to obtain katon context information. By adopting the technical scheme, when the application program is detected to be blocked, the blocking context information is acquired by calling the function called by the system when the application program does not respond to the event, so that the system limit can be broken through, the more comprehensive blocking context information can be acquired, and the accurate positioning and the blocking problem solving are facilitated.
Based on the foregoing embodiment, the degree of blocking corresponding to the preset blocking state may be lower than the degree of blocking corresponding to the occurrence of the application unresponsive event. The method and the device have the advantages that as the degree of the blocking is serious when the unresponsive event of the application program occurs, and the blocking context information can be obtained through the technical scheme provided by the embodiment of the invention when the degree of the blocking is not serious, the process of obtaining trace information when the ANR event occurs is simulated in advance, the blocking context information is further obtained, the blocking problems of different degrees can be analyzed in a targeted manner, and the blocking problems of the application program can be more comprehensively solved.
On the basis of the above embodiment, after obtaining the katon context information, the method further includes: writing the katon context information into a preset local file, and/or reporting the context information. The advantage of setting up like this is that can in time preserve or report the card context information that obtains, the developer of being convenient for carries out the analysis to the card problem. The preset local file may be a newly created local file or an existing local file, which is not limited in the embodiment of the present invention. After the katon context information is obtained, the katon context information can be written into a preset local file, a preset application program has the authority of reading the preset local file, the preset local file can be read when the katon context information is needed to be used, for example, a background server corresponding to the preset application program can read the preset local file through the preset application program, and further the katon context information when the preset application program is katon is obtained. After the katon context information is obtained, the katon context information can be directly reported, for example, the katon context information is reported to a background server corresponding to a preset application program, and a developer can timely analyze the katon problem according to the reported katon context information and solve the katon problem. In addition, after the katon context information is obtained, the katon context information can be written into a preset local file, and then the preset local file is reported, so that the purpose of reporting the katon context information is achieved.
Example two
Fig. 2 is a schematic flow chart of an information obtaining method according to a second embodiment of the present invention, wherein optimization is performed on the basis of the above embodiment, and related steps of creating a sub-process and obtaining katon context information by using the sub-process are added.
Illustratively, when the preset application program is detected to be blocked, acquiring a pointer of a first system function of the runtime object, including: when the occurrence of a pause of a preset application program is detected, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process, and acquiring a pointer of a first system function of an object in running by using the child process. The calling the first system function through the runtime object and transmitting an output stream into the first system function comprises the following steps: and calling the first system function through the runtime object by utilizing the subprocess, and transmitting an output stream into the first system function. The obtaining information contained in the output stream to obtain the katon context information includes: acquiring information contained in the output stream by using the child process, and acquiring stack information of preset types of all threads of the parent process by using the child process; and obtaining the katon context information according to the information contained in the output stream and the stack information of the preset type. The multi-process scheme can effectively reduce or even avoid negative effects, such as crashing or secondary cartoon, on the preset application program.
Further, after the katon context information is obtained according to the information contained in the output stream and the preset type of stack information, the method may further include: and transmitting the cartoon context information to the parent process by utilizing a child process through a cross-process communication mode. The setting has the advantages that the cartoon context information is transmitted to the father process, and the father process can report the cartoon context information in time conveniently. The cross-process communication mode may be, for example, an anonymous shared memory mode.
Optionally, as shown in fig. 2, the method may include:
step 201, when a preset application program is detected to enter a preset stuck state, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process.
The first process is a main process of a preset application program and is also a parent process of the created child process. For example, the JNI layer may be invoked by calling a pre-written Native method, and then creating a sub-process of the current process of the preset application using a fork function.
Step 202, opening a first dynamic link library by using a subprocess, and acquiring a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
Step 203, calling the first system function through the runtime object by using the subprocess, and transmitting an output stream into the first system function.
Step 204, obtaining information contained in the output stream by using the sub-process.
The execution of steps 202 to 204 is similar to that of the above embodiment, except that the execution is performed by using a sub-process, and the description thereof is omitted. In addition, since the sub-process is used for completion, when the first system function is called by the sub-process, only part of the katon context information is contained in the output stream, and the stack information of the preset type of all threads of the parent process is not contained, and the stack information needs to be acquired separately through the following steps.
Step 205, acquiring stack information of preset types of all threads of the parent process by using the child process.
The preset type of Stack information includes kernel Stack (kernel Stack) information and Native Stack (Native Stack) information, and the information included in the output stream obtained by the child process includes Java layer Stack (Java Stack) information of all threads of the parent process.
Optionally, acquiring, by the child process, kernel stack information of all threads of the parent process, including: and acquiring pointers of thread list objects of the run-time objects through the child process, traversing all threads of the parent process, and acquiring corresponding kernel stack information through reading preset stack file directories respectively corresponding to all the processes. The pointer of the Thread list object can be obtained through rutime- > GetThreadList (), the ForEach function pointer of the Thread list object can be obtained through dlsym, the ForEach function is called to traverse all threads (Thread) of the parent process, and the Kernel Stack of the Thread of the parent process can be obtained through reading/proc/ppid/task/tid/Stack.
Optionally, acquiring, by the child process, kernel stack information of all threads of the parent process, including: and opening a second dynamic link library, acquiring a pointer of a second system function, and acquiring the local stack information of all threads of the parent process by calling the second system function, wherein the second system function comprises a Backtrace function. The library can be opened by dlopen, then a Backtrace:: create (int, backtraceMap) function pointer is obtained by dlsym, and Native Stack of all threads of a parent process is obtained by calling the function pointer to designate the parent process and threads.
And 206, obtaining the katon context information by utilizing the subprocess according to the information contained in the output stream and the stack information of the preset type.
For example, the sub-process may assemble or aggregate the obtained incomplete katon context information, the kernel Stack, and the Native Stack to obtain the complete katon context information.
Step 207, transmitting the cartoon context information to the parent process by using the child process in an anonymous memory sharing mode.
Step 208, writing the katon context information into a preset local file through a parent process and reporting.
According to the information acquisition method provided by the embodiment of the invention, when the preset application program is detected to enter the preset cartoon state, the child process of the preset application program is firstly created, partial trace information of the main process of the preset application program is acquired by utilizing the child process, the acquired other stack information of the father process is combined to obtain complete cartoon context information, the complete cartoon context information is transmitted to the father process, and then the father process is written into a local file and reported, so that the multiprocess scheme not only can break through the system limit to acquire more comprehensive cartoon context information, help to accurately position and solve the cartoon problem, but also can effectively reduce or even avoid negative effects such as crashing or secondary cartoon on the preset application program.
Based on the above embodiment, optionally, the version number of the android operating system is lower than a preset version number, and the preset version number may be freely set, for example, 8.0 version. At present, in worldwide, especially third world countries, many people still use low-end intelligent terminal equipment which is low in cost and not advanced enough in hardware facilities, because the complexity of application programs has higher and higher requirements on hardware resources, the probability of the application programs to be blocked or even unresponsive on a low-end machine type is higher, the version of an operating system commonly installed on the low-end machine type is lower, and based on factors such as compatibility and performance, the multi-process scheme can be adopted for collecting the blocking information of the application programs aiming at the low-version operating system, so that negative effects such as crashing or secondary blocking and the like on preset application programs are reduced or even avoided. For the high-version operating system, the implementation can be realized by adopting the related technical scheme adopted in the first embodiment, namely, the katon context information is directly acquired through the process of the preset application program, so that the information acquisition efficiency can be improved, and the katon problem can be conveniently and timely analyzed.
Example III
Fig. 3 is a flow chart of an information acquisition method according to a third embodiment of the present invention, where the embodiment of the present invention optimizes based on the foregoing embodiment, and different schemes may be adopted for acquiring the katon information for different operating system versions.
Optionally, as shown in fig. 3, the method may include:
step 301, detecting that a preset application program enters a preset clamping state.
Step 302, judging whether the version number of the current operating system is lower than a preset version number, if yes, executing step 306; otherwise, step 303 is performed.
It should be noted that this step may also be performed before step 301, and in addition, for the case of knowing the version number of the operating system of the intelligent terminal, the step may not be required, and the katon information may be directly obtained according to the version number by adopting a corresponding scheme.
For example, for current android operating systems, the preset version number may be 8.0.
Step 303, opening the first dynamic link library, and obtaining a pointer of the runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
Step 304, calling the first system function through the runtime object, and transmitting the output stream into the first system function, and obtaining the information contained in the output stream to obtain the katon context information.
And 305, writing the katon context information into a preset local file and reporting the same.
Fig. 4 is a flowchart of an information obtaining method for a high-version operating system according to a third embodiment of the present invention, and the contents of the steps 303 to 305 are further refined, and the steps 303 to 305 can be further understood with reference to fig. 4.
Step 306, creating a sub-process of the current process of the preset application program.
Step 307, opening the first dynamic link library by using the sub-process, and obtaining a pointer of the runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
Step 308, calling the first system function by using the subprocess through the runtime object, and transmitting the output stream into the first system function to acquire the information contained in the output stream.
Step 309, acquiring kernel stack information and local stack information of all threads of the parent process by using the child process, and summarizing the kernel stack information and the local stack information with information in the output stream to obtain the katon context information.
And 310, transmitting the cartoon context information to the parent process by utilizing the child process in an anonymous memory sharing mode.
Step 311, writing the katon context information into a preset local file through a parent process and reporting.
Fig. 5 is a flowchart of a method for obtaining information for a low-version operating system according to the third embodiment of the present invention, and the contents of the steps 306 to 311 are further refined, and the steps 306 to 311 can be further understood with reference to fig. 5.
According to the information acquisition method provided by the embodiment of the invention, different cartoon information acquisition modes are selected according to the height of an operating system installed in the intelligent terminal equipment. For a high version, a scheme simulating the ANR flow of the system can be directly adopted to acquire a system run object pointer in a dynamic link mode, and a DumpForSigQuit method of the object is called to acquire Trace information for reporting operation, so that the information acquisition efficiency can be ensured; for the low version, incomplete Trace information of the main process can be obtained in a dynamic link mode in a sub-process of a fork, kernel Stack and Native Stack of the main process are additionally obtained, and finally the complete Trace information is assembled and transmitted to the main process for reporting operation in a cross-process communication mode, so that negative effects on a preset application program, such as crashing or secondary blocking, can be reduced or even avoided.
Example IV
Fig. 6 is a block diagram of an information acquisition device according to a fourth embodiment of the present invention, where the device may be implemented by software and/or hardware, and may be generally integrated in an intelligent terminal device, and may perform information acquisition by executing an information acquisition method. As shown in fig. 6, the apparatus includes:
the function pointer acquisition module 601 is configured to acquire a pointer of a first system function of a runtime object when detecting that a preset application enters a preset katon state, where the first system function includes a function for backing up runtime information when an application unresponsive event occurs;
a function calling module 602, configured to call the first system function through the runtime object, and transmit an output stream into the first system function;
the information obtaining module 603 is configured to obtain the information contained in the output stream, so as to obtain the katon context information.
The information acquisition device provided by the embodiment of the invention acquires the pointer of the first system function of the running object when the preset application program enters the preset katon state, wherein the first system function comprises a function for backing up the running information when an unresponsive event of the application program occurs, the first system function is called by the running object, an output stream is transmitted into the first system function, and the information contained in the output stream is acquired so as to obtain the katon context information. By adopting the technical scheme, when the application program is detected to be blocked, the blocking context information is acquired by calling the function called by the system when the application program does not respond to the event, so that the system limit can be broken through, the more comprehensive blocking context information can be acquired, and the accurate positioning and the blocking problem solving are facilitated.
Optionally, the preset application program is installed in an android operating system, and the first system function is a dumpfortigquit function.
Optionally, the acquiring the pointer of the first system function of the runtime object includes:
and opening a first dynamic link library, and acquiring a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
Optionally, when detecting that the preset application program is blocked, acquiring a pointer of a first system function of the runtime object includes:
when detecting that a preset application program is blocked, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process;
acquiring a pointer of a first system function of the object in operation by utilizing the subprocess;
the calling the first system function through the runtime object and transmitting an output stream into the first system function comprises the following steps:
calling the first system function through the runtime object by utilizing the subprocess, and transmitting an output stream into the first system function;
the obtaining information contained in the output stream to obtain the katon context information includes:
acquiring information contained in the output stream through the subprocess;
acquiring stack information of preset types of all threads of the parent process through the child process;
and obtaining the katon context information according to the information contained in the output stream and the stack information of the preset type.
Optionally, the preset type of stack information includes kernel stack information and local stack information, and the information included in the output stream obtained by the child process includes Java layer stack information of all threads of the parent process.
Optionally, acquiring, by the child process, kernel stack information of all threads of the parent process, including:
and acquiring pointers of thread list objects of the run-time objects through the child process, traversing all threads of the parent process, and acquiring corresponding kernel stack information through reading preset stack file directories respectively corresponding to all the processes.
Optionally, acquiring, by the child process, kernel stack information of all threads of the parent process, including:
and opening a second dynamic link library, acquiring a pointer of a second system function, and acquiring the local stack information of all threads of the parent process by calling the second system function, wherein the second system function comprises a Backtrace function.
Optionally, the apparatus further comprises:
the information transfer module is configured to, after obtaining the katon context information according to the information contained in the output stream and the preset type of stack information, further include: and transmitting the cartoon context information to the parent process by utilizing the child process in an anonymous shared memory mode.
Optionally, if the version number of the current operating system is lower than the preset version number, creating a sub-process of the first process of the preset application program.
Optionally, the apparatus further comprises:
and the information processing module is used for writing the katon context information into a preset local file after the katon context information is obtained, and/or reporting the context information.
Optionally, the detecting that the preset application program enters the preset clamping state includes:
acquiring the frame rate of a preset application program in the running process;
and when the current frame rate is detected to be smaller than a preset frame rate threshold value, determining that the preset application program is detected to enter a preset cartoon state.
Optionally, the degree of blocking corresponding to the preset blocking state is lower than the degree of blocking corresponding to the occurrence of the unresponsive event of the application program.
Example five
The embodiment of the present invention also provides a storage medium containing computer executable instructions, which when executed by a computer processor, are used to perform the information acquisition method provided by the embodiment of the present invention, the method comprising:
when the preset application program is detected to enter a preset blocking state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program unresponsive event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
and acquiring information contained in the output stream to obtain the katon context information.
Storage media-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk or tape devices; computer system memory or random access memory, such as DRAM, DDRRAM, SRAM, EDORAM, rambus (Rambus) RAM, etc.; nonvolatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a second, different computer system connected to the first computer system through a network such as the internet. The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations (e.g., in different computer systems connected by a network). The storage medium may store program instructions (e.g., embodied as a computer program) executable by one or more processors.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present invention is not limited to the information obtaining operation described above, and may also perform the related operations in the information obtaining method provided in any of the corresponding embodiments of the present invention.
Example six
The embodiment of the invention provides intelligent terminal equipment, which integrates the information acquisition device provided by the embodiment of the invention. Fig. 7 is a block diagram of an intelligent terminal device according to a sixth embodiment of the present invention. The intelligent terminal device 700 comprises a memory 701, a processor 702 and a computer program stored in the memory 701 and capable of running on the processor 702, wherein the processor 702 implements the information acquisition method provided by the embodiment of the invention when executing the computer program. The method comprises the following steps:
when the preset application program is detected to enter a preset blocking state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program unresponsive event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
and acquiring information contained in the output stream to obtain the katon context information.
According to the intelligent terminal equipment provided by the embodiment of the invention, when the application program is detected to be blocked, the blocking context information is acquired by calling the function called by the system when the unresponsive event of the application program occurs, so that the system limit can be broken through, the more comprehensive blocking context information can be acquired, and the accurate positioning and the blocking problem solving are facilitated.
The information acquisition device, the storage medium and the intelligent terminal device provided in the above embodiments can execute the information acquisition method provided in any embodiment of the present invention, and have the corresponding functional modules and beneficial effects of executing the method. Technical details not described in detail in the above embodiments may be referred to the information acquisition method provided in any embodiment of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (14)

1. An information acquisition method, characterized by comprising:
when the preset application program is detected to enter a preset blocking state, acquiring a pointer of a first system function of a runtime object, wherein the first system function comprises a function for backing up runtime information when an application program unresponsive event occurs;
calling the first system function through the runtime object, and transmitting an output stream into the first system function;
acquiring information contained in the output stream to obtain katon context information;
the output stream is a byte output stream or a character output stream;
the katon context information comprises relevant information for analyzing katon, and the relevant information for analyzing katon comprises at least one of Java layer stack information, kernel stack information and local stack information;
the corresponding jamming degree of the preset jamming state is lower than that of the application program when the application program does not respond to the event.
2. The method of claim 1, wherein the current operating system is an android operating system and the first system function is a dumpforsigquery function.
3. The method of claim 1, wherein the obtaining a pointer to a first system function of a runtime object comprises:
and opening a first dynamic link library, and acquiring a pointer of a runtime object in the first dynamic link library and a pointer of a first system function of the runtime object.
4. The method of claim 1, wherein the step of obtaining a pointer to a first system function of the runtime object when a click of the preset application is detected comprises:
when detecting that a preset application program is blocked, creating a child process of a first process of the preset application program, wherein the first process becomes a parent process;
acquiring a pointer of a first system function of the object in operation by utilizing the subprocess;
the calling the first system function through the runtime object and transmitting an output stream into the first system function comprises the following steps:
calling the first system function through the runtime object by utilizing the subprocess, and transmitting an output stream into the first system function;
the obtaining information contained in the output stream to obtain the katon context information includes:
acquiring information contained in the output stream by using the subprocess;
acquiring stack information of preset types of all threads of the parent process by utilizing the child process;
and obtaining the katon context information according to the information contained in the output stream and the stack information of the preset type.
5. The method of claim 4, wherein the preset type of stack information includes kernel stack information and local stack information, and the information included in the output stream acquired by the child process includes Java layer stack information of all threads of the parent process.
6. The method of claim 5, wherein obtaining kernel stack information for all threads of the parent process with the child process comprises:
and acquiring pointers of thread list objects of the run-time objects by utilizing the child process, traversing all threads of the parent process, and acquiring corresponding kernel stack information by reading preset stack file directories respectively corresponding to all the processes.
7. The method of claim 5, wherein obtaining kernel stack information for all threads of the parent process with the child process comprises:
and opening a second dynamic link library by using the child process, acquiring a pointer of a second system function, and acquiring local stack information of all threads of the parent process by calling the second system function, wherein the second system function comprises a Backtrace function.
8. The method of claim 4, further comprising, after obtaining the katon context information from the information contained in the output stream and the preset type of stack information:
and transmitting the cartoon context information to the parent process by utilizing the child process in an anonymous shared memory mode.
9. The method of claim 4, wherein creating the sub-process of the first process of the preset application comprises:
if the version number of the current operating system is lower than the preset version number, creating a sub-process of the first process of the preset application program.
10. The method according to any one of claims 1-9, further comprising, after obtaining the katon context information:
writing the katon context information into a preset local file, and/or reporting the context information.
11. The method of claim 1, wherein detecting that the preset application enters a preset stuck state comprises:
acquiring the frame rate of a preset application program in the running process;
and when the current frame rate is detected to be smaller than a preset frame rate threshold value, determining that the preset application program is detected to enter a preset cartoon state.
12. An information acquisition apparatus, characterized by comprising:
the function pointer acquisition module is used for acquiring a pointer of a first system function of a runtime object when the preset application program is detected to enter a preset katon state, wherein the first system function comprises a function for backing up runtime information when an application program unresponsive event occurs;
the function calling module is used for calling the first system function through the runtime object and transmitting an output stream into the first system function;
the information acquisition module is used for acquiring information contained in the output stream so as to obtain the katon context information;
the output stream is a byte output stream or a character output stream;
the katon context information comprises relevant information for analyzing katon, and the relevant information for analyzing katon comprises at least one of Java layer stack information, kernel stack information and local stack information;
the corresponding jamming degree of the preset jamming state is lower than that of the application program when the application program does not respond to the event.
13. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1-11.
14. A smart terminal device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-11 when executing the computer program.
CN201910951262.9A 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment Active CN110688245B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910951262.9A CN110688245B (en) 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910951262.9A CN110688245B (en) 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment

Publications (2)

Publication Number Publication Date
CN110688245A CN110688245A (en) 2020-01-14
CN110688245B true CN110688245B (en) 2023-05-26

Family

ID=69111562

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910951262.9A Active CN110688245B (en) 2019-10-08 2019-10-08 Information acquisition method, device, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN110688245B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286773A (en) * 2020-10-19 2021-01-29 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for collecting crash information
CN112650647B (en) * 2020-12-29 2023-10-31 北京字节跳动网络技术有限公司 Information acquisition method, device, equipment and medium
CN113114843B (en) * 2021-03-25 2022-06-10 北京小米移动软件有限公司 Data processing method and device, terminal and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763012A (en) * 2018-03-13 2018-11-06 广东欧珀移动通信有限公司 Interim card information acquisition method, device and terminal
CN109840177A (en) * 2017-11-24 2019-06-04 腾讯科技(深圳)有限公司 A kind of processing method and relevant device of Caton
CN109902011A (en) * 2019-02-28 2019-06-18 深圳乐信软件技术有限公司 A kind of software Caton monitoring method, device, equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11003764B2 (en) * 2018-02-06 2021-05-11 Jayant Shukla System and method for exploiting attack detection by validating application stack at runtime

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109840177A (en) * 2017-11-24 2019-06-04 腾讯科技(深圳)有限公司 A kind of processing method and relevant device of Caton
CN108763012A (en) * 2018-03-13 2018-11-06 广东欧珀移动通信有限公司 Interim card information acquisition method, device and terminal
CN109902011A (en) * 2019-02-28 2019-06-18 深圳乐信软件技术有限公司 A kind of software Caton monitoring method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110688245A (en) 2020-01-14

Similar Documents

Publication Publication Date Title
CN109284269B (en) Abnormal log analysis method and device, storage medium and server
CN110688245B (en) Information acquisition method, device, storage medium and equipment
US8522209B2 (en) Method and system for integrating profiling and debugging
US7434206B2 (en) Identifying memory leaks in computer systems
US8051409B1 (en) Monitoring memory accesses for multiple computer processes
US8250543B2 (en) Software tracing
CN108984389B (en) Application program testing method and terminal equipment
US20080243969A1 (en) Method and system for customizing allocation statistics
US9355003B2 (en) Capturing trace information using annotated trace output
US10095599B2 (en) Optimization for application runtime monitoring
US9529691B2 (en) Monitoring and correlating a binary process in a distributed business transaction
US20090265719A1 (en) Application macro recording utilizing method interception
CN110799952A (en) Distributed time travel tracking recording and playback
CN107608609B (en) Event object sending method and device
CN108664380B (en) After-execution software debugging system with performance display and debugging method
CN110795311B (en) Event playback method and device
CN108874672B (en) Application program exception positioning method, device, equipment and storage medium
CN109831351B (en) Link tracking method, device, terminal and storage medium
WO2018171195A1 (en) Dependency-injection-based android application semi-automatization test method
CN110597704B (en) Pressure test method, device, server and medium for application program
US11580228B2 (en) Coverage of web application analysis
Naughton et al. Fault injection framework for system resilience evaluation: fake faults for finding future failures
CN110651260A (en) Enhanced component delay tracking
CN110888628A (en) Method, device, equipment and storage medium for generating control tool
US9069897B2 (en) Capturing telemetry data by dynamic language engine

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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231010

Address after: 31a, 15th floor, building 30, maple commercial city, bangrang Road, Brazil

Patentee after: Baiguoyuan Technology (Singapore) Co.,Ltd.

Address before: 511400 floor 5-13, West Tower, building C, 274 Xingtai Road, Shiqiao street, Panyu District, Guangzhou City, Guangdong Province

Patentee before: GUANGZHOU BAIGUOYUAN INFORMATION TECHNOLOGY Co.,Ltd.