File parsing method, device, computer equipment and storage medium
By obtaining and querying the second identification code that meets the identification requirements when the application crashes, parsing the crash file, the problem of incomplete information is solved, and accurate positioning and analysis of application crashes is achieved, and maintenance efficiency is improved.
Patent Information
- Application Number
- CN202210375480.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-04-11
AI Technical Summary
The crash file information captured when an application crashes is incomplete, which causes developers to be unable to analyze effectively, affecting maintenance efficiency and progress.
By obtaining the first identification code in the crash file, and querying the second identification code that meets the identification requirements in the target mapping table, analyzing the crash file based on the second identification code, establishing a mapping table between the system library and the three-party library, and parsing it using the symbol table file.
It realizes accurate positioning and analysis of application crashes, improving application quality and maintenance efficiency.
Smart Images

Figure CN114722007B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a file parsing method, apparatus, computer equipment, and storage medium. Background Art
[0002] With the advancement of computer technology, more and more applications are being downloaded, installed, and used by clients. However, applications may experience anomalies during operation, such as freezing or flash back, which can lead to application crashes. Developers can analyze and resolve application crashes using crash files captured during the application crash.
[0003] However, the crash files captured when an application crashes usually have the problem of incomplete captured information, which makes it impossible for developers to perform reasonable analysis on the crash files, thereby affecting the efficiency and progress of developers in maintaining the application. Summary of the Invention
[0004] The embodiments of the present disclosure at least provide a file parsing method, apparatus, computer equipment, and storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides a file parsing method, the method comprising: obtaining a crash file generated when an application crashes; the crash file comprising at least one piece of information: system information, crash stack information, and library information; determining a first identification code in the crash file; wherein the first identification code is used to indicate a target execution file for parsing the crash file; when it is determined that the first identification code does not meet the identification requirements, querying a target mapping table for a second identification code that matches the crash file; the target mapping table is used to indicate a mapping relationship between a resource library contained in the application and an identification code; parsing the crash file based on the second identification code to obtain a file parsing result.
[0006] In an optional embodiment, the application includes a system library; the method further includes: determining a first standard identification code of the system library in the application and a library name of the system library, and determining system information of the application; establishing a first mapping table based on the system information, the library name of the system library and the first standard identification code; wherein the first mapping table is used to indicate a mapping relationship between the system library and the identification code, and the system information includes at least one of the following: operating system name, operating system version and processor type.
[0007] In an optional embodiment, the application includes a third-party library; the method further includes: determining a second standard identification code of the third-party library in the application and the library name of the third-party library, and determining the application version number of the application; establishing a second mapping table based on the application version number, the library name of the third-party library and the second standard identification code, wherein the second mapping table is used to indicate the mapping relationship between the third-party library and the identification code.
[0008] In an optional embodiment, there are multiple target mapping tables, and different mapping tables correspond to different types of resource libraries; when it is determined that the first identification code does not meet the identification requirements, querying the target mapping table for a second identification code that matches the crash file, including: when it is determined that the first identification code does not meet the identification requirements, determining the type information of the resource library corresponding to the first identification code; determining the target mapping table that matches the first identification code based on the type information; and querying the matching target mapping table for a second identification code that matches the crash file.
[0009] In an optional embodiment, the querying of the matching target mapping table for the second identification code that matches the crash file includes: when it is determined that the matching target mapping table is the first mapping table, extracting the first search information from the crash file, wherein the first search information includes: system information and / or the library name of the system library; the first mapping table is used to indicate the mapping relationship between the system library and the identification code; searching the first mapping table for the identification code that matches the first search information as the second identification code.
[0010] In an optional embodiment, the querying of the matching target mapping table for the second identification code that matches the crash file includes: when the matching target mapping table is the second mapping table, extracting second search information from the crash file, wherein the second search information includes: the library name of the third-party library and / or the application version number of the application; searching the second mapping table for the identification code that matches the second search information as the second identification code.
[0011] In an optional implementation, the target executable file is a symbol table file; parsing the crash file based on the second identification code to obtain a file parsing result includes: determining the corresponding target symbol table file based on the second identification code; calling a parsing function based on the target symbol table file, and parsing the crash file based on the parsing function.
[0012] In an optional implementation, the method further includes: after obtaining the analysis result of the crash file, sending the analysis result to the terminal device where the application is located.
[0013] In a second aspect, an embodiment of the present disclosure further provides a file parsing device, comprising: an acquisition unit, configured to acquire a crash file generated when an application crashes; the crash file contains at least one type of information: system information, crash stack information, and library information; a determination unit, configured to determine a first identification code in the crash file; wherein the first identification code is used to indicate a target execution file for parsing the crash file; a query unit, configured to query a target mapping table for a second identification code that matches the crash file when it is determined that the first identification code does not meet the identification requirements; the target mapping table is used to indicate a mapping relationship between a resource library and an identification code contained in the application; and a parsing unit, configured to parse the crash file based on the second identification code to obtain a file parsing result.
[0014] In a third aspect, an embodiment of the present disclosure further provides a computer device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are performed.
[0015] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect or any possible implementation of the first aspect are executed.
[0016] As can be seen from the above description, after obtaining the crash file generated by an application crash, the first identification code in the crash file can be determined. If it is determined that the first identification code does not meet the identification requirements, the second identification code that matches the crash file can be searched in the target mapping table. This can determine the second identification code that matches the crash file and meets the identification requirements, solving the problem of the first identification code being unable to be identified. Afterwards, the crash file can be parsed based on the second identification code to obtain the file parsing results, which can achieve accurate positioning and analysis of the application crash, thereby improving the quality of the application.
[0017] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments. The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and, together with the specification, are used to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without inventive effort.
[0019] Figure 1 A flowchart of a file parsing method provided by an embodiment of the present disclosure is shown;
[0020] Figure 2 A flowchart of a method for establishing a first mapping table provided by an embodiment of the present disclosure is shown;
[0021] Figure 3 A flowchart of a method for establishing a second mapping table provided by an embodiment of the present disclosure is shown;
[0022] Figure 4 A flowchart of a method for parsing the crash file based on the second identification code to obtain a file parsing result provided by an embodiment of the present disclosure when the target executable file is a symbol table file is shown;
[0023] Figure 5 A schematic diagram of a file parsing device provided by an embodiment of the present disclosure is shown;
[0024] Figure 6 A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the disclosure for which protection is sought, but merely represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.
[0026] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0027] The term "and / or" herein simply describes an association relationship, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, and the existence of B alone. In addition, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.
[0028] Research has found that with the development of computer technology, more and more applications are being downloaded, installed, and used by clients. However, during operation, applications may experience anomalies such as freezing or flash back, which can lead to application crashes. Developers can analyze and resolve application crashes using the crash files captured when the application crashes.
[0029] However, the crash files captured when an application crashes usually have the problem of incomplete captured information, which makes it impossible for developers to perform reasonable analysis on the crash files, thereby affecting the efficiency and progress of developers in maintaining the application.
[0030] In general, the process of capturing and analyzing crashes can be described as follows.
[0031] First, the symbol table of the resource library included in the application is uploaded to the server, a mapping relationship between the symbol table, an identification code for identifying the symbol table and the library name of the resource library is established, and the mapping relationship is stored in a database.
[0032] When an application crash is detected, the client where the application is located can record system information, crash stack information, and library information of loaded libraries into a crash file, and upload the crash file to the server.
[0033] The server can then determine the library name and the corresponding identification code of the loaded library based on the library information of the crash file, and query the above mapping relationship based on the identification code and library name to obtain a matching symbol table. Then, the server can use this matching symbol table to call the parsing function to parse the crash file and obtain the file parsing result.
[0034] However, in the crash file recorded by the client where the application is located, the identification code is usually unrecognizable, which in turn causes the server to be unable to query and obtain a symbol table matching the identification code, and thus unable to parse the crash file.
[0035] Based on the above research, the present disclosure provides a file parsing method, apparatus, computer equipment and storage medium. It can be seen from the above description that after obtaining the crash file generated by the crash of the application, the first identification code in the crash file can be determined, and when it is determined that the first identification code does not meet the identification requirements, the second identification code that matches the crash file can be queried in the target mapping table, so that the second identification code that matches the crash file and meets the identification requirements can be determined, solving the problem that the first identification code cannot be identified. Afterwards, the crash file can be parsed based on the second identification code to obtain the file parsing result, so that the crash of the application can be accurately located and analyzed, thereby improving the quality of the application.
[0036] To facilitate understanding of this embodiment, a file parsing method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the file parsing method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities.
[0037] See also Figure 1 FIG. 1 is a flowchart of a file parsing method provided by an embodiment of the present disclosure, wherein the method includes steps S101 to S107, wherein:
[0038] S101: Obtain a crash file generated when an application crashes; the crash file includes at least one type of information: system information, crash stack information, and library information.
[0039] In an embodiment of the present disclosure, a crash capture tool may be installed in the client, and after the crash capture tool detects that an application in the client has crashed, the crash file generated when the application crashed is obtained through the crash capture tool. The crash capture tool may be Breakpad or Crashpad. The present disclosure does not specifically limit the crash capture tool, and the tool is subject to implementation.
[0040] In an embodiment of the present disclosure, a crash file may include at least one of the following information: system information, crash stack information, library information, etc. The system information may be used to indicate relevant information about the system corresponding to the client where the application is located. For example, the system information may include at least the following information: operating system name, operating system version, and processor name.
[0041] The crash stack information may be used to indicate the crash address and crash program corresponding to the application crash.
[0042] The library information may be used to indicate relevant information of resource libraries included in the application. For example, the library information may be used to indicate the library names of resource libraries included in the application and the UUID (Universally Unique Identifier) corresponding to each library.
[0043] In an embodiment of the present disclosure, the resource library included in the application may be a system library and / or a third-party library, wherein the system library is used to indicate a public library associated with the operating system included in the application, and the third-party library is used to indicate a library customized by the developer to meet the needs of the application.
[0044] S103: Determine a first identification code in the crash file; wherein the first identification code is used to indicate a target executable file for parsing the crash file.
[0045] In the embodiment of the present disclosure, the first identification code is used to indicate the target executable file for parsing the crash file, wherein the target executable file can be a symbol table file. In this case, the first identification code is an identification code that can be used to indicate the symbol table file.
[0046] In the embodiment of the present disclosure, the first identification code may be a UUID included in the library information in the crash file.
[0047] S105: When it is determined that the first identification code does not meet the identification requirement, query a target mapping table for a second identification code that matches the crash file; the target mapping table is used to indicate a mapping relationship between resource libraries included in the application and identification codes.
[0048] In the embodiment of the present disclosure, the identification requirement can be understood as the completeness requirement of the first identification code. For example, when the first identification code is incomplete, it can be determined that the first identification code does not meet the identification requirement. When the first identification code is complete, it can be determined that the first identification code meets the identification requirement.
[0049] Wherein, when the first identification code is a UUID, an incomplete first identification code may be understood as the UUID being 000000000000000000000000000000000000, and a complete first identification code may be understood as the UUID not being 0000000000000000000000000000000000000.
[0050] In an embodiment of the present disclosure, when it is determined that the first identification code does not meet the identification requirement, a second identification code matching the crash file may be queried in the target mapping table.
[0051] The second identification code can be understood as the identification code when the first identification code is complete. For example, if the identification code is B0F8044975DE3923BB7EAE1C6F846A730, then the first identification code is incomplete. The first identification code may be 00000000000000000000000000000000000000. In this case, the second identification code obtained by querying the target mapping table is B0F8044975DE3923BB7EAE1C6F846A730.
[0052] S107: Parse the crash file based on the second identification code to obtain a file parsing result.
[0053] In an embodiment of the present disclosure, after the second identification code is obtained through query, the crash file can be parsed based on the second identification code to obtain a file parsing result.
[0054] During specific implementation, the target executable file indicated by the second identification code may be determined based on the second identification code, and then the crash file may be parsed based on the target executable file to obtain a file parsing result.
[0055] In addition, when the first identification code meets the identification requirement, the crash file can be parsed based on the first identification code to obtain a file parsing result.
[0056] As can be seen from the above description, after obtaining the crash file generated by an application crash, the first identification code in the crash file can be determined. If it is determined that the first identification code does not meet the identification requirements, the second identification code that matches the crash file can be searched in the target mapping table. This can determine the second identification code that matches the crash file and meets the identification requirements, solving the problem of the first identification code being unable to be identified. Afterwards, the crash file can be parsed based on the second identification code to obtain the file parsing results, which can achieve accurate positioning and analysis of the application crash, thereby improving the quality of the application.
[0057] In an optional embodiment, if Figure 2 As shown, in the case where the application includes a system library, with respect to S101 to S107, the method disclosed herein further includes the following steps:
[0058] Step S21: determining a first standard identification code of a system library in the application and a library name of the system library, and determining system information of the application;
[0059] Step S22: Establish a first mapping table based on the system information, the library name of the system library and the first standard identification code; wherein the first mapping table is used to indicate the mapping relationship between the system library and the identification code, and the system information includes at least one of the following: operating system name, operating system version and processor type.
[0060] In the embodiment of the present disclosure, the first standard identification code can be understood as an identification code corresponding to the system library of the application program that meets the identification requirements. The first standard identification code can be determined based on the target executable file corresponding to the system library.
[0061] During specific implementation, the system file corresponding to the system library of the application can be obtained first, and then the target execution file (for example, the system symbol table file) of the system library can be determined based on the system file. Then, the first standard identification code corresponding to the system library can be determined based on the target execution file of the system library. For example, the first line in the target execution file can be determined as the first standard identification code, or the second line in the target execution file can be determined as the first standard identification code. The present disclosure does not specifically limit the above-mentioned method of determining the first standard identification code based on the target execution file, and it is subject to what can be implemented.
[0062] It should be noted that the system file corresponding to the system library of the application is automatically obtained by the server, and after obtaining the system file, the first standard identification code of the system library can be determined based on the system file.
[0063] In addition, the server may also obtain the first standard identification code of the system library by querying the crash information recorded in the historical crash file.
[0064] In the disclosed embodiments, the system library name and system information can also be determined based on the system file. This system information can include information such as the operating system name, operating system version, and processor type. A mapping relationship can then be established between the system library name, system information, and the first standard identification code to obtain a first mapping table. Specifically, the first mapping table can include a mapping relationship between library name, operating system name, operating system version, processor name, and first standard identification code.
[0065] In the above embodiment, when the application includes a system library, a first mapping table can be established based on the system information of the application, the library name of the system library and the first standard identification code of the system library. Then, when the first identification code in the crash file does not meet the identification requirements, the second identification code that matches the crash file can be queried through the first mapping table.
[0066] In an optional embodiment, if Figure 3As shown, in the case where the application includes a third-party library, with respect to S101 to S107, the disclosed method further includes the following steps:
[0067] Step S31: determining the second standard identification code of the third-party library in the application and the library name of the third-party library, and determining the application version number of the application;
[0068] Step S32: establishing a second mapping table based on the application version number, the library name of the third-party library and the second standard identification code, wherein the second mapping table is used to indicate the mapping relationship between the third-party library and the identification code.
[0069] In the embodiment of the present disclosure, the second standard identification code can be understood as an identification code corresponding to the third-party library of the application program that meets the identification requirements. The second standard identification code can be determined based on the target executable file corresponding to the third-party library of the application program.
[0070] During specific implementation, after the application design is completed, the library name of the third-party library of the application, the target execution file of the third-party library (for example, the symbol table of the third-party library), and the application version number corresponding to the application can be stored in the database of the server. Afterwards, the target execution file of the system library (for example, the symbol table file of the system library) can be determined based on the system file. Then, the first line in the target execution file of the third-party library can be determined as the second standard identification code, or the second line in the target execution file of the third-party library can be determined as the second standard identification code. The present disclosure does not specifically limit the above-mentioned method of determining the second standard identification code based on the target execution file, and it is subject to what can be implemented.
[0071] In an embodiment of the present disclosure, a second mapping table can be established based on the application version number of the application, the library name of the third-party library and the second standard identification code, that is, the second mapping table can be a mapping relationship between library name_application version number_second standard identification code.
[0072] In the above embodiment, when the application includes a third-party library, a second mapping table can be established based on the application version number of the application, the library name of the third-party library and the second standard identification code of the third-party library. Then, when the first identification code in the crash file does not meet the identification requirements, the second mapping table can be used to query and obtain a second identification code that matches the crash file.
[0073] In an optional embodiment, when there are multiple target mapping tables and different mapping tables correspond to different types of resource libraries, S105: when it is determined that the first identification code does not meet the identification requirements, searching the target mapping table for a second identification code that matches the crash file specifically includes the following steps:
[0074] Step S41: when it is determined that the first identification code does not meet the identification requirement, determining the type information of the resource library corresponding to the first identification code;
[0075] Step S42: determining a target mapping table matching the first identification code based on the type information;
[0076] Step S43: Searching the matching target mapping table for a second identification code that matches the crash file.
[0077] In an embodiment of the present disclosure, the target mapping table can be used to indicate the mapping relationship between the resource library contained in the application and the identification code. Therefore, when the application contains multiple resource libraries, the number of target mapping tables is also multiple, and different target mapping tables correspond to different types of resource libraries.
[0078] For example, when the application contains two types of resource libraries, the number of target mapping tables is also two. When the application contains three types of resource libraries, the number of target mapping tables is also three. This disclosure does not limit the types of resource libraries contained in the application and the number of target mapping tables, which are subject to implementation.
[0079] In the embodiment of the present disclosure, the application includes two types of resource libraries, one of which is a system library type and the other is a third-party library type.
[0080] Therefore, when it is determined that the first identification code does not meet the identification requirement, the type information of the resource library corresponding to the first identification code can be determined, and the target mapping table matching the first identification code can be determined based on the type information.
[0081] In the case of determining the type information of the resource library corresponding to the first identification code, the type information may be determined based on the library name of the resource library corresponding to the first identification code.
[0082] In an embodiment of the present disclosure, after determining the target mapping table that matches the first identification code, the second identification code that matches the crash file may be searched in the matching target mapping table.
[0083] In the above implementation, when it is determined that the first identification code does not meet the identification requirements, the type information of the resource library corresponding to the first identification code can be determined, and a target mapping table matching the first identification code can be determined based on the type information. Afterwards, the second identification code matching the crash file can be queried in the matching target mapping table. In this way, corresponding target mapping tables can be established for different types of resource libraries, and the mapping relationship between the resource library included in the application and the identification code corresponding to the resource library can be established more accurately and comprehensively, thereby improving the success rate of parsing crash files.
[0084] In an optional embodiment, the above step S43: searching the matching target mapping table for the second identification code that matches the crash file specifically includes the following steps:
[0085] Step S51: When it is determined that the matching target mapping table is the first mapping table, extracting first search information from the crash file, wherein the first search information includes: system information and / or a library name of a system library; the first mapping table is used to indicate a mapping relationship between the system library and an identification code;
[0086] Step S52: searching the first mapping table for an identification code that matches the first search information as the second identification code.
[0087] In the embodiment of the present disclosure, when it is determined that the resource library of the application is a system library, the target mapping table that matches the system library may be determined to be the first mapping table.
[0088] When it is determined that the matching target mapping table is the first mapping table, the first search information can be extracted from the acquired crash file. The first search information can be used to indicate information in the first mapping table other than the second identification code, such as the system information and / or the library name of the system library as described in step S22 above. The system information is the system information contained in the crash file, and the library name of the system library is the library name in the library information contained in the crash file.
[0089] In the embodiment of the present disclosure, after the first search information is extracted, an identification code matching the first search information may be searched in the first mapping table, and the matching identification code may be determined as the second identification code.
[0090] In the above embodiment, when it is determined that the matching target mapping table is the first mapping table, the first search information in the crash file can be extracted, and the identification code that matches the first search information can be searched in the first mapping table, and the matching identification code can be determined as the second identification code. Therefore, if the first identification code does not meet the identification requirements, the second identification code that matches the crash file can be obtained from the crash file, thereby solving the problem of being unable to parse the crash file when the first identification code does not meet the identification requirements, thereby increasing the probability of successful crash file parsing, and further improving the quality of the application.
[0091] In an optional embodiment, the above step S43: searching the matching target mapping table for the second identification code that matches the crash file specifically includes the following steps:
[0092] Step S61: when the matching target mapping table is the second mapping table, extracting second search information from the crash file, wherein the second search information includes: a library name of a third-party library and / or an application version number of the application;
[0093] Step S62: searching the second mapping table for an identification code that matches the second search information as the second identification code.
[0094] In the embodiment of the present disclosure, when it is determined that the resource library of the application is a third-party library, the target mapping table that matches the system library may be determined to be the second mapping table.
[0095] When it is determined that the matching target mapping table is the second mapping table, second search information can be extracted from the acquired crash file. The second search information can be used to indicate information in the second mapping table other than the second identification code, such as the application version number and / or the library name of the third-party library as described in step S32 above.
[0096] The application version number may be included in the crash file. For example, when the crash capture tool collects crash information generated when an application crashes and generates a crash file, the application version number of the application is also collected in the crash file. In addition, the application version number may not be included in the crash file. In this case, when obtaining the crash file generated when the application crashes, the application version number of the application can be obtained at the same time. This disclosure does not limit the storage location of the application version number, which is subject to implementation.
[0097] In the embodiment of the present disclosure, after the second search information is extracted, an identification code matching the second search information may be searched in the second mapping table, and the matching identification code may be determined as the second identification code.
[0098] In the above embodiment, when it is determined that the matching target mapping table is the second mapping table, the second search information can be extracted, and an identification code matching the second search information can be searched in the second mapping table, and the matching identification code can be determined as the second identification code. Therefore, if the first identification code does not meet the identification requirements, the second identification code matching the crash file can be obtained from the crash file, thereby solving the problem of being unable to parse the crash file when the first identification code does not meet the identification requirements, thereby improving the probability of successful crash file parsing, and thus timely analyzing and improving application crashes, thereby further improving the quality of the application.
[0099] In an optional embodiment, if Figure 4 As shown, in the case where the target executable file is a symbol table file, S107: parsing the crash file based on the second identification code to obtain a file parsing result specifically includes the following steps:
[0100] Step S71: determining a corresponding target symbol table file based on the second identification code;
[0101] Step S72: calling a parsing function based on the target symbol table file, and parsing the crash file based on the parsing function.
[0102] In the embodiment of the present disclosure, after determining the second identification code, the target symbol table file corresponding to the second identification code can be determined based on the second identification code. In this case, the second identification code can also be understood as the standard identification code corresponding to each library in the resource library included in the application. For example, in the case where the resource library is a system library, the second identification code is the first standard identification code, and in the case where the resource library is a third-party library, the second identification code is the second standard identification code.
[0103] After that, the parsing function can be called based on the target symbol table file, and the crash file can be parsed based on the parsing function to obtain the file parsing result. The parsing function can be minidump_stackwalk.
[0104] The file parsing result can be understood as the parsing result of the crash stack in the crash file. The file parsing result can include at least the following information: crash location, crash code, crash library information, crash application name, etc.
[0105] In the above implementation, the corresponding target symbol table file can be determined based on the second identification code, and the parsing function can be called based on the target symbol table file to parse the crash file to obtain the file parsing result. In this way, a more accurate target symbol table file can be determined, and a more accurate file parsing result can be obtained.
[0106] In an optional embodiment, with respect to S101 to S107, the method of the present disclosure further includes:
[0107] After obtaining the analysis result of the crash file, the analysis result is sent to the terminal device where the application is located.
[0108] In the embodiment of the present disclosure, when the first identification code of the system library of the application does not meet the identification requirements, the server can accurately match the system symbol table through the system version number, library name, and first standard identification code. In the case that the first identification code of the third-party library of the application does not meet the identification requirements, the only matching information available for the third-party library is: library name and application version number. Since there may be upgrades to the third-party library under the same version number, there may be a phenomenon that the parsing result of the crash file is not accurate.
[0109] Therefore, in the disclosed embodiment, after obtaining the analysis result of the crash file, the analysis result can be sent to the terminal device where the application is located. For example, a selection box can be sent to the terminal device where the application is located, and the content in the selection box can be "Is the analysis correct?", and the user at the terminal device can determine whether the analysis result is correct.
[0110] It should be noted that the present disclosure does not specifically limit the content of the analysis result sent to the terminal device where the application is located, so long as the user at the terminal device can determine whether the analysis result is correct.
[0111] In the above implementation, whether the analysis result is correct can be determined based on the user of the terminal device where the application is located, thereby assisting the server-side staff to more accurately and quickly determine the cause of the crash, thereby improving the efficiency and accuracy of improving the application crash.
[0112] Those skilled in the art will understand that in the above-mentioned method of the specific implementation method, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0113] Based on the same inventive concept, the embodiment of the present disclosure also provides a file parsing device corresponding to the file parsing method. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned file parsing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0114] Reference Figure 5 FIG. 1 is a schematic diagram of a file parsing device provided by an embodiment of the present disclosure, wherein the device includes: an acquisition unit 51, a determination unit 52, a query unit 53, and a parsing unit 54; wherein,
[0115] An acquisition unit 51 is configured to acquire a crash file generated when an application crashes; the crash file includes at least one type of information: system information, crash stack information, and library information;
[0116] A determining unit 52 is configured to determine a first identification code in the crash file; wherein the first identification code is used to indicate a target executable file for parsing the crash file;
[0117] A query unit 53 is configured to query a target mapping table for a second identification code that matches the crash file if it is determined that the first identification code does not meet the identification requirement; the target mapping table is configured to indicate a mapping relationship between resource libraries included in the application and identification codes;
[0118] The parsing unit 54 is configured to parse the crash file based on the second identification code to obtain a file parsing result.
[0119] As can be seen from the above description, after obtaining the crash file generated by an application crash, the first identification code in the crash file can be determined. If it is determined that the first identification code does not meet the identification requirements, the second identification code that matches the crash file can be searched in the target mapping table. This can determine the second identification code that matches the crash file and meets the identification requirements, solving the problem of the first identification code being unable to be identified. Afterwards, the crash file can be parsed based on the second identification code to obtain the file parsing results, which can achieve accurate positioning and analysis of the application crash, thereby improving the quality of the application.
[0120] In one possible implementation, when the application includes a system library, the device is further used to: determine a first standard identification code of the system library in the application and a library name of the system library, and determine system information of the application; establish a first mapping table based on the system information, the library name of the system library and the first standard identification code; wherein the first mapping table is used to indicate a mapping relationship between the system library and the identification code, and the system information includes at least one of the following: operating system name, operating system version and processor type.
[0121] In one possible implementation, when the application includes a third-party library, the device is further used to: determine a second standard identification code of the third-party library and the library name of the third-party library in the application, and determine the application version number of the application; establish a second mapping table based on the application version number, the library name of the third-party library and the second standard identification code, wherein the second mapping table is used to indicate the mapping relationship between the third-party library and the identification code.
[0122] In one possible implementation, when there are multiple target mapping tables and different mapping tables correspond to different types of resource libraries, the query unit is further used to: determine the type information of the resource library corresponding to the first identification code when it is determined that the first identification code does not meet the identification requirements; determine the target mapping table that matches the first identification code based on the type information; and query the matching target mapping table for a second identification code that matches the crash file.
[0123] In one possible implementation, the query unit is further used to: when it is determined that the matching target mapping table is the first mapping table, extract the first search information in the crash file, wherein the first search information includes: system information and / or the library name of the system library; the first mapping table is used to indicate the mapping relationship between the system library and the identification code; and the identification code matching the first search information is searched in the first mapping table as the second identification code.
[0124] In one possible implementation, the query unit is further used to: extract second search information from the crash file when the matching target mapping table is a second mapping table, wherein the second search information includes: the library name of the third-party library and / or the application version number of the application; and search the second mapping table for an identification code that matches the second search information as the second identification code.
[0125] In one possible implementation, when the target executable file is a symbol table file, the parsing unit is further used to: determine the corresponding target symbol table file based on the second identification code; call a parsing function based on the target symbol table file, and parse the crash file based on the parsing function.
[0126] In a possible implementation, the parsing unit is further configured to: after obtaining the parsing result of the crash file, send the parsing result to the terminal device where the application is located.
[0127] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference can be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0128] Corresponding to Figure 1 The file parsing method in the present disclosure also provides a computer device 600, such as Figure 6 FIG. 6 is a schematic diagram of the structure of a computer device 600 provided in an embodiment of the present disclosure, including:
[0129] Processor 61, memory 62, and bus 63; memory 62 is used to store execution instructions and includes internal memory 621 and external memory 622; the internal memory 621 is also called internal memory and is used to temporarily store operation data in the processor 61 and data exchanged with external memory 622 such as a hard disk. The processor 61 exchanges data with the external memory 622 through the internal memory 621. When the computer device 600 is running, the processor 61 communicates with the memory 62 via the bus 63, so that the processor 61 executes the following instructions:
[0130] Obtaining a crash file generated when an application crashes; the crash file includes at least one type of information: system information, crash stack information, and library information;
[0131] Determine a first identification code in the crash file; wherein the first identification code is used to indicate a target executable file for parsing the crash file;
[0132] If it is determined that the first identification code does not meet the identification requirement, querying a target mapping table for a second identification code that matches the crash file; the target mapping table is used to indicate a mapping relationship between resource libraries included in the application and identification codes;
[0133] The crash file is parsed based on the second identification code to obtain a file parsing result.
[0134] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program executes the steps of the file parsing method described in the above method embodiment. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0135] The embodiments of the present disclosure also provide a computer program product, which carries program code. The instructions included in the program code can be used to execute the steps of the file parsing method described in the above method embodiment. For details, please refer to the above method embodiment and will not be repeated here.
[0136] The computer program product may be implemented in hardware, software, or a combination thereof. In one embodiment, the computer program product is implemented as a computer storage medium. In another embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0137] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0138] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0139] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0140] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0141] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present disclosure, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure shall be subject to the scope of protection of the claims.
Claims
1. A file parsing method, characterized in that: include: Get the crash file generated when the application crashes; The crash file contains at least one type of information: system information, crash stack information, and library information; Determine a first identification code in the crash file; wherein the first identification code is used to indicate a target executable file for parsing the crash file; If it is determined that the first identification code does not meet the identification requirement, querying a target mapping table for a second identification code that matches the crash file; the target mapping table is used to indicate a mapping relationship between resource libraries included in the application and identification codes; Parse the crash file based on the second identification code to obtain a file parsing result, There are multiple target mapping tables, and different mapping tables correspond to different types of resource libraries. When it is determined that the first identification code does not meet the identification requirements, searching the target mapping table for a second identification code that matches the crash file includes: If it is determined that the first identification code does not meet the identification requirement, determining type information of the resource library corresponding to the first identification code; Determining a target mapping table that matches the first identification code based on the type information; The matching target mapping table is searched for a second identification code that matches the crash file.
2. The method according to claim 1, characterized in that The application includes a system library; the method further includes: Determining a first standard identification code of a system library in the application and a library name of the system library, and determining system information of the application; A first mapping table is established based on the system information, the library name of the system library and the first standard identification code; wherein the first mapping table is used to indicate the mapping relationship between the system library and the identification code, and the system information includes at least one of the following: operating system name, operating system version and processor type.
3. The method according to claim 1, characterized in that The application includes a third-party library; the method further includes: Determine the second standard identification code of the third-party library in the application and the library name of the third-party library, and determine the application version number of the application; A second mapping table is established based on the application version number, the library name of the third-party library, and the second standard identification code, wherein the second mapping table is used to indicate a mapping relationship between the third-party library and the identification code.
4. The method according to claim 1, wherein The searching the matching target mapping table for a second identification code that matches the crash file includes: When it is determined that the matching target mapping table is the first mapping table, extracting first search information from the crash file, wherein the first search information includes: system information and / or a library name of a system library; the first mapping table is used to indicate a mapping relationship between the system library and the identification code; The identification code that matches the first search information is searched in the first mapping table as the second identification code.
5. The method according to claim 1, characterized in that The searching the matching target mapping table for a second identification code that matches the crash file includes: In a case where the matching target mapping table is the second mapping table, extracting second search information from the crash file, wherein the second search information includes: a library name of a third-party library and / or an application version number of the application; The identification code that matches the second search information is searched in the second mapping table as the second identification code.
6. The method according to claim 1, characterized in that The target execution file is a symbol table file; Parsing the crash file based on the second identification code to obtain a file parsing result includes: Determine the corresponding target symbol table file based on the second identification code; A parsing function is called based on the target symbol table file, and the crash file is parsed based on the parsing function.
7. The method according to claim 1, characterized in that The method further comprises: After obtaining the analysis result of the crash file, the analysis result is sent to the terminal device where the application is located.
8. A file parsing device, characterized in that: include: An acquisition unit is used to obtain a crash file generated when an application crashes; The crash file contains at least one type of information: system information, crash stack information, and library information; A determining unit, configured to determine a first identification code in the crash file; wherein the first identification code is used to indicate a target executable file for parsing the crash file; a query unit configured to query a target mapping table for a second identification code that matches the crash file if it is determined that the first identification code does not meet the identification requirement; the target mapping table is configured to indicate a mapping relationship between resource libraries included in the application and the identification codes; a parsing unit, configured to parse the crash file based on the second identification code to obtain a file parsing result, There are multiple target mapping tables, and different mapping tables correspond to different types of resource libraries. When it is determined that the first identification code does not meet the identification requirements, searching the target mapping table for a second identification code that matches the crash file includes: If it is determined that the first identification code does not meet the identification requirement, determining type information of the resource library corresponding to the first identification code; Determining a target mapping table that matches the first identification code based on the type information; The matching target mapping table is searched for a second identification code that matches the crash file.
9. A computer device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the file parsing method according to any one of claims 1 to 7 are performed.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the file parsing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for analyzing crash file
CN111638991A
Method and equipment for processing program crash and computer readable storage medium
CN113419886A