CN111813641B - Method, device, medium and equipment for collecting crash information - Google Patents

Method, device, medium and equipment for collecting crash information Download PDF

Info

Publication number
CN111813641B
CN111813641B CN202010566785.4A CN202010566785A CN111813641B CN 111813641 B CN111813641 B CN 111813641B CN 202010566785 A CN202010566785 A CN 202010566785A CN 111813641 B CN111813641 B CN 111813641B
Authority
CN
China
Prior art keywords
stack
stack frame
crash
acquiring
identifier corresponding
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
CN202010566785.4A
Other languages
Chinese (zh)
Other versions
CN111813641A (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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010566785.4A priority Critical patent/CN111813641B/en
Publication of CN111813641A publication Critical patent/CN111813641A/en
Application granted granted Critical
Publication of CN111813641B publication Critical patent/CN111813641B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure provides a method, apparatus, medium and device for collecting crash information, where the method includes: when the memory overflow breakdown is monitored, a stack storage object of the breakdown object is obtained; acquiring a method identifier corresponding to a method of each stack frame in the crash call stack through a stack storage object; for each stack frame, calling an analysis function based on a method identifier corresponding to the stack frame method, and acquiring a method signature of the stack frame returned by the analysis function; for each stack frame, calling a local conversion function based on a method identifier corresponding to the stack frame method, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function; and storing the method signature, the source file name and the source code line number of each stack frame as collapse information. The method and the device ensure the minimum application to the memory, so that after the android application has OOM breakdown, java call stack information is acquired under the condition that the occupied memory is as small as possible, and the maximum success rate of acquiring the call stack is ensured.

Description

Method, device, medium and equipment for collecting crash information
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and a device for collecting crash information.
Background
When the android application crashes, call stack information of the android application needs to be acquired to analyze the reason of the crash. The existing crash information collection program generally sets a callback of a java crash to be a self-defined java method by calling setDefaultUncaughtExceptionHandler of a Thread class of a system when an application is started, and when the java crash occurs to the android application, the system can call back the method and transfer the crash information in a parameter mode through Throwable type objects. The existing crash information collector will usually directly obtain and record its java call stack through the PRINTSTACKTRACE or GETSTACKTRACE method of this Throwable object.
When the system crash is the OOM, that is, when a crash caused by insufficient memory occurs, the PRINTSTACKTRACE or GETSTACKTRACE method at this time is likely to fail because a relatively large memory needs to be applied, so that the java call stack cannot be acquired. The cause of the android application crash cannot be analyzed.
Disclosure of Invention
The disclosure aims to provide a method, a device, a medium and equipment for collecting crash information, which can solve at least one technical problem. The specific scheme is as follows:
According to a specific embodiment of the present disclosure, in a first aspect, the present disclosure provides a method for collecting crash information, including: when the memory overflow breakdown is monitored, a stack storage object of the breakdown object is obtained; acquiring a method identifier corresponding to a method of each stack frame in the crash call stack through the stack storage object; for each stack frame, calling an analysis function based on a method identifier corresponding to the method of the stack frame, and acquiring a method signature of the stack frame returned by the analysis function; for each stack frame, calling a local conversion function based on a method identifier corresponding to the method of the stack frame, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function; and storing the method signature, the source file name and the source code line number of each stack frame as collapse information.
Optionally, when the memory overflow crash is monitored, acquiring a stack storage object of the crash object includes: monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and obtaining a stack storage object of the collapse object through Java program reflection, wherein the stack storage object is the bottom layer representation of a call stack.
Optionally, the method identifier corresponding to the method for obtaining each stack frame in the crash call stack through the stack storage object includes: strongly converting the stack storage object into an object array; acquiring a first element of the object array, and strongly converting the first element into an integer array; and obtaining an element with an index of i of the integer array, and marking the element as a first identifier, wherein the first identifier is a method identifier corresponding to a method of a current stack frame, i is more than or equal to 0 and less than or equal to N-1, and N is a natural number.
Optionally, for each stack frame, calling an analysis function based on a method identifier corresponding to a method of the stack frame, and obtaining a method signature of the stack frame returned by the analysis function, where the method signature includes: and for each stack frame, calling an analysis function based on the first identifier and a second identifier representing true or false to acquire a method name and a class name of the current stack frame.
Optionally, the method identifier corresponding to the stack frame-based method calls a local conversion function, and obtains a source file name and a source code line number of the stack frame returned by the local conversion function, including: obtaining an element with index of i+N of the integer array, obtaining an instruction offset value corresponding to a current stack frame, and marking the instruction offset value as a third mark, wherein N=M-1, N represents the length of the stack frame, M represents the length of the object array, and both N and M are natural numbers; and calling a local conversion function based on the first identifier and the third identifier, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function.
Optionally, the analysis function is prettyMethod functions of the system, and the local conversion function is TranslateLocation functions of the system.
According to a second aspect of the specific embodiments of the present disclosure, the present disclosure provides a crash information collecting apparatus, including: the first acquisition unit is used for acquiring a stack storage object of a crashed object when the memory overflow crashes; the second acquisition unit is used for acquiring a method identifier corresponding to the method of each stack frame in the crash call stack through the stack storage object; the first calling unit is used for calling an analysis function based on a method identifier corresponding to a method of each stack frame and acquiring a method signature of the stack frame returned by the analysis function; the second calling unit is used for calling a local conversion function based on a method identifier corresponding to a method of the stack frame for each stack frame, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function; and the storage unit is used for storing the method signature, the source file name and the source code line number of each stack frame as collapse information.
Optionally, the first obtaining unit is further configured to: monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and obtaining a stack storage object of the collapse object through Java program reflection, wherein the stack storage object is the bottom layer representation of a call stack.
According to a third aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a method as claimed in any one of the above.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: one or more processors; storage means for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the method of any of the preceding claims.
Compared with the prior art, the scheme of the embodiment of the disclosure has at least the following beneficial effects: according to the method, the content of the bottom layer representation of the crashed call stack is acquired, then the content is analyzed and converted into actual call stack information, so that the minimum application to the memory is ensured, the java call stack information of the android application is acquired under the condition that the memory is occupied as little as possible after the android application crashes, the maximum success rate of acquiring the call stack is ensured, and more effective information is provided for the investigation problem.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort. In the drawings:
FIG. 1 illustrates a flow chart of a crash information collection method according to an embodiment of the disclosure;
FIG. 2 illustrates a data structure diagram of an object array according to an embodiment of the present disclosure;
FIG. 3 illustrates a schematic diagram of a crash information collection apparatus according to an embodiment of the disclosure;
Fig. 4 shows a schematic diagram of an electronic device connection structure according to an embodiment of the present disclosure.
Detailed Description
For the purpose of promoting an understanding of the principles and advantages of the disclosure, reference will now be made in detail to the drawings, in which it is apparent that the embodiments described are only some, but not all embodiments of the disclosure. Based on the embodiments in this disclosure, all other embodiments that a person of ordinary skill in the art would obtain without making any inventive effort are within the scope of protection of this disclosure.
The terminology used in the embodiments of the disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure of embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, the "plurality" generally includes at least two.
It should be understood that the term "and/or" as used herein is merely one relationship describing the association of the associated objects, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
It should be understood that although the terms first, second, third, etc. may be used in describing … … in the embodiments of the present disclosure, these … … should not be limited to these terms. These terms are only used to distinguish … …. For example, the first … … may also be referred to as the second … …, and similarly the second … … may also be referred to as the first … …, without departing from the scope of the embodiments of the present disclosure.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrase "if determined" or "if detected (stated condition or event)" may be interpreted as "when determined" or "in response to determination" or "when detected (stated condition or event)" or "in response to detection (stated condition or event), depending on the context.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a product or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such product or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a commodity or device comprising such elements.
Alternative embodiments of the present disclosure are described in detail below with reference to the drawings.
For an operating program developed by an android system, the operating program generally includes a bottom layer (also called a native layer) developed based on an editing language such as C or c++, an art virtual machine layer operating on the bottom layer, and a Java assembly layer operating on the art virtual machine layer. In the process of program development and execution, the Java layer can call the bottom executable function to execute related tasks through the virtual machine layer. When the system crashes, the bottom layer call stack needs to be called to analyze the crash reasons.
As shown in fig. 1, according to a specific embodiment of the present disclosure, the present disclosure provides a method for collecting crash information, including the following method steps:
step S102: and when the memory overflow crash is monitored, acquiring a stack storage object of the crash object.
Optionally, the obtaining the stack storage object of the crash object includes: monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and obtaining a stack storage object of the collapse object through Java program reflection, wherein the stack storage object is the bottom layer representation of a call stack.
Firstly, initializing an application program, wherein the initialization process comprises the steps of calling setDefaultUncaughtExceptionHandler methods of a system Thread class to monitor a crash event at a fixed clock frequency, obtaining a Throwable crash object after the system crash occurs, and using java code to reflect and obtain a stack storage object backtrace of the Throwable crash object. The stack storage object backtrace is a bottom layer representation of the call stack, and the detailed information of all stack frames can be obtained by analyzing the obtained information of the stack storage object backtrace, so that the cause of the system crash can be analyzed.
Step S104: and acquiring a method identifier corresponding to the method of each stack frame in the crash call stack through the stack storage object.
Optionally, the method identifier corresponding to the method for obtaining each stack frame in the crash call stack through the stack storage object includes the following substeps:
step S104-1: strongly converting the stack storage object into an object array;
step S104-2: taking a first element of the object array, and strongly converting the first element into an integer array;
step S104-3: and taking the element with the index of i of the integer array as a first identifier.
The specific data processing process is described as first strongly converting stack memory Object backtrace into an Object array of the Object [ ] type, denoted as Object array backtraceArr, as shown in FIG. 2, which is a data structure of Object array backtraceArr; then, the first element of the object array backtraceArr is taken and marked as first; then, the first element first is strongly converted into an integer array of the int [ ] type (in the case of 32-bit operation) or the long [ ] type (in the case of 64-bit operation), which is denoted by firstIL, and the element of the integer array firstIL with index i is denoted by mid as a first identifier, which is used as one of the parameters of the called function when the following function is called.
Step S106: and calling an analysis function for each stack frame based on a method identifier corresponding to the method of the stack frame, and acquiring a method signature of the stack frame returned by the analysis function.
The traversal procedure for each stack frame is as follows: taking an element with index i of the integer array firstIL as a first identifier, marking as mid, which is jmehthodID of a method of a current stack frame, then calling an analysis function prettyMethod, inputting the first identifier mid and a second identifier true in the called analysis function prettyMethod, feeding back detailed information of the method of the stack frame through the analysis function prettyMethod, and storing the detailed information, wherein the second identifier true represents whether to return a signature of the method or not, and returning the signature of the method when true is true, and not returning the signature of the method when false is false.
The method signature of all stack frames is obtained by traversing all stack frames, and the specific process is that i traverses from 0 to N-1, namely traverses all stack frames, the size M of the object array backtraceArr is the number of stack frames N+1, namely the size M of the object array backtraceArr and the number N of stack frames meet the relation N=M-1, wherein N and M are natural numbers.
Step S108: and calling a local conversion function according to a method identifier corresponding to the method of the stack frame for each stack frame, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function.
Optionally, for each stack frame, calling a local conversion function based on a method identifier corresponding to a method of the stack frame, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function, where the method includes the following method steps:
step S108-1: obtaining an instruction offset value corresponding to a current stack frame by taking an element with an index of i+N of the integer array, and marking the instruction offset value as a third mark, wherein N=M-1, N represents the length of the stack frame, M represents the length of the object array, and both N and M are natural numbers;
Step S108-2: and calling a local conversion function of the system, inputting a first identifier and a third identifier, and acquiring a source file name and a source code line number of the current stack frame.
The specific process for acquiring the source file name and the source code line number corresponding to the current stack frame comprises the following steps: the element with index of i+N of integer array firstIL is taken, namely, the instruction offset value dexPC corresponding to the current stack frame is obtained and marked as dp, then the local conversion function TranslateLocation of the system is called, the first identifier mid and the third identifier dp are input into the local conversion function TranslateLocation, and the source file name and the source code line number corresponding to the stack frame can be returned through the local conversion function TranslateLocation.
I traversing from 0 to N-1, traversing the stack storage object, and obtaining source file names and source code line numbers of all stack frames.
Step S110: and storing the method signature, the source file name and the source code line number of each stack frame as collapse information.
I, traversing from 0 to N-1, traversing the stack storage object, and obtaining method signatures, source file names and source code line numbers of all stack frames. After the traversing is completed, the method name, the class name, the source file name and the source code line number of each stack frame in the java crash call stack are obtained, namely all the information of the crash call stack is obtained, and the method signature, the source file name and the source code line number of each stack frame are stored as crash information so as to conveniently analyze all the information of the crash call stack and obtain the reason of system crash.
According to the method, the bottom layer representation Of the crash call stack is obtained, then the content Of the crash call stack is analyzed and converted into actual call stack information, so that the minimum application to the Memory is guaranteed, and the java call stack information is obtained under the condition that the occupied Memory is as small as possible after the android application is crashed, so that the maximum success rate Of obtaining the call stack is guaranteed, and more effective information is provided for the investigation problem.
In addition, the disclosure further provides an embodiment of the apparatus adapted to the above embodiment, so as to implement the method steps described in the above embodiment, and the explanation based on the meaning of the same names is the same as that of the above embodiment, which has the same technical effects as those of the above embodiment, and will not be repeated herein.
As shown in fig. 3, according to an embodiment of the present disclosure, the present disclosure provides an apparatus for collecting crash information, which includes a first obtaining unit 302, a second obtaining unit 304, a first calling unit 306, a second calling unit 308, and a storage unit 310, which are specifically described below.
The first acquisition unit 302: and the stack storage object is used for acquiring the crashed object when the memory overflow crashes.
Optionally, the obtaining the stack storage object of the crash object includes: monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and obtaining a stack storage object of the collapse object through Java program reflection, wherein the stack storage object is the bottom layer representation of a call stack.
The second acquisition unit 304: and acquiring a method identifier corresponding to the method of each stack frame in the crash call stack through the stack storage object.
Optionally, the second obtaining unit 304 is further configured to: strongly converting the stack storage object into an object array; taking a first element of the object array, and strongly converting the first element into an integer array; and taking the element with the index of i of the integer array as a first identifier.
The first calling unit 306: and the method is used for calling an analysis function for each stack frame based on a method identifier corresponding to the method of the stack frame, and acquiring a method signature of the stack frame returned by the analysis function.
Optionally, the first invoking unit 306 is further configured to: obtaining an instruction offset value corresponding to a current stack frame by taking an element with an index of i+N of the integer array, and marking the instruction offset value as a third mark, wherein N=M-1, N represents the length of the stack frame, M represents the length of the object array, and both N and M are natural numbers; and calling a local conversion function of the system, inputting a first identifier and a third identifier, and acquiring a source file name and a source code line number of the current stack frame. i, traversing from 0 to N-1, traversing the stack storage object, and obtaining source file names and source code line numbers of all stack frames.
Storage unit 310: and the method signature, the source file name and the source code line number of each stack frame are used for being stored as collapse information.
The device acquires the java call stack information under the condition Of occupying as little Memory as possible after the android application is crashed by acquiring the bottom layer representation Of the crashed call stack and analyzing the content Of the crashed call stack and converting the content into the actual call stack information, thereby ensuring the minimum application to the Memory, and providing more effective information for the investigation problem.
As shown in fig. 4, the present embodiment provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the one processor to enable the at least one processor to perform the get call stack method steps as described in the embodiments above.
The disclosed embodiments provide a non-transitory computer storage medium storing computer executable instructions that perform the method steps described in the embodiments above.
Referring now to fig. 4, a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 4 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 4, the electronic device may include a processing means (e.g., a central processor, a graphics processor, etc.) 401, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other by a bus 405. An input/output (I/O) interface 405 is also connected to bus 405.
In general, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 405 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, etc.; storage 408 including, for example, magnetic tape, hard disk, etc.; and a communication device 405. The communication means 405 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 shows an electronic device having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 405, or from storage device 408, or from ROM 402. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 401.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.

Claims (10)

1. A crash information collection method, comprising:
when the memory overflow breakdown is monitored, a stack storage object of the breakdown object is obtained;
Acquiring a method identifier corresponding to a method of each stack frame in the crash call stack through the stack storage object;
For each stack frame, calling an analysis function based on a method identifier corresponding to the method of the stack frame, and acquiring a method signature of the stack frame returned by the analysis function;
For each stack frame, calling a local conversion function based on a method identifier corresponding to a method of the stack frame, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function, wherein the source file name and the source code line number of the stack frame are obtained by inputting the method identifier corresponding to the method of the stack frame and an instruction offset value corresponding to the stack frame in the local conversion function, and the local conversion function is a Transl ateLocati on function of a system with the memory overflow breakdown;
and storing the method signature, the source file name and the source code line number of each stack frame as collapse information.
2. The method of claim 1, wherein when a memory overflow crash is detected, obtaining a stack storage object of the crash object comprises:
Monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs;
And obtaining a stack storage object of the collapse object through Java program reflection, wherein the stack storage object is the bottom layer representation of a call stack.
3. The method of claim 1, wherein the obtaining, by the stack storage object, a method identifier corresponding to a method for each stack frame in the crash call stack, comprises:
Strongly converting the stack storage object into an object array;
acquiring a first element of the object array, and strongly converting the first element into an integer array;
and obtaining an element with an index of i of the integer array, and marking the element as a first identifier, wherein the first identifier is a method identifier corresponding to a method of a current stack frame, i is more than or equal to 0 and less than or equal to N-1, and N is a natural number.
4. The method of claim 3, wherein for each stack frame, calling an analysis function based on a method identifier corresponding to a method of the stack frame, and obtaining a method signature of the stack frame returned by the analysis function, comprises:
And for each stack frame, calling an analysis function based on the first identifier and a second identifier representing true or false to acquire a method name and a class name of the current stack frame.
5. The method of claim 3, wherein the method identifier corresponding to the stack frame-based method calls a local conversion function, and obtaining a source file name and a source code line number of the stack frame returned by the local conversion function comprises:
Obtaining an element with index of i+N of the integer array, obtaining an instruction offset value corresponding to a current stack frame, and marking the instruction offset value as a third mark, wherein N=M-1, N represents the length of the stack frame, and M represents the length of the object array;
And calling a local conversion function based on the first identifier and the third identifier, and acquiring a source file name and a source code line number of the stack frame returned by the local conversion function.
6. The method of claim 1, wherein the analysis function is a prettyMethod function of a system.
7. A crash information collecting apparatus, comprising:
The first acquisition unit is used for acquiring a stack storage object of a crashed object when the memory overflow crashes;
The second acquisition unit is used for acquiring a method identifier corresponding to the method of each stack frame in the crash call stack through the stack storage object;
The first calling unit is used for calling an analysis function based on a method identifier corresponding to a method of each stack frame and acquiring a method signature of the stack frame returned by the analysis function;
The second calling unit is configured to call a local conversion function according to a method identifier corresponding to a method of the stack frame for each stack frame, obtain a source file name and a source code line number of the stack frame returned by the local conversion function, where the source file name and the source code line number of the stack frame are obtained by inputting the method identifier corresponding to the method of the stack frame and an instruction offset value corresponding to the stack frame in the local conversion function, and the local conversion function is a Transl ateLocation function of a system in which the memory overflow breakdown occurs;
and the storage unit is used for storing the method signature, the source file name and the source code line number of each stack frame as collapse information.
8. The apparatus of claim 7, wherein the first acquisition unit is further to:
Monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and obtaining a stack storage object of the collapse object through Java program reflection, wherein the stack storage object is the bottom layer representation of a call stack.
9. 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 to 6.
10. An electronic device, comprising:
one or more processors;
Storage means for storing one or more programs which when executed by the one or more processors cause the one or more processors to implement the method of any of claims 1 to 6.
CN202010566785.4A 2020-06-19 2020-06-19 Method, device, medium and equipment for collecting crash information Active CN111813641B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010566785.4A CN111813641B (en) 2020-06-19 2020-06-19 Method, device, medium and equipment for collecting crash information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010566785.4A CN111813641B (en) 2020-06-19 2020-06-19 Method, device, medium and equipment for collecting crash information

Publications (2)

Publication Number Publication Date
CN111813641A CN111813641A (en) 2020-10-23
CN111813641B true CN111813641B (en) 2024-05-17

Family

ID=72845293

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010566785.4A Active CN111813641B (en) 2020-06-19 2020-06-19 Method, device, medium and equipment for collecting crash information

Country Status (1)

Country Link
CN (1) CN111813641B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905378B (en) * 2021-03-03 2024-03-08 广州虎牙科技有限公司 Crash information analysis method, device, electronic equipment and readable storage medium
CN112925717B (en) * 2021-03-22 2024-03-12 北京字节跳动网络技术有限公司 Method, apparatus, device and medium for determining object of call stack frame
CN114546590B (en) * 2022-02-18 2023-03-14 北京基调网络股份有限公司 Java virtual machine heap memory set object monitoring method and memory overflow analysis method
CN114595244B (en) * 2022-03-11 2023-10-17 抖音视界有限公司 Method and device for aggregating crash data, electronic equipment and storage medium
CN115061837B (en) * 2022-08-16 2023-03-14 苏州浪潮智能科技有限公司 Method and device for scheduling, tracking and acquiring user space call stack

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539883A (en) * 2009-05-05 2009-09-23 北京和利时系统工程有限公司 Error tracking method of embedded system and device thereof
CN107133144A (en) * 2017-05-02 2017-09-05 山东浪潮商用系统有限公司 A kind of dynamic monitoring heap memory uses wrong internal memory monitoring device and method
CN108446186A (en) * 2018-01-30 2018-08-24 国家计算机网络与信息安全管理中心 Method for recovering Dex source file from shell-added Android application program
CN110489159A (en) * 2019-08-02 2019-11-22 北京字节跳动网络技术有限公司 Installation kit compressing method and data analysis method, device, medium and equipment
CN110489165A (en) * 2019-08-02 2019-11-22 北京字节跳动网络技术有限公司 Obtain method, apparatus, medium and the equipment of call stack stack frame command offsets
CN110489179A (en) * 2019-08-02 2019-11-22 北京字节跳动网络技术有限公司 Obtain method, apparatus, medium and the equipment of call stack stack frame function signature
CN110764941A (en) * 2019-09-05 2020-02-07 北京字节跳动网络技术有限公司 Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110865898A (en) * 2019-10-12 2020-03-06 北京字节跳动网络技术有限公司 Method, device, medium and equipment for clustering crash call stack

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101539883A (en) * 2009-05-05 2009-09-23 北京和利时系统工程有限公司 Error tracking method of embedded system and device thereof
CN107133144A (en) * 2017-05-02 2017-09-05 山东浪潮商用系统有限公司 A kind of dynamic monitoring heap memory uses wrong internal memory monitoring device and method
CN108446186A (en) * 2018-01-30 2018-08-24 国家计算机网络与信息安全管理中心 Method for recovering Dex source file from shell-added Android application program
CN110489159A (en) * 2019-08-02 2019-11-22 北京字节跳动网络技术有限公司 Installation kit compressing method and data analysis method, device, medium and equipment
CN110489165A (en) * 2019-08-02 2019-11-22 北京字节跳动网络技术有限公司 Obtain method, apparatus, medium and the equipment of call stack stack frame command offsets
CN110489179A (en) * 2019-08-02 2019-11-22 北京字节跳动网络技术有限公司 Obtain method, apparatus, medium and the equipment of call stack stack frame function signature
CN110764941A (en) * 2019-09-05 2020-02-07 北京字节跳动网络技术有限公司 Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110865898A (en) * 2019-10-12 2020-03-06 北京字节跳动网络技术有限公司 Method, device, medium and equipment for clustering crash call stack

Also Published As

Publication number Publication date
CN111813641A (en) 2020-10-23

Similar Documents

Publication Publication Date Title
CN111813641B (en) Method, device, medium and equipment for collecting crash information
CN111274760B (en) Rich text data processing method and device, electronic equipment and computer storage medium
CN110865898B (en) Method, device, medium and equipment for converging crash call stack
CN110489101B (en) Interface simulation method, system, medium and electronic equipment
CN110489179B (en) Method, device, medium and equipment for acquiring call stack frame function signature
CN111198859B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN111813465B (en) Information acquisition method, device, medium and equipment
CN109446025B (en) Operation behavior playback method and device, electronic equipment and readable medium
CN110489165B (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110727566B (en) Method, device, medium and electronic equipment for acquiring process crash information
CN110764941A (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110717122B (en) Page performance acquisition method and device and electronic equipment
CN112954056B (en) Method and device for processing monitoring data, electronic equipment and storage medium
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN111783010B (en) Webpage blank page monitoring method, device, terminal and storage medium
CN110941549B (en) Memory leak detection method, device, medium and electronic equipment
CN111708680A (en) Error reporting information analysis method and device, electronic equipment and storage medium
CN111045926A (en) Application program jamming detection method, device, medium and electronic equipment
CN112084086B (en) Information collection method, device, medium and electronic equipment
CN111124627A (en) Method, device, terminal and storage medium for determining application program caller
CN112379967B (en) Simulator detection method, device, equipment and medium
CN110764995B (en) Method, device, medium and electronic equipment for detecting file access abnormality
CN114490266A (en) Data acquisition method, device, equipment and storage medium
CN110908860B (en) Java thread acquisition method and device, medium and electronic equipment
CN111241368B (en) Data processing method, device, medium and equipment

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