CN110928779B - File processing method, application program operation fault positioning method and equipment - Google Patents

File processing method, application program operation fault positioning method and equipment Download PDF

Info

Publication number
CN110928779B
CN110928779B CN201911131659.XA CN201911131659A CN110928779B CN 110928779 B CN110928779 B CN 110928779B CN 201911131659 A CN201911131659 A CN 201911131659A CN 110928779 B CN110928779 B CN 110928779B
Authority
CN
China
Prior art keywords
data
application program
instruction
target
methods
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911131659.XA
Other languages
Chinese (zh)
Other versions
CN110928779A (en
Inventor
杨志谦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Douyin Vision Co Ltd filed Critical Douyin Vision Co Ltd
Priority to CN201911131659.XA priority Critical patent/CN110928779B/en
Publication of CN110928779A publication Critical patent/CN110928779A/en
Application granted granted Critical
Publication of CN110928779B publication Critical patent/CN110928779B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The application relates to a file processing and application program operation fault positioning method and equipment. The file processing method comprises the following steps: designating a data subarea for each method at least according to the total instruction length of each method of an application program, writing instruction offset data of each method into a target position of a partition corresponding to the method, wherein each partition corresponds to one or more methods of the application program, the length of each partition is not less than the total instruction length of each method corresponding to the partition, and the target position is a position pointed by an instruction offset address included in the instruction offset data; storing target mapping relation data into a second target file corresponding to the application program, and deleting the target mapping relation data from the first target file, wherein the target mapping relation data comprises mapping relation data of instruction offset addresses and source code line numbers of all the methods. The application program processing method can effectively reduce the size of the application program package.

Description

File processing method, application program operation fault positioning method and equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a file processing method, an application program operation fault positioning method and an apparatus.
Background
An application program (APP) running on an Android operating system prints and reports stack information running when the application program crashes after crashing, wherein the stack information comprises a method call stack running when crashing and a corresponding line number, and the line number is stored in an application program package (apk) in the compiling stage of the application program. After an APP crashes, this information can help the developer locate where the application was misplaced.
Typically, each line of source code corresponds to a line number, occupying a certain volume of apk packets. The line number held in the apk packet of an application typically occupies a size of about 1.5MB to 3 MB. With the increasing functions of APP, for some super APPs, the number of line numbers is larger due to the huge number of source codes.
Compression of the apk of an application has been the goal of application development.
Disclosure of Invention
In order to further compress the apk of the application program, a file processing method, an application program operation fault positioning method and computer equipment capable of realizing the application program fault positioning under the condition that the line number is removed from the apk are provided.
In a first aspect, an embodiment of the present application provides a file processing method, where the file includes a first target file of an application program and a second target file corresponding to the application program, a data area of the first target file includes at least a debug information data area, a data content of the first target file includes at least target mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, and the method includes:
Respectively designating data subareas for each method according to at least the respective instruction total length of each method of an application program, and writing instruction offset data of each method into a target position of the data subarea corresponding to the method, wherein the instruction offset data comprises instruction offset addresses, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the respective instruction total length of each method corresponding to the data subarea, and the target position is the position pointed by the instruction offset address included in the instruction offset data;
reading target mapping relation data from a first target file, wherein the target mapping relation data comprises mapping relation data of instruction offset addresses of all methods and source code line numbers of application programs;
and storing the target mapping relation data into a second target file corresponding to the application program, and deleting the target mapping relation data from the first target file.
According to the file processing method provided by the embodiment of the invention, on one hand, the target mapping relation data stored in the first target file is deleted, namely, the line number is deleted from the apk packet of the application program, so that the purpose of compressing the apk of the application program is achieved; on the other hand, the target mapping relation data are stored in a second target application file, and the instruction offset address of the instruction of the application program is stored in the debugging information data area, so that after the application program crashes, the instruction offset address is read from the adjusting information data area and is reported instead of the line number, and in the fault locating stage, the corresponding line number can be found in the second target application file according to the reported instruction offset address, and further fault locating is realized; on the other hand, partition sharing of the data area is realized by modifying the data storage format of the debug information data area, and compared with the existing method that each method corresponds to one debug information data area, the new data storage format provided by the embodiment of the invention enables the storage space occupied by the debug information data area to be smaller, and further achieves the purpose of compressing apk.
In the embodiment of the invention, when the data subareas are designated for each method, not only the total instruction length of each method but also the method names of each method and/or the number of method parameters of each method can be used.
That is, the above-mentioned data sub-areas are respectively assigned to the above-mentioned respective methods according to at least the total instruction length of each method of the application program, and one implementation manner thereof is as follows: designating data subareas for each method according to at least the total instruction length and the method names of each method of the application program, wherein the methods with the same method names correspond to different data subareas; another implementation is: designating data subareas for each method according to at least the total instruction length and the method parameter number of each method of the application program, wherein the methods with different method parameter numbers correspond to different data subareas; yet another implementation is: and respectively designating data subareas for each method according to at least the total instruction length, the method names and the parameter number of each method of the application program.
The inventor finds that in the process of implementing the invention, if the number of method parameters of a certain method is different from the number of method parameters of other methods corresponding to a data subarea designated by the method, when an application program is crashed by an instruction of the method, the reported crash report does not carry line number information (if the line number information is replaced by instruction offset data, the instruction offset data is not carried), and the crash positioning is interfered. To avoid this, the method provided by the embodiment of the present invention, when designating a data subregion for a method, designates a method of the same number of method parameters to the same data subregion (it should be noted that this does not mean that all methods of the same number of method parameters are designated to the same data subregion, since designating a data subregion for a method is also related to other reference factors).
The inventor also finds that if the methods with the same method name are assigned to the same data subarea in the process of realizing the invention, ambiguity exists when the line number of the source code is resolved in the process of positioning the running fault of the application program, so that the resolution cannot be successfully performed. To avoid this, in embodiments of the present invention, methods of the same method name are assigned to different data subregions.
Based on any of the above method embodiments, the instruction offset data may further include identification information of a data sub-area where the instruction offset data is located.
The identification information of the data sub-region is carried in the instruction offset data, so that the object mapping relation data in the second object file is filtered according to the identification information of the data sub-region in the offset data carried in the crash report in the subsequent application program operation fault positioning stage, and only the line number is searched in part of the filtered object mapping relation data, thereby shortening the searching time and improving the searching efficiency.
On the basis, in one implementation manner, the target mapping relationship data is stored in a second target file corresponding to the application program, and specifically, the target mapping relationship data can be stored in the second target file corresponding to the application program in groups according to the corresponding data subareas, and each group of target mapping relationship data corresponds to one data subarea. In another implementation manner, the target mapping relationship data further comprises identification information of the data subareas corresponding to the methods.
In the embodiment of the present invention, the identification information of the data subregion may, but is not limited to, include: the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
The index of the data subarea is the offset address of the data subarea.
Based on any of the above method embodiments, the data subregion division manner of the debug information data region may be:
sequencing all methods of the application program according to the total length of the respective instructions;
grouping the ordered sequence formed by each method at least once until the summation result of the maximum value of the instruction total length of each group of methods is not more than the length of the modulation information data area, wherein the number of each group of methods obtained at the same time is the same, and the grouping number of each group of methods is decreased;
and searching the maximum value of the total length of the instructions of each group of methods for each grouping, summing, comparing the summation result with the length of the debugging information data area, and dividing the debugging information data area into data subareas with the same number as the grouping according to the maximum value of the total length of the instructions of each group of methods if the summation result is not greater than the length of the debugging information data area.
Through the partition mode, the partitions can be more balanced, and the situation that the methods corresponding to certain or certain data subareas are too many and the methods corresponding to certain or certain data subareas are too few is avoided.
In a second aspect, an embodiment of the present invention provides a file processing apparatus, where the file includes a first target file of an application program and a second target file corresponding to the application program, a data area of the first target file includes at least a debug information data area, a data content of the first target file includes at least target mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, the apparatus including:
the instruction offset data writing module is used for respectively designating data subareas for the methods according to at least the respective instruction total length of the methods of the application program, writing the instruction offset data of the methods into target positions of the data subareas corresponding to the methods, wherein the instruction offset data comprises instruction offset addresses, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the respective instruction total length of the methods corresponding to the data subarea, and the target positions are positions pointed by the instruction offset addresses included in the instruction offset data;
The mapping relation data reading module is used for reading target mapping relation data from the first target file, wherein the target mapping relation data comprises mapping relation data of instruction offset addresses of the methods and source code line numbers of the application program;
and the mapping relation data transfer module is used for storing the target mapping relation data into a second target file corresponding to the application program and deleting the target mapping relation data from the first target file.
The file processing device provided by the embodiment of the invention deletes the target mapping relation data stored in the first target file, namely deletes the line number from the apk packet of the application program, thereby achieving the purpose of compressing the apk of the application program; on the other hand, the target mapping relation data are stored in a second target application file, and the instruction offset address of the instruction of the application program is stored in the debugging information data area, so that after the application program crashes, the instruction offset address is read from the adjusting information data area and is reported instead of the line number, and in the fault locating stage, the corresponding line number can be found in the second target application file according to the reported instruction offset address, and further fault locating is realized; on the other hand, partition sharing of the data area is realized by modifying the data storage format of the debug information data area, and compared with the existing method that each method corresponds to one debug information data area, the new data storage format provided by the embodiment of the invention enables the storage space occupied by the debug information data area to be smaller, and further achieves the purpose of compressing apk.
In the embodiment of the present invention, when the instruction offset data writing module designates the data sub-area for each of the above methods, the method can be based on not only the total instruction length of each method, but also the method name of each method and/or the number of method parameters of each method.
That is, the instruction offset data writing module designates data sub-areas for each method of the application program at least according to the total instruction length of each method, and one implementation manner thereof is as follows: designating data subareas for each method according to at least the total instruction length and the method names of each method of the application program, wherein the methods with the same method names correspond to different data subareas; another implementation is: designating data subareas for each method according to at least the total instruction length and the method parameter number of each method of the application program, wherein the methods with different method parameter numbers correspond to different data subareas; yet another implementation is: and respectively designating data subareas for each method according to at least the total instruction length, the method names and the parameter number of each method of the application program.
The inventor finds that in the process of implementing the invention, if the number of method parameters of a certain method is different from the number of method parameters of other methods corresponding to a data subarea designated by the method, when an application program is crashed by an instruction of the method, the reported crash report does not carry line number information (if the line number information is replaced by instruction offset data, the instruction offset data is not carried), and the crash positioning is interfered. To avoid this, the apparatus provided in the embodiment of the present invention assigns methods of the same number of method parameters to the same data subregion when assigning data subregions to methods (it should be noted that this does not mean that all methods of the same number of method parameters are assigned to the same data subregion, since assigning data subregions to methods is also related to other reference factors).
The inventor also finds that if the methods with the same method name are assigned to the same data subarea in the process of realizing the invention, ambiguity exists when the line number of the source code is resolved in the process of positioning the running fault of the application program, so that the resolution cannot be successfully performed. To avoid this, in embodiments of the present invention, the instruction offset data write module assigns methods of the same method name to different data subregions.
Based on any of the above device embodiments, the instruction offset data may further include identification information of a data sub-area where the instruction offset data is located.
The identification information of the data sub-region is carried in the instruction offset data, so that the object mapping relation data in the second object file is filtered according to the identification information of the data sub-region in the offset data carried in the crash report in the subsequent application program operation fault positioning stage, and only the line number is searched in part of the filtered object mapping relation data, thereby shortening the searching time and improving the searching efficiency.
On the basis, in one implementation manner, the mapping relation data transfer module stores the target mapping relation data into a second target file corresponding to the application program, and specifically, the target mapping relation data can be stored into the second target file corresponding to the application program in a grouping mode according to the corresponding data subareas, and each group of target mapping relation data corresponds to one data subarea. In another implementation manner, the target mapping relationship data further comprises identification information of the data subareas corresponding to the methods.
In the embodiment of the present invention, the identification information of the data subregion may, but is not limited to, include: the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
The index of the data subarea is the offset address of the data subarea.
On the basis of any of the above apparatus embodiments, the apparatus may further include a data subregion dividing module configured to:
sequencing all methods of the application program according to the total length of the respective instructions;
grouping the ordered sequence formed by the methods at least once until the summation result of the maximum value of the instruction total length of each group of methods is not more than the length of the modulation information data area, wherein the number of each group of methods obtained at the same time is the same, and the grouping number of each group of methods is decreased;
and searching the maximum value of the total length of the instructions of each group of methods for each grouping, summing, comparing the summation result with the length of the debugging information data area, and dividing the debugging information data area into data subareas with the same number as the grouping according to the maximum value of the total length of the instructions of each group of methods if the summation result is not greater than the length of the debugging information data area.
Through the partition mode, the partitions can be more balanced, and the situation that the methods corresponding to certain or certain data subareas are too many and the methods corresponding to certain or certain data subareas are too few is avoided.
In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method embodiments described above when executing the computer program.
On one hand, the computer equipment provided by the embodiment of the invention deletes the target mapping relation data stored in the first target file, namely deletes the line number from the apk packet of the application program, thereby achieving the purpose of compressing the apk of the application program; on the other hand, the target mapping relation data are stored in a second target application file, and the instruction offset address of the instruction of the application program is stored in the debugging information data area, so that after the application program crashes, the instruction offset address is read from the adjusting information data area and is reported instead of the line number, and in the fault locating stage, the corresponding line number can be found in the second target application file according to the reported instruction offset address, and further fault locating is realized; on the other hand, partition sharing of the data area is realized by modifying the data storage format of the debug information data area, and compared with the existing method that each method corresponds to one debug information data area, the new data storage format provided by the embodiment of the invention enables the storage space occupied by the debug information data area to be smaller, and further achieves the purpose of compressing apk.
In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium including a program stored with instructions for performing the method provided by any of the method embodiments described above.
The computer readable storage medium provided by the embodiment of the invention deletes the target mapping relation data stored in the first target file, namely deletes the line number from the apk packet of the application program, thereby achieving the purpose of compressing the apk of the application program; on the other hand, the target mapping relation data are stored in a second target application file, and the instruction offset address of the instruction of the application program is stored in the debugging information data area, so that after the application program crashes, the instruction offset address is read from the adjusting information data area and is reported instead of the line number, and in the fault locating stage, the corresponding line number can be found in the second target application file according to the reported instruction offset address, and further fault locating is realized; on the other hand, partition sharing of the data area is realized by modifying the data storage format of the debug information data area, and compared with the existing method that each method corresponds to one debug information data area, the new data storage format provided by the embodiment of the invention enables the storage space occupied by the debug information data area to be smaller, and further achieves the purpose of compressing apk.
In a fifth aspect, an embodiment of the present invention provides a method for positioning an operation failure of an application program, including:
Acquiring instruction offset data of a target instruction of an application program from an application program crash report reported by a terminal, wherein the target instruction is an instruction operated when the application program crashes, the instruction offset data comprises an instruction offset address, the instruction offset address is obtained by searching a debug information data area of a first target file of the application program from the report terminal of the application program crash report, the debug information data area is divided into a plurality of data subareas, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the total instruction length of each method corresponding to the data subarea, the target position in each data subarea stores the instruction offset data of each corresponding method, the target position is the position pointed by the instruction offset address included in the instruction offset data, the data area of the first target file at least comprises the debug information data area, and the data content of the first target file at least comprises target mapping relation data;
reading an instruction offset address from the instruction offset data;
searching a second target file corresponding to the application program for a source code line number of the application program corresponding to the instruction offset address, wherein target mapping relation data are stored in the second target file, and the target mapping relation data comprise mapping relation data of the instruction offset addresses of the methods and the source code line numbers of the application program;
And determining the source code causing the application program to crash according to the searched source code line number.
According to the application program operation fault positioning method provided by the embodiment of the invention, because the second target file can be obtained, even if the crash report does not carry the source code line number but carries the instruction offset data, the corresponding line number can be found in the second target application file according to the reported instruction offset address, so that the fault positioning is realized.
On this basis, the instruction offset data may further include identification information of a data sub-area where the instruction offset data is located, and correspondingly, a source code line number of the application program corresponding to the instruction offset address is searched in a second target file corresponding to the application program, where an implementation manner may be:
reading the identification information of the data subareas from the instruction offset data;
searching a candidate target mapping relation data set from the second target file according to the identification information of the data sub-region, and searching a source code line number of the application program corresponding to the instruction offset address in the candidate target mapping relation data set, wherein the candidate target mapping relation data set is a set formed by target mapping relation data corresponding to the identification information of the data sub-region.
Still further, the identification information of the data subregion may include: and the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
In a sixth aspect, an embodiment of the present invention provides an application program operation fault positioning device, including:
the system comprises an instruction offset data reading module, an instruction offset data processing module and a data processing module, wherein the instruction offset data reading module is used for acquiring instruction offset data of a target instruction of an application program from an application program crash report reported by a terminal, the target instruction is an instruction operated when the application program crashes, the instruction offset data comprises an instruction offset address, the instruction offset address is obtained by searching a debug information data area of a first target file of the application program from the report terminal of the application program crash report, the debug information data area is divided into a plurality of data subareas, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the instruction total length of each method corresponding to the data subarea, the target position in each data subarea is a position pointed by the instruction offset address included in the instruction offset data, the data area of the first target file at least comprises the debug information data area, and the data content of the first target file at least comprises target mapping relation data;
The instruction offset address reading module is used for reading the instruction offset address from the instruction offset data;
the source code line number searching module is used for searching the source code line number of the application program corresponding to the instruction offset address in a second target file corresponding to the application program, and target mapping relation data are stored in the second target file, wherein the target mapping relation data comprise mapping relation data of the instruction offset address of each method and the source code line number of the application program;
and the fault source code searching module is used for determining source codes which cause the application program to crash according to the searched source code line numbers.
According to the application program operation fault positioning device provided by the embodiment of the invention, because the second target file can be obtained, even if the crash report does not carry the source code line number but carries the instruction offset data, the corresponding line number can be found in the second target application file according to the reported instruction offset address, so that the fault positioning is realized.
On this basis, the instruction offset data may further include identification information of a data sub-area where the instruction offset data is located, and the corresponding source code line number searching module searches the second target file corresponding to the application program for the source code line number of the application program corresponding to the instruction offset address, where an implementation manner may be:
Reading the identification information of the data subareas from the instruction offset data;
searching a candidate target mapping relation data set from the second target file according to the identification information of the data sub-region, and searching a source code line number of the application program corresponding to the instruction offset address in the candidate target mapping relation data set, wherein the candidate target mapping relation data set is a set formed by target mapping relation data corresponding to the identification information of the data sub-region.
Still further, the identification information of the data subregion may include: the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
In a seventh aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of any of the method embodiments described above when executing the computer program.
The computer equipment provided by the embodiment of the invention can acquire the second target file, so that even if the crash report does not carry the source code line number but carries the instruction offset data, the corresponding line number can be found in the second target application file according to the reported instruction offset address, thereby realizing fault location.
In an eighth aspect, an embodiment of the present invention provides a computer readable storage medium including a program stored with instructions for executing the method provided by the above method embodiment.
The computer readable storage medium provided by the embodiment of the invention can acquire the second target file, so that even if the crash report does not carry the source code line number but carries the instruction offset data, the corresponding line number can be found in the second target application file according to the reported instruction offset address, thereby realizing fault location.
Drawings
FIG. 1 is a flow chart of a method for processing files according to an embodiment of the present invention;
FIG. 2 is a block diagram of a document processing apparatus according to an embodiment of the present invention;
FIG. 3 is a block diagram of a computer device in an embodiment of the invention;
FIG. 4 is a flowchart of a method for locating an operation failure of an application program according to an embodiment of the present invention;
FIG. 5 is a block diagram of an application operation fault locating device in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In some of the processes described in the specification and claims of this application and the above figures, a number of operations occurring in a particular order are included, but it should be understood that these processes may include more or less operations, and that these operations may be performed sequentially or in parallel.
The file processing method provided by the embodiment of the invention is executed in the development stage of the application program, specifically after the first target file is generated during compiling of the application program. The method comprises the steps of sharing a debugging information data area in each first target file of an application program, dividing the debugging information data area into a plurality of data subareas, using a specific data subarea specification mode, enabling each method group of the application program to share the same storage area (data subarea) and content (instruction offset data), and storing target mapping relation data recorded with the shared content. In the running process of the application program, if a crash occurs, the mobile terminal reports a crash log to the server, and when the information in the reported crash log is analyzed, a line number corresponding to an instruction causing the crash can be positioned according to the stored target mapping relation data, so that a corresponding original stack can be obtained. Taking an application program running in an android system as an example, the method provided by the embodiment of the invention can be accessed in a non-invasive manner in a compiling stage and a crash log analysis stage. Compression of apk of the application program can be effectively achieved, and the compression amount can reach 1M to 2.5M or more. .
Taking an application running in the android system as an example, the first target file is a DEX file. For other operating systems, the first target file may be other files originally used to save line number information.
For a DEX file, the debug information data area is the data area where the debugeinfoItem is located. For other forms of first target files, the debug information data area is a data area from which line number information can be originally read after an application program crashes.
The embodiment of the invention improves the first target file. Specifically, taking a DEX file as an example, in the prior art, each method of an application program corresponds to one debugeinfoItem, and mapping relation data of an offset address of an instruction of the corresponding method and a source code line number is stored in the debugeinfoItem. In addition, in the prior art, the source code line number is saved in debug items of the DEX file. In the embodiment of the invention, the complete debugeinfoItem data area is partitioned into a plurality of data subareas, the lengths of the data subareas are not completely the same, the instruction offset data of the corresponding method is stored in the data subareas, and the source code line number stored in the debug items is deleted.
In the embodiment of the present invention, the partitioning of the debugeinfoItem data area may be performed in advance, or may be performed during the execution of the file processing method provided in the embodiment of the present invention.
There are various partitioning modes, and the embodiment of the present invention is not limited, for example, the debugeinfoetitem is divided into a plurality of data subregions according to the equal length difference. For another example, the methods of the application program are ordered according to the total length of the respective instructions; grouping the ordered sequence formed by each method at least once until the summation result of the maximum value of the instruction total length of each group of methods is not more than the length of the modulation information data area, wherein the number of each group of methods obtained at the same time is the same, and the grouping number of each group of methods is decreased; and searching the maximum value of the total length of the instructions of each group of methods for each grouping, summing, comparing the summation result with the length of the debugging information data area, and dividing the debugging information data area into data subareas with the same number as the grouping according to the maximum value of the total length of the instructions of each group of methods if the summation result is not greater than the length of the debugging information data area. By the partitioning mode, the partitioning can be more balanced, and the situation that the methods corresponding to certain or certain data subareas are too many and the methods corresponding to certain or certain data subareas are too few is avoided.
In the embodiment of the invention, the generated debugging information data area of the first target file can not store the target mapping relation data any more through the service logic of the compiler. The data area may also be formatted in a partitioned manner.
The embodiment of the application provides a file processing method, where the file includes a first target file of an application program and a second target file corresponding to the application program, a data area of the first target file includes at least a debug information data area, a data content of the first target file includes at least target mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, as shown in fig. 1, and the method includes:
step 101, respectively designating data subareas for each method according to at least the total instruction length of each method of the application program, and writing instruction offset data of each method into a target position of the data subarea corresponding to the method.
Wherein the instruction offset data includes an instruction offset address.
Each data subarea corresponds to one or more methods of the application program, and the length of each data subarea is not smaller than the respective instruction total length of each method corresponding to the data subarea. For example, the data subregion a corresponds to N methods, where the instruction total length of method i is longest among the N methods, and then the length of the data subregion a is not less than the instruction total length of method i.
The target position is a position pointed to by an instruction offset address included in the instruction offset data. In the embodiment of the present invention, the location refers to a storage location in a storage space.
Step 102, reading target mapping relation data from the first target file.
The target mapping relation data comprise mapping relation data of instruction offset addresses of all methods and source code line numbers of application programs.
And step 103, storing the target mapping relation data into a second target file corresponding to the application program, and deleting the target mapping relation data from the first target file.
According to the file processing method provided by the embodiment of the invention, on one hand, the target mapping relation data stored in the first target file is deleted, namely, the line number is deleted from the apk packet of the application program, so that the purpose of compressing the apk of the application program is achieved; on the other hand, the target mapping relation data are stored in a second target application file, and the instruction offset address of the instruction of the application program is stored in the debugging information data area, so that after the application program crashes, the instruction offset address is read from the adjusting information data area and is reported instead of the line number, and in the fault locating stage, the corresponding line number can be found in the second target application file according to the reported instruction offset address, and further fault locating is realized; on the other hand, partition sharing of the data area is realized by modifying the data storage format of the debug information data area, and compared with the existing method that each method corresponds to one debug information data area, the new data storage format provided by the embodiment of the invention enables the storage space occupied by the debug information data area to be smaller, and further achieves the purpose of compressing apk.
In the embodiment of the invention, when the data subareas are designated for each method, not only the total instruction length of each method but also the method names of each method and/or the number of method parameters of each method can be used.
That is, the above-mentioned data sub-areas are respectively assigned to the above-mentioned respective methods according to at least the total instruction length of each method of the application program, and one implementation manner thereof is as follows: designating data subareas for each method according to at least the total instruction length and the method names of each method of the application program, wherein the methods with the same method names correspond to different data subareas; another implementation is: designating data subareas for each method according to at least the total instruction length and the method parameter number of each method of the application program, wherein the methods with different method parameter numbers correspond to different data subareas; yet another implementation is: and respectively designating data subareas for each method according to at least the total instruction length, the method names and the parameter number of each method of the application program.
The inventor finds that in the process of implementing the invention, if the number of method parameters of a certain method is different from the number of method parameters of other methods corresponding to a data subarea designated by the method, when an application program is crashed by an instruction of the method, the reported crash report does not carry line number information (if the line number information is replaced by instruction offset data, the instruction offset data is not carried), and the crash positioning is interfered. To avoid this, the method provided by the embodiment of the present invention, when designating a data subregion for a method, designates a method of the same number of method parameters to the same data subregion (it should be noted that this does not mean that all methods of the same number of method parameters are designated to the same data subregion, since designating a data subregion for a method is also related to other reference factors).
The inventor also finds that if the methods with the same method name are assigned to the same data subarea in the process of realizing the invention, ambiguity exists when the line number of the source code is resolved in the process of positioning the running fault of the application program, so that the resolution cannot be successfully performed. To avoid this, in embodiments of the present invention, methods of the same method name are assigned to different data subregions.
The following illustrates specifying data subregions for a method.
If the data subarea is specified for the method based on the total instruction length and the method parameter number only, searching the data subarea with the length not smaller than the total instruction length of the method; selecting a data subarea with the minimum length from the searched data subareas; judging whether the method corresponding to the data subarea with the minimum length is the same as the parameter number of the method; if the data sub-areas are the same, designating the data sub-area with the minimum length for the method; if the data subareas are different, selecting the data subareas with the length being smaller, and judging the data subareas until the data subareas are successfully appointed for the method.
If the data subarea is specified based on the instruction total length and the method name, searching the data subarea with the length not smaller than the instruction total length of the method; selecting a data subarea with the minimum length from the searched data subareas; judging whether the method corresponding to the data subarea with the minimum length is the same as the method name of the method; if the data sub-areas are different, designating the data sub-area with the minimum length for the method; if the same method name exists, selecting the data subarea with the length smaller than the second time, and judging the data subarea until the data subarea is successfully appointed for the method.
If the method is to specify the data sub-area based on the total instruction length, the method parameter number and the method name, the method may be implemented by referring to the above implementation manner, which is not described herein again.
Based on any of the above method embodiments, the instruction offset data may further include identification information of a data sub-area where the instruction offset data is located.
The identification information of the data sub-region is carried in the instruction offset data, so that the object mapping relation data in the second object file is filtered according to the identification information of the data sub-region in the offset data carried in the crash report in the subsequent application program operation fault positioning stage, and only the line number is searched in part of the filtered object mapping relation data, thereby shortening the searching time and improving the searching efficiency.
On the basis, in one implementation manner, the target mapping relationship data is stored in a second target file corresponding to the application program, and specifically, the target mapping relationship data can be stored in the second target file corresponding to the application program in groups according to the corresponding data subareas, and each group of target mapping relationship data corresponds to one data subarea. In another implementation manner, the target mapping relationship data further comprises identification information of the data subareas corresponding to the methods.
In the embodiment of the present invention, the identification information of the data subregion may, but is not limited to, include: the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
The index of the data subarea is the offset address of the data subarea.
The file processing method provided by the embodiment of the invention is explained below in connection with a specific application scenario.
In the compiling stage of a certain application program running on the android system, after aapt, javac, lancent, bytex and other processes, DEX file merging (DexMerge) is carried out, and then apk is generated by packaging.
After the apk is generated by packaging through a Hook function (Hook) inserted in advance, reading each Dex file in the apk.
Judging whether a Debug Item exists in the Dex file, if not, returning the OFFSET of the debug_Info to be NO_OFFSET (0), and not changing the Dex file, if so, realizing the sharing of the Debug Info area in the Dex file according to the following processing mode:
writing the line number information in the original debug_item in the Dex file into the LineNumberMapping.txt of the second target file;
aiming at each method, searching a debugInfo offset (namely a debugInfo sub-area) with proper size, judging whether instruction offset data of the method is written into the debugInfo sub-area, if so, directly returning to an instruction offset address of the method, writing the returned instruction offset address into a second target file, and establishing a corresponding relation with line number information; otherwise, writing the instruction offset data of the method into the DebugInfo subregion, returning the instruction offset address of the method, writing the returned instruction offset address into the second target file, and establishing a corresponding relation with the line number information.
Among other things, the implementation of finding the appropriate sized DebugInfo offset may be:
calculating the total instruction length of the method, if the total instruction length of the method exceeds 65536, then the method provided by the embodiment of the invention is unsuitable, reng writes the original DebugInfo of the method according to the existing mode, and returns the offset address (actually the line number offset) of the DebugInfo, if the total instruction length of the method does not exceed 65536, determining the number of method parameters of the method, searching the DebugInfo subregions with the same number of method parameters and the length not smaller than the total instruction length of the method, possibly searching a plurality of DebugInfo subregions, judging from the smallest DebugInfo subregion, judging whether the method with the same name as the method exists in the DebugInfo subregion, if not, writing the instruction offset data of the method into the DebugInfo subregion, and if not, sequentially searching the judgment according to the ascending order until a proper partition is found, or determining that the proper partition is not found, sharing is not performed, and still carrying out data storage according to the existing mode.
On the basis, the embodiment of the invention provides a specific data format of instruction offset data, wherein one instruction offset data occupies one shaping amount (32 bits), and the shaping amount comprises the following steps:
The lower 16 bits are used to store the instruction offset address, the first instruction offset of the method is 0, and each time an instruction is added, the offset is increased by one memory size for the instruction. If the total length of one method instruction is greater than 65536, then optimization is skipped.
Bits 17-24 are used to hold the partition (i.e., sub-region) index, and if the number of partitions is full (over 256), then the optimization is skipped.
Bits 25-30 are used to save the number of method parameters for the method. If the number of method parameters exceeds 64, the optimization is skipped.
Bits 31-32 remain, constant at 0.
The instruction number in the code_item is the same as the debug_info in the code_item after writing in the dex, and meanwhile, the reported stack information is the instruction offset because the data originally with the line number is rewritten into the instruction offset.
The DebugInfo scheme in the shared dex is embedded into the packing flow:
the Hook android standard packages dexmere or package tasks (two kinds of task adaptation, either of which is found to perform the dex line number optimization procedure).
Through the processing procedure, the line number offset originally stored in the DebugInfo region is changed into the stored instruction offset, and the DebugInfo region is shared.
Based on the same inventive concept as the file processing method, the embodiment of the invention further provides a file processing device, where the file includes a first target file of an application program and a second target file corresponding to the application program, a data area of the first target file includes at least a debug information data area, a data content of the first target file includes at least target mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, as shown in fig. 2, where the device includes:
An instruction offset data writing module 201, configured to specify data sub-areas for the respective methods according to at least respective instruction total lengths of the respective methods of the application program, and write instruction offset data of the respective methods into target positions of the data sub-areas corresponding to the methods, where the instruction offset data includes instruction offset addresses, each data sub-area corresponds to one or more methods of the application program, and each data sub-area has a length not smaller than the respective instruction total length of the respective method corresponding to the data sub-area, and the target positions are positions to which the instruction offset addresses included in the instruction offset data point;
a mapping relationship data reading module 202, configured to read target mapping relationship data from a first target file, where the target mapping relationship data includes mapping relationship data of an instruction offset address of each method and a source code line number of the application program;
and the mapping relationship data transferring module 203 is configured to store the target mapping relationship data in a second target file corresponding to the application program, and delete the target mapping relationship data from the first target file.
The specific implementation manner of each module may refer to the description of the method embodiment, and will not be repeated herein.
The file processing device provided by the embodiment of the invention deletes the target mapping relation data stored in the first target file, namely deletes the line number from the apk packet of the application program, thereby achieving the purpose of compressing the apk of the application program; on the other hand, the target mapping relation data are stored in a second target application file, and the instruction offset address of the instruction of the application program is stored in the debugging information data area, so that after the application program crashes, the instruction offset address is read from the adjusting information data area and is reported instead of the line number, and in the fault locating stage, the corresponding line number can be found in the second target application file according to the reported instruction offset address, and further fault locating is realized; on the other hand, partition sharing of the data area is realized by modifying the data storage format of the debug information data area, and compared with the existing method that each method corresponds to one debug information data area, the new data storage format provided by the embodiment of the invention enables the storage space occupied by the debug information data area to be smaller, and further achieves the purpose of compressing apk.
Based on the same inventive concept as the file processing method, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the steps of the above method embodiments when executing the computer program.
On one hand, the computer equipment provided by the embodiment of the invention deletes the target mapping relation data stored in the first target file, namely deletes the line number from the apk packet of the application program, thereby achieving the purpose of compressing the apk of the application program; on the other hand, the target mapping relation data are stored in a second target application file, and the instruction offset address of the instruction of the application program is stored in the debugging information data area, so that after the application program crashes, the instruction offset address is read from the adjusting information data area and is reported instead of the line number, and in the fault locating stage, the corresponding line number can be found in the second target application file according to the reported instruction offset address, and further fault locating is realized; on the other hand, partition sharing of the data area is realized by modifying the data storage format of the debug information data area, and compared with the existing method that each method corresponds to one debug information data area, the new data storage format provided by the embodiment of the invention enables the storage space occupied by the debug information data area to be smaller, and further achieves the purpose of compressing apk.
As described above, the file processing method provided in the embodiment of the present invention is implemented during compiling of an application program, and then the computer device provided in the embodiment of the present invention is a device running a compiler, which may be a Personal Computer (PC), a notebook computer, a workstation, a server, or the like. One implementation structure is shown in fig. 3, and at least includes: a processor 301, such as a central processing unit, which may perform various suitable actions and processes in accordance with a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage 306 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the computer device operation are also stored. The ROM 302, RAM 303, and storage device 306 are collectively referred to as memory, and the processor 301, ROM 302, RAM 303, and storage device 306 are connected to each other by a bus 304. An input/output (I/O) interface 305 is also connected to bus 304. In general, the following devices may be connected to the I/O interface 305: input devices including, for example, touch screens, touch pads, keyboards, mice, cameras, microphones, etc.; output devices including, for example, liquid Crystal Displays (LCDs), speakers, etc.; storage devices including, for example, magnetic tape, hard disk, etc.; a communication device. The communication means may allow the computer device to communicate with other devices wirelessly or by wire to exchange data. While fig. 3 shows a computer device having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
As shown in fig. 4, an embodiment of the present invention provides a method for positioning an operation fault of an application program, including:
step 401, acquiring instruction offset data of a target instruction of the application program from an application program crash report reported by a terminal.
The target instruction is an instruction operated when the application program crashes, the instruction offset data comprises an instruction offset address, the instruction offset address is obtained by searching a debug information data area of a first target file of the application program by a report terminal of the application program crash report, the debug information data area is divided into a plurality of data subareas, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not smaller than the instruction total length of each method corresponding to the data subarea, the target position in each data subarea stores the instruction offset data of each corresponding method, the target position is the position pointed by the instruction offset address included in the instruction offset data, the data area of the first target file at least comprises the debug information data area, and the data content of the first target file at least comprises target mapping relation data.
Step 402, reading the instruction offset address from the instruction offset data.
Step 403, searching for a source code line number of the application program corresponding to the instruction offset address in the second target file corresponding to the application program.
And the second target file stores target mapping relation data, wherein the target mapping relation data comprises mapping relation data of instruction offset addresses of the methods and source code line numbers of the application program.
And step 404, determining source codes which cause the application program to crash according to the searched source code line numbers.
The method for positioning the running fault of the application program provided by the embodiment of the invention can be realized on network side equipment (such as a server) or terminal equipment (personal computer, mobile terminal and the like) of a provider of the application program.
According to the application program operation fault positioning method provided by the embodiment of the invention, because the second target file can be obtained, even if the crash report does not carry the source code line number but carries the instruction offset data, the corresponding line number can be found in the second target application file according to the reported instruction offset address, so that the fault positioning is realized.
On this basis, the instruction offset data may further include identification information of a data sub-area where the instruction offset data is located, and correspondingly, a source code line number of the application program corresponding to the instruction offset address is searched in a second target file corresponding to the application program, where an implementation manner may be:
reading the identification information of the data subareas from the instruction offset data;
searching a candidate target mapping relation data set from the second target file according to the identification information of the data sub-region, and searching a source code line number of the application program corresponding to the instruction offset address in the candidate target mapping relation data set, wherein the candidate target mapping relation data set is a set formed by target mapping relation data corresponding to the identification information of the data sub-region.
Still further, the identification information of the data subregion may include: and the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
The operation fault locating method provided by the embodiment of the invention is described in detail below in combination with the specific application scenario.
After receiving a crash log of an application program, judging whether a Mapping file corresponding to the application program exists, and if not, processing according to the existing analysis flow;
if so, judging whether a-dslnmapping parameter exists, if so, calling a custom trace analysis crash stack, and if not, processing according to the existing analysis flow, and if not, judging whether the Mapping file is a Mapping WithLineNumber.
If not, processing according to the existing analysis flow, and if so, further judging whether a cachemappingsize parameter exists;
if the analysis result does not exist, calling a self-defined trace analysis crash stack, and processing according to the existing analysis flow when the analysis result still cannot be analyzed; if so, splitting the MappingWithLineNumber.txt into a Mapping file of Proguard official and a second target file only containing the Mapping relation between instruction offset data and line number information according to the identification, and analyzing a crash stack according to a self-defined trace by utilizing the second target file.
The self-defined trace is the operation fault positioning method provided by the embodiment of the invention.
Based on the same inventive concept as the application program operation fault locating method, the embodiment of the invention also provides an application program operation fault locating device, as shown in fig. 5, comprising:
the instruction offset data reading module 501 is configured to obtain instruction offset data of a target instruction of an application program from an application program crash report reported by a terminal, where the target instruction is an instruction operated when the application program crashes, the instruction offset data includes an instruction offset address, the instruction offset address is obtained by searching a debug information data area of a first target file of the application program from a report terminal of the application program crash report, the debug information data area is divided into a plurality of data subregions, each data subregion corresponds to one or more methods of the application program, a length of each data subregion is not less than a respective instruction total length of each method corresponding to the data subregion, a target position in each data subregion stores instruction offset data of each corresponding method, the target position is a position pointed by the instruction offset address included in the instruction offset data, the data area of the first target file at least includes the debug information data area, and a data content of the first target file at least includes target mapping relation data;
An instruction offset address reading module 502, configured to read an instruction offset address from instruction offset data;
the source code line number searching module 503 is configured to search a second object file corresponding to the application program for a source code line number of the application program corresponding to the instruction offset address, where the second object file stores target mapping relationship data, and the target mapping relationship data includes mapping relationship data between the instruction offset address of each method and the source code line number of the application program;
the fault source code searching module 504 is configured to determine a source code that causes the application program to crash according to the searched source code line number.
The specific implementation manner of each module may refer to the description of the above method embodiment, and will not be repeated herein.
According to the application program operation fault positioning device provided by the embodiment of the invention, because the second target file can be obtained, even if the crash report does not carry the source code line number but carries the instruction offset data, the corresponding line number can be found in the second target application file according to the reported instruction offset address, so that the fault positioning is realized.
Based on the same inventive concept as the application program operation fault locating method, the embodiment of the invention provides a computer device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the steps of any of the method embodiments when executing the computer program.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus and units described above may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
The foregoing details of the mobile terminal provided by the embodiments of the present invention are described, and those skilled in the art will appreciate that the present invention is not limited to the specific embodiments and application ranges according to the concepts of the embodiments of the present invention.
The embodiments described above are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.

Claims (15)

1. A file processing method, wherein the file includes a first target file of an application program and a second target file corresponding to the application program, a data area of the first target file includes at least a debug information data area, a data content of the first target file includes at least target mapping relationship data, and the debug information data area is divided into a plurality of data subregions, the method comprising:
designating the data subareas for each method according to at least the respective instruction total length of each method of the application program, and writing instruction offset data of each method into a target position of the data subareas corresponding to the method, wherein the instruction offset data comprises instruction offset addresses, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the respective instruction total length of each method corresponding to the data subarea, and the target position is the position pointed by the instruction offset address included in the instruction offset data;
reading target mapping relation data from the first target file, wherein the target mapping relation data comprises mapping relation data of instruction offset addresses of the methods and source code line numbers of the application program;
Storing the target mapping relation data into a second target file corresponding to the application program, and deleting the target mapping relation data from the first target file;
the data subarea division mode of the debugging information data area is as follows:
sequencing all the methods of the application program according to the total length of the respective instructions;
grouping the sequencing sequences formed by the methods at least once until the summation result of the maximum value of the instruction total length of each group of methods is not more than the length of the debugging information data area, wherein the number of each group of methods obtained at the same time is the same, and the grouping number of each group of methods is decreased;
and searching the maximum value of the total length of the instructions of each group of methods for each grouping, summing, comparing the summation result with the length of the debugging information data area, and dividing the debugging information data area into data subareas with the same number as the grouping according to the maximum value of the total length of the instructions of each group of methods if the summation result is not greater than the length of the debugging information data area.
2. The method according to claim 1, wherein the assigning data sub-areas to the respective methods of the application program, respectively, at least according to their respective instruction total lengths, comprises:
And respectively designating data subareas for each method according to at least the total instruction length and the method names of each method of the application program, wherein the methods with the same method names correspond to different data subareas.
3. The method according to claim 1, wherein the assigning data sub-areas to the respective methods of the application program, respectively, at least according to their respective instruction total lengths, comprises:
and respectively designating data subareas for each method according to at least the total instruction length and the method parameter quantity of each method of the application program, wherein the methods with different method parameter quantities correspond to different data subareas.
4. A method according to any one of claims 1 to 3, wherein the instruction offset data further includes identification information of a data sub-area in which the instruction offset data is located.
5. The method of claim 4, wherein the identification information of the data subregion comprises: and the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
6. A file processing apparatus, wherein the file includes a first target file of an application program and a second target file corresponding to the application program, a data area of the first target file includes at least a debug information data area, a data content of the first target file includes at least target mapping relationship data, and the debug information data area is divided into a plurality of data subregions, the apparatus comprising:
The instruction offset data writing module is used for respectively designating the data subareas for each method according to at least the respective instruction total length of each method of the application program, writing the instruction offset data of each method into a target position of the data subareas corresponding to the method, wherein the instruction offset data comprises instruction offset addresses, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the respective instruction total length of each method corresponding to the data subarea, and the target position is the position pointed by the instruction offset address included in the instruction offset data;
the mapping relation data reading module is used for reading target mapping relation data from the first target file, wherein the target mapping relation data comprises mapping relation data of instruction offset addresses of the methods and source code line numbers of the application program;
the target mapping relation data transfer module is used for storing the target mapping relation data into a second target file corresponding to the application program and deleting the target mapping relation data from the first target file;
The data subarea division mode of the debugging information data area is as follows:
sequencing all the methods of the application program according to the total length of the respective instructions;
grouping the sequencing sequences formed by the methods at least once until the summation result of the maximum value of the instruction total length of each group of methods is not more than the length of the debugging information data area, wherein the number of each group of methods obtained at the same time is the same, and the grouping number of each group of methods is decreased;
and searching the maximum value of the total length of the instructions of each group of methods for each grouping, summing, comparing the summation result with the length of the debugging information data area, and dividing the debugging information data area into data subareas with the same number as the grouping according to the maximum value of the total length of the instructions of each group of methods if the summation result is not greater than the length of the debugging information data area.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 5 when the computer program is executed by the processor.
8. A computer-readable storage medium, comprising a program stored thereon for executing the method of any one of claims 1 to 5.
9. An application program operation fault locating method, comprising the steps of:
acquiring instruction offset data of a target instruction of an application program from an application program crash report reported by a terminal, wherein the target instruction is an instruction operated when the application program crashes, the instruction offset data comprises an instruction offset address, the instruction offset address is obtained by searching a debug information data area of a first target file of the application program from the report terminal of the application program crash report, the debug information data area is divided into a plurality of data subareas, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the total instruction length of each method corresponding to the data subarea, the target position in each data subarea stores the instruction offset data of each corresponding method, the target position is the position pointed by the instruction offset address included in the instruction offset data, the data area of the first target file at least comprises the debug information data area, and the data content of the first target file at least comprises target mapping relation data;
Reading an instruction offset address from the instruction offset data;
searching a second target file corresponding to the application program for a source code line number of the application program corresponding to the instruction offset address, wherein target mapping relation data are stored in the second target file, and the target mapping relation data comprise mapping relation data of the instruction offset addresses of the methods and the source code line numbers of the application program;
determining a source code which causes the application program to crash according to the searched source code line number;
the data subarea division mode of the debugging information data area is as follows:
sequencing all the methods of the application program according to the total length of the respective instructions;
grouping the sequencing sequences formed by the methods at least once until the summation result of the maximum value of the instruction total length of each group of methods is not more than the length of the debugging information data area, wherein the number of each group of methods obtained at the same time is the same, and the grouping number of each group of methods is decreased;
and searching the maximum value of the total length of the instructions of each group of methods for each grouping, summing, comparing the summation result with the length of the debugging information data area, and dividing the debugging information data area into data subareas with the same number as the grouping according to the maximum value of the total length of the instructions of each group of methods if the summation result is not greater than the length of the debugging information data area.
10. The method of claim 9, wherein methods with the same method name correspond to different data subregions.
11. The method according to claim 9 or 10, wherein the instruction offset data further includes identification information of a data sub-area where the instruction offset data is located, and the searching for the source code line number of the application program corresponding to the instruction offset address in the second target file corresponding to the application program includes:
reading the identification information of the data subareas from the instruction offset data;
searching a candidate target mapping relation data set from the second target file according to the identification information of the data sub-region, and searching a source code line number of the application program corresponding to the instruction offset address in the candidate target mapping relation data set, wherein the candidate target mapping relation data set is a set formed by target mapping relation data corresponding to the identification information of the data sub-region.
12. The method of claim 11, wherein the identification information of the data subregion comprises: and the number of method parameters of the method corresponding to the data subarea and/or the index of the data subarea.
13. An application program operation failure positioning device, characterized by comprising:
the instruction offset data reading module is used for obtaining instruction offset data of a target instruction of the application program from an application program crash report reported by a terminal, wherein the target instruction is an instruction operated when the application program crashes, the instruction offset data comprises an instruction offset address, the instruction offset address is obtained by searching a debug information data area of a first target file of the application program from the report terminal of the application program crash report, the debug information data area is divided into a plurality of data subareas, each data subarea corresponds to one or more methods of the application program, the length of each data subarea is not less than the instruction total length of each method corresponding to the data subarea, the target position in each data subarea stores the instruction offset data of each corresponding method, the target position is the position pointed by the instruction offset address included in the instruction offset data, the data area of the first target file at least comprises the debug information data area, and the data content of the first target file at least comprises target mapping relation data;
The instruction offset address reading module is used for reading an instruction offset address from the instruction offset data;
the source code line number searching module is used for searching a source code line number of the application program corresponding to the instruction offset address in a second target file corresponding to the application program, wherein target mapping relation data are stored in the second target file, and the target mapping relation data comprise mapping relation data of the instruction offset address of each method and the source code line number of the application program;
the fault source code searching module is used for determining source codes which cause the application program to crash according to the searched source code line numbers;
the data subarea division mode of the debugging information data area is as follows:
sequencing all the methods of the application program according to the total length of the respective instructions;
grouping the sequencing sequences formed by the methods at least once until the summation result of the maximum value of the instruction total length of each group of methods is not more than the length of the debugging information data area, wherein the number of each group of methods obtained at the same time is the same, and the grouping number of each group of methods is decreased;
and searching the maximum value of the total length of the instructions of each group of methods for each grouping, summing, comparing the summation result with the length of the debugging information data area, and dividing the debugging information data area into data subareas with the same number as the grouping according to the maximum value of the total length of the instructions of each group of methods if the summation result is not greater than the length of the debugging information data area.
14. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 9 to 12 when the computer program is executed by the processor.
15. A computer readable storage medium, comprising a program stored thereon for performing the method of any of claims 9 to 12.
CN201911131659.XA 2019-11-19 2019-11-19 File processing method, application program operation fault positioning method and equipment Active CN110928779B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911131659.XA CN110928779B (en) 2019-11-19 2019-11-19 File processing method, application program operation fault positioning method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911131659.XA CN110928779B (en) 2019-11-19 2019-11-19 File processing method, application program operation fault positioning method and equipment

Publications (2)

Publication Number Publication Date
CN110928779A CN110928779A (en) 2020-03-27
CN110928779B true CN110928779B (en) 2023-04-25

Family

ID=69853379

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911131659.XA Active CN110928779B (en) 2019-11-19 2019-11-19 File processing method, application program operation fault positioning method and equipment

Country Status (1)

Country Link
CN (1) CN110928779B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416414B (en) * 2022-01-17 2024-05-14 北京百度网讯科技有限公司 Fault information positioning method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015101096A1 (en) * 2013-12-30 2015-07-09 北京奇虎科技有限公司 Method and device for detecting malicious code in smart terminal
CN105608393A (en) * 2016-01-19 2016-05-25 北京鼎源科技有限公司 Reinforcement method of executable file reorganization on basis of Android
CN206207022U (en) * 2016-09-14 2017-05-31 江苏师范大学 A kind of visualization pipeline fault alignment system based on android system
CN108763060A (en) * 2018-04-27 2018-11-06 广州华多网络科技有限公司 Native layers of collapse source tracing method, device, storage medium and terminal in android system
CN109634838A (en) * 2018-10-25 2019-04-16 深圳壹账通智能科技有限公司 Position method, apparatus, storage medium and the electronic equipment of application failure

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8074201B2 (en) * 2002-07-10 2011-12-06 National Instruments Corporation Deployment and execution of a program on an embedded device
US7607123B2 (en) * 2004-09-21 2009-10-20 Hewlett-Packard Development Company, L.P. Systems and methods for validating debug information for optimized code
JP4822817B2 (en) * 2005-11-22 2011-11-24 パナソニック株式会社 Compilation system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015101096A1 (en) * 2013-12-30 2015-07-09 北京奇虎科技有限公司 Method and device for detecting malicious code in smart terminal
CN105608393A (en) * 2016-01-19 2016-05-25 北京鼎源科技有限公司 Reinforcement method of executable file reorganization on basis of Android
CN206207022U (en) * 2016-09-14 2017-05-31 江苏师范大学 A kind of visualization pipeline fault alignment system based on android system
CN108763060A (en) * 2018-04-27 2018-11-06 广州华多网络科技有限公司 Native layers of collapse source tracing method, device, storage medium and terminal in android system
CN109634838A (en) * 2018-10-25 2019-04-16 深圳壹账通智能科技有限公司 Position method, apparatus, storage medium and the electronic equipment of application failure

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Using ProGuard Rules with Redex;facebook;《https://fbredex.com/docs/proguard》;20160617;全文 *
头条APK瘦身之路;字节跳动技术团队;《https://mp.weixin.qq.com/s/gCOCkbORfdnWhLGI0b7w9Q》;20170825;全文 *
支付宝 App 构建优化解析:Android 包大小极致压缩;琉克 mPasS;《https://mp.weixin.qq.com/s/_gnT2kjqpfMFs0kqAg4Qig》;20181112;全文第1-9页 *

Also Published As

Publication number Publication date
CN110928779A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
CN108399132B (en) Scheduling test method, device and storage medium
US8434057B2 (en) Optimized implementation of breakpoint in java debugger agent
US8073673B2 (en) Emulated memory management
CN110231994B (en) Memory analysis method, memory analysis device and computer readable storage medium
US20110154299A1 (en) Apparatus and method for executing instrumentation code
CN108073507B (en) Processing method and device for kernel crash field data
CN110716845B (en) Log information reading method of Android system
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN112099800A (en) Code data processing method and device and server
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN111258680A (en) Resource loading method and device, storage medium and electronic device
CN110955598A (en) Breakpoint processing method and device of kernel mode program
CN113867644A (en) Disk array optimization method and device, computer equipment and storage medium
CN110928779B (en) File processing method, application program operation fault positioning method and equipment
CN111803917A (en) Resource processing method and device
CN112269665B (en) Memory processing method and device, electronic equipment and storage medium
CN112965661A (en) Data storage method, device, equipment and storage medium
CN112685275A (en) Algorithm strategy searching method and device, electronic equipment and storage medium
CN116521414A (en) Fault code positioning method, cloud server, system and storage medium
CN114237989B (en) Database service deployment and disaster tolerance method and device
CN106326310B (en) Resource encryption updating method for mobile phone client software
CN113010195B (en) System upgrading method, storage medium and terminal equipment
CN108874468B (en) Application program loading method and device, computer equipment and storage medium
CN111356987B (en) Dynamic memory identification method and device
CN111209056B (en) Method and device for loading function, readable storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

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

Applicant after: Douyin Vision Co.,Ltd.

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

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

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

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

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

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

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant