CN113867730A - Method, device and equipment for determining target source code mapping file and storage medium - Google Patents

Method, device and equipment for determining target source code mapping file and storage medium Download PDF

Info

Publication number
CN113867730A
CN113867730A CN202111145410.1A CN202111145410A CN113867730A CN 113867730 A CN113867730 A CN 113867730A CN 202111145410 A CN202111145410 A CN 202111145410A CN 113867730 A CN113867730 A CN 113867730A
Authority
CN
China
Prior art keywords
source code
code
mapping file
code mapping
target
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.)
Pending
Application number
CN202111145410.1A
Other languages
Chinese (zh)
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 Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202111145410.1A priority Critical patent/CN113867730A/en
Publication of CN113867730A publication Critical patent/CN113867730A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code

Landscapes

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

Abstract

The disclosure relates to a method, a device, a system, equipment and a storage medium for determining a target source code mapping file, and relates to the technical field of computers. The method comprises the following steps: acquiring an error stack generated in the running process of a target program, wherein the error stack comprises an abnormal code of the target program and an identifier of a source code mapping file corresponding to the abnormal code; responding to the operation of inputting an error stack, acquiring and decompressing a scheduling source code mapping file compression packet corresponding to a target program to obtain one or more source code mapping files; and according to the identifier of the source code mapping file corresponding to the abnormal code, determining a target source code mapping file corresponding to the identifier from one or more source code mapping files.

Description

Method, device and equipment for determining target source code mapping file and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for determining a target source code mapping file.
Background
When developing an applet project, after a developer uploads source codes to a server, the server needs to convert the source codes into program codes under a supported operating environment and generate a source code mapping file compression package including a plurality of source code mapping files. When the client (such as a terminal) runs the converted language program code, if a code running error occurs, a developer can obtain an error code and a row and column number of the error code through the small program interface, so that the developer can determine a position in a source code corresponding to the error code, and further modify the source code corresponding to the error code.
In order to determine the row and column number in the source code corresponding to the error code, developers usually use a manual determination method. For example, a developer manually selects a source code mapping file corresponding to an error code and inputs the position of the error code, and uses a source code mapping file debugging plug-in of a program development tool to analyze the source code mapping file and the position of the source code corresponding to the error code, so as to determine the position of the source code corresponding to the error code. In the case where a large number of error codes are required to determine the positions of the corresponding source codes, a large amount of time and effort are required.
Disclosure of Invention
The present disclosure provides a method, an apparatus, a device, and a storage medium for determining a target source code mapping file, which can shorten the time and reduce the workload of developers when a large number of error codes need to determine the positions of corresponding source codes.
The technical scheme of the embodiment of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a method for determining a target source code mapping file, where the method may be applied to a terminal, and the method may include: the method comprises the steps that a terminal obtains an error stack corresponding to a target program, wherein the error stack is generated in the running process of the target program and comprises an abnormal code in the target program and an identifier of a source code mapping file corresponding to the abnormal code; responding to the operation of inputting an error stack, the terminal acquires and decompresses a source code mapping file compression packet corresponding to a target program to obtain one or more source code mapping files; and the terminal determines a target source code mapping file corresponding to the identifier from one or more source code mapping files according to the identifier of the source code mapping file corresponding to the abnormal code.
Optionally, the error stack further includes a location of the exception code in the target program, and the method further includes: for each exception code in the error stack, the terminal performs a position determination operation in turn, the position determination operation comprising: determining a source code mapping file corresponding to the abnormal code; and determining the position of the abnormal code in the application program code according to the position of the abnormal code in the target program and the source code mapping file corresponding to the abnormal code.
Optionally, the "determining the position of the abnormal code in the application program code according to the position of the abnormal code in the target program and the source code mapping file corresponding to the abnormal code" specifically includes: and the terminal analyzes the source code mapping file corresponding to the abnormal code line by line according to the line number and the column number of the abnormal code, and determines the line number and the column number of the application program corresponding to the abnormal code.
Optionally, before "acquiring the error stack corresponding to the target program", the method further includes: the terminal responds to the uploading operation and downloads a source code mapping file compression package corresponding to the target program, wherein the source code mapping file compression package comprises one or more source code mapping files; and the terminal stores the source code mapping file compression package according to the information of the application program, wherein the information of the application program comprises one or more of version number and name.
Optionally, the "acquiring and decompressing the source code mapping file compression packet corresponding to the target program" specifically includes: and the terminal acquires and decompresses the source code mapping file compression packet corresponding to the target program according to the information of the application program corresponding to the target program.
Optionally, the method further includes: and the terminal outputs the position of the application program code corresponding to the abnormal code.
According to a second aspect of the embodiments of the present disclosure, an apparatus for determining a target source code mapping file is provided. The apparatus may include: an acquisition unit and a determination unit; the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring an error stack corresponding to a target program, the error stack is generated in the running process of the target program, and the error stack comprises an abnormal code in the target program and an identifier of a source code mapping file corresponding to an abnormal single side; the acquisition unit is also used for responding to the operation of inputting the error stack, acquiring and decompressing a source code mapping file compression packet corresponding to the target program to obtain one or more source code mapping files; and the determining unit is used for determining a target source code mapping file corresponding to the identifier from one or more source code mapping files according to the identifier of the source code mapping file corresponding to the abnormal code.
Optionally, the error stack further includes a location of the exception code in the target program, and the apparatus further includes a processing unit, the processing unit is configured to: for each exception code in the error stack, performing a location determination operation in turn, the location determination operation comprising: determining a source code mapping file corresponding to the abnormal code; and determining the position of the abnormal code in the application program code according to the position of the abnormal code in the target program and the source code mapping file corresponding to the abnormal code.
Optionally, the determining unit is specifically configured to: and analyzing the source code mapping file corresponding to the abnormal code line by line according to the line number and the column number of the abnormal code, and determining the line number and the column number of the application program corresponding to the abnormal code.
Optionally, the apparatus further includes a downloading unit and a storage unit, where the downloading unit is configured to, in response to an upload operation, download a source code mapping file compression package corresponding to the target program, where the source code mapping file compression package includes one or more source code mapping files; and the storage unit is used for storing the source code mapping file compression package according to the information of the application program, wherein the information of the application program comprises one or more of version number and name.
Optionally, the obtaining unit is specifically configured to obtain and decompress a source code mapping file compression packet corresponding to the target program according to the information of the application program corresponding to the target program.
Optionally, the apparatus further includes an output unit, configured to output a location of the application code corresponding to the exception code.
According to a third aspect of embodiments of the present disclosure, there is provided a computing device, which may include: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement any one of the above-mentioned first aspect methods for optionally determining a target source code mapping file.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon instructions, which, when executed by a processor of a computing device, enable the computing device to perform any one of the above methods for determining an optional target source code mapping file of the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, which includes computer instructions that, when executed on a computing device, cause the computing device to execute the method for determining a target source code mapping file according to any one of the optional implementations of the first aspect.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
based on any one of the above aspects, in the present disclosure, the terminal may obtain an error stack corresponding to the target program, where the error stack includes an exception code in the target program and an identifier of a source code mapping file corresponding to the exception code. In response to the operation of inputting the error stack by the user, the terminal can automatically acquire and decompress the source code mapping file corresponding to the target program to obtain one or more source code mapping files. Then, the terminal may determine a target source code mapping file corresponding to the abnormal code from the one or more source code mapping files according to the identifier of the abnormal code in the error stack. That is to say, compared with a manual scheme, in the case that a large number of abnormal codes need to determine the positions of corresponding source codes, the terminal can automatically determine the target source code mapping file corresponding to the abnormal codes, and developers do not need to manually search the source code mapping file, so that time is reduced, and efforts of the developers can be saved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a schematic diagram illustrating an interface for locating an exception code according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram illustrating an architecture of a communication system provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating another interface for locating an exception code provided by an embodiment of the present disclosure;
fig. 4 is a flowchart illustrating a method for determining a target source code mapping file according to an embodiment of the present disclosure;
fig. 5 is a flowchart illustrating a method for determining a target source code mapping file according to an embodiment of the present disclosure;
fig. 6 is a flowchart illustrating a method for determining a target source code mapping file according to an embodiment of the present disclosure;
fig. 7 is a flowchart illustrating a method for determining a target source code mapping file according to an embodiment of the present disclosure;
fig. 8 is a flowchart illustrating a method for determining a target source code mapping file according to an embodiment of the present disclosure;
fig. 9 is a flowchart illustrating a method for determining a target source code mapping file according to an embodiment of the present disclosure;
fig. 10 is a schematic structural diagram illustrating a determining apparatus of a target source code mapping file according to an embodiment of the present disclosure;
fig. 11 is a schematic structural diagram illustrating a device for determining a target source code mapping file according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, and/or components.
The data to which the present disclosure relates may be data that is authorized by a user or sufficiently authorized by parties.
As described in the background art, when determining the row and column numbers of the exception codes in the source code, a developer needs to determine a source code mapping file (source map) file corresponding to each exception code, and then input the row and column number of each exception code for determining the row and column numbers of the exception codes in the source code.
For example, a developer needs to manually download a source mapping file compression package of source code and decompress the source mapping file compression package to obtain a plurality of source mapping files. Then, the developer manually determines the source code mapping file corresponding to each error code from the plurality of source code mapping files, and inputs the position (such as a row and column number) of the error code, so as to determine the position of the source code corresponding to each error code.
However, in the process of receiving and running the converted program code from the server (also referred to as a program development server, such as a wechat server) by the terminal installed with the program running software (such as wechat), a developer needs to constantly monitor whether an error code occurs, and when the error code occurs, the developer determines the position of the source code corresponding to the error code by using a manual determination method. When the number of error codes is very large, if the method of manual determination is adopted, a developer needs to repeatedly determine the source code mapping file and the position corresponding to the error codes, and the method is time-consuming and heavy in workload.
In one example, as shown in a of fig. 1, an interface diagram for determining a location of a source code corresponding to an exception code is shown. The interface may include a first selection box 101 and a first input box 102. Wherein the first selection box 101 is used for responding to the operation of a developer and determining a source code mapping file. For example, in response to an operation for clicking "select file", an interface diagram as shown in b in fig. 1 may be displayed. The interface diagram comprises a plurality of source code mapping files (such as a source code mapping file 1-a source code mapping file 4 in the figure). Further, in response to a click operation of the developer on the source code mapping file 1 in b of fig. 1, the interface diagram shown in c of fig. 1 may be displayed.
After selecting the source code mapping file corresponding to the exception code, the row and column number of the exception code in the source code may be output in response to an operation of the developer inputting the position (e.g., row and column number) of the exception code in the first input box 102 in c of fig. 1. For example, the output may be on a display device of the console.
As can be seen from the above description, a developer needs to manually select a source code mapping file corresponding to an exception code and input a location of the exception code. In the case where the number of abnormal codes is large, if a method of manual determination is adopted, a large amount of time and effort are required.
Based on this, the embodiment of the present disclosure provides a method for determining a target source code mapping file, where a terminal obtains an error stack corresponding to a target program, where the error stack is generated by the target program in an operation process, and the error stack includes an abnormal code in the target program and an identifier of the source code mapping file corresponding to the abnormal code; the terminal responds to the operation of inputting the error stack, acquires and decompresses a source code mapping file compression packet corresponding to the target program, and obtains one or more source code mapping files; and the terminal determines a target source code mapping file corresponding to the identifier from one or more source code mapping files according to the identifier of the source mapping file corresponding to the abnormal code.
Based on the method for determining the target source code mapping file provided by the embodiment of the disclosure, the terminal may obtain an error stack corresponding to the target program, where the error stack includes an abnormal code in the target program and an identifier of the source code mapping file corresponding to the abnormal code. And the terminal responds to the operation of inputting an error stack by a user, automatically acquires and decompresses the source code mapping file corresponding to the target program, and obtains one or more source code mapping files. Then, the terminal may determine a target source code mapping file corresponding to the abnormal code from the one or more source code mapping files according to the identifier of the abnormal code in the error stack. That is to say, compared with a manual scheme, in the case that a large number of abnormal codes need to determine the positions of corresponding source codes, the terminal can automatically determine the target source code mapping file corresponding to the abnormal codes, and developers do not need to manually search the source code mapping file, so that time is reduced, and efforts of the developers can be saved.
The following provides an exemplary description of a method for determining a target source code mapping file according to an embodiment of the present disclosure with reference to the accompanying drawings:
fig. 2 is a schematic diagram of a communication system according to an embodiment of the present disclosure, as shown in fig. 2, the communication system may include: the server 210 and the terminal 220, and the server 210 and the terminal 220 can establish connection with each other through a wired network or a wireless network.
The server 210 may be configured to convert the application code into a code supported by the terminal 220, and send the converted code to the terminal 220 for the terminal 220 to run the code.
The application code is code edited by a developer using a programming language, and can be used to generate an application.
The terminal 220 may be a computer, a personal computer, a notebook, a tablet, a mobile terminal, etc. The terminal 230 can run the converted, supported program code and generate supported applications. For example, taking the server 210 as a wechat applet development server as an example, the terminal 220 may be installed with wechat. And the program developer uploads the application program codes to the WeChat applet development server through a WeChat program interface. After receiving the application program code from the terminal, the wechat applet development server can convert the application program code into a code supported by the wechat and send the converted code to the terminal, so that the wechat of the terminal can run the converted code to generate the wechat applet.
The terminal 220 may be further configured to receive an error stack including the exception code, and determine a source code mapping file corresponding to the exception code, and a column/row number of the exception code in the source code.
It should be noted that, in the present disclosure, the terminal 220 may determine the position of the source code corresponding to the exception code according to the row and column number of the exception code in the converted code program and the source code mapping file. Specifically, reference may be made to the following description, which is not repeated herein.
In one example, the terminal 220 may have an interface as shown in FIG. 3, which includes an input box 301 and an output box 302.
Wherein the input box 301 is used to input one or more exception codes. For example, the one or more exception codes may be the following exception code 1 through exception code 9:
cannot read property 'video' of undefined// property "video" that Cannot read undefined "
TypeError Cannt read property 'video' of unfinished.// type error: the undefined attribute "video" cannot be read "
at a. < anonymous > (https:// usr/app-service. js:8534:329320)// exception code 1
at s (https:// usr/app-service. js:8534:2420)// exception code 2
Next (https:// usr/app-service. js:8534:1715)// exception code 3
at https:// usr/app-service. js:8534:1440// exception code 4
at s (https:// usr/app-service. js:8534:1211)// exception code 5
at a.t.swipperchangeupdown (https:// usr/app-service.js:8534:328219)// exception code 6
at a. < anonymous > (https:// usr/app-service. js:8534:327713)// exception code 7
at s (https:// usr/app-service. js:8534:2420)// exception code 8
Next (https:// usr/app-service. js:8534:1715)// exception code 9
Wherein "https:// usr/" in the above third to eleventh lines is used to indicate a prefix. Js represents a converted code file of the exception code. The converted file may be used to identify a source code mapping file corresponding to the exception code. The converted code file and the code mapping file are in one-to-one correspondence. In the above third to eleventh rows ": "previous number (e.g. 8534) is the line number of the exception code in the converted code file, third to eleventh": the "next number (e.g., 329320, 2420, 1715, 1440, etc.) is the column number of the exception code in the converted code file.
Wherein, after the terminal 220 determines the rank number of each exception code in the source code, the output block 302 may be configured to output the rank number of each exception code in the source code.
In one example, as shown in FIG. 3, the output box may include a sequence number, exception code, source map file, line number (line) in source code, column number (column) in source code. Other information, such as a name (name), may also be included. Where the name may refer to the name of an identifier in the source code, the identifier may be used to represent a variable in the source code.
As shown in fig. 4, the method for determining a target source code mapping file according to the embodiment of the present disclosure may include:
s401, the terminal obtains an error stack corresponding to the target program.
The terminal may be the terminal 220 in fig. 2.
The error stack may be generated during the running process of the target program, for example, the error stack may be generated during the running process of the application program (e.g., WeChat) of the terminal 220 in FIG. 2. The error stack may include the exception code in the target program, an identification of the source code mapping file to which the exception code corresponds. The target program is converted from the application program code.
S402, responding to the operation of inputting the error stack, the terminal acquires and decompresses the source code mapping file compression packet to obtain one or more source code mapping files.
The operation of inputting the error stack may be an input operation, which may be an operation of inputting an exception code to the terminal through an input interface of the terminal by a developer, or an operation of actively inputting the error stack to the terminal by the server after the server runs the target program. For example, the developer may input an exception code through the input box 301 of the terminal 220. The abnormal code may refer to code which is abnormal or cannot be run by the program development server in the process of running the target program.
The source code mapping file compressed package may include one or more source code mapping files.
S403, the terminal determines a target source code mapping file corresponding to the identifier from one or more source code mapping files according to the identifier of the source code mapping file corresponding to the abnormal code.
The identifier of the source code mapping file can uniquely identify one source code mapping file.
The technical scheme provided by the embodiment at least has the following beneficial effects: from S401 to S403, in the method for determining a target source code mapping file provided in the embodiment of the present disclosure, a terminal obtains an error stack of a target program, where the error stack is generated in an operation process of the target program, and the error stack includes an exception code in the target program, an identifier of a source code mapping file corresponding to the exception code, and a position of the exception code in the target program; and the terminal acquires and decompresses the source code mapping file corresponding to the target program to obtain one or more source code mapping files. Then, the terminal may determine a target source code mapping file corresponding to the abnormal code from the one or more source code mapping files according to the identifier of the abnormal code in the error stack. That is to say, compared with a manual scheme, in the case that a large number of abnormal codes need to determine the positions of corresponding source codes, the terminal can automatically determine the target source code mapping file corresponding to the abnormal codes, and developers do not need to manually search the source code mapping file, so that time is reduced, and efforts of the developers can be saved.
In one embodiment, the error stack further includes the location of the exception code in the target program, and in conjunction with fig. 4, as shown in fig. 5, the method may further include S501.
S501, for each abnormal code in the error stack, the terminal sequentially executes position determination operation.
Wherein the location determination operation may be used to determine a location of the exception code in the application code. The position determination operation may include S5011 and S5012.
S5011, the terminal determines a source code mapping file corresponding to the abnormal code.
The source code mapping file may include a target correspondence. The target correspondence may be used to determine the location of source code to which code in the target program corresponds. For example, the target correspondence may be a correspondence between a position of code in the target program and a position of code in the source code. The identification of the source code mapping file may be used to uniquely identify the source code mapping file. For example, the identifier of the source code mapping file may be, without limitation, a number, a name, or the like of the source code mapping file.
It should be noted that, in the embodiment of the present disclosure, the correspondence included in different source code mapping files may be different. For example, the source code mapping file 1 includes a first correspondence, and the source code mapping file 2 includes a second correspondence. The first correspondence is a correspondence between a position of the code in the first program and a position of the code in the source code 1. The second correspondence is a correspondence between the position of the code in the second program and the position of the code in the source code 2.
The first program and the second program may be different programs in the target program. Source code 1 and source code 2 may be different portions of the program in the source code.
S5012, the terminal determines the position of the abnormal code in the application program according to the position of the abnormal code in the target program and the source code mapping file corresponding to the abnormal code.
In a possible implementation manner, the terminal may determine the position of the source code corresponding to the abnormal code according to the target correspondence and the position of the abnormal code in the target program.
The error stack may further include a location of the exception code in the target program.
In one example, the terminal may query the target correspondence and determine a location of a source code corresponding to the exception code. Specifically, reference may be made to the prior art, which is not described in detail.
For example, if the position of the exception code in the target program is (a1, B2), the target correspondence is queried, and the terminal can determine that the position of the source code corresponding to the exception code is (a1, B2).
The technical scheme provided by the embodiment at least has the following beneficial effects: as can be seen from S501, for each exception code in the error stack, the terminal may perform a location determination operation, that is, after determining the source code mapping file of the exception code, the terminal may determine the location of the exception code in the application program code according to the location of the exception code in the target program and the source code mapping file corresponding to the exception code. Therefore, the terminal can sequentially determine the position of each abnormal code in the error stack in the application program code, and the missing of the abnormal code is avoided.
In an embodiment, referring to fig. 5 and as shown in fig. 6, in the above S5012, the method for determining, by the terminal, the location of the exception code in the target program and the source code mapping file corresponding to the exception code may specifically include:
s601, the terminal analyzes the source code mapping file corresponding to the abnormal code line by line according to the line number and the column number of the abnormal code, and determines the line number and the column number of the application program corresponding to the abnormal code.
The location of the exception code may include, among other things, a line number and a column number of the exception code.
The technical scheme provided by the embodiment at least has the following beneficial effects: as can be seen from S601, the terminal may parse the source code mapping file corresponding to the abnormal code line by line according to the line number and the column number of the abnormal code. Therefore, the terminal can accurately determine the line number and the column number of the application program corresponding to the abnormal code.
In an embodiment, with reference to fig. 4, as shown in fig. 7, before S401, the method provided in the embodiment of the present disclosure may further include S701 to S702.
And S701, the terminal responds to the uploading operation and downloads the source code mapping file compression package corresponding to the target program.
The source code mapping file compressed package may include one or more source code mapping files.
The uploading operation may refer to the terminal sending the application program code to the server. Accordingly, after the server receives the application code from the terminal, the application code may be converted into a target program and one or more source code mapping files may be generated. The method for the server to convert the source code into the target program and generate one or more source code mapping files may refer to the prior art and is not described in detail herein. The server may further compress the one or more source code mapping files to obtain a source code mapping file compression package.
In one example, a developer may upload application code to a server via a terminal using a CI tool. For example, taking the server as a wechat applet server as an example, the developer may send the application program code to the wechat applet server through a predetermined interface of the wechat.
S702, the terminal stores the source code mapping file compression package according to the information of the application program.
The information of the application program may include one or more of a version number and a name of the application program.
The technical scheme provided by the embodiment at least has the following beneficial effects: as can be seen from S701 to S702, after receiving one or more source code files uploaded by a developer, a terminal may upload the one or more source code files to a server, and the server may convert the one or more source code files into a target program and generate a source code mapping file compression package including the one or more source code mapping files. In this way, the server may send the source code mapping file compressed packet to the terminal, so that the subsequent terminal determines the source code mapping file corresponding to the abnormal code and determines the position of the source code corresponding to the abnormal code according to the source code mapping file.
In an embodiment, referring to fig. 4, as shown in fig. 8, in the above S402, a method for a terminal to obtain and decompress a corresponding source code mapping file compression packet of a target program may specifically include S801.
S801, the terminal acquires and decompresses the source code mapping file compression packet corresponding to the target program according to the information of the application program corresponding to the target program.
The technical scheme provided by the embodiment at least has the following beneficial effects: as can be seen from S801, after downloading the source code mapping file compressed package corresponding to the target program, the terminal stores the source code mapping file compressed package based on the information of the application program corresponding to the target program. Therefore, the terminal can quickly and accurately acquire the source code mapping file compression package corresponding to the target program according to the information of the application program corresponding to the target program.
In an embodiment, in conjunction with fig. 8, as shown in fig. 9, the method may further include S901.
And S901, outputting the position of the application program code corresponding to the abnormal code by the terminal.
In one example, the terminal may output the location of the application code corresponding to the exception code through output block 302 in fig. 3.
The technical scheme provided by the embodiment at least has the following beneficial effects: as can be seen from S901, after determining the location of the application code corresponding to the abnormal code, the terminal may output the location of the corresponding application code, so that a developer may modify the application code according to the location of the application code corresponding to the abnormal code.
It is understood that, in practical implementation, the terminal according to the embodiment of the present disclosure may include one or more hardware structures and/or software modules for implementing the foregoing method for determining the corresponding target source code mapping file, and the executing hardware structures and/or software modules may constitute an electronic device. Those of skill in the art will readily appreciate that the present disclosure can be implemented in hardware or a combination of hardware and computer software for implementing the exemplary algorithm steps described in connection with the embodiments disclosed herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
Based on such understanding, the embodiment of the present disclosure also provides a device for determining a target source code mapping file. The determining means may be applied to the terminal, e.g. may be a chip or a device of the terminal. Fig. 10 is a schematic structural diagram illustrating a determining apparatus of a target source code mapping file according to an embodiment of the present disclosure. As shown in fig. 10, the determining means of the target source code mapping file may include: an acquisition unit 1001 and a determination unit 1002.
An obtaining unit 1001, configured to obtain an error stack corresponding to a target program, where the error stack is generated in an operating process of the target program, and the error stack includes an exception code in the target program and an identifier of a source code mapping file corresponding to the exception code. The obtaining unit 1001 is further configured to, in response to an operation of inputting an error stack, obtain and decompress a source code mapping file compression packet corresponding to a target program to obtain one or more source code mapping files; the determining unit 1002 is configured to determine, according to the identifier of the source code mapping file corresponding to the abnormal code, a target source code mapping file corresponding to the identifier from the one or more source code mapping files. For example, in conjunction with fig. 4, the determination unit 1002 is configured to perform S403.
Optionally, the error stack further includes a position of the exception code in the target program, as shown in fig. 10, the determining apparatus further includes a processing unit 1003, and the processing unit 1003 is configured to, for each exception code in the error stack, sequentially perform a position determining operation, where the position determining operation includes: determining a source code mapping file corresponding to the abnormal code; and determining the position of the abnormal code in the application program according to the position of the abnormal code in the target program and the source code mapping file of the abnormal code poison.
Optionally, the determining unit 1002 is specifically configured to parse, line by line, the source code mapping file corresponding to the exception code according to the line number and the column number of the exception code, and determine the line number and the column number of the application program corresponding to the exception code.
Optionally, as shown in fig. 10, the determining means may further include a downloading unit 1004 and a storing unit 1005. And the downloading unit is used for responding to the uploading operation and downloading the source code mapping file compression package corresponding to the target program, wherein the source code mapping file compression package comprises one or more source code mapping files. A storage unit 1005, configured to store the source code mapped file compression package according to information of an application program, where the information of the application program includes one or more of a version number and a name.
Optionally, as shown in fig. 10, the apparatus may further include an output unit 1006. The output unit 1006 is configured to output a location of the application code corresponding to the exception code.
As described above, the embodiment of the present disclosure may perform functional module division on the determination apparatus for a target source code mapping file according to the above method example. The integrated module can be realized in a hardware form, and can also be realized in a software functional module form. In addition, it should be further noted that the division of the modules in the embodiments of the present disclosure is schematic, and is only a logic function division, and there may be another division manner in actual implementation. For example, the functional blocks may be divided for the respective functions, or two or more functions may be integrated into one processing block.
With regard to the apparatus for determining a target source code mapping file in the foregoing embodiment, the specific manner in which each module performs operations and the beneficial effects thereof have been described in detail in the foregoing method embodiment, and are not described again here.
The embodiment of the disclosure also provides a device for determining the target source code mapping file. Fig. 11 shows a schematic structural diagram of a determination apparatus provided in an embodiment of the present disclosure. The determining means may comprise at least one processor 111, a communication bus 112, a memory 113 and at least one communication interface 114.
Processor 111 may be a Central Processing Unit (CPU), a micro-processing unit, an ASIC, or one or more integrated circuits for controlling the execution of programs in accordance with the disclosed aspects. As an example, in connection with fig. 10, the function implemented by the determination unit 1002 in the determination apparatus is the same as the function implemented by the processor 111 in fig. 11.
The communication bus 112 may include a path that conveys information between the aforementioned components.
The communication interface 114 may be any device, such as a transceiver, for communicating with other devices or communication networks, such as a server, an ethernet, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), etc. As an example, in connection with fig. 11, the function realized by the acquisition unit 1001 in the determination device is the same as the function realized by the communication interface 114 in fig. 11.
The memory 113 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that may store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that may store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be self-contained and connected to the processing unit by a bus. The memory may also be integrated with the processing unit.
The memory 113 is used for storing application program codes for executing the disclosed scheme, and the processor 111 controls the execution. The processor 111 is configured to execute application program code stored in the memory 113 to implement the functions of the disclosed method.
In particular implementations, processor 111 may include one or more CPUs such as CPU0 and CPU1 in fig. 11 for one embodiment.
In one implementation, the terminal may include multiple processors, such as processor 111 and processor 115 in fig. 11, for example. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In one embodiment, the determining means may further include an input device 116 and an output device 117. The input device 116 communicates with the output device 117 and may accept user input in a variety of ways. For example, the input device 116 may be a mouse, a keyboard, a touch screen device, or a sensing device, among others. The output device 117 is in communication with the processor 111 and may display information in a variety of ways. For example, the output device 111 may be a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display device, or the like.
Those skilled in the art will appreciate that the configuration shown in fig. 11 does not constitute a limitation of the determination means, and may include more or fewer components than those shown, or combine certain components, or employ a different arrangement of components.
The present disclosure also provides a computer-readable storage medium comprising instructions stored thereon, which when executed by a processor of a computer device, enable a computer to perform the method for determining a target source code mapping file provided by the above-described illustrative embodiments. For example, the computer readable storage medium may be a memory 113 comprising instructions executable by the processor 111 of the determination device to perform the method described above. Also for example, the computer readable storage medium may be a memory 112 comprising instructions executable by a processor 111 of the server to perform the above-described method. Alternatively, the computer readable storage medium may be a non-transitory computer readable storage medium, for example, which may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The present disclosure also provides a computer program product comprising computer instructions which, when run on a determining apparatus, cause the determining apparatus to perform the method for determining a target source code mapping file as shown in any of the above figures 4-8.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for determining a target source code mapping file is characterized by comprising the following steps:
acquiring an error stack corresponding to a target program, wherein the error stack is generated in the running process of the target program and comprises an abnormal code in the target program and an identifier of a source code mapping file corresponding to the abnormal code;
responding to the operation of inputting the error stack, acquiring and decompressing a source code mapping file compression packet corresponding to the target program to obtain one or more source code mapping files;
and determining a target source code mapping file corresponding to the identifier from the one or more source code mapping files according to the identifier of the source code mapping file corresponding to the abnormal code.
2. The method of claim 1, wherein the error stack further includes a location of the exception code in the target program, the method further comprising:
for each exception code in the error stack, performing a location determination operation in turn, the location determination operation comprising:
determining a source code mapping file corresponding to the abnormal code;
and determining the position of the abnormal code in the application program code according to the position of the abnormal code in the target program and the source code mapping file corresponding to the abnormal code.
3. The method of claim 2, wherein determining the location of the exception code in the application code according to the location of the exception code in the target program and a source code mapping file corresponding to the exception code comprises:
and analyzing the source code mapping file corresponding to the abnormal code line by line according to the line number and the column number of the abnormal code, and determining the line number and the column number of the application program code corresponding to the abnormal code.
4. The method of any of claims 1-3, wherein prior to said obtaining the error stack corresponding to the target program, the method further comprises:
responding to the uploading operation, and downloading a source code mapping file compression package corresponding to the target program; the source code mapping file compressed packet comprises one or more source code mapping files;
and storing the source code mapping file compression package according to the information of the application program, wherein the information of the application program comprises one or more of version number and name.
5. The method of claim 4, wherein the obtaining and decompressing the source code mapping file compression packet corresponding to the target program comprises:
and acquiring and decompressing the source code mapping file compression packet corresponding to the target program according to the information of the application program corresponding to the target program.
6. The method of claim 5, further comprising:
and outputting the position of the application program code corresponding to the abnormal code.
7. The device for determining the target source code mapping file is characterized by comprising an acquisition unit and a determination unit;
the acquiring unit is configured to acquire an error stack corresponding to a target program, where the error stack is generated in an operating process of the target program, and the error stack includes an exception code in the target program and an identifier of a source code mapping file corresponding to the exception code;
the obtaining unit is further configured to obtain and decompress a source code mapping file compression packet corresponding to the target program in response to an operation of inputting the error stack, so as to obtain one or more source code mapping files;
and the determining unit is used for determining a target source code mapping file corresponding to the identifier from the one or more source code mapping files according to the identifier of the source code mapping file corresponding to the abnormal code.
8. A computing device, wherein the computing device comprises:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of determining a target source code mapping file according to any of claims 1-6.
9. A computer-readable storage medium having instructions stored thereon, wherein the instructions in the computer-readable storage medium, when executed by a processor of a computing device, enable the computing device to perform a method of determining a target source code mapping file as recited in any of claims 1-6.
10. A computer program product comprising instructions that, when run on a computing device, cause the computing device to perform the method of determining a target source code map file according to any of claims 1-6.
CN202111145410.1A 2021-09-28 2021-09-28 Method, device and equipment for determining target source code mapping file and storage medium Pending CN113867730A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111145410.1A CN113867730A (en) 2021-09-28 2021-09-28 Method, device and equipment for determining target source code mapping file and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111145410.1A CN113867730A (en) 2021-09-28 2021-09-28 Method, device and equipment for determining target source code mapping file and storage medium

Publications (1)

Publication Number Publication Date
CN113867730A true CN113867730A (en) 2021-12-31

Family

ID=78992124

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111145410.1A Pending CN113867730A (en) 2021-09-28 2021-09-28 Method, device and equipment for determining target source code mapping file and storage medium

Country Status (1)

Country Link
CN (1) CN113867730A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160306612A1 (en) * 2015-04-14 2016-10-20 International Business Machines Corporation Determining errors and warnings corresponding to a source code revision
CN108459949A (en) * 2017-02-17 2018-08-28 腾讯科技(深圳)有限公司 A kind of test method and terminal
CN111752819A (en) * 2019-03-29 2020-10-09 广州市百果园信息技术有限公司 Abnormity monitoring method, device, system, equipment and storage medium
CN111753330A (en) * 2020-06-18 2020-10-09 百度在线网络技术(北京)有限公司 Method, device and equipment for determining data leakage subject and readable storage medium
CN112527546A (en) * 2020-12-14 2021-03-19 携程旅游网络技术(上海)有限公司 Application exception rapid positioning method, system, equipment and storage medium
CN113392893A (en) * 2021-06-08 2021-09-14 北京达佳互联信息技术有限公司 Method, device, storage medium and computer program product for positioning service fault

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160306612A1 (en) * 2015-04-14 2016-10-20 International Business Machines Corporation Determining errors and warnings corresponding to a source code revision
CN108459949A (en) * 2017-02-17 2018-08-28 腾讯科技(深圳)有限公司 A kind of test method and terminal
CN111752819A (en) * 2019-03-29 2020-10-09 广州市百果园信息技术有限公司 Abnormity monitoring method, device, system, equipment and storage medium
CN111753330A (en) * 2020-06-18 2020-10-09 百度在线网络技术(北京)有限公司 Method, device and equipment for determining data leakage subject and readable storage medium
CN112527546A (en) * 2020-12-14 2021-03-19 携程旅游网络技术(上海)有限公司 Application exception rapid positioning method, system, equipment and storage medium
CN113392893A (en) * 2021-06-08 2021-09-14 北京达佳互联信息技术有限公司 Method, device, storage medium and computer program product for positioning service fault

Similar Documents

Publication Publication Date Title
US10223397B1 (en) Social graph based co-location of network users
CN112800095A (en) Data processing method, device, equipment and storage medium
KR20200029387A (en) Data aggregation method for cache optimization and efficient processing
CN109408375A (en) The generation method and device of interface document
CN111291103A (en) Interface data analysis method and device, electronic equipment and storage medium
CN111061956A (en) Method and apparatus for generating information
US9514184B2 (en) Systems and methods for a high speed query infrastructure
CN111274512A (en) Page loading method, device and medium
CN111352836A (en) Pressure testing method and related device
US20140344447A1 (en) Method and apparatus for executing application
US9571557B2 (en) Script caching method and information processing device utilizing the same
CN112769706A (en) Componentized routing method and system
CN115686606A (en) Method, device, system and medium for displaying item dependency tree
KR102545045B1 (en) Method and apparatus for generating information
CN114253798A (en) Index data acquisition method and device, electronic equipment and storage medium
CN114465937A (en) Network card testing method, device, server, medium, and computer program product
CN111309341B (en) Android application installation flow optimization method based on time-consuming prediction
JP2016024486A (en) Data utilization system and control method therefor
CN112416648A (en) Data verification method and device
CN113867730A (en) Method, device and equipment for determining target source code mapping file and storage medium
CN115455006A (en) Data processing method, data processing device, electronic device, and storage medium
US20220197901A1 (en) Ai model optimization method and apparatus
CN109815455A (en) Item file treating method and apparatus
EP4359932A1 (en) In-app failure intelligent data collection and analysis
CN113704120A (en) Data transmission method, device, equipment and storage medium

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