CN110489165B - Method, device, medium and equipment for acquiring call stack frame instruction offset - Google Patents

Method, device, medium and equipment for acquiring call stack frame instruction offset Download PDF

Info

Publication number
CN110489165B
CN110489165B CN201910710327.0A CN201910710327A CN110489165B CN 110489165 B CN110489165 B CN 110489165B CN 201910710327 A CN201910710327 A CN 201910710327A CN 110489165 B CN110489165 B CN 110489165B
Authority
CN
China
Prior art keywords
call stack
target thread
event
array
acquiring
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
CN201910710327.0A
Other languages
Chinese (zh)
Other versions
CN110489165A (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.)
Douyin Vision Co Ltd
Douyin Vision Beijing 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 CN201910710327.0A priority Critical patent/CN110489165B/en
Publication of CN110489165A publication Critical patent/CN110489165A/en
Application granted granted Critical
Publication of CN110489165B publication Critical patent/CN110489165B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30145Instruction analysis, e.g. decoding, instruction word fields

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure provides a method, an apparatus, a medium, and a device for obtaining a call stack frame instruction offset, where the method includes: acquiring a call stack storage object in a trigger event; converting the call stack storage object into an object array; taking a first element of the object array, and converting the first element into an integer array or a long integer array; and intercepting the second half section data of the integer array or the long integer array to obtain the call stack frame instruction offset. The method can accurately obtain the instruction offset value of the call stack frame in the crash event or the pause event, and further can obtain the source code line number in the dex file through the instruction offset value, so that the APK can still find the crash position of the file after deleting the line number information in the installation package, the volume of the android application installation package can be effectively simplified, the downloading success rate of the application is further improved, more users are brought to the product, and the popularization efficiency of the product is improved.

Description

Method, device, medium and equipment for acquiring call stack frame instruction offset
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 obtaining a call stack frame instruction offset.
Background
The inclusion volume of android applications is one of the important indexes for measuring the application quality: the smaller the bag volume is, the higher the download success rate of the user is, and the more users can use the application. The dex in the installation package (apk file) of the android application stores the code of the application, and occupies a considerable volume. If the volume of the part can be reduced, the volume of the installation package can be effectively reduced undoubtedly, the line number information of the application code is stored in the debug item in the dex, the operation effect of the code cannot be influenced after deletion, but the line number information of the source code corresponding to the application cannot be obtained, and the positioning is difficult when the application goes wrong.
Therefore, how to accurately acquire the instruction offset value of the call stack after deleting the source code line number of the call stack, and then find the source code line number is a technical problem to be solved.
BRIEF SUMMARY OF THE PRESENT DISCLOSURE
An object of the present disclosure is to provide a method, an apparatus, a medium, and a device for obtaining a call stack frame instruction offset, which can solve at least one of the above-mentioned technical problems. The specific scheme is as follows:
according to a specific implementation manner of the present disclosure, in a first aspect, the present disclosure provides a method for obtaining a call stack frame instruction offset, including:
acquiring a call stack storage object in a trigger event;
converting the call stack storage object into an object array;
taking a first element of the object array, and converting the first element into an integer array or a long integer array;
and intercepting the second half section data of the integer array or the long integer array to obtain the call stack frame instruction offset.
Optionally, the obtaining of the call stack storage object in the trigger event includes:
and when the trigger event is a crash event, directly reflecting and acquiring a call stack storage object.
Optionally, the obtaining of the call stack storage object in the trigger event includes: when the trigger event is a stuck event, the obtaining of the call stack storage object in the trigger event includes:
acquiring the ID of a target thread;
pausing the target thread according to the ID of the target thread;
acquiring the call stack storage object from the suspended target thread;
resuming execution of the target thread.
Optionally, the obtaining the ID of the target thread includes:
obtaining a pointer parameter for storing local service in the katton event through reflection;
and executing the first function to obtain the ID of the target thread.
Optionally, the suspending the target thread according to the ID of the target thread includes:
and inputting the ID of the target thread as a parameter into a second function, and pausing the target thread.
Optionally, the obtaining the call stack storage object from the suspended target thread includes:
and inputting the pointer parameter of the local service stored in the morton event into a third function to obtain the call stack storage object.
Optionally, the resuming the execution of the target thread includes:
and inputting the ID of the target thread as a parameter into a fourth function, and recovering the execution of the target thread.
According to a second aspect of the present disclosure, an apparatus for obtaining an offset of a call stack frame instruction is provided, which includes:
the acquisition unit is configured to acquire a call stack storage object in a trigger event;
the first conversion unit is configured to convert the call stack storage object into an object array;
the second conversion unit is configured to take a first element of the object array and strongly convert the first element into an integer array or a long integer array;
and the intercepting unit is configured to intercept the second half section data of the integer array or the long integer array to obtain the call stack frame instruction offset.
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: the method can accurately obtain the instruction offset value of the call stack frame in the crash event or the stuck event, can further determine the source code line number in the dex file through the instruction offset value, so that after the APK deletes the line number information in the installation package, the APK can still obtain the instruction offset value of the call stack frame in the crash event or the stuck event through the built-in SDK, and further find out the crash position of the file, so that the volume of the android application installation package can be effectively simplified, the downloading success rate of the application is improved, more users are brought to the product, and the popularization efficiency of the product is improved.
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 logical relationship diagram according to an embodiment of the present disclosure;
FIG. 2 illustrates an edit process method flow diagram in accordance with an embodiment of the present disclosure;
FIG. 3 illustrates a parsing process method flow diagram according to an embodiment of the disclosure;
FIG. 4 illustrates a flow diagram of a get instruction offset method according to an embodiment of the disclosure;
FIG. 5 is a schematic diagram of a fetch instruction offset apparatus according to an embodiment of the present disclosure;
fig. 6 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.
As shown in fig. 1, the logic relationship diagram according to the embodiment of the present disclosure includes a compiling process, a mobile phone terminal, an analysis server, and a front-end display, where the compiling process is that a program developer performs simplified editing of an APK through a compiler, the generated APK installation package is installed in the mobile phone terminal of a user, when the mobile phone terminal crashes or jams, an instruction offset value and a function name of a call stack are obtained through an SDK in the APK, and are reported to the analysis server, and the analysis server obtains an accurate crash position after analyzing, and displays the crash position to the program developer through the front-end display device, and the program developer can accurately locate the crash or jam position. The method comprises the following specific steps:
the APK compilation process is as follows, as shown in fig. 2:
step S202: and acquiring a dex file in the APK.
The Android Package (APK) is an Android installation package (APK), and the APK file can be installed by directly transmitting the APK file to an Android simulator or an Android mobile phone for execution.
The APK is used for packaging the project compiled by the android sdk into an installer file with the format of APK. The apk file is in zip format, but the suffix name is modified into apk, and the dex file can be seen after being decompressed by UnZip.
The dex file is the type of executable file on the Android platform. Dex (Dalvik vm executions), an Android Dalvik executive, is a Dalvik bytecode. When the Android runs a program, UnZip decompression is firstly needed, and a dex file can be seen after decompression.
Step S204: and storing the mapping relation between the instruction offset and the line number in the dex file as a first data file through a first file application tool.
The first file application tool can be dexdump to obtain a complete dex file before the deletion line number of Proguard, the dex file reserves the relation between each function dexPC (instruction offset) and the source code line number, and the relation can be stored as a data file by the dexdump tool and is used for describing the relation between each function dexPC (instruction offset) and the source code line number. This data file will be used by the parsing server.
Step S206: and deleting the line number file in the dex file through a second file application tool to form a simplified installation package file.
The second file application tool may be Proguard, which controls Proguard to generate a dex file without including debug item, and may be implemented by removing a configuration option of "-keep linemanaging table" used in general development, so that the generated dex file does not retain a relationship between a dexPC (instruction offset) and a line number of a function, and an APK volume is reduced.
Optionally, the method further comprises the following steps:
step S208: and saving the confusion relation of the function names in the dex file as a second data file through a third file application tool.
The third file application tool may be a trace, which saves the relationship between the member name of the class name before confusion and the member name of the class name after confusion as a mapping file, and the mapping file is also used by the resolution server. For example, the function name "do sth" is confused as "d", and the mapping file retains the mapping relationship between "do sth" and "d", so that anyone can know that the function name is "do sth" substantially through "d".
Optionally, the APK compiling process further includes one of the following method steps:
firstly, the first data file is sent to a server for data analysis.
And sending the dex file without deleting the line number to a server side, wherein the dex file reserves the mapping relation between the instruction offset and the line number, and when the corresponding instruction offset value is obtained from the mobile phone crash side, the accurate line number of the call stack can be obtained through the mapping relation.
Secondly, the simplified installation package file is sent to a mobile terminal for installation.
And the APK file with the row number deleted is sent to the mobile terminal, and the mobile terminal rapidly installs the APK file after obtaining the APK, so that the time and the space for installing the APK are reduced, the data flow is saved, and the user experience performance is improved.
The mobile terminal can be any android system such as a mobile phone and a PAD (PAD application program), and can be an intelligent terminal for operating the APK, after the intelligent terminal obtains the simplified APK file, once the intelligent terminal is broken down (for example, flashing) in the installation and operation process, the SDK in the APK can automatically obtain the needed call stack to analyze the reason of the breakdown. And after the SDK acquires the dexPC and the function signature of each stack frame in the call stack, reporting to the server for analysis to obtain the DexPC.
And thirdly, sending the second data file to a server for data analysis.
The server comprises any analysis server used for analyzing the crash problem, the analysis server is used for analyzing the information reported by the android client into a call stack with a real source code line number, and the analysis server is divided into two parts:
A. and obtaining the source code line number of each stack frame in the call stack according to the relationship between the dexPC and the source code line number of each function in the dex generated in the compiling process and the reported dexPC value and function signature of each stack frame in the call stack.
B. And obtaining the class name and the function name before each stack frame is confused according to the mapping file generated in the compiling process and the stack frame information in the call stack obtained in the last step (which is realized by a trace tool of Proguard). This results in a call stack with a true source line number and an un-obfuscated class name method name for each stack frame.
The APK resolution process is as follows, as shown in fig. 3:
step S302: and acquiring a first data file, wherein the first data file stores the mapping relation between the instruction offset and the line number in the dex file.
The first data file is a dex file which reserves the mapping relation between the instruction offset and the line number in the APK file.
The complete dex file before deleting the line number is acquired through Proguard, the dex file maintains the relation between each function dexPC (instruction offset) and the source code line number, and the relation can be saved as a data file through a dexdump tool and is used for describing the relation between each function dexPC (instruction offset) and the source code line number. This data file will be used by the parsing server.
Step S304: and acquiring a second data file, wherein the second data file stores the confusion relation of the function names in the dex file.
The second data file is a file storing the confusion relationship of the function name in the dex file, the application tool trace saves the relationship between the member name of the class name before confusion and the member name of the class name after confusion as a mapping file, and the file is also used by the analysis server. For example, the function name "do sth" is confused as "d", and the mapping file retains the mapping relationship between "do sth" and "d", so that anyone can know that the function name is "do sth" substantially through "d".
Step S306: and acquiring an instruction offset value and a function signature of each stack frame in a call stack reported by a network.
The network report is obtained from the mobile terminal provided with the simplified APK, and the mobile terminal is quickly installed after obtaining the APK, so that the time and the space for installing the APK are reduced, the data flow is saved, and the user experience performance is improved.
The mobile terminal can be any android system such as a mobile phone and a PAD (PAD application program), and can be an intelligent terminal for operating the APK, after the intelligent terminal obtains the simplified APK file, once the intelligent terminal is broken down (for example, flashing) in the installation and operation process, the SDK in the APK can automatically obtain the needed call stack to analyze the reason of the breakdown. And after the SDK acquires the dexPC and the function signature of each stack frame in the call stack, reporting to the server for analysis to obtain the DexPC.
Step S308: and finding the source code line number and the class name function name before confusion of each stack frame from the relationship between the first data file and the second data file through the instruction deviation value and the function signature.
The server comprises any analysis server used for analyzing the crash problem, the analysis server is used for analyzing the information reported by the android client into a call stack with a real source code line number, and the analysis server is divided into two parts:
A. and obtaining the source code line number of each stack frame in the call stack according to the relationship between the dexPC and the source code line number of each function in the dex generated in the compiling process and the reported dexPC value and function signature of each stack frame in the call stack.
B. And obtaining the class name and the function name before each stack frame is confused according to the mapping file generated in the compiling process and the stack frame information in the call stack obtained in the last step (which is realized by a trace tool of Proguard). This results in a call stack with a true source line number and an un-obfuscated class name method name for each stack frame.
Optionally, the method further comprises the following steps:
step S310: determining an accurate call stack according to the line number of the source code and the name of the class name function before confusion; and displaying the call stack information.
Once an accurate call stack is determined through the source code line number and the name of the class name function before confusion, the call stack is sent to the front end to be displayed, the front end is used for displaying the call stack from the android client after being processed by the analysis server, and an intuitive visual interface is provided for a developer to solve problems and obtain application information.
The method for acquiring the instruction offset by the mobile phone terminal comprises the following steps:
as shown in fig. 4, the present disclosure provides a method for obtaining a call stack frame instruction offset, including:
step S402: and acquiring a call stack storage object in the trigger event.
Optionally, the method specifically includes:
when the trigger event is a crash event (a Throwable object), a call stack storage object (a backup object) is directly obtained through reflection, wherein the crash event is that when problems such as invalid access of a memory, an invalid object, memory leakage, stack overflow and the like occur in the running process of a mobile phone application program, the application program cannot run normally, so that the program has phenomena such as flash back, no response and the like.
When the trigger event is a stuck event (Thread object), the stuck event refers to an unsmooth event such as delayed response occurring in the process of program running. The acquiring a call stack storage object (backing object) in the trigger event comprises:
first, the ID of the target thread is obtained. Obtaining a pointer parameter for storing local service in the katton event through reflection; and executing the first function to obtain the ID of the target thread.
Firstly, obtaining a member which is stored with a native (local service) layer representation in a target Thread object through reflection, wherein the member is a pointer and is called targetPtr below; then execute the GetThreadId function of Dbg class to get the id of the target thread, hereinafter targetId.
And secondly, pausing the target thread according to the ID of the target thread. And inputting the ID of the target thread as a parameter into a second function, and pausing the target thread.
Then, using targetId as a parameter, the suspend thread function of Dbg class is executed, and then the target thread suspends the execution.
And thirdly, acquiring the call stack storage object from the suspended target thread. And inputting the pointer parameter of the local service stored in the morton event into a third function to obtain the call stack storage object.
And then, taking the targetPtr as a parameter, executing a creatInternalStackTrace function, and obtaining a return result, namely backtrace.
Fourth, resume execution of the target thread. And inputting the ID of the target thread as a parameter into a fourth function, and recovering the execution of the target thread.
Finally, with targetId as a parameter, Dbg class resumerThread function is executed, after which the target thread resumes execution.
Step S404: and converting the call stack storage object into an object array by force.
Step S406: and taking a first element of the object array, and converting the first element into an integer array or a long integer array.
Step S408: and intercepting the second half section data of the integer array or the long integer array to obtain the call stack frame instruction offset.
Specifically, the call stack storage Object backtrace is forced to be an Object [ ] type Object (hereinafter referred to as backtraceArr); then taking a first element first of the backstraceArr; then, the first is converted into an object (hereinafter referred to as first IL) of an int [ ] type (under 32-bit operation condition) or a long [ ] type (under 64-bit operation condition); and finally, taking out the data of the second half section of the array of the firstIL, namely the dexPC value of all stack frames.
The method for acquiring the function signature by the mobile phone terminal comprises the following steps:
since the size of the backtracear is +1, the length of the stackCnt is-1; then i starts traversing from 0 to stackCnt-1, i.e. all stack frames are traversed, and each traversal process is as follows: taking an element (hereinafter referred to as mid) with an index of i of firstIL, which is jmehthodID of the method of the stack frame, taking an element (hereinafter referred to as cls) with an index of i +1 of backstraceArr, which is a class where the method of the stack frame is located, then transferring the mid and the cls from a java layer to a c layer, obtaining a method object (hereinafter referred to as method) by the c layer through a ToReflectMethod function of a java virtual machine, and then transferring the method to the java layer and recording a signature (including a method name, a parameter number and types of each parameter).
Thus, the required call stack is obtained, the dexPC value and the method signature of each stack frame in the call stack are obtained, and the DexPC value and the method signature are reported to the analysis server for processing through the network at the android client.
The method can accurately obtain the instruction offset value of the call stack frame in the crash event or the stuck event, can further determine the source code line number in the dex file through the instruction offset value, so that after the APK deletes the line number information in the installation package, the APK can still obtain the instruction offset value of the call stack frame in the crash event or the stuck event through the built-in SDK, and further find out the crash position of the file, so that the volume of the android application installation package can be effectively simplified, the downloading success rate of the application is improved, more users are brought to the product, and the popularization efficiency of the product is improved.
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. 5, according to the specific embodiment of the present disclosure, the present disclosure provides an apparatus for obtaining a call stack frame instruction offset, which includes a obtaining unit 502, a first converting unit 504, a second converting unit 506, and an intercepting unit 508.
The acquisition unit 502: and acquiring a call stack storage object in the trigger event.
Optionally, the method specifically includes:
and when the trigger event is a crash event (Throwable object), directly reflecting and acquiring a call stack storage object (backing object).
When the trigger event is a click event (Thread object), acquiring a call stack storage object (fallback object) in the trigger event includes:
first, the ID of the target thread is obtained. Obtaining a pointer parameter for storing local service in the katton event through reflection; and executing the first function to obtain the ID of the target thread.
Firstly, obtaining a member which is used for storing a native layer representation in a target Thread object through reflection, wherein the member is a pointer and is called targetPtr below; then execute the GetThreadId function of Dbg class to get the id of the target thread, hereinafter targetId.
And secondly, pausing the target thread according to the ID of the target thread. And inputting the ID of the target thread as a parameter into a second function, and pausing the target thread.
Then, using targetId as a parameter, the suspend thread function of Dbg class is executed, and then the target thread suspends the execution.
And thirdly, acquiring the call stack storage object from the suspended target thread. And inputting the pointer parameter of the local service stored in the morton event into a third function to obtain the call stack storage object.
And then, taking the targetPtr as a parameter, executing a creatInternalStackTrace function, and obtaining a return result, namely backtrace.
Fourth, resume execution of the target thread. And inputting the ID of the target thread as a parameter into a fourth function, and recovering the execution of the target thread.
Finally, with targetId as a parameter, Dbg class resumerThread function is executed, after which the target thread resumes execution.
First conversion unit 504: and converting the call stack storage object into an object array by force.
Second conversion unit 506: and taking a first element of the object array, and converting the first element into an integer array or a long integer array.
The interception unit 508: and intercepting the second half section data of the integer array or the long integer array to obtain the call stack frame instruction offset.
Specifically, the call stack storage Object backtrace is forced to be an Object [ ] type Object (hereinafter referred to as backtraceArr); then taking a first element first of the backstraceArr; then, the first is converted into an object (hereinafter referred to as first IL) of an int [ ] type (under 32-bit operation condition) or a long [ ] type (under 64-bit operation condition); and finally, taking out the data of the second half section of the array of the firstIL, namely the dexPC value of all stack frames.
The device can accurately obtain the instruction deviation value of the call stack frame in the crash event or the stuck event, and can further determine the source code line number in the dex file after the instruction deviation value, so that after the APK deletes the line number information in the installation package, the APK can still obtain the instruction deviation value of the call stack frame in the crash event or the stuck event through the built-in SDK, and further find the crash position of the file, so that the volume of the android application installation package can be effectively simplified, the downloading success rate of the application is improved, more users are brought to the product, and the popularization efficiency of the product is improved.
As shown in fig. 6, 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 content of the first and second substances,
the memory stores instructions executable by the one processor to cause the at least one processor to perform the method steps of 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. 6, 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. 6 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. 6, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 605. An input/output (I/O) interface 605 is also connected to bus 605.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 605 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, etc.; storage 608 including, for example, tape, hard disk, etc.; and a communication device 605. The communication device 605 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 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 605, or installed from the storage device 608, or installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
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 (8)

1. A method for obtaining call stack frame instruction offset is applied to a terminal, and is characterized by comprising the following steps:
acquiring a call stack storage object in a trigger event, wherein the trigger event is a stuck event, and the stuck event is a non-smooth event delaying response in the program running process; the acquiring of the call stack storage object in the trigger event includes: acquiring the ID of a target thread; pausing the target thread according to the ID of the target thread; acquiring the call stack storage object from the suspended target thread; resuming execution of the target thread;
converting the call stack storage object into an object array;
taking a first element of the object array, and converting the first element into an integer array or a long integer array;
and intercepting the second half section data of the integer array or the long integer array to obtain the call stack frame instruction offset.
2. The method of claim 1, wherein obtaining the ID of the target thread comprises:
obtaining a pointer parameter for storing local service in the katton event through reflection;
and executing the first function to obtain the ID of the target thread.
3. The method of claim 2, wherein said pausing said target thread based on said target thread's ID comprises:
and inputting the ID of the target thread as a parameter into a second function, and pausing the target thread.
4. The method of claim 3, wherein said fetching the call stack memory object from the suspended target thread comprises:
and inputting the pointer parameter of the local service stored in the morton event into a third function to obtain the call stack storage object.
5. The method of claim 4, wherein said resuming execution of the target thread comprises:
and inputting the ID of the target thread as a parameter into a fourth function, and recovering the execution of the target thread.
6. An apparatus for obtaining a call stack frame instruction offset, applied to a terminal, includes:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is configured to acquire a call stack storage object in a trigger event, the trigger event is a stuck event, and the stuck event is a non-smooth event with delayed response in the program running process; the acquiring of the call stack storage object in the trigger event includes: acquiring the ID of a target thread; pausing the target thread according to the ID of the target thread; acquiring the call stack storage object from the suspended target thread; resuming execution of the target thread;
the first conversion unit is configured to convert the call stack storage object into an object array;
the second conversion unit is configured to take a first element of the object array and strongly convert the first element into an integer array or a long integer array;
and the intercepting unit is configured to intercept the second half section data of the integer array or the long integer array to obtain the call stack frame instruction offset.
7. 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 5.
8. 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 5.
CN201910710327.0A 2019-08-02 2019-08-02 Method, device, medium and equipment for acquiring call stack frame instruction offset Active CN110489165B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910710327.0A CN110489165B (en) 2019-08-02 2019-08-02 Method, device, medium and equipment for acquiring call stack frame instruction offset

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910710327.0A CN110489165B (en) 2019-08-02 2019-08-02 Method, device, medium and equipment for acquiring call stack frame instruction offset

Publications (2)

Publication Number Publication Date
CN110489165A CN110489165A (en) 2019-11-22
CN110489165B true CN110489165B (en) 2021-10-15

Family

ID=68549307

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910710327.0A Active CN110489165B (en) 2019-08-02 2019-08-02 Method, device, medium and equipment for acquiring call stack frame instruction offset

Country Status (1)

Country Link
CN (1) CN110489165B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764941A (en) * 2019-09-05 2020-02-07 北京字节跳动网络技术有限公司 Method, device, medium and equipment for acquiring call stack frame instruction offset

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813465B (en) * 2020-06-19 2023-11-21 北京字节跳动网络技术有限公司 Information acquisition method, device, medium and equipment
CN111813641B (en) * 2020-06-19 2024-05-17 北京字节跳动网络技术有限公司 Method, device, medium and equipment for collecting crash information
CN112650647B (en) * 2020-12-29 2023-10-31 北京字节跳动网络技术有限公司 Information acquisition method, device, equipment and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101211309A (en) * 2006-12-29 2008-07-02 中兴通讯股份有限公司 Embedded system progress abnormal tracking position-finding method
CN102109975A (en) * 2009-12-24 2011-06-29 华为技术有限公司 Method, device and system for determining function call relationship
CN103019707A (en) * 2012-11-30 2013-04-03 华为技术有限公司 Call stack analyzing and processing method and device
CN103106132A (en) * 2013-03-05 2013-05-15 中标软件有限公司 Kernel function calling stack analyzing and debugging method in case of Linux system breakdown
CN103559123A (en) * 2013-10-24 2014-02-05 烽火通信科技股份有限公司 Function call stack analyzing method and device based on VxWorks operation system
CN108763060A (en) * 2018-04-27 2018-11-06 广州华多网络科技有限公司 Native layers of collapse source tracing method, device, storage medium and terminal in android system
CN109426603A (en) * 2017-08-21 2019-03-05 北京京东尚科信息技术有限公司 A kind of method and apparatus for analyzing application program Caton

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8949675B2 (en) * 2010-11-30 2015-02-03 Microsoft Corporation Error report processing using call stack similarity
US9836343B2 (en) * 2014-03-17 2017-12-05 Microsoft Technology Licensing, Llc Framework for user-mode crash reporting

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101211309A (en) * 2006-12-29 2008-07-02 中兴通讯股份有限公司 Embedded system progress abnormal tracking position-finding method
CN102109975A (en) * 2009-12-24 2011-06-29 华为技术有限公司 Method, device and system for determining function call relationship
CN103019707A (en) * 2012-11-30 2013-04-03 华为技术有限公司 Call stack analyzing and processing method and device
CN103106132A (en) * 2013-03-05 2013-05-15 中标软件有限公司 Kernel function calling stack analyzing and debugging method in case of Linux system breakdown
CN103559123A (en) * 2013-10-24 2014-02-05 烽火通信科技股份有限公司 Function call stack analyzing method and device based on VxWorks operation system
CN109426603A (en) * 2017-08-21 2019-03-05 北京京东尚科信息技术有限公司 A kind of method and apparatus for analyzing application program Caton
CN108763060A (en) * 2018-04-27 2018-11-06 广州华多网络科技有限公司 Native layers of collapse source tracing method, device, storage medium and terminal in android system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
mPaaS.支付宝App构建优化解析:Android包大小极致压.《https://juejin.cn/post/6844903712201277448》.2018, *
支付宝App构建优化解析:Android包大小极致压;mPaaS;《https://juejin.cn/post/6844903712201277448》;20181112;第4-7页 *
获取任意线程调用栈的那些事;a359798678;《https://blog.csdn.net/a359798678/article/details/101953786》;20171010;第1-6页 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764941A (en) * 2019-09-05 2020-02-07 北京字节跳动网络技术有限公司 Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110764941B (en) * 2019-09-05 2023-04-18 北京字节跳动网络技术有限公司 Method, device, medium and equipment for acquiring call stack frame instruction offset

Also Published As

Publication number Publication date
CN110489165A (en) 2019-11-22

Similar Documents

Publication Publication Date Title
CN110489179B (en) Method, device, medium and equipment for acquiring call stack frame function signature
CN110489165B (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110764941B (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110489101B (en) Interface simulation method, system, medium and electronic equipment
CN110865898B (en) Method, device, medium and equipment for converging crash call stack
CN111813641B (en) Method, device, medium and equipment for collecting crash information
CN109873735B (en) Performance test method and device for H5 page and computer equipment
CN111367516B (en) Application interface generation method and device and electronic equipment
CN111240684A (en) Cutting method and device of JS code, medium and electronic equipment
CN103885814A (en) Simulator device and method for operating ARM APKs on x86 framework
CN113377365B (en) Code display method, apparatus, device, computer readable storage medium and product
CN108089870B (en) Method and apparatus for repairing applications
CN110489159A (en) Installation kit compressing method and data analysis method, device, medium and equipment
CN111813465B (en) Information acquisition method, device, medium and equipment
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN110908860B (en) Java thread acquisition method and device, medium and electronic equipment
CN110727480B (en) Method, device, medium and equipment for acquiring call stack frame instruction offset
CN110941549B (en) Memory leak detection method, device, medium and electronic equipment
CN110489164B (en) Acquisition method, device, medium and equipment of hidden assertion information
CN111045926B (en) Application program jamming detection method, device, medium and electronic equipment
CN111435328B (en) Application testing method and device, electronic equipment and readable storage medium
CN110908882A (en) Performance analysis method and device of application program, terminal equipment and medium
CN117251355A (en) Performance test method, device, equipment, computer readable storage medium and product
CN111258797B (en) Memory leak detection method, device, medium and electronic equipment
US20150178060A1 (en) Creating a prerequisite checklist corresponding to a software application

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
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: Tiktok vision (Beijing) Co.,Ltd.