CN110928779A - File processing method, application program operation fault positioning method and device - Google Patents

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

Info

Publication number
CN110928779A
CN110928779A CN201911131659.XA CN201911131659A CN110928779A CN 110928779 A CN110928779 A CN 110928779A CN 201911131659 A CN201911131659 A CN 201911131659A CN 110928779 A CN110928779 A CN 110928779A
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.)
Granted
Application number
CN201911131659.XA
Other languages
Chinese (zh)
Other versions
CN110928779B (en
Inventor
杨志谦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to 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

Abstract

The application relates to a method and equipment for locating file processing and application program operation faults. The file processing method comprises the following steps: at least appointing a data sub-area for each method according to the respective instruction total length of each method of the application program, writing the instruction offset data of each method into the target position of the 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 respective instruction total length of each method corresponding to the partition, and the target position is the position pointed by the instruction offset address included in the instruction offset data; 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, wherein the target mapping relation data comprises the mapping relation data of the instruction offset address and the line number of the source code of each method. By adopting the application program processing method, the size of the application program package can be effectively reduced.

Description

File processing method, application program operation fault positioning method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a file processing method, an application program operation fault location method, and an application program operation fault location device.
Background
After an application program (APP) running on an Android operating system crashes, stack information running when the application program crashes is printed and reported, the stack information comprises a method call stack running when the application program crashes and a corresponding line number, and the line number is stored in an application program package (apk) at the compiling stage of the application program. After the APP crashes, this information can help the developer locate where the application has reported an error.
Typically, each line of source code corresponds to a line number, occupying a certain volume of the apk packet. The line numbers saved in the apps' apk packets typically occupy a size of about 1.5MB to 3 MB. With the increasing of the functions of the APP, for some super APPs, the number of line numbers is larger due to the large number of source codes.
And compressing 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 application program fault positioning under the condition that a line number can be 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 object file of an application program and a second object file corresponding to the application program, a data area of the first object file at least includes a debug information data area, data content of the first object file at least includes object mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, where the method includes:
respectively designating data sub-regions for each method at least according to the respective instruction total length of each method of the application program, and writing the instruction offset data of each method into the target position of the data sub-region corresponding to the method, wherein the instruction offset data comprises an instruction offset address, each data sub-region corresponds to one or more methods of the application program, the length of each data sub-region is not less than the respective instruction total length of each method corresponding to the data sub-region, 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 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.
In 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 aim of compressing the apk of the application program is fulfilled; on the other hand, the target mapping relation data is 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 debugging information data area instead of the row number for reporting, and in the fault positioning stage, the corresponding row number can be found in the second target application file according to the reported instruction offset address, and then fault positioning is realized; on the other hand, the partition sharing of the data area is realized by modifying the data storage format of the debugging information data area, and compared with the prior art that each method corresponds to one debugging information data area, the new data storage format provided by the embodiment of the invention enables the debugging information data area to occupy smaller storage space, thereby further realizing the purpose of compressing apk.
In the embodiment of the present invention, when the data sub-area is specified for each method, the data sub-area may be specified not only according to the total length of the instruction of each method, but also according to the method name of each method and/or the number of the method parameters of each method.
That is, the data sub-regions are respectively specified for the methods at least according to the total instruction length of each method of the application program, and one implementation manner of the method is as follows: respectively appointing data sub-regions for the methods at least according to the respective instruction total length and the respective method names of the methods of the application program, wherein the methods with the same method name correspond to different data sub-regions; the other realization mode is as follows: respectively appointing data sub-regions for the methods at least according to the respective total instruction length and the respective method parameter number of the methods of the application program, wherein the methods with different method parameter numbers correspond to different data sub-regions; yet another implementation is: and respectively assigning data subregions for the methods at least according to the respective total instruction length, the respective method name and the respective method parameter number of the methods of the application program.
The inventor finds that, in the process of implementing the present invention, if the number of method parameters of a certain method is different from the number of method parameters of other methods corresponding to the data sub-area designated for the certain method, and the instruction of the method causes application program crash, the reported crash report does not carry line number information (if the line number information is replaced by instruction offset data, the reported crash report does not carry instruction offset data), and interference is caused to crash location. To avoid this, embodiments of the present invention provide a method that assigns the same number of method parameters to the same data sub-region when assigning data sub-regions to methods (it should be noted that this does not mean that all methods with the same number of method parameters are assigned to the same data sub-region, since assigning data sub-regions to methods is also related to other reference factors).
The inventor also finds that ambiguity exists when the line number of the source code is analyzed in the process of positioning the operation fault of the application program if the methods with the same method name are assigned to the same data sub-region, so that the analysis cannot be successful. To avoid this, in the embodiment of the present invention, methods with the same method name are assigned to different data sub-regions.
On the basis of any of the above method embodiments, the instruction offset data may further include identification information of a data sub-region 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 target mapping relation data in the second target 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 the filtered part of the target mapping relation data, so that the searching time is shortened, and the searching efficiency is improved.
On this basis, in one implementation manner, the target mapping relationship data is saved in the second target file corresponding to the application program, specifically, the target mapping relationship data may be saved in the second target file corresponding to the application program in groups according to the corresponding data sub-regions, where each group of target mapping relationship data corresponds to one data sub-region. In another implementation manner, the target mapping relationship data further includes identification information of the data sub-regions corresponding to the respective methods.
In the embodiment of the present invention, the identification information of the data sub-region may include, but is not limited to: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
The index of the data sub-region is the offset address of the data sub-region.
On the basis of any of the above method embodiments, the data sub-region division manner of the debug information data region may be:
sequencing all methods of the application program according to respective total instruction lengths;
grouping the sequencing sequences formed by the methods at least once until the summation result of the maximum total length of the instructions of each group of methods is not more than the length of the modulation information data area, wherein each group of methods obtained at the same time has the same number, and the grouping number of each time is decreased;
and aiming at each grouping, searching and summing the maximum total instruction length of each group of methods, comparing the summation result with the length of the debugging information data area, and if the summation result is not greater than the length of the debugging information data area, dividing the debugging information data area into data sub-areas with the same number as the grouping according to the maximum total instruction length of each group of methods.
By the aid of the partitioning mode, partitioning can be more balanced, and the situation that too many methods corresponding to a certain data sub-area or data sub-areas exist and too few methods corresponding to the certain data sub-area or data sub-areas exist is avoided.
In a second aspect, an embodiment of the present invention provides a file processing apparatus, where the file includes a first object file of an application program and a second object file corresponding to the application program, a data area of the first object file at least includes a debug information data area, data content of the first object file at least includes object mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, the apparatus includes:
an instruction offset data writing module, configured to respectively specify data sub-regions for the methods at least according to respective instruction total lengths of the methods of the application program, and write the instruction offset data of the methods into target positions of the data sub-regions corresponding to the methods, where the instruction offset data includes instruction offset addresses, each data sub-region corresponds to one or more methods of the application program, the length of each data sub-region is not less than the respective instruction total lengths of the methods corresponding to the data sub-region, and the target position is a position pointed by the instruction offset addresses included in the instruction offset data;
a mapping relation data reading module, configured to read target mapping relation data from a first target file, where the target mapping relation data includes mapping relation data between instruction offset addresses of the methods and a source code line number 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.
On one hand, 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 row 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 is 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 debugging information data area instead of the row number for reporting, and in the fault positioning stage, the corresponding row number can be found in the second target application file according to the reported instruction offset address, and then fault positioning is realized; on the other hand, the partition sharing of the data area is realized by modifying the data storage format of the debugging information data area, and compared with the prior art that each method corresponds to one debugging information data area, the new data storage format provided by the embodiment of the invention enables the debugging information data area to occupy smaller storage space, thereby further realizing 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 method, the instruction offset data writing module may not only specify the total length of the instruction for each method, but also specify the method name for each method and/or the number of the method parameters for each method.
That is to say, the instruction offset data writing module respectively specifies the data sub-regions for the methods according to at least the total instruction length of each method of the application program, and one implementation manner of the instruction offset data writing module is as follows: respectively appointing data sub-regions for the methods at least according to the respective instruction total length and the respective method names of the methods of the application program, wherein the methods with the same method name correspond to different data sub-regions; the other realization mode is as follows: respectively appointing data sub-regions for the methods at least according to the respective total instruction length and the respective method parameter number of the methods of the application program, wherein the methods with different method parameter numbers correspond to different data sub-regions; yet another implementation is: and respectively assigning data subregions for the methods at least according to the respective total instruction length, the respective method name and the respective method parameter number of the methods of the application program.
The inventor finds that, in the process of implementing the present invention, if the number of method parameters of a certain method is different from the number of method parameters of other methods corresponding to the data sub-area designated for the certain method, and the instruction of the method causes application program crash, the reported crash report does not carry line number information (if the line number information is replaced by instruction offset data, the reported crash report does not carry instruction offset data), and interference is caused to crash location. To avoid this, the apparatus provided in this embodiment of the present invention assigns the same number of methods of the method parameter to the same data sub-region when assigning the data sub-region to the method (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 sub-region, since assigning the data sub-region to the method is also related to other reference factors).
The inventor also finds that ambiguity exists when the line number of the source code is analyzed in the process of positioning the operation fault of the application program if the methods with the same method name are assigned to the same data sub-region, so that the analysis cannot be successful. To avoid this, in the embodiment of the present invention, the instruction offset data writing module assigns methods with the same method name to different data sub-areas.
On the basis of any of the above apparatus embodiments, the instruction offset data may further include identification information of a data sub-region 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 target mapping relation data in the second target 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 the filtered part of the target mapping relation data, so that the searching time is shortened, and the searching efficiency is improved.
On this basis, in one implementation manner, the mapping relationship data transfer module stores the target mapping relationship data in the second target file corresponding to the application program, and specifically, the target mapping relationship data may be stored in the second target file corresponding to the application program in groups according to the corresponding data sub-regions, where each group of target mapping relationship data corresponds to one data sub-region. In another implementation manner, the target mapping relationship data further includes identification information of the data sub-regions corresponding to the respective methods.
In the embodiment of the present invention, the identification information of the data sub-region may include, but is not limited to: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
The index of the data sub-region is the offset address of the data sub-region.
On the basis of any of the above apparatus embodiments, the apparatus may further include a data sub-region dividing module, configured to:
sequencing all methods of the application program according to respective total instruction lengths;
grouping the sequencing sequences formed by the methods at least once until the summation result of the maximum total length of the instructions of each group of methods is not more than the length of a modulation information data area, wherein each group of methods obtained at the same time has the same number, and the grouping number of each time is decreased;
and aiming at each grouping, searching and summing the maximum total length of the instructions of each group of methods, comparing the summation result with the length of the debugging information data area, and if the summation result is not greater than the length of the debugging information data area, dividing the debugging information data area into data sub-areas with the same number as the grouping according to the maximum total length of the instructions of each group of methods.
By the aid of the partitioning mode, partitioning can be more balanced, and the situation that too many methods corresponding to a certain data sub-area or data sub-areas exist and too few methods corresponding to the certain data sub-area or data sub-areas exist is avoided.
In a third aspect, an embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above method embodiments when executing the computer program.
On one hand, the computer device provided by the embodiment of the invention deletes the target mapping relation data stored in the first target file, namely deletes the row 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 is 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 debugging information data area instead of the row number for reporting, and in the fault positioning stage, the corresponding row number can be found in the second target application file according to the reported instruction offset address, and then fault positioning is realized; on the other hand, the partition sharing of the data area is realized by modifying the data storage format of the debugging information data area, and compared with the prior art that each method corresponds to one debugging information data area, the new data storage format provided by the embodiment of the invention enables the debugging information data area to occupy smaller storage space, thereby further realizing 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 thereon for executing the method provided by any of the above-mentioned method embodiments.
In the computer-readable storage medium provided in the embodiment of the present invention, on one hand, the target mapping relationship data stored in the first target file is deleted, that is, the row number is deleted from the apk packet of the application program, so as to achieve the purpose of compressing the apk of the application program; on the other hand, the target mapping relation data is 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 debugging information data area instead of the row number for reporting, and in the fault positioning stage, the corresponding row number can be found in the second target application file according to the reported instruction offset address, and then fault positioning is realized; on the other hand, the partition sharing of the data area is realized by modifying the data storage format of the debugging information data area, and compared with the prior art that each method corresponds to one debugging information data area, the new data storage format provided by the embodiment of the invention enables the debugging information data area to occupy smaller storage space, thereby further realizing the purpose of compressing apk.
In a fifth aspect, an embodiment of the present invention provides an application program operation fault location method, including:
acquiring 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 debugging information data area of a first target file of the application program from a reporting terminal of the application program crash report, the debugging information data area is divided into a plurality of data sub-areas, each data sub-area corresponds to one or more methods of the application program, the length of each data sub-area is not less than the total length of the instruction of each method corresponding to the data sub-area, the target position in each data sub-area is stored with the instruction offset data of each corresponding method, and 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 comprises a debugging 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 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;
and determining the source code causing the crash of the application program according to the searched source code line number.
According to the method for locating the operation fault of the application program, provided by the embodiment of the invention, because the second target file can be obtained, even if the crash report does not carry the line number of the source code 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, and the fault location is further realized.
On this basis, the instruction offset data may further include identification information of a data sub-region where the instruction offset data is located, and correspondingly, the source code line number of the application program corresponding to the instruction offset address is searched in the second target file corresponding to the application program, and the implementation manner may be:
reading identification information of the data sub-region from the instruction offset data;
and 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 sub-region may include: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
In a sixth aspect, an embodiment of the present invention provides an apparatus for locating an application operation fault, including:
an instruction offset data reading module, 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 that is run when the application program crashes, the instruction offset data includes an instruction offset address, the instruction offset address is obtained by searching a debugging information data area of a first target file of the application program from the reporting terminal of the application program crash report, the debugging information data area is divided into a plurality of data sub-areas, each data sub-area corresponds to one or more methods of the application program, the length of each data sub-area is not less than the total length of instructions of each method corresponding to the data sub-area, a target position in each data sub-area stores instruction offset data of each corresponding method, and a target position is a position to which the instruction offset address included in the instruction offset data points, the data area of the first target file at least comprises a debugging 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;
a source code line number searching module, configured to search 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, where target mapping relationship data is stored in the second target file, 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;
and the fault source code searching module is used for determining the source code causing the crash of the application program according to the searched source code line number.
According to the application program operation fault positioning device provided by the embodiment of the invention, as the second target file can be obtained, even if the crash report does not carry the line number of the source code 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, and thus fault positioning is realized.
On this basis, the instruction offset data may further include identification information of a data sub-region where the instruction offset data is located, and correspondingly, the source code line number search module searches 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, and the implementation manner may be:
reading identification information of the data sub-region from the instruction offset data;
and 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 sub-region may include: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
In a seventh aspect, an embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of any of the method embodiments described above are implemented.
The computer device provided by the embodiment of the invention can acquire the second target file, so that even if the crash report does not carry the line number of the source code 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, and further the fault location is realized.
In an eighth aspect, an embodiment of the present invention provides a computer-readable storage medium, which includes a program stored therein for executing the method provided by the foregoing method embodiment.
The computer-readable storage medium provided in the embodiment of the present invention can obtain the second target file, so that even if the crash report does not carry the line number of the source code 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 implementing fault location.
Drawings
FIG. 1 is a flowchart of a file processing method 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 application operation failure according to an embodiment of the present invention;
fig. 5 is a block diagram of an apparatus for locating an operation failure of an application according to 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 is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In some of the flows described in the specification and claims of the present application and in the above-described figures, a number of operations are included that occur in a particular order, but it should be clearly understood that the flows may include more or less operations, and that the 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, particularly in the compiling period of the application program, and is executed after the first target file is generated. 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 sub-areas, enabling the methods of the application program to share the same storage area (data sub-area) and content (instruction offset data) in a grouping mode by using a specific data sub-area specifying mode, and storing target mapping relation data recorded with the shared content. In the running process of the application program, if the crash happens, the mobile terminal reports a crash log to the server, and when 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, non-intrusive access can be realized in a compiling stage and a crash log analyzing stage so as to realize the method provided by the embodiment of the invention. The compression of the apk of the application program can be effectively realized, and the compression amount can reach 1M to 2.5M or even more. .
Taking an application program 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 another file originally used for storing the line number information.
For a DEX file, the debug information data area is the data area where the debuggeinfo item is located. For the first target file in other forms, the debugging information data area is a data area from which the line number information can be originally read after the 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 debuggeinfo item, and mapping relationship data between an offset address of an instruction corresponding to the method and a source code line number is stored in the debuggeinfo item. 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 present invention, the complete debug info item data area is partitioned into a plurality of data sub-areas, the length of each data sub-area is not completely the same, the instruction offset data of the corresponding method is stored in the data sub-area, and the source code line number stored in the debug items is deleted.
In the embodiment of the present invention, the partition of the data area of the debuggeinfoitem may be performed in advance, or may be performed in the execution process of the file processing method provided in the embodiment of the present invention.
There are various partition manners, and the embodiment of the present invention is not limited, for example, the debuggeinfo item is divided into a plurality of data sub-areas according to the equal length difference. For another example, the methods of the application program are sorted 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 total length of the instructions of each group of methods is not more than the length of the modulation information data area, wherein each group of methods obtained at the same time has the same number, and the grouping number of each time is decreased; and aiming at each grouping, searching and summing the maximum total instruction length of each group of methods, comparing the summation result with the length of the debugging information data area, and if the summation result is not greater than the length of the debugging information data area, dividing the debugging information data area into data sub-areas with the same number as the grouping according to the maximum total instruction length of each group of methods. By the partition mode, the partition can be more balanced, and the situation that too many methods corresponding to a certain data sub-area or data sub-areas exist and too few methods corresponding to the certain data sub-area or data sub-areas exist is avoided.
In the embodiment of the invention, the target mapping relation data is not stored in the debugging information data area of the generated first target file through the service logic of the compiler. The data area may also be formatted in a partitioned manner.
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 at least includes a debug information data area, data content of the first target file at least includes target mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, as shown in fig. 1, where the method includes:
step 101, respectively designating data sub-areas for each method at least according to the respective instruction total length of each method of the application program, and writing the instruction offset data of each method into the target position of the data sub-area corresponding to the method.
Wherein the instruction offset data comprises an instruction offset address.
Each data sub-region corresponds to one or more methods of an application program, and the length of each data sub-region is not less than the total instruction length of each method corresponding to the data sub-region. For example, the data sub-area a corresponds to N methods, where the total instruction length of method i is longest among the N methods, and then the length of the data sub-area a is not less than the total instruction length of method i.
The target location is the location pointed to by the instruction offset address included in the instruction offset data. In the embodiment of the present invention, the location refers to a storage location in the storage space.
And 102, reading target mapping relation data from the first target file.
The target mapping relation data comprises mapping relation data of instruction offset addresses of all the methods and source code line numbers of the application programs.
And 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.
In 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 aim of compressing the apk of the application program is fulfilled; on the other hand, the target mapping relation data is 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 debugging information data area instead of the row number for reporting, and in the fault positioning stage, the corresponding row number can be found in the second target application file according to the reported instruction offset address, and then fault positioning is realized; on the other hand, the partition sharing of the data area is realized by modifying the data storage format of the debugging information data area, and compared with the prior art that each method corresponds to one debugging information data area, the new data storage format provided by the embodiment of the invention enables the debugging information data area to occupy smaller storage space, thereby further realizing the purpose of compressing apk.
In the embodiment of the present invention, when the data sub-area is specified for each method, the data sub-area may be specified not only according to the total length of the instruction of each method, but also according to the method name of each method and/or the number of the method parameters of each method.
That is, the data sub-regions are respectively specified for the methods at least according to the total instruction length of each method of the application program, and one implementation manner of the method is as follows: respectively appointing data sub-regions for the methods at least according to the respective instruction total length and the respective method names of the methods of the application program, wherein the methods with the same method name correspond to different data sub-regions; the other realization mode is as follows: respectively appointing data sub-regions for the methods at least according to the respective total instruction length and the respective method parameter number of the methods of the application program, wherein the methods with different method parameter numbers correspond to different data sub-regions; yet another implementation is: and respectively assigning data subregions for the methods at least according to the respective total instruction length, the respective method name and the respective method parameter number of the methods of the application program.
The inventor finds that, in the process of implementing the present invention, if the number of method parameters of a certain method is different from the number of method parameters of other methods corresponding to the data sub-area designated for the certain method, and the instruction of the method causes application program crash, the reported crash report does not carry line number information (if the line number information is replaced by instruction offset data, the reported crash report does not carry instruction offset data), and interference is caused to crash location. To avoid this, embodiments of the present invention provide a method that assigns the same number of method parameters to the same data sub-region when assigning data sub-regions to methods (it should be noted that this does not mean that all methods with the same number of method parameters are assigned to the same data sub-region, since assigning data sub-regions to methods is also related to other reference factors).
The inventor also finds that ambiguity exists when the line number of the source code is analyzed in the process of positioning the operation fault of the application program if the methods with the same method name are assigned to the same data sub-region, so that the analysis cannot be successful. To avoid this, in the embodiment of the present invention, methods with the same method name are assigned to different data sub-regions.
The following illustrates the assignment of data sub-regions for a method.
If the data sub-area is specified for the method only based on the total instruction length and the number of the method parameters, the data sub-area with the length not less than the total instruction length of the method is searched; 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 quantity of the method or not; if the length of the data subarea is the same as the length of the data subarea, the data subarea with the minimum length is appointed for the method; and if the data sub-regions are different, selecting the data sub-regions with the small length, and judging until the data sub-regions are successfully appointed for the method.
If the data sub-area is only designated based on the total instruction length and the method name, searching the data sub-area with the length not less 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 subregion with the minimum length is the same as the method name of the method or not; if the data sub-regions are different, the data sub-region with the minimum length is appointed for the method; and if the same method name exists, selecting the data sub-region with the second-order small length, and judging until the data sub-region is successfully appointed for the method.
If the data sub-region is specified based on the total length of the instruction, the number of parameters of the method, and the name of the method, the data sub-region can be implemented by referring to the implementation manner, which is not described herein again.
On the basis of any of the above method embodiments, the instruction offset data may further include identification information of a data sub-region 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 target mapping relation data in the second target 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 the filtered part of the target mapping relation data, so that the searching time is shortened, and the searching efficiency is improved.
On this basis, in one implementation manner, the target mapping relationship data is saved in the second target file corresponding to the application program, specifically, the target mapping relationship data may be saved in the second target file corresponding to the application program in groups according to the corresponding data sub-regions, where each group of target mapping relationship data corresponds to one data sub-region. In another implementation manner, the target mapping relationship data further includes identification information of the data sub-regions corresponding to the respective methods.
In the embodiment of the present invention, the identification information of the data sub-region may include, but is not limited to: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
The index of the data sub-region is the offset address of the data sub-region.
The following describes a file processing method provided in an embodiment of the present invention with reference to a specific application scenario.
And aiming at the compiling stage of a certain application program running on the android system, carrying out the processes of aapt, javac, launch, bytex and the like, then carrying out DEX file merging (DexMerge), and then packaging to generate apk.
After apk is generated by packaging through a Hook function (Hook) inserted in advance, each Dex file in the apk is read.
Judging whether a Debug Item exists in the Dex file, if not, returning the OFFSET of Debug _ Info to be NO _ OFFSET (0), 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 a second target file LineNumberMapping.txt;
for each method, finding a debugginfo offset (namely a debugginfo sub-area) with a proper size, judging whether the instruction offset data of the method is written into the debugginfo 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 the line number information; otherwise, writing the instruction offset data of the method into the debugginfo sub-area, returning the instruction offset address of the method, writing the returned instruction offset address into a second target file, and establishing a corresponding relation with the line number information.
The implementation manner of finding the appropriate debugginfo offset may be as follows:
calculating the total instruction length of the method, if the total instruction length of the method exceeds 65536, it is not suitable for the method provided by the embodiment of the present invention, reng writes the original debugginfo of the method according to the existing manner, and returns the offset address (actually, the line number offset) of the debugginfo, if the total instruction length of the method does not exceed 65536, determines the number of method parameters of the method, searches for debugginfo sub-regions with the same number of method parameters as the written method and the length not less than the total instruction length of the method, possibly finds a plurality of debugginfo sub-regions, judges from the smallest debugginfo sub-region, judges whether the debugginfo sub-region has the method with the same name as the method, if not, writes the instruction offset data of the method into the debugginfo sub-region, otherwise, sequentially searches for the judgment according to the ascending order of size until a suitable partition is found, or determines that a suitable partition is not found, then no sharing is performed and data storage is still performed in the existing manner.
On this basis, the embodiment of the present invention proposes a specific data format of instruction offset data, one instruction offset data occupies one shaping amount (32 bits), wherein:
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 which the instruction is temporarily used. If one method instruction total length 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.
25-30 bits are used to store the number of method parameters for the method. If the number of method parameters exceeds 64, optimization is skipped.
Bits 31-32 are reserved and are constant at 0.
Thus, the Debug _ Info in the Code _ Item with similar instruction number in the written dex is the same, and meanwhile, the reported stack information is the instruction offset because the data which is originally the line number is rewritten into the instruction offset.
Embedding the DebugInfo scheme in the shared dex into a packaging flow:
the Hook android standard packed dexMerge or package task (two tasks adaptive, find either of them to perform the dex line number optimization process).
Through the processing procedure, the originally stored line number offset of the DebugInfo area is changed into the stored instruction offset, and the DebugInfo area is shared.
Based on the same inventive concept as the file processing method, an embodiment of the present invention further 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 at least includes a debug information data area, data content of the first target file at least includes target mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, as shown in fig. 2, the apparatus includes:
an instruction offset data writing module 201, configured to at least specify data sub-regions for the methods according to respective instruction total lengths of the methods of the application program, and write the instruction offset data of the methods into target positions of the data sub-regions corresponding to the methods, where the instruction offset data includes instruction offset addresses, each data sub-region corresponds to one or more methods of the application program, the length of each data sub-region is not less than the respective instruction total lengths of the methods corresponding to the data sub-region, and the target position is a position pointed by the instruction offset address included in the instruction offset data;
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 between an instruction offset address of each of the foregoing methods and a source code line number of the application program;
a mapping relationship data transferring module 203, configured to save the target mapping relationship data into 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 is not described herein again.
On one hand, 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 row 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 is 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 debugging information data area instead of the row number for reporting, and in the fault positioning stage, the corresponding row number can be found in the second target application file according to the reported instruction offset address, and then fault positioning is realized; on the other hand, the partition sharing of the data area is realized by modifying the data storage format of the debugging information data area, and compared with the prior art that each method corresponds to one debugging information data area, the new data storage format provided by the embodiment of the invention enables the debugging information data area to occupy smaller storage space, thereby further realizing 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, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of the above method embodiments are implemented.
On one hand, the computer device provided by the embodiment of the invention deletes the target mapping relation data stored in the first target file, namely deletes the row 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 is 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 debugging information data area instead of the row number for reporting, and in the fault positioning stage, the corresponding row number can be found in the second target application file according to the reported instruction offset address, and then fault positioning is realized; on the other hand, the partition sharing of the data area is realized by modifying the data storage format of the debugging information data area, and compared with the prior art that each method corresponds to one debugging information data area, the new data storage format provided by the embodiment of the invention enables the debugging information data area to occupy smaller storage space, thereby further realizing the purpose of compressing apk.
As described above, the file processing method provided by the embodiment of the present invention is implemented during the compilation of the application program, and then, the computer device provided by the embodiment of the present invention is a device for running a compiler, and may be a Personal Computer (PC), a notebook computer, a workstation, a server, and the like. One implementation structure is shown in fig. 3, and at least includes: a processor 301 (e.g., a central processing unit) that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage device 306 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the computer device are also stored. The ROM 302, the RAM 303, and the storage device 306 are collectively referred to as a memory, and the processor 301, the ROM 302, the RAM 303, and the storage device 306 are connected to one another by a bus 304. An input/output (I/O) interface 305 is also connected to bus 304. Generally, 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, and the like; output devices including, for example, Liquid Crystal Displays (LCDs), speakers, and the like; storage devices including, for example, magnetic tape, hard disk, etc.; and a communication device. The communication means may allow the computer device to communicate wirelessly or by wire with other devices to exchange data. While fig. 3 illustrates a computer device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
As shown in fig. 4, an embodiment of the present invention provides a method for locating an application operation fault, including:
step 401, 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 the debugging information data area of the first target file of the application program from the reporting terminal of the application program crash report, the debugging information data area is divided into a plurality of data subregions, each data subregion corresponds to one or more methods of the application program, the length of each data subregion is not less than the total length of instructions of each method corresponding to the data subregion, and the target location in each data subregion holds instruction offset data for the corresponding respective method, the target position is a position pointed by an instruction offset address included in the instruction offset data, the data area of the first target file at least includes a debugging information data area, and the data content of the first target file at least includes target mapping relation data.
Step 402, reading an instruction offset address from the instruction offset data.
And step 403, searching 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 storing target mapping relation data in the second target file, wherein the target mapping relation data comprises mapping relation data of the instruction offset addresses of the methods and the source code line numbers of the application programs.
And step 404, determining the source code causing the crash of the application program according to the searched line number of the source code.
The method for locating 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) and can also be realized on terminal equipment (a personal computer, a mobile terminal and the like) of a provider of the application program.
According to the method for locating the operation fault of the application program, provided by the embodiment of the invention, because the second target file can be obtained, even if the crash report does not carry the line number of the source code 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, and the fault location is further realized.
On this basis, the instruction offset data may further include identification information of a data sub-region where the instruction offset data is located, and correspondingly, the source code line number of the application program corresponding to the instruction offset address is searched in the second target file corresponding to the application program, and the implementation manner may be:
reading identification information of the data sub-region from the instruction offset data;
and 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 sub-region may include: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
The operation fault location method provided by the embodiment of the invention is described in detail below with reference to the above specific application scenarios.
After receiving a crash log of an application program, judging whether a Mapping file corresponding to the application program exists or not, and if not, processing according to the existing analysis flow;
if yes, judging whether a-dslnmapping parameter exists, if yes, calling a user-defined trace to analyze a crash stack, if not, processing according to the existing analysis flow, and if not, judging whether a Mapping file is MappingWithLinenumber.txt;
if not, processing according to the existing analysis flow, and if the analysis flow is MappingWithLineNumber.txt, further judging whether a cachemappingsize parameter exists;
if the failure exists, calling a custom trace analysis crash stack, and processing according to the existing analysis flow when the failure still exists; and if the Mapping file exists, the Mapping WithLineNumber.txt is divided into a Mapping file of a Proguard official party and a second target file only containing the Mapping relation between the instruction offset data and the line number information according to the identification, and the second target file is utilized to analyze the crash stack according to the customized trace.
The customized 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 location method, an embodiment of the present invention further provides an application program operation fault location apparatus, as shown in fig. 5, including:
an instruction offset data reading module 501, 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 that is run when the application program crashes, the instruction offset data includes an instruction offset address, the instruction offset address is obtained by searching a debugging information data area of a first target file of the application program from the reporting terminal of the application program crash report, the debugging information data area is divided into a plurality of data sub-areas, each data sub-area corresponds to one or more methods of the application program, the length of each data sub-area is not less than the total length of instructions of each method corresponding to the data sub-area, a target position in each data sub-area stores instruction offset data of each corresponding method, and a target position is a position to which the instruction offset address included in the instruction offset data points, the data area of the first target file at least comprises a debugging information data area, and the data content of the first target file at least comprises target mapping relation data;
an instruction offset address reading module 502, configured to read an instruction offset address from instruction offset data;
a source code line number searching module 503, configured to search 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, where target mapping relationship data is stored in the second target file, 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;
and the fault source code searching module 504 is used for determining the source code causing the crash of the application program according to the searched source code line number.
The specific implementation of each module may refer to the description of the method embodiment, and is not described herein again.
According to the application program operation fault positioning device provided by the embodiment of the invention, as the second target file can be obtained, even if the crash report does not carry the line number of the source code 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, and thus fault positioning is realized.
Based on the same inventive concept as the application program operation fault location method, an embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and operable on the processor, and when the processor executes the computer program, the steps of any of the method embodiments described above are implemented.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic or optical disk, or the like.
While the mobile terminal provided in the embodiments of the present invention has been described in detail, for those skilled in the art, the idea of the embodiments of the present invention may be changed in the specific implementation and application scope, and in summary, the content of the present description should not be construed as limiting the present invention.
The embodiments described above are only a part of the embodiments of the present invention, and not all of them. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Claims (16)

1. A file processing method is characterized in that a file comprises 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 at least comprises a debugging information data area, data contents of the first target file at least comprise target mapping relation data, and the debugging information data area is divided into a plurality of data sub-areas, and the method comprises the following steps:
respectively designating the data sub-regions for the methods at least according to respective instruction total lengths of the methods of the application program, and writing instruction offset data of the methods into target positions of the data sub-regions corresponding to the methods, wherein the instruction offset data comprises instruction offset addresses, each data sub-region corresponds to one or more methods of the application program, the length of each data sub-region is not less than the respective instruction total lengths of the methods corresponding to the data sub-region, and the target positions are positions pointed by the instruction offset addresses 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 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.
2. The method according to claim 1, wherein the respectively designating the data sub-regions for the respective methods of the application according to at least the total instruction length of the respective methods comprises:
and respectively appointing data sub-regions for the methods at least according to the respective instruction total length and the respective method names of the methods of the application program, wherein the methods with the same method name correspond to different data sub-regions.
3. The method according to claim 1, wherein the respectively designating the data sub-regions for the respective methods of the application according to at least the total instruction length of the respective methods comprises:
and respectively assigning data sub-regions for the methods at least according to the respective total instruction length and the respective method parameter number of the methods of the application program, wherein the methods with different method parameter numbers correspond to different data sub-regions.
4. The method according to any one of claims 1 to 3, wherein the instruction offset data further comprises identification information of a data sub-region in which the instruction offset data is located.
5. The method of claim 4, wherein the identification information of the data sub-region comprises: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
6. The method according to any one of claims 1 to 5, wherein the data sub-regions of the debug information data region are divided in a manner that:
sequencing all methods of the application program according to respective total instruction lengths;
grouping the sequencing sequences formed by the methods at least once until the summation result of the maximum total length of the instructions of each group of methods is not more than the length of the modulation information data area, wherein each group of methods obtained at the same time has the same number, and the grouping number of each time is decreased;
and aiming at each grouping, searching and summing the maximum total instruction length of each group of methods, comparing the summation result with the length of the debugging information data area, and if the summation result is not greater than the length of the debugging information data area, dividing the debugging information data area into data sub-areas with the same number as the grouping according to the maximum total instruction length of each group of methods.
7. A file processing apparatus, wherein the file includes a first object file of an application program and a second object file corresponding to the application program, a data area of the first object file at least includes a debug information data area, data content of the first object file at least includes object mapping relationship data, and the debug information data area is divided into a plurality of data sub-areas, the apparatus comprising:
an instruction offset data writing module, configured to respectively specify the data sub-regions for the methods at least according to respective instruction total lengths of the methods of the application program, and write the instruction offset data of the methods into target positions of the data sub-regions corresponding to the methods, where the instruction offset data includes instruction offset addresses, each data sub-region corresponds to one or more methods of the application program, and the length of each data sub-region is not less than the respective instruction total lengths of the methods corresponding to the data sub-region, and the target positions are positions pointed by the instruction offset addresses included in the instruction offset data;
a mapping relationship data reading module, configured to read target mapping relationship data from the first target file, where the target mapping relationship data includes mapping relationship data between the instruction offset address of each method and a source code line number of the application program;
and 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.
8. 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 steps of the method of any of claims 1 to 6 are implemented when the computer program is executed by the processor.
9. A computer-readable storage medium comprising a program stored thereon for executing the method of any one of claims 1 to 6.
10. An application program operation fault locating method is characterized by comprising the following steps:
acquiring 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 debugging information data area of a first target file of the application program from a reporting terminal of the application program crash report, the debugging information data area is divided into a plurality of data sub-areas, each data sub-area corresponds to one or more methods of the application program, the length of each data sub-area is not less than the total length of the instruction of each method corresponding to the data sub-area, the target position in each data sub-area is stored with the instruction offset data of each corresponding method, and 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 comprises a debugging 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 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;
and determining the source code causing the crash of the application program according to the searched source code line number.
11. The method of claim 10, wherein methods having the same method name correspond to different data sub-regions.
12. The method according to claim 10 or 11, 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 identification information of the data sub-region from the instruction offset data;
and 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.
13. The method of claim 12, wherein the identification information of the data sub-region comprises: the number of method parameters of the method corresponding to the data sub-region, and/or the index of the data sub-region.
14. An application program operation fault locating device is characterized by comprising:
an instruction offset data reading module, 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 that is run when the application program crashes, the instruction offset data includes an instruction offset address, the instruction offset address is obtained by searching a debugging information data area of a first target file of the application program from a reporting terminal of the application program crash report, the debugging information data area is divided into a plurality of data sub-areas, each data sub-area corresponds to one or more methods of the application program, the length of each sub-area data is not less than the total length of an instruction of each method corresponding to the sub-area data, and a target position in each data sub-area stores instruction offset data of each corresponding method, and the target position is a position to which the instruction offset address included in the instruction offset data points, the data area of the first target file at least comprises a debugging 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;
a source code line number searching module, configured to search 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, where target mapping relationship data is stored in the second target file, 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;
and the fault source code searching module is used for determining the source code causing the crash of the application program according to the searched source code line number.
15. 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 steps of the method according to any of claims 10 to 13 are implemented by the processor when executing the computer program.
16. A computer-readable storage medium comprising a program stored thereon for executing the method of any one of claims 10 to 13.
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 true CN110928779A (en) 2020-03-27
CN110928779B 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)

Cited By (2)

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

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040010734A1 (en) * 2002-07-10 2004-01-15 Marius Ghercioiu Deployment and execution of a program on an embedded device
US20060064676A1 (en) * 2004-09-21 2006-03-23 Hewlett-Packard Development Company, L.P. Systems and methods for validating debug information for optimized code
US20070168984A1 (en) * 2005-11-22 2007-07-19 Matsushita Electric Industrial Co., Ltd. Compiling system, debugging system and program development system
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

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040010734A1 (en) * 2002-07-10 2004-01-15 Marius Ghercioiu Deployment and execution of a program on an embedded device
US20060064676A1 (en) * 2004-09-21 2006-03-23 Hewlett-Packard Development Company, L.P. Systems and methods for validating debug information for optimized code
US20070168984A1 (en) * 2005-11-22 2007-07-19 Matsushita Electric Industrial Co., Ltd. Compiling system, debugging system and program development system
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
FACEBOOK: "Using ProGuard Rules with Redex", 《HTTPS://FBREDEX.COM/DOCS/PROGUARD》 *
字节跳动技术团队: "头条APK瘦身之路", 《HTTPS://MP.WEIXIN.QQ.COM/S/GCOCKBORFDNWHLGI0B7W9Q》 *
琉克 MPASS: "支付宝 App 构建优化解析:Android 包大小极致压缩", 《HTTPS://MP.WEIXIN.QQ.COM/S/_GNT2KJQPFMFS0KQAG4QIG》 *

Cited By (2)

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

Also Published As

Publication number Publication date
CN110928779B (en) 2023-04-25

Similar Documents

Publication Publication Date Title
CN108399132B (en) Scheduling test method, device and storage medium
CN107291480B (en) Function calling method and device
CN106569869A (en) Plug-in packaging method and device
CN110231994B (en) Memory analysis method, memory analysis device and computer readable storage medium
CN109766124A (en) Business development method, apparatus, computer equipment and storage medium
CN106294113B (en) creation method and device based on programmable test service
CN110716845B (en) Log information reading method of Android system
CN107015841B (en) Preprocessing method for program compiling and program compiling device
CN110659031A (en) Compiling method and device of application program, electronic equipment and storage medium
CN112099800A (en) Code data processing method and device and server
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN110837391B (en) Application program hot updating method and device, storage medium and electronic equipment
US8769498B2 (en) Warning of register and storage area assignment errors
US10552135B1 (en) Reducing a size of an application package
CN110928779B (en) File processing method, application program operation fault positioning method and equipment
CN111666102A (en) File format conversion method, chip verification method, related device and network chip
CN114237989B (en) Database service deployment and disaster tolerance method and device
CN113535580B (en) CTS test method, CTS test device and test equipment
US8819494B2 (en) Automatically changing parts in response to tests
CN111880803B (en) Software construction method and device applied to multiple platforms
CN114296774A (en) Application program storage method, application program calling device and storage medium
CN111356987B (en) Dynamic memory identification method and device
CN111190658A (en) System for supporting dynamic loading of application program on SoC (system on chip) without MMU (memory management unit) based on-chip execution
CN111209056B (en) Method and device for loading function, readable storage medium and electronic equipment
CN114296986B (en) Memory leakage positioning method, device, 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