Fault determination method and device, electronic equipment and storage medium
By receiving fault resolution requests at client startup and utilizing the target dynamic library for each stack frame in the stack to resolve the issue of low efficiency in client stack acquisition, more efficient fault type determination is achieved, improving operational stability and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2026-03-31
AI Technical Summary
In existing technologies, client-side stack tracking is inefficient, consumes a large amount of memory, and affects operational stability and efficiency.
When the client starts up, it receives a fault resolution request, carrying a stack trace and binary file. The server parses the target dynamic library corresponding to each stack frame in the stack trace, updates the attribute information, determines the fault type, and reduces the storage pressure and workload of the client.
It improves stack acquisition efficiency, reduces client storage pressure and workload, and enhances operational stability and efficiency.
Smart Images

Figure CN115048232B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a fault determination method, apparatus, electronic device, and storage medium. Background Technology
[0002] In related technologies, after the client obtains the stack trace, it is necessary to obtain the offset of the binary file corresponding to each stack frame in the stack, and then symbolize it to locate the fault. During the operation, the client needs to store a large number of binary files multiple times and traverse them one by one, which is a lot of work. This not only occupies a lot of memory on the client, but also increases the time for the client to collect the stack trace, affecting the efficiency of stack trace collection. Summary of the Invention
[0003] This disclosure provides a fault determination method, apparatus, electronic device, and storage medium to at least solve the problem of low stack acquisition efficiency in related technologies. The technical solution of this disclosure is as follows:
[0004] According to a first aspect of the present disclosure, a fault determination method is provided, comprising:
[0005] Receive a fault resolution request sent by the client when the target application starts; the fault resolution request carries the stack trace and binary file corresponding to the target application;
[0006] Based on the stack and the binary file, determine the target dynamic library corresponding to each stack frame in the stack;
[0007] Based on the attribute information of each target dynamic library, the attribute information of the corresponding stack frame of each target dynamic library is updated to obtain the updated attribute information of each stack frame.
[0008] The fault type of the target application is determined based on the update attribute information of each stack frame in the stack.
[0009] In one exemplary implementation, determining the target dynamic library corresponding to each stack frame in the stack based on the stack and the binary file includes:
[0010] Parse the binary file to obtain at least two dynamic libraries; each dynamic library includes a start address and an end address.
[0011] Parse the stack to obtain the stack frame address of each stack frame in the stack;
[0012] Based on the stack frame address of each stack frame, and the start and end addresses of each dynamic library, determine the target dynamic library corresponding to each stack frame.
[0013] In one exemplary implementation, determining the target dynamic library corresponding to each stack frame based on the stack frame address of each stack frame and the start and end addresses of each dynamic library includes:
[0014] Identify any stack frame as the target stack frame and obtain the target address of the target stack frame;
[0015] Get the start and end addresses for each dynamic library;
[0016] Traverse the at least two dynamic libraries to find the dynamic library whose start and end addresses include the target address;
[0017] The dynamic library that includes the target address between the start address and the end address is determined as the target dynamic library of the target stack frame.
[0018] In one exemplary implementation, traversing the at least two dynamic libraries to find a dynamic library whose start and end addresses include the target address includes:
[0019] Sort the at least two dynamic libraries according to the starting address corresponding to each dynamic library;
[0020] Based on the sorting results and the binary search algorithm, find the dynamic library whose starting address and ending address include the target address.
[0021] In one exemplary implementation, updating the attribute information of the stack frame corresponding to each target dynamic library based on the attribute information of each target dynamic library to obtain the updated attribute information of each stack frame includes:
[0022] Obtain the initial attribute information for each stack frame;
[0023] The initial attribute information of each stack frame and the attribute information of the target dynamic library corresponding to each stack frame are used as the updated attribute information of each stack frame.
[0024] In one exemplary implementation, determining the fault type of the target application based on the update attribute information of each stack frame in the stack includes:
[0025] The symbolization tool is invoked to symbolize the update attribute information of each stack frame, thereby obtaining the function identifier corresponding to each stack frame;
[0026] The fault type of the target application is determined based on the function identifiers of each stack frame in the stack.
[0027] In one exemplary embodiment, the attribute information of the target dynamic library includes at least one of the target dynamic library's offset, identification code, and memory location.
[0028] According to a second aspect of the present disclosure, a fault determination apparatus is provided, comprising:
[0029] The fault resolution request sending module is configured to receive fault resolution requests sent by the client when the target application starts; the fault resolution request carries the stack and binary file corresponding to the target application;
[0030] The target dynamic library determination module is configured to determine the target dynamic library corresponding to each stack frame in the stack based on the stack and the binary file.
[0031] The attribute update module is configured to update the attribute information of the corresponding stack frame of each target dynamic library based on the attribute information of each target dynamic library, so as to obtain the updated attribute information of each stack frame.
[0032] The fault type determination module is configured to determine the fault type of the target application based on the updated attribute information of each stack frame in the stack.
[0033] In one exemplary embodiment, the target dynamic library determination module includes:
[0034] The file parsing unit is configured to parse the binary file to obtain at least two dynamic libraries; each dynamic library includes a start address and an end address.
[0035] The stack frame address determination unit is configured to parse the stack to obtain the stack frame address of each stack frame in the stack;
[0036] The target dynamic library determination unit is configured to determine the target dynamic library corresponding to each stack frame based on the stack frame address of each stack frame and the start and end addresses of each dynamic library.
[0037] In one exemplary embodiment, the target dynamic library determination unit includes:
[0038] The target address acquisition unit is configured to determine any stack frame as the target stack frame and acquire the target address of the target stack frame;
[0039] The start address acquisition unit is configured to retrieve the start and end addresses for each dynamic library.
[0040] The dynamic library lookup unit is configured to perform a traversal of the at least two dynamic libraries to find the dynamic library whose start address and end address include the target address;
[0041] The target dynamic library determination unit is configured to determine the dynamic library that includes the target address between the start address and the end address as the target dynamic library of the target stack frame.
[0042] In one exemplary embodiment, the dynamic library lookup unit includes:
[0043] The sorting subunit is configured to sort the at least two dynamic libraries according to the start address corresponding to each dynamic library;
[0044] The dynamic library lookup subunit is configured to perform a search based on the sorting result and a binary search algorithm to find dynamic libraries whose start and end addresses include the target address.
[0045] In one exemplary embodiment, the attribute update module includes:
[0046] The initial attribute information acquisition unit is configured to acquire the initial attribute information of each stack frame;
[0047] The attribute information update determination unit is configured to use the initial attribute information of each stack frame and the attribute information of the target dynamic library corresponding to each stack frame as the updated attribute information of each stack frame.
[0048] In one exemplary embodiment, the fault type determination module includes:
[0049] The function identifier determination unit is configured to execute the call symbolization tool to symbolize the update attribute information of each stack frame to obtain the function identifier corresponding to each stack frame;
[0050] The fault type determination unit is configured to determine the fault type of the target application based on the function identifiers of each stack frame in the stack.
[0051] In one exemplary embodiment, the attribute information of the target dynamic library includes at least one of the target dynamic library's offset, identification code, and memory location.
[0052] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0053] processor;
[0054] Memory used to store the processor's executable instructions;
[0055] The processor is configured to execute the instructions to implement the fault determination method described above.
[0056] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by an electronic device processor, enables the electronic device to perform the fault determination method as described above.
[0057] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the fault determination method as described above.
[0058] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0059] This application receives a fault analysis request sent by a client when a target application starts. The fault analysis request carries the stack trace and binary file corresponding to the target application. Based on the stack trace and the binary file, the target dynamic library corresponding to each stack frame in the stack is determined. According to the attribute information of each target dynamic library, the attribute information of the stack frame corresponding to each target dynamic library is updated to obtain the updated attribute information of each stack frame. Based on the updated attribute information of each stack frame in the stack, the fault type of the target application is determined. In this application, the client stores the binary file only once during the target application's operation and sends the stack trace and binary file to the server for parsing and fault determination. This reduces the client's storage pressure and workload, improves the client's operational stability and efficiency, and increases the efficiency of the client's stack trace acquisition.
[0060] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0061] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0062] Figure 1 This is an application environment diagram illustrating a fault determination method according to an exemplary embodiment.
[0063] Figure 2 This is a flowchart illustrating a fault determination method according to an exemplary embodiment.
[0064] Figure 3 This is a flowchart illustrating a method for determining the target dynamic library corresponding to each stack frame in the stack, according to an exemplary embodiment.
[0065] Figure 4 This is a flowchart illustrating a method for determining the target dynamic library corresponding to each stack frame according to an exemplary embodiment.
[0066] Figure 5 This is a flowchart illustrating a method for traversing at least two dynamic libraries and finding a dynamic library whose target address is included between a start address and an end address, according to an exemplary embodiment.
[0067] Figure 6 This is a flowchart illustrating a method for updating the attribute information of the stack frame corresponding to each target dynamic library based on the attribute information of each target dynamic library, according to an exemplary embodiment, to obtain the updated attribute information of each stack frame.
[0068] Figure 7 This is a flowchart illustrating a client-side stack acquisition method according to an exemplary embodiment.
[0069] Figure 8 This is a flowchart illustrating a method for a server to parse a reported file according to an exemplary embodiment.
[0070] Figure 9 This is a block diagram illustrating a fault determination apparatus according to an exemplary embodiment.
[0071] Figure 10 This is a block diagram illustrating an electronic device for determining a fault, according to an exemplary embodiment. Detailed Implementation
[0072] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0073] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0074] Existing stack trace acquisition methods are relatively inefficient. When collecting stack traces at high frequencies, they can cause applications to become sluggish and unresponsive.
[0075] To improve the efficiency of stack acquisition, this disclosure provides a fault determination method, apparatus, electronic device, and storage medium.
[0076] Please see Figure 1 The diagram illustrates an application environment for a fault determination method according to an exemplary embodiment. The application environment may include a server 01 and a client 02.
[0077] Specifically, in the embodiments of this specification, server 01 may include a standalone server, a distributed server, or a server cluster composed of multiple servers. It may also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Server 01 may include a network communication unit, a processor, and a memory, etc. Specifically, server 01 can be used to receive a fault analysis request sent by client 02 when the target application starts; the fault analysis request carries the stack and binary file corresponding to the target application; based on the stack and the binary file, the target dynamic library corresponding to each stack frame in the stack is determined; according to the attribute information of each target dynamic library, the attribute information of the stack frame corresponding to each target dynamic library is updated to obtain the updated attribute information of each stack frame; according to the updated attribute information of each stack frame in the stack, the fault type of the target application is determined.
[0078] Specifically, in this embodiment of the specification, the client 02 may include physical devices such as smartphones, desktop computers, tablets, laptops, digital assistants, smart wearable devices, and in-vehicle clients, or software running on the physical device, such as web pages provided to users by some service providers, or applications provided to users by these service providers. Specifically, the client 02 can be used to send a fault analysis request to the server 01 when the target application starts.
[0079] Figure 2 This is a flowchart illustrating a fault determination method according to an exemplary embodiment, such as... Figure 2 As shown, this method can be applied to Figure 1 The server 01 shown includes the following steps.
[0080] In step S21, a fault resolution request sent by the client when the target application starts is received; the fault resolution request carries the stack and binary file corresponding to the target application.
[0081] In this embodiment of the disclosure, the target application can be any type of application installed on the client, including but not limited to video applications, social applications, game applications, live streaming applications, navigation applications, etc. If a failure occurs during the operation of the target application, the client collects the stack trace. When the target application starts on the client, it can be determined whether the collected stack trace exists on the client. If it exists, the client sends a fault analysis request to the server, so that the server can analyze the corresponding fault of the client based on the stack trace.
[0082] In some embodiments, the method further includes:
[0083] If the target application experiences a runtime failure upon its first startup, the client collects the stack trace of the target application.
[0084] In this embodiment of the disclosure, the operational failure of the target application may include, but is not limited to, the target application experiencing lag, insufficient memory, crashes, or other failures.
[0085] The client obtains the binary file corresponding to the target application;
[0086] The client stores the stack and the binary file;
[0087] In this embodiment of the disclosure, when the target application is running, after obtaining the stack frame in the stack through backtrace, the online lookup of the corresponding binary's UUID, virtual address, real address, offset, etc., is no longer performed; only the backtrace is stored, along with all binary files. During the entire runtime of the target application, all binary files are stored only once. After storing this data, the client does not perform any processing on this data, only reporting this content to the server when needed.
[0088] In some embodiments, the receiving client sending a fault resolution request when the target application starts includes:
[0089] The client receives a fault resolution request sent during the second startup of the target application; the fault resolution request is generated by the client based on the stack and the binary file.
[0090] In this embodiment of the disclosure, the client can collect the stack trace when the target application is first launched; and upon the second launch, generate a fault resolution request based on the stack trace and the binary file, and send the fault resolution request to the server. The stack trace can be one or more, and the binary file is the file corresponding to the target application.
[0091] In a specific embodiment, such as Figure 7 As shown, Figure 7 The flowchart for collecting the stack trace for the client includes:
[0092] In step S701, the client responds to the target application launch command and starts the target application;
[0093] In step S703, the client collects stacks 1, 2, ..., n;
[0094] In step S705, the client obtains the binary file information of the target application;
[0095] In step S707, the client stores stacks 1-n and the binary file to a local file;
[0096] In step S709, when the target application is restarted for the second time, the client searches for local files and reports stack 1-n and binary files to the server.
[0097] In step S23, based on the stack and the binary file, the target dynamic library corresponding to each stack frame in the stack is determined;
[0098] In some embodiments, such as Figure 3 As shown, determining the target dynamic library corresponding to each stack frame in the stack based on the stack and the binary file includes:
[0099] In step S231, the binary file is parsed to obtain at least two dynamic libraries; each dynamic library includes a start address and an end address.
[0100] In this embodiment of the disclosure, the efficiency of client-side stack acquisition is 90% higher than that of conventional techniques (client-side stack parsing).
[0101] In this embodiment of the disclosure, the binary file may consist of multiple dynamic libraries; each dynamic library may include multiple addresses, where the first address is the start address, i.e., the address when the target application is loaded, and the end address is the address when the target application finishes running. Other addresses may be included between the start and end addresses. A library is code in a file that can be called by another library or an executable file. Once a library is loaded (referred to as "linking" when discussing compiled code), the code in the library is (usually) directly called by other code and runs in the same manner as the code that called it. A dynamic library is a special object file, typically with the extension .so on UNIX (and the standard extension .dll on Windows), which is loaded at runtime by the executable file that uses it. Unlike static libraries, dynamic libraries are not copied into the target program at compile time; the target program only stores references to the dynamic library. The dynamic library is actually loaded when the program runs.
[0102] In step S233, the stack is parsed to obtain the stack frame address of each stack frame in the stack.
[0103] In this embodiment of the disclosure, a stack may include multiple stack frames; the stack frame address of each stack frame can be obtained. In the field of computer science, a stack is an indispensable concept. A stack is a data structure, specifically a data structure where data items are arranged sequentially, and data items can only be inserted and deleted at one end (called the top of the stack). In microcontroller applications, the stack is a special storage area, its main function being to temporarily store data and addresses, typically used to protect breakpoints and the execution context. In C language, each stack frame corresponds to an incomplete function. The stack frame stores the function's return address and local variables. A stack frame, also called a procedure activation record, is a data structure used by the compiler to implement procedure / function calls.
[0104] In step S235, the target dynamic library corresponding to each stack frame is determined based on the stack frame address of each stack frame and the start and end addresses of each dynamic library.
[0105] In this embodiment of the disclosure, the target dynamic library corresponding to each stack frame can be determined based on the stack frame address and the start and end addresses of the dynamic library.
[0106] In this embodiment of the disclosure, multiple dynamic libraries are obtained by parsing the binary file of the target application, each dynamic library including a start address and an end address; the stack is parsed to obtain the stack frame address of each stack frame; thereby, the target dynamic library corresponding to each stack frame is quickly determined based on the dynamic library address and the stack frame address, so as to update the attribute information of each stack frame.
[0107] In this embodiment of the disclosure, such as Figure 4 As shown, determining the target dynamic library corresponding to each stack frame based on the stack frame address of each stack frame and the start and end addresses of each dynamic library includes:
[0108] In step S2351, any stack frame is determined as the target stack frame, and the target address of the target stack frame is obtained;
[0109] In step S2353, the start address and end address corresponding to each dynamic library are obtained;
[0110] In step S2355, the at least two dynamic libraries are traversed to find the dynamic library whose start address and end address include the target address;
[0111] In some embodiments, such as Figure 5 As shown, the step of traversing the at least two dynamic libraries and searching for a dynamic library whose start and end addresses include the target address includes:
[0112] In step S23551, the at least two dynamic libraries are sorted according to the start address corresponding to each dynamic library;
[0113] In this embodiment of the disclosure, the starting address of each dynamic library can be obtained, and the dynamic libraries can be sorted according to the characters in the starting address; for example, the dynamic libraries can be sorted according to the numbers in the starting address from largest to smallest or smallest to largest to obtain the sorting result.
[0114] In step S23553, based on the sorting result and the binary search algorithm, a dynamic library that includes the target address between the start address and the end address is searched.
[0115] In this embodiment of the disclosure, binary search, also known as half-interval search, is a highly efficient search method. However, binary search requires that the linear list must use a sequential storage structure, and that the elements in the list be arranged in order of their keys.
[0116] In this embodiment of the disclosure, each dynamic library can be sorted according to the starting address corresponding to the dynamic library, and then the target dynamic library corresponding to each stack frame can be quickly determined according to the binary search algorithm.
[0117] In step S2357, the dynamic library that includes the target address between the start address and the end address is determined as the target dynamic library of the target stack frame.
[0118] In this embodiment of the disclosure, each dynamic library can be traversed according to the stack frame address, the start address and the end address of each dynamic library, and the dynamic library corresponding to the address range (between the start address and the end address) into which the stack frame address falls can be determined as the target dynamic library of the target stack frame; thereby determining the target dynamic library corresponding to each stack frame in the stack.
[0119] In this embodiment of the disclosure, the target dynamic library corresponding to the stack frame can be determined according to the association between the stack frame address and the start address and end address of each dynamic library, so that the attribute information of the stack frame can be quickly completed according to the target dynamic library.
[0120] In step S25, the attribute information of the stack frame corresponding to each target dynamic library is updated according to the attribute information of each target dynamic library to obtain the updated attribute information of each stack frame.
[0121] In this embodiment, the attribute information of the target dynamic library includes at least one of the following: the target dynamic library's offset, identification code, and memory location. The identification code of the target dynamic library can be a UUID, which stands for Universally Unique Identifier. UUID is a software construction standard and part of the Open Software Foundation's work in the field of distributed computing environments. Its purpose is to ensure that all elements in a distributed system have unique identification information without requiring a central control point to assign identification information. In this way, everyone can create a UUID that does not conflict with others. Under such circumstances, there is no need to consider the problem of duplicate names during database creation.
[0122] In this embodiment of the disclosure, the offset, identification code, and at least one piece of information in memory of the stack frame can be quickly completed using the target dynamic library, thereby facilitating the symbolization of the stack frame.
[0123] In some embodiments, such as Figure 6 As shown, the step of updating the attribute information of the stack frame corresponding to each target dynamic library based on the attribute information of each target dynamic library to obtain the updated attribute information of each stack frame includes:
[0124] In step S251, the initial attribute information of each stack frame is obtained;
[0125] In this embodiment of the disclosure, the initial attribute information of the stack frame may include, but is not limited to, the virtual address, real address, and other information of the stack frame.
[0126] In step S253, the initial attribute information of each stack frame and the attribute information of the target dynamic library corresponding to each stack frame are used as the updated attribute information of each stack frame.
[0127] In this embodiment of the disclosure, the attribute information of the target dynamic library includes at least one of the target dynamic library's offset, identification code, and memory.
[0128] In this embodiment of the disclosure, the attribute information of the target dynamic library can be assigned to the stack frame, and combined with the initial attribute information of the stack frame, the complete attribute information of the stack frame can be obtained.
[0129] In step S27, the fault type of the target application is determined based on the update attribute information of each stack frame in the stack.
[0130] In some embodiments, determining the fault type of the target application based on the update attribute information of each stack frame in the stack includes:
[0131] The symbolization tool is invoked to symbolize the update attribute information of each stack frame, thereby obtaining the function identifier corresponding to each stack frame;
[0132] In this embodiment, the symbolication tool (symbolicatecrash) is a command-line tool. Symbolication requires a crash log file, a dSYM (symbol table) file, and the symbolication tool. In layman's terms, symbolication is the conversion of machine language into human-readable symbols. In this context, it refers to converting exception information (represented in hexadecimal symbols) from iOS or Mac OS into high-level code snippets readable by developers, thereby further locating the source of the exception and quickly fixing it. Symbolication allows developers to quickly find the exception stack trace, thereby locating and resolving the problem, ensuring the program runs smoothly. Crash files are typically represented by files ending in xxx.crash, and the methods for obtaining them differ depending on whether it's for debugging development or production. For example, during the development and testing phase, it can be exported from a test phone using the Xcode compiler.
[0133] The fault type of the target application is determined based on the function identifiers of each stack frame in the stack.
[0134] In this embodiment of the disclosure, the fault types of the target application may include, but are not limited to, faults such as target application lag (watchdog timer), insufficient memory, crashes, and freezes. After determining the function identifiers of each stack frame, the fault type of the target application can be determined through a symbol table.
[0135] In this embodiment of the disclosure, the update attribute information of each stack frame can be symbolized using a symbolization tool to obtain a function identifier, and then the fault type of the target application can be quickly determined based on the function identifier.
[0136] In a specific embodiment, such as Figure 8 As shown, Figure 8 The flowchart for the method of parsing the reported file for the server includes:
[0137] In step S801, the server obtains the reported file;
[0138] In step S803, the server parses the file, splits it to obtain a binary file and stack information (collecting stack 1-n);
[0139] In step S805, the server parses the binary file to obtain the dynamic library Image 1-Image n;
[0140] In step S807, the server sorts the images according to the address of each image;
[0141] In step S809, the server uses a binary search algorithm to find the corresponding Image for each stack frame in the stack.
[0142] In step S8011, the server completes the offset, memory size, UUID and other information of the Image to which each stack frame belongs;
[0143] In step S8013, the server performs symbolization processing on the completed stack frame.
[0144] This invention only obtains the stack frame on the client side, while the timing for completing the binary file information is moved to the server, thereby reducing the workload of the client and improving the efficiency of the client in acquiring the stack.
[0145] This disclosure receives a fault analysis request sent by a client when a target application starts. The fault analysis request carries a stack trace and a binary file corresponding to the target application. Based on the stack trace and the binary file, the target dynamic library corresponding to each stack frame in the stack is determined. According to the attribute information of each target dynamic library, the attribute information of the stack frame corresponding to each target dynamic library is updated to obtain updated attribute information for each stack frame. Based on the updated attribute information of each stack frame in the stack, the fault type of the target application is determined. In this application, the client stores the binary file only once during the target application's operation and sends the stack trace and the binary file to the server for parsing and fault determination. This reduces the client's storage pressure and workload, improves the client's operational stability and efficiency, and increases the efficiency of the client in collecting the stack trace.
[0146] Figure 9 This is a block diagram illustrating a fault determination apparatus according to an exemplary embodiment. (Refer to...) Figure 9 The device includes:
[0147] The fault resolution request sending module 910 is configured to receive a fault resolution request sent by the client when the target application starts; the fault resolution request carries the stack and binary file corresponding to the target application.
[0148] The target dynamic library determination module 920 is configured to determine the target dynamic library corresponding to each stack frame in the stack based on the stack and the binary file.
[0149] The attribute update module 930 is configured to update the attribute information of the stack frame corresponding to each target dynamic library based on the attribute information of each target dynamic library, so as to obtain the updated attribute information of each stack frame.
[0150] The fault type determination module 940 is configured to determine the fault type of the target application based on the updated attribute information of each stack frame in the stack.
[0151] In some embodiments, the target dynamic library determination module includes:
[0152] The file parsing unit is configured to parse the binary file to obtain at least two dynamic libraries; each dynamic library includes a start address and an end address.
[0153] The stack frame address determination unit is configured to parse the stack to obtain the stack frame address of each stack frame in the stack;
[0154] The target dynamic library determination unit is configured to determine the target dynamic library corresponding to each stack frame based on the stack frame address of each stack frame and the start and end addresses of each dynamic library.
[0155] In some embodiments, the target dynamic library determination unit includes:
[0156] The target address acquisition unit is configured to determine any stack frame as the target stack frame and acquire the target address of the target stack frame;
[0157] The start address acquisition unit is configured to retrieve the start and end addresses for each dynamic library.
[0158] The dynamic library lookup unit is configured to perform a traversal of the at least two dynamic libraries to find the dynamic library whose start address and end address include the target address;
[0159] The target dynamic library determination unit is configured to determine the dynamic library that includes the target address between the start address and the end address as the target dynamic library of the target stack frame.
[0160] In some embodiments, the dynamic library lookup unit includes:
[0161] The sorting subunit is configured to sort the at least two dynamic libraries according to the start address corresponding to each dynamic library;
[0162] The dynamic library lookup subunit is configured to perform a search based on the sorting result and a binary search algorithm to find dynamic libraries whose start and end addresses include the target address.
[0163] In some embodiments, the attribute update module includes:
[0164] The initial attribute information acquisition unit is configured to acquire the initial attribute information of each stack frame;
[0165] The attribute information update determination unit is configured to use the initial attribute information of each stack frame and the attribute information of the target dynamic library corresponding to each stack frame as the updated attribute information of each stack frame.
[0166] In some embodiments, the fault type determination module includes:
[0167] The function identifier determination unit is configured to execute the call symbolization tool to symbolize the update attribute information of each stack frame to obtain the function identifier corresponding to each stack frame;
[0168] The fault type determination unit is configured to determine the fault type of the target application based on the function identifiers of each stack frame in the stack.
[0169] In some embodiments, the attribute information of the target dynamic library includes at least one of the target dynamic library's offset, identification code, and memory location.
[0170] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0171] In one exemplary embodiment, an electronic device is also provided, including a processor; a memory for storing processor-executable instructions; wherein, when the processor is configured to execute the instructions stored in the memory, it implements the fault determination method provided in any of the above embodiments.
[0172] The electronic device can be a client, a server, or a similar computing device. Taking a server as an example... Figure 10 This is a block diagram illustrating an electronic device according to an exemplary embodiment, such as... Figure 10As shown, the server 1000 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1010 (CPUs 1010 may include, but are not limited to, microprocessors (MCUs) or programmable logic devices (FPGAs), a memory 1030 for storing data, and one or more storage media 1020 (e.g., one or more mass storage devices) for storing application programs 1023 or data 1022. The memory 1030 and storage media 1020 may be temporary or persistent storage. The program stored in the storage media 1020 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 1010 may be configured to communicate with the storage media 1020 and execute the series of instruction operations in the storage media 1020 on the server 1000. Server 1000 may also include one or more power supplies 1060, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1040, and / or one or more operating systems 1021, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0173] The input / output interface 1040 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 1000. In one example, the input / output interface 1040 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 1040 may be a radio frequency (RF) module for wireless communication with the Internet.
[0174] Those skilled in the art will understand that Figure 10 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 1000 may also include... Figure 10 The more or fewer components shown, or having the same Figure 10 The different configurations shown.
[0175] In one exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1030 including instructions, which can be executed by a processor 1010 of the device 1000 to perform the above-described method. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0176] In one exemplary embodiment, an electronic device is also provided, comprising:
[0177] A processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the fault determination method described above.
[0178] In one exemplary embodiment, a computer program product is also provided, including a computer program that, when executed by a processor, implements the fault determination method provided in any of the above embodiments.
[0179] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0180] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0181] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A failure determination method characterized by comprising: The method is applied to a server and comprises the following steps: receiving a failure analysis request sent by a client when a target application is started, wherein the failure analysis request carries a stack corresponding to the target application and a binary file; analyzing the binary file to obtain at least two dynamic libraries, wherein each dynamic library comprises a start address and an end address; analyzing the stack to obtain a stack frame address of each stack frame in the stack; determining a target dynamic library corresponding to each stack frame in the stack according to the stack frame address of each stack frame and the start address and the end address of each dynamic library; updating attribute information of a stack frame corresponding to each target dynamic library according to attribute information of each target dynamic library to obtain updated attribute information of each stack frame; determining a failure type of the target application according to the updated attribute information of each stack frame in the stack.
2. The method of claim 1, wherein, The method of determining the target dynamic library corresponding to each stack frame comprises the following steps: determining any stack frame as a target stack frame and obtaining a target address of the target stack frame; obtaining the start address and the end address of each dynamic library; traversing the at least two dynamic libraries to find a dynamic library comprising the target address between the start address and the end address; determining the dynamic library comprising the target address between the start address and the end address as the target dynamic library of the target stack frame.
3. The method of claim 2, wherein, The method of traversing the at least two dynamic libraries to find a dynamic library comprising the target address between the start address and the end address comprises the following steps: sorting the at least two dynamic libraries according to the start address of each dynamic library; finding a dynamic library comprising the target address between the start address and the end address according to the sorting result and a binary search algorithm.
4. The method of claim 1, wherein, The method of updating the attribute information of the stack frame corresponding to each target dynamic library according to the attribute information of each target dynamic library to obtain the updated attribute information of each stack frame comprises the following steps: obtaining initial attribute information of each stack frame; taking the initial attribute information of each stack frame and the attribute information of the target dynamic library corresponding to each stack frame as the updated attribute information of each stack frame.
5. The method according to any one of claims 1 to 4, characterized in that, The method of determining the failure type of the target application according to the updated attribute information of each stack frame in the stack comprises the following steps: calling a symbolization tool to perform symbolization processing on the updated attribute information of each stack frame to obtain a function identifier corresponding to each stack frame; determining the failure type of the target application according to the function identifier of each stack frame in the stack.
6. The method according to any one of claims 1 to 4, characterized in that, The attribute information of the target dynamic library comprises at least one of an offset, an identification code and a memory of the target dynamic library.
7. A failure determination apparatus characterized by comprising: The device is applied to a server and comprises the following modules: a failure analysis request sending module configured to perform the following step: receiving a failure analysis request sent by a client when a target application is started, wherein the failure analysis request carries a stack corresponding to the target application and a binary file; The target dynamic library determination module is configured to perform the following: resolving the binary file to obtain at least two dynamic libraries; each dynamic library comprises a start address and an end address; resolving the stack to obtain a stack frame address of each stack frame in the stack; and determining a target dynamic library corresponding to each stack frame in the stack according to the stack frame address of each stack frame and the start address and the end address corresponding to each dynamic library. The attribute updating module is configured to perform the following: updating attribute information of a stack frame corresponding to each target dynamic library according to attribute information of each target dynamic library to obtain updated attribute information of each stack frame. The fault type determination module is configured to perform the following: determining a fault type of the target application according to the updated attribute information of each stack frame in the stack.
8. An electronic device, comprising: The computer program product comprises: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the fault determination method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, When the instructions in the computer readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the fault determination method according to any one of claims 1-6.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the fault determination method according to any one of claims 1-6.
Citation Information
Patent Citations
Application crash processing method, device and system
CN111708655A
Systems And Methods For Preventing Client Application Crashes Due To Operating System Updates
US20200334102A1