CN111813641A - 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
CN111813641A
CN111813641A CN202010566785.4A CN202010566785A CN111813641A CN 111813641 A CN111813641 A CN 111813641A CN 202010566785 A CN202010566785 A CN 202010566785A CN 111813641 A CN111813641 A CN 111813641A
Authority
CN
China
Prior art keywords
stack
stack frame
acquiring
crash
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.)
Granted
Application number
CN202010566785.4A
Other languages
Chinese (zh)
Other versions
CN111813641B (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

Images

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, the method comprising: when monitoring that the memory overflows and collapses, acquiring a stack storage object of the collapsed object; acquiring a method identifier corresponding to a method of each stack frame in a crash call stack through a 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 crash information. The method and the device ensure the minimum application for the memory, so that after OOM breakdown occurs in android application, java call stack information is obtained under the condition that the occupied memory is as small as possible, and the maximum success rate of obtaining 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, the information of the call stack of the android application needs to be acquired so as to analyze the reason of the crash. The conventional crash information collecting program generally sets a callback of java crash as a self-defined java method by calling setdefaultunnaughtectxpertionhandler of a Thread type of a system when an application is started, and when java crash occurs to an android application, the system calls the method and transmits the crash information in a parameter form through an object of the Thread type. The existing crash information collector usually obtains and records the java call stack of the conventional crash information collector directly through the printStackTrace or getStackTrace method of the Throwable object.
When the system crash is caused by the OOM, namely the crash caused by insufficient memory occurs, the printStackTrace or getStackTrace method at the moment is likely to fail because a large memory needs to be applied, so that the java call stack cannot be acquired. The cause of the crash of the android application cannot be analyzed.
Disclosure of Invention
An object of the present disclosure is to provide a method, an apparatus, a medium, and a device for collecting crash information, which can solve at least one of the above-mentioned technical problems. 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 monitoring that the memory overflows and collapses, acquiring a stack storage object of the collapsed object; acquiring a method identifier corresponding to a method of each stack frame in a 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 crash information.
Optionally, when monitoring that the memory overflow crashes, obtaining the stack storage object of the crashed object includes: monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and acquiring a stack storage object of the crashed object through Java program reflection, wherein the stack storage object is a bottom-layer representation of a call stack.
Optionally, the obtaining, by the stack storage object, a method identifier corresponding to a method of each stack frame in the crash call stack includes: converting the stack storage object into an object array by force; acquiring a first element of the object array, and converting the first element into an integer array; and acquiring an element with an index i of the integer array, and recording the element as a first identifier, wherein the first identifier is a method identifier corresponding to a method of the current stack frame, i is greater than or equal to 0 and less than or equal to N-1, and N is a natural number.
Optionally, the calling, for each stack frame, an analysis function based on a method identifier corresponding to the method of the stack frame, and obtaining a method signature of the stack frame returned by the analysis function include: and for each stack frame, calling an analysis function based on the first identifier and a second identifier representing true and false to acquire the method name and the name of the class of the current stack frame.
Optionally, the calling a local conversion function by the method identifier corresponding to the method based on the stack frame to obtain the source file name and the source code line number of the stack frame returned by the local conversion function includes: acquiring an element with an index i + N of the integer array, acquiring an instruction offset value corresponding to a current stack frame, and recording the instruction offset value as a third identifier, wherein N is 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 a pretty method function of the system, and the local transfer function is a transitielocation function of the system.
According to a second aspect, the present disclosure provides a crash information collecting apparatus, including: the first obtaining unit is used for obtaining a stack storage object of a crashed object when monitoring that the memory overflows and crashes; the second obtaining unit is used for obtaining a method identifier corresponding to a method of each stack frame in the crash call stack through the stack storage object; a first calling unit, configured to call, for each stack frame, an analysis function based on a method identifier corresponding to a method of the stack frame, and obtain a method signature of the stack frame returned by the analysis function; a second calling unit, configured to call, for each stack frame, a local conversion function based on a method identifier corresponding to the method of the stack frame, and obtain 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 crash 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 acquiring a stack storage object of the crashed object through Java program reflection, wherein the stack storage object is a bottom-layer representation of a call stack.
According to a third aspect, the present disclosure provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any one of the above.
According to a fourth aspect thereof, the present disclosure provides 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 carry out a method as claimed in any preceding claim.
Compared with the prior art, the scheme of the embodiment of the disclosure at least has the following beneficial effects: according to the method, the minimum application for the memory is guaranteed by obtaining the bottom layer representation of the collapsed call stack, analyzing the content of the collapsed call stack and converting the content into the actual call stack information, so that java call stack information is obtained under the condition that the occupied memory is as small as possible after OOM collapse occurs in the android application, the maximum success rate of obtaining the call stack is guaranteed, and more effective information is provided for troubleshooting.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty. In the drawings:
FIG. 1 illustrates a flow diagram 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 shows a schematic structural diagram of a crash information collection apparatus according to an embodiment of the disclosure;
fig. 4 shows an electronic device connection structure schematic according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure clearer, the present disclosure will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present disclosure, rather than all embodiments. All other embodiments, which can be derived by one of ordinary skill in the art from the embodiments disclosed herein without making any creative effort, shall fall within the scope of protection of the present disclosure.
The terminology used in the embodiments of the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in the disclosed 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, and "a plurality" typically includes at least two.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
It should be understood that although the terms first, second, third, etc. may be used to describe … … in embodiments of the present disclosure, these … … should not be limited to these terms. These terms are used only to distinguish … …. For example, the first … … can also be referred to as the second … … and, similarly, the second … … can also be referred to as the first … … without departing from the scope of 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 phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that an article 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 article or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in the article or device in which the element is included.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
The operating program developed by the android system generally includes a bottom layer (also called native layer) developed based on an editing language such as C or C + +, an art virtual machine layer running on the bottom layer, and a Java assembly layer running on the art virtual machine layer. In the process of program development and execution, the Java layer can call the bottom executable function through the virtual machine layer to execute related tasks. When the system crashes, the bottom layer call stack is required to be called to analyze the reason of the crash.
As shown in fig. 1, according to an embodiment of the present disclosure, the present disclosure provides a method of crash information collection, comprising the following method steps:
step S102: and when the monitoring shows that the memory overflow is crashed, acquiring a stack storage object of the crashed object.
Optionally, the obtaining a stack storage object of the crashed object includes: monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and acquiring a stack storage object of the crashed object through Java program reflection, wherein the stack storage object is a bottom-layer representation of a call stack.
Firstly, initializing an application program, wherein the initialization process comprises calling a setDefaultUncaudexexciptoHandler method of a system Thread class to monitor a crash event at a fixed clock frequency, obtaining a Throwable crash object after a system crash occurs, and reflecting and obtaining a stack storage object backtrace of the Throwable crash object by using java codes. The stack storage object backtrace is the 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 reason of 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 obtaining, by the stack storage object, a method identifier corresponding to a method of each stack frame in the crash call stack includes the following sub-steps:
step S104-1: converting the stack storage object into an object array by force;
step S104-2: taking a first element of the object array, and converting the first element into an integer array;
step S104-3: and taking the element with the index of the integer array as i, and recording as a first identifier.
The specific data processing process is described as that, firstly, the stack storage Object backspace is forced to be an Object array of an Object [ ] type, and is marked as an Object array backsracerr, as shown in fig. 2, the data structure of the Object array backsracerr is shown; then, taking a first element of the object array backstraceArr and marking as first; and then, strongly converting the first element, namely the first element, into an integer array of an int [ ] type (under 32-bit running condition) or a long [ ] type (under 64-bit running condition), recording the integer array as the first identifier, and taking an element with the index of the integer array, namely i, as a first identifier, recording the element as mid, wherein the first identifier is used as one of parameters of a called function when a subsequent function is called.
Step S106: and calling an analysis function based on the method identifier corresponding to the method of the stack frame aiming at each stack frame, and acquiring the 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 the element as mid, which is jmehthodID of the method of the current stack frame, then calling an analysis function pretty method, inputting the first identifier mid and a second identifier true in the called analysis function pretty method, feeding back detailed information of the method of the stack frame through the analysis function pretty method, and storing the detailed information, wherein the second identifier true represents whether to return a signature of the method, the signature of the method is returned when true, and the signature of the method is not returned when false.
Traversing all stack frames to obtain signatures of all stack frames, wherein the specific process is that i starts from 0 to traverse to N-1, namely all stack frames are traversed, the size M of the object array backstraceArr is the number N +1 of the stack frames, namely the size M of the object array backstraceArr and the number N of the stack frames meet the relation N-M-1, and both N and M are natural numbers.
Step S108: and for each stack frame, calling a local conversion function based on the 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.
Optionally, the method for each stack frame calls a local conversion function based on a method identifier corresponding to the method for the stack frame, and obtains a source file name and a source code line number of the stack frame returned by the local conversion function, including the following steps:
step S108-1: taking an element with an index of the integer array being i + N, obtaining an instruction offset value corresponding to a current stack frame, and recording the instruction offset value as a third identifier, wherein N is 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 the first identifier and the third identifier, and acquiring a source file name and a source code line number of the current stack frame.
The specific process of obtaining the source file name and the source code line number corresponding to the current stack frame is as follows: the index of the integer array firstIL is taken as an element of i + N, namely, an instruction offset value dexPC corresponding to the current stack frame is obtained and recorded as dp, then a local conversion function TranslateLocation of the system is called, a first identification mid and a third identification dp are input into the local conversion function TranslateLocation, and a source file name and a source code line number corresponding to the stack frame can be returned through the local conversion function TranslateLocation.
And i, traversing from 0 to N-1, and acquiring the source file names and the source code line numbers of all stack frames by traversing the stack storage object.
Step S110: and storing the method signature, the source file name and the source code line number of each stack frame as crash information.
And i, traversing from 0 to N-1, traversing the stack storage object, and acquiring the method signatures, the source file names and the source code line numbers of all the stack frames. After the traversal 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, that is, all 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 that all information of the crash call stack can be analyzed conveniently to obtain the reason of system crash.
According to the method, the minimum application for the Memory is ensured by acquiring the bottom-layer representation Of the collapsed call stack, analyzing the content Of the collapsed call stack and converting the content into the actual call stack information, so that after OOM (Out Of Memory) collapse occurs in the android application, the java call stack information is acquired under the condition that the occupied Memory is as little as possible, the maximum success rate Of acquiring the call stack is ensured, and more effective information is provided for troubleshooting.
In addition, the present disclosure also provides an apparatus embodiment adapted to the above embodiment, for implementing the method steps described in the above embodiment, and the explanation based on the same name and meaning is the same as that of the above embodiment, and has the same technical effect as that of the above embodiment, and is not described again here.
As shown in fig. 3, according to an embodiment of the present disclosure, the present disclosure provides a device for collecting crash information, which includes a first obtaining unit 302, a second obtaining unit 304, a first invoking unit 306, a second invoking unit 308, and a storage unit 310, which is described in detail below.
The first acquisition unit 302: and the method is used for acquiring the stack storage object of the crashed object when the monitoring shows that the memory overflow crashes.
Optionally, the obtaining a stack storage object of the crashed object includes: monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs; and acquiring a stack storage object of the crashed object through Java program reflection, wherein the stack storage object is a 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: converting the stack storage object into an object array by force; taking a first element of the object array, and converting the first element into an integer array; and taking the element with the index of the integer array as i, and recording as a first identifier.
The first calling unit 306: and the method identifier is used for calling an analysis function based on the method identifier corresponding to the method of the stack frame aiming at each stack frame, and acquiring the method signature of the stack frame returned by the analysis function.
Optionally, the first invoking unit 306 is further configured to: taking an element with an index of the integer array being i + N, obtaining an instruction offset value corresponding to a current stack frame, and recording the instruction offset value as a third identifier, wherein N is 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 the first identifier and the third identifier, and acquiring a source file name and a source code line number of the current stack frame. And i, traversing from 0 to N-1, traversing the stack storage object, and acquiring source file names and source code line numbers of all stack frames.
The storage unit 310: and the method signature, the source file name and the source code line number of each stack frame are used as crash information to be stored.
The device analyzes the content Of the call stack by acquiring the bottom representation Of the crash call stack and converts the content into actual call stack information, so that the minimum application to the Memory is ensured, and the java call stack information is acquired under the condition Of occupying the Memory as little as possible after OOM (Out Of Memory) crash occurs in android application, thereby ensuring the maximum success rate Of acquiring the call stack and providing more effective information for troubleshooting.
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 cause the at least one processor to perform the get call stack method steps as described in the above embodiments.
The disclosed embodiments provide a non-volatile computer storage medium having stored thereon computer-executable instructions that may perform the method steps as described in the embodiments above.
Referring now to FIG. 4, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 401 that 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 necessary for the operation of the electronic apparatus are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 405. An input/output (I/O) interface 405 is also connected to bus 405.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 405 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, or the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 405. The communication means 405 may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the 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 illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 405, or may be installed from the storage device 408, or may be installed from the ROM 402. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 401.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present 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 contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart 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 described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.

Claims (10)

1. A crash information collection method, comprising:
when monitoring that the memory overflows and collapses, acquiring a stack storage object of the collapsed object;
acquiring a method identifier corresponding to a method of each stack frame in a 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 crash information.
2. The method of claim 1, wherein obtaining a stack storage object of a crashed object when a memory overflow crash is detected comprises:
monitoring a thread crash event through a monitoring function, and acquiring a crash object when the crash event occurs;
and acquiring a stack storage object of the crashed object through Java program reflection, wherein the stack storage object is a 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 of each stack frame in a crash call stack comprises:
converting the stack storage object into an object array by force;
acquiring a first element of the object array, and converting the first element into an integer array;
and acquiring an element with an index i of the integer array, and recording the element as a first identifier, wherein the first identifier is a method identifier corresponding to a method of the current stack frame, i is greater 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 and false to acquire the method name and the name of the class of the current stack frame.
5. The method as claimed in claim 3, wherein the calling a local conversion function by the method identifier corresponding to the stack frame to obtain the source file name and the source code line number of the stack frame returned by the local conversion function comprises:
acquiring an element with an index i + N of the integer array, acquiring an instruction offset value corresponding to a current stack frame, and recording the instruction offset value as a third identifier, wherein N is 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 analytic function is a prettyMethod function of the system, and the local transfer function is a TranslateLocation function of the system.
7. A crash information collection apparatus, comprising:
the first obtaining unit is used for obtaining a stack storage object of a crashed object when monitoring that the memory overflows and crashes;
the second obtaining unit is used for obtaining a method identifier corresponding to a method of each stack frame in the crash call stack through the stack storage object;
a first calling unit, configured to call, for each stack frame, an analysis function based on a method identifier corresponding to a method of the stack frame, and obtain a method signature of the stack frame returned by the analysis function;
a second calling unit, configured to call, for each stack frame, a local conversion function based on a method identifier corresponding to the method of the stack frame, and obtain 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 crash information.
8. The apparatus of claim 7, wherein 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 acquiring a stack storage object of the crashed object through Java program reflection, wherein the stack storage object is a bottom-layer representation of a call stack.
9. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out 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 carry out the method of any one 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 true CN111813641A (en) 2020-10-23
CN111813641B 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)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905378A (en) * 2021-03-03 2021-06-04 广州虎牙科技有限公司 Crash information analysis method and device, electronic equipment and readable storage medium
CN114546590A (en) * 2022-02-18 2022-05-27 北京基调网络股份有限公司 Java virtual machine heap memory set object monitoring method and memory overflow analysis method
CN114595244A (en) * 2022-03-11 2022-06-07 北京字节跳动网络技术有限公司 Collapse data aggregation method and device, electronic equipment and storage medium
CN115061837A (en) * 2022-08-16 2022-09-16 苏州浪潮智能科技有限公司 Method and device for scheduling, tracking and acquiring user space call stack
WO2022199283A1 (en) * 2021-03-22 2022-09-29 北京字节跳动网络技术有限公司 Method and apparatus for determining object of call stack frame, device, and medium

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

Cited By (7)

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

Also Published As

Publication number Publication date
CN111813641B (en) 2024-05-17

Similar Documents

Publication Publication Date Title
CN111813641B (en) Method, device, medium and equipment for collecting crash information
CN110865898B (en) Method, device, medium and equipment for converging crash call stack
CN111813465B (en) Information acquisition method, device, medium and equipment
CN110489179B (en) Method, device, medium and equipment for acquiring call stack frame function signature
CN109446025B (en) Operation behavior playback method and device, electronic equipment and readable medium
US11595591B2 (en) Method and apparatus for triggering special image effects and hardware device
CN109873735B (en) Performance test method and device for H5 page and computer equipment
CN110764941B (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110471709B (en) Method, device, medium and electronic equipment for accelerating webpage opening speed
CN110489165B (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110377289A (en) A kind of data analysis method, device, medium and electronic equipment
CN110489159A (en) Installation kit compressing method and data analysis method, device, medium and equipment
CN111428165A (en) Three-dimensional model display method and device and electronic equipment
CN113312119B (en) Information synchronization method and device, computer readable storage medium and electronic equipment
CN112954056B (en) Method and device for processing monitoring data, electronic equipment and storage medium
CN110908860B (en) Java thread acquisition method and device, medium and electronic equipment
CN110337027A (en) Video generation method, device and electronic equipment
CN112083976A (en) Information acquisition method, device, medium and equipment
CN111813667B (en) Method, device, medium and equipment for collecting application running track
CN112379967B (en) Simulator detection method, device, equipment and medium
CN114461214A (en) Page display method and device, electronic equipment and storage medium
CN110727480B (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN111813663B (en) Pointer type identification method, device, medium and equipment
CN111813664B (en) Crash information collection method, device, medium and equipment
CN116910669B (en) Data classification method, device, electronic equipment and readable storage medium

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