CN111414301B - Method and device for debugging application program - Google Patents

Method and device for debugging application program Download PDF

Info

Publication number
CN111414301B
CN111414301B CN201910012573.9A CN201910012573A CN111414301B CN 111414301 B CN111414301 B CN 111414301B CN 201910012573 A CN201910012573 A CN 201910012573A CN 111414301 B CN111414301 B CN 111414301B
Authority
CN
China
Prior art keywords
browser
source code
api
debugging
application program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910012573.9A
Other languages
Chinese (zh)
Other versions
CN111414301A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201910012573.9A priority Critical patent/CN111414301B/en
Publication of CN111414301A publication Critical patent/CN111414301A/en
Application granted granted Critical
Publication of CN111414301B publication Critical patent/CN111414301B/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/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a device for debugging an application program, relates to the technical field of computers, and can solve the problem that the conventional mobile phone debugging application needs to be carried out in respective platform development tools, so that the debugging operation is complicated. The method comprises the following steps: compiling and analyzing source codes to be debugged, so as to convert an Application Program Interface (API) in the source codes into an API applicable to a browser and obtain a global object; executing compiled source codes in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source codes belong; displaying the executed source codes in the browser so as to debug the executed source codes by using a debugging tool of the browser. The method is mainly suitable for the scene of debugging the mobile phone APP.

Description

Method and device for debugging application program
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for debugging an application program.
Background
Debugging is a process of debugging and debugging by various means after programming, and is a necessary program for ensuring that the provided equipment can normally operate. At present, mobile phone application debugging is required to be carried out in respective platform development tools. For example, after mobile phone applications under two systems (an iOS system and an Android system) with the same logic are developed by using ajax technology, the applications of the iOS system need to be debugged by using an xcode tool, the applications of the Android system need to be debugged by using a studio tool, and the debugging operation is complicated.
Disclosure of Invention
In view of this, the method and the device for debugging the application program provided by the invention can solve the problem that the conventional mobile phone debugging application needs to be performed in respective platform development tools, so that the debugging operation is complicated.
In a first aspect, the present invention provides a method of debugging an application, the method comprising:
compiling and analyzing source codes to be debugged, so as to convert an Application Program Interface (API) in the source codes into an API applicable to a browser and obtain a global object;
executing compiled source codes in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source codes belong;
displaying the executed source codes in the browser so as to debug the executed source codes by using a debugging tool of the browser.
Optionally, the method further comprises:
the code modified in the browser is synchronized to the pre-compiled source code with the same functionality.
Optionally, executing the compiled source code in the browser includes:
when a style is encountered in the process of executing the compiled source code in the browser, converting the encountered style in the compiled source code into a style suitable for the browser;
when encountering a Document Object Model (DOM) in the process of executing the compiled source code in the browser, converting the encountered DOM in the compiled source code into a DOM suitable for the browser;
when the action of acquiring the mobile terminal related information is encountered in the process of executing the compiled source codes in the browser, the mobile terminal related information is acquired from a server, and the server and the mobile terminal are in communication connection with each other, wherein the communication connection can acquire the mobile terminal related information.
Optionally, the method further comprises:
and generating a hypertext markup language (HTML) page comprising a page source code path, a converted API and a functional module required in the execution process of the browser for each page of the application program to be debugged, wherein the functional module comprises a style conversion module, a DOM conversion module and a mobile terminal related information acquisition module.
Optionally, based on the converted API, the global object, and the execution characteristics of the application program to which the source code belongs, executing the compiled source code in the browser includes:
after the browser acquires the selected HTML page generated for the application program to be debugged, injecting the global object into the browser;
creating an HTML page comprising execution characteristics of the application program;
loading compiled source codes under a page source code path contained in the selected HTML page in the created HMTL page;
and executing loaded codes in the browser based on the converted API, the functional module and the global object contained in the selected HTML page.
Optionally, the source code is a code with a dynamic interface design function;
and/or, the API comprises a JavaScript API.
In a second aspect, the present invention provides an apparatus for debugging an application, the apparatus comprising:
the compiling analysis unit is used for compiling and analyzing source codes to be debugged so as to convert an Application Program Interface (API) in the source codes into an API applicable to a browser and obtain a global object;
the execution unit is used for executing the compiled source codes in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source codes belong;
the display unit is used for displaying the executed source codes in the browser so as to debug the executed source codes by using a debugging tool of the browser.
Optionally, the apparatus further includes:
and the synchronization unit is used for synchronizing the codes modified in the browser to the source codes before compiling with the same function.
Optionally, the execution unit is configured to, when a style is encountered in the process of executing the compiled source code in the browser, convert the encountered style in the compiled source code into a style applicable to the browser; when encountering a Document Object Model (DOM) in the process of executing the compiled source code in the browser, converting the encountered DOM in the compiled source code into a DOM suitable for the browser; when the action of acquiring the mobile terminal related information is encountered in the process of executing the compiled source codes in the browser, the mobile terminal related information is acquired from a server, and the server and the mobile terminal are in communication connection with each other, wherein the communication connection can acquire the mobile terminal related information.
Optionally, the apparatus further includes:
the generation unit is used for generating a hypertext markup language (HTML) page comprising a page source code path, a converted API and a functional module required in the execution process of the browser for each page of the application program to be debugged, wherein the functional module comprises a style conversion module, a DOM conversion module and a mobile terminal related information acquisition module.
Optionally, the executing unit is configured to inject the global object into the browser after the browser obtains the selected HTML page generated for the application program to be debugged; creating an HTML page comprising execution characteristics of the application program; loading compiled source codes under a page source code path contained in the selected HTML page in the created HMTL page; and executing loaded codes in the browser based on the converted API, the functional module and the global object contained in the selected HTML page.
Optionally, the source code is a code with a dynamic interface design function;
and/or, the API comprises a JavaScript API.
In a third aspect, the present invention provides a storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform a method of debugging an application as described in the first aspect.
In a fourth aspect, the present invention provides an apparatus for debugging an application, the apparatus comprising a storage medium and a processor;
the processor is suitable for realizing each instruction;
the storage medium is suitable for storing a plurality of instructions;
the instructions are adapted to be loaded by the processor and to perform the method of debugging an application as described in the first aspect.
By means of the technical scheme, the method and the device for debugging the application program can compile and analyze the source code to be debugged firstly, so that an API (Application Programming Interface, application program interface) in the source code is converted into an API suitable for a browser, a global object is obtained, then the compiled source code is executed in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs, and finally the executed source code is displayed in the browser, so that a debugger can directly debug the executed source code by using a debugging tool of the browser. Therefore, the debugging method provided by the invention realizes that the source code under any mobile terminal operating system can be debugged in one browser without being debugged under respective development platforms, thereby simplifying the debugging steps.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow chart of a method for debugging an application provided by an embodiment of the present invention;
FIG. 2 illustrates a flow chart of another method of debugging an application provided by an embodiment of the present invention;
FIG. 3 illustrates a block diagram of an apparatus for debugging an application provided by an embodiment of the present invention;
FIG. 4 illustrates a block diagram of another apparatus for debugging an application provided by an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The embodiment of the invention provides a method for debugging an application program, as shown in fig. 1, the method mainly comprises the following steps:
101. compiling and analyzing source codes to be debugged, so as to convert the APIs in the source codes into APIs applicable to a browser and obtain global objects.
The developer will develop applications for different operating systems based on the same logic and then debug the applications using a browser on the computer, respectively. After the source code of an application program is obtained, the source code can be compiled and analyzed firstly, the API in the source code is converted into the API suitable for the browser, namely, the API suitable for the browser with the same function that can run in the browser is correspondingly created according to the meaning of the API in the source code, so that the API can be successfully called when the code is executed in the browser later, the specific function is realized, and the global object required by the source code after the subsequent compiling can be obtained in advance through analysis.
The source code is a code with a dynamic interface design function, and has functions which are not available in many existing browsers, such as touch zoom-in and zoom-out. Therefore, a developer is required to develop a unique API of the application program in advance, and when debugging is required, the API in the source code is converted into an API suitable for the browser according to the API developed in advance. For example, the code having the dynamic interface design function may be a code in an XML (Extensible Markup Language ) format written using ajax technology, and the code supported by the browser is a code in an HTML (HyperText Markup Language ) format, so that it is necessary to convert APIs in the XML code into APIs in the HTML format having the same function.
In addition, APIs related to dynamic design may be written by JavaScript, so the APIs include JavaScript APIs. The browser used in the embodiment of the invention can be a *** browser or other browsers.
102. And executing the compiled source code in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs.
And compiling the source codes in the process of analyzing the source codes to be debugged and converting the APIs in the source codes into APIs applicable to the browser, and executing the compiled source codes after compiling. However, the execution order of the mobile terminal application is different from the execution order of the computer browser, the mobile terminal application is executed periodically, and the computer browser is executed according to the code sequence, so that the browser is required to simulate the execution characteristics of the application. In addition, global objects need to be used in executing code, so before compiled source code is executed, global objects needed in the execution process need to be created. After the global object and the execution feature are obtained, the compiled source code can be executed in the browser based on the converted API, the global object and the execution feature of the application program to which the source code belongs.
103. Displaying the executed source codes in the browser so as to debug the executed source codes by using a debugging tool of the browser.
After compiling and executing the source code, the execution result can be displayed in the browser, and at the moment, a debugging person can debug the execution result by utilizing a debugging tool of the browser. For example, a debugger can look up a style written by a developer in an element tag of a Chrome browser debugging tool, can modify and debug in real time, can look up a DOM structure in the element tag, can modify and debug in real time, can see an API written by the developer in a source tag, and can modify and debug in real time.
When a special mobile terminal application program development platform is used for debugging codes, a series of breakpoints are required to be preset for normal debugging, and when the browser is used for debugging codes, the breakpoints can be added in the running process, so that the problem of positioning is facilitated.
According to the method for debugging the application program, provided by the embodiment of the invention, the source code to be debugged can be compiled and analyzed firstly, so that an API (Application Programming Interface, application program interface) in the source code is converted into an API suitable for a browser, a global object is obtained, then the compiled source code is executed in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs, and finally the executed source code is displayed in the browser, so that a debugger can directly debug the executed source code by using a debugging tool of the browser. Therefore, the debugging method provided by the invention realizes that the source code under any mobile terminal operating system can be debugged in one browser without being debugged under respective development platforms, thereby simplifying the debugging steps.
Further, according to the method shown in fig. 1, another embodiment of the present invention further provides a method for debugging an application program, as shown in fig. 2, where the method mainly includes:
201. compiling and analyzing source codes to be debugged, so as to convert the APIs in the source codes into APIs applicable to a browser and obtain global objects.
After the source codes of the application program to be debugged are obtained, the source codes of the application program to be debugged can be analyzed firstly, then the API in each page source code is converted into the API suitable for the browser, and then an HTML page comprising a page source code path, the converted API and the functional modules required in the execution process of the browser is generated for each page of the application program to be debugged, so that a debugger can select a page to be debugged from the generated HTML pages and open the page by the browser so as to carry out debugging operation in the browser later. The function module comprises a style conversion module, a DOM conversion module and a mobile terminal related information acquisition module (e.g. a mock module).
202. And executing the compiled source code in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs.
Specifically, after the browser obtains the selected HTML page generated for the application program to be debugged, a global object required by a subsequent execution code may be injected into the browser, and an HTML page including execution characteristics of the application program may be created; then loading compiled source codes under a page source code path contained in the selected HTML page in the created HMTL page; and finally, executing loaded codes in the browser based on the converted API, the functional module and the global object contained in the selected HTML page.
In order to make the display effect of the compiled source code in the browser the same as that in the mobile terminal, it is necessary to convert the code which is not applicable to the browser into the code which is applicable to the browser. Thus, the specific implementation manner of executing the compiled source code in the browser may be: when a style (such as layout, color, size, etc.) is encountered in the process of executing the compiled source code in the browser, converting the encountered style in the compiled source code into a style suitable for the browser; when encountering a Document Object Model (DOM) in the process of executing the compiled source code in the browser, converting the encountered DOM in the compiled source code into a DOM suitable for the browser; when the compiled source code is executed in the browser, the mobile terminal related information is acquired from a server, the server and the mobile terminal are in communication connection with each other, namely, when the mobile terminal related information acquiring action is executed, an information acquiring request can be sent to the server by using a mobile terminal related information acquiring module (for example, a mock module), and the server acquires related information from the connected mobile terminal according to the information acquiring request and feeds back to the mobile terminal related information acquiring module.
Wherein, the mobile terminal related information includes: identification code, system version, screen size, network status (e.g., 2G, 4G, wiFi), etc. The developer may need to read the information of the mobile terminal in the program developed by the developer, but because the information cannot be acquired in the browser, when the code for acquiring the information is encountered during running of the program in the browser, the embodiment of the invention acquires the corresponding information through the server.
203. Displaying the executed source codes in the browser so as to debug the executed source codes by using a debugging tool of the browser.
204. The code modified in the browser is synchronized to the pre-compiled source code with the same functionality.
Since the code which is finally required to be debugged and modified is the source code, and the code which is modified in the browser is not the source code, the source code is required to be correspondingly modified after the code is modified in the browser. The embodiment of the invention can provide the function of converting the codes in the browser and the source codes of various operating systems, so that the codes modified in the browser can be synchronized to the source codes with the same function, the debugging and modification of the source codes are realized, and the source codes can be modified without a long compiling and packaging process like the original development.
According to the method for debugging the application program, source codes to be debugged can be compiled and analyzed, APIs in the source codes are converted into APIs suitable for a browser, global objects are obtained, then the compiled source codes are executed in the browser based on the converted APIs, the global objects and execution characteristics of the application program to which the source codes belong, patterns and DOM encountered in the executing process are converted into patterns and DOM suitable for the browser, when relevant information of the mobile terminal is required to be acquired, relevant information of the mobile terminal is acquired from a server, so that the operation effect in the browser is the same as the operation effect in the mobile terminal, debugging personnel can utilize a debugging tool of the browser to directly debug the executed source codes, and the codes modified in the browser are synchronized to the source codes before compiling with the same function. Therefore, the debugging method provided by the invention not only can convert the source code of any mobile terminal operating system into the code suitable for the browser, and can debug the code in one browser, but also can synchronize the code debugged and modified in the browser to the source code, thereby realizing the automatic modification of the source code.
Further, according to the above embodiment of the method, another embodiment of the present invention further provides an apparatus for debugging an application, as shown in fig. 3, where the apparatus mainly includes:
the compiling analysis unit 31 is configured to compile and analyze source codes to be debugged, so as to convert an API of an application program interface in the source codes into an API applicable to a browser, and obtain a global object;
an execution unit 32, configured to execute the compiled source code in the browser based on the converted API, the global object, and the execution feature of the application program to which the source code belongs;
and the display unit 33 is configured to display the executed source code in the browser, so that the executed source code is debugged by using a debugging tool of the browser.
Optionally, as shown in fig. 4, the apparatus further includes:
and the synchronization unit 34 is used for synchronizing the code modified in the browser to the source code before compiling with the same function after the debugging tool of the browser is used for debugging the source code after execution.
Optionally, the executing unit 32 is configured to convert, when a style is encountered in the process of executing the compiled source code in the browser, the encountered style in the compiled source code into a style applicable to the browser; when encountering a Document Object Model (DOM) in the process of executing the compiled source code in the browser, converting the encountered DOM in the compiled source code into a DOM suitable for the browser; when the action of acquiring the mobile terminal related information is encountered in the process of executing the compiled source codes in the browser, the mobile terminal related information is acquired from a server, and the server and the mobile terminal are in communication connection with each other, wherein the communication connection can acquire the mobile terminal related information.
Optionally, as shown in fig. 4, the apparatus further includes:
the generating unit 35 is configured to generate, for each page of the application program to be debugged, a hypertext markup language HTML page including a page source code path, a converted API, and a functional module required in the execution process of the browser, where the functional module includes a style conversion module, a DOM conversion module, and a mobile terminal related information acquisition module.
Optionally, the executing unit 32 is configured to inject the global object into the browser after the browser obtains the selected HTML page generated for the application to be debugged; creating an HTML page comprising execution characteristics of the application program; loading compiled source codes under a page source code path contained in the selected HTML page in the created HMTL page; and executing loaded codes in the browser based on the converted API, the functional module and the global object contained in the selected HTML page.
Optionally, the source code is a code with a dynamic interface design function;
and/or, the API comprises a JavaScript API.
According to the device for debugging the application program, provided by the embodiment of the invention, the source code to be debugged can be compiled and analyzed firstly, so that the API in the source code is converted into the API suitable for the browser, the global object is obtained, then the compiled source code is executed in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs, and finally the executed source code is displayed in the browser, so that a debugger can directly debug the executed source code by using a debugging tool of the browser. Therefore, the debugging method provided by the invention realizes that the source code under any mobile terminal operating system can be debugged in one browser without being debugged under respective development platforms, thereby simplifying the debugging steps.
The device comprises a processor and a storage medium, wherein the compiling analysis unit, the execution unit, the display unit and the like are stored in the storage medium as program units, and the processor executes the program units stored in the storage medium to realize corresponding functions.
The processor comprises a kernel, and the kernel retrieves corresponding program units from the storage medium. The kernel may be provided with one or more kernel parameters to simplify the steps of debugging the program.
Further, according to the above embodiment, another embodiment of the present invention further provides a storage medium storing a plurality of instructions adapted to be loaded by a processor and to execute the method of debugging an application as described above.
The storage medium may include volatile memory, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The instructions stored in the storage medium provided by the embodiment of the invention can be compiled and analyzed firstly to convert the API in the source code into the API suitable for the browser, obtain the global object, execute the compiled source code in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs, and finally show the executed source code in the browser, so that a debugger can directly debug the executed source code by using a debugging tool of the browser. Therefore, the debugging method provided by the invention realizes that the source code under any mobile terminal operating system can be debugged in one browser without being debugged under respective development platforms, thereby simplifying the debugging steps.
Further, according to the above embodiment, another embodiment of the present invention further provides an apparatus for debugging an application, where the apparatus includes a storage medium and a processor;
the processor is suitable for realizing each instruction;
the storage medium is suitable for storing a plurality of instructions;
the instructions are adapted to be loaded by the processor and to perform the method of debugging an application as described above.
According to the device for debugging the application program, provided by the embodiment of the invention, the source code to be debugged can be compiled and analyzed firstly, so that the API in the source code is converted into the API suitable for the browser, the global object is obtained, then the compiled source code is executed in the browser based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs, and finally the executed source code is displayed in the browser, so that a debugger can directly debug the executed source code by using a debugging tool of the browser. Therefore, the debugging method provided by the invention realizes that the source code under any mobile terminal operating system can be debugged in one browser without being debugged under respective development platforms, thereby simplifying the debugging steps.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the methods and apparatus described above may be referenced to one another. In addition, the "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent the merits and merits of the embodiments.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functions of some or all of the components of methods and apparatus for debugging an application according to embodiments of the present invention may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present invention can also be implemented as an apparatus or device program (e.g., a computer program and a computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present invention may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names.

Claims (10)

1. A method of debugging an application, the method comprising:
compiling and analyzing source codes to be debugged, so as to convert an Application Program Interface (API) in the source codes into an API applicable to a browser and obtain a global object;
based on the converted API, the global object and the execution characteristics of the application program to which the source code belongs, executing the compiled source code in the browser comprises the following steps: after the browser acquires the selected HTML page generated for the application program to be debugged, injecting the global object into the browser; creating an HTML page comprising execution characteristics of the application program; loading compiled source codes under a page source code path contained in the selected HTML page in the created HMTL page; executing loaded codes in the browser based on the converted API, the function module and the global object contained in the selected HTML page, wherein the HTML page generated for the application program to be debugged is a hypertext markup language (HTML) page comprising a page source code path, the converted API and the function module required in the execution process of the browser, and the function module comprises a style conversion module, a DOM conversion module and a mobile terminal related information acquisition module;
displaying the executed source codes in the browser so as to debug the executed source codes by using a debugging tool of the browser.
2. The method according to claim 1, wherein the method further comprises:
the code modified in the browser is synchronized to the pre-compiled source code with the same functionality.
3. The method of claim 1 or 2, wherein executing compiled source code in the browser comprises:
when a style is encountered in the process of executing the compiled source code in the browser, converting the encountered style in the compiled source code into a style suitable for the browser;
when encountering a Document Object Model (DOM) in the process of executing the compiled source code in the browser, converting the encountered DOM in the compiled source code into a DOM suitable for the browser;
when the action of acquiring the mobile terminal related information is encountered in the process of executing the compiled source codes in the browser, the mobile terminal related information is acquired from a server, and the server and the mobile terminal are in communication connection with each other, wherein the communication connection can acquire the mobile terminal related information.
4. The method of any one of claims 1-2, wherein the source code is code having dynamic interface design functionality;
and/or, the API comprises a JavaScript API.
5. An apparatus for debugging an application, the apparatus comprising:
the compiling analysis unit is used for compiling and analyzing source codes to be debugged so as to convert an Application Program Interface (API) in the source codes into an API applicable to a browser and obtain a global object;
the execution unit is configured to execute the compiled source code in the browser based on the converted API, the global object, and the execution feature of the application program to which the source code belongs, and includes: after the browser acquires the selected HTML page generated for the application program to be debugged, injecting the global object into the browser; creating an HTML page comprising execution characteristics of the application program; loading compiled source codes under a page source code path contained in the selected HTML page in the created HMTL page; executing loaded codes in the browser based on the converted API, the function module and the global object contained in the selected HTML page, wherein the HTML page generated for the application program to be debugged is a hypertext markup language (HTML) page comprising a page source code path, the converted API and the function module required in the execution process of the browser, and the function module comprises a style conversion module, a DOM conversion module and a mobile terminal related information acquisition module;
the display unit is used for displaying the executed source codes in the browser so as to debug the executed source codes by using a debugging tool of the browser.
6. The apparatus of claim 5, wherein the apparatus further comprises:
and the synchronization unit is used for synchronizing the codes modified in the browser to the source codes before compiling with the same function.
7. The apparatus according to claim 5 or 6, wherein the execution unit is configured to, when a style is encountered in executing the compiled source code in the browser, convert the style in the encountered compiled source code into a style suitable for the browser; when encountering a Document Object Model (DOM) in the process of executing the compiled source code in the browser, converting the encountered DOM in the compiled source code into a DOM suitable for the browser; when the action of acquiring the mobile terminal related information is encountered in the process of executing the compiled source codes in the browser, the mobile terminal related information is acquired from a server, and the server and the mobile terminal are in communication connection with each other, wherein the communication connection can acquire the mobile terminal related information.
8. The apparatus of any one of claims 5-6, wherein the source code is code having dynamic interface design functionality;
and/or, the API comprises a JavaScript API.
9. A storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform a method of debugging an application as claimed in any one of claims 1 to 4.
10. An apparatus for debugging an application, the apparatus comprising a storage medium and a processor;
the processor is suitable for realizing each instruction;
the storage medium is suitable for storing a plurality of instructions;
the instructions being adapted to be loaded by the processor and to perform the method of debugging an application as claimed in any one of claims 1 to 4.
CN201910012573.9A 2019-01-07 2019-01-07 Method and device for debugging application program Active CN111414301B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910012573.9A CN111414301B (en) 2019-01-07 2019-01-07 Method and device for debugging application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910012573.9A CN111414301B (en) 2019-01-07 2019-01-07 Method and device for debugging application program

Publications (2)

Publication Number Publication Date
CN111414301A CN111414301A (en) 2020-07-14
CN111414301B true CN111414301B (en) 2023-06-20

Family

ID=71490696

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910012573.9A Active CN111414301B (en) 2019-01-07 2019-01-07 Method and device for debugging application program

Country Status (1)

Country Link
CN (1) CN111414301B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7873872B1 (en) * 2001-07-10 2011-01-18 Versata Development Group, Inc. System and method for remotely debugging application programs
WO2012019639A1 (en) * 2010-08-10 2012-02-16 International Business Machines Corporation A method and system to automatically testing a web application
CN108647028A (en) * 2018-05-09 2018-10-12 广州腾讯科技有限公司 Application information processing method and device
CN109032917A (en) * 2017-06-09 2018-12-18 北京金山云网络技术有限公司 Page adjustment method and system, mobile terminal and computer end
CN109144856A (en) * 2018-07-27 2019-01-04 北京皮尔布莱尼软件有限公司 A kind of UI automated testing method calculates equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7873872B1 (en) * 2001-07-10 2011-01-18 Versata Development Group, Inc. System and method for remotely debugging application programs
WO2012019639A1 (en) * 2010-08-10 2012-02-16 International Business Machines Corporation A method and system to automatically testing a web application
CN109032917A (en) * 2017-06-09 2018-12-18 北京金山云网络技术有限公司 Page adjustment method and system, mobile terminal and computer end
CN108647028A (en) * 2018-05-09 2018-10-12 广州腾讯科技有限公司 Application information processing method and device
CN109144856A (en) * 2018-07-27 2019-01-04 北京皮尔布莱尼软件有限公司 A kind of UI automated testing method calculates equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈晓江 ; 董浩 ; 房鼎益 ; 王怀军 ; 张凡 ; .基于反调试的JavaScript代码保护方法研究!.四川大学学报(工程科学版).2015,(01),全文. *

Also Published As

Publication number Publication date
CN111414301A (en) 2020-07-14

Similar Documents

Publication Publication Date Title
CN110134386B (en) Program editing method and device
US9182953B2 (en) Hybrid dynamic code compiling device, method, and service system thereof
CN112270149B (en) Verification platform automatic integration method and system, electronic equipment and storage medium
US20080127113A1 (en) Method and system for implementing watchpoints
CN108920496B (en) Rendering method and device
CN106021257A (en) Method, device, and system for crawler to capture data supporting online programming
CN107015903B (en) Interface test program generation method and device and electronic equipment
CN103049371A (en) Testing method and testing device of Android application programs
CN106776338B (en) Test method, test device and server
CN109857663B (en) Keyword driving and image similarity combined automatic test platform
CN112083920A (en) Front-end page design method, device, storage medium and equipment
CN102262684A (en) Method and device for generating webpage page of mobile terminal
Stocco et al. PESTO: A tool for migrating DOM-based to visual web tests
Walkinshaw et al. Using compression algorithms to support the comprehension of program traces
CN105224465B (en) Webpage adjustment method and device
CN109684192A (en) Local test method, equipment, storage medium and device based on data processing
CN102722438A (en) Kernel debugging method and equipment
CN111078217A (en) Brain graph generation method, apparatus and computer-readable storage medium
CN104317580A (en) Integrated development environment for virtual test application (APP)
CN111367512B (en) Method and device for creating Android library module dependency relationship in application development
CN111414301B (en) Method and device for debugging application program
CN111158665B (en) Code generation method and device, electronic equipment and storage medium
CN111736812A (en) Document code execution method and device, computer equipment and storage medium
CN113641594B (en) Cross-terminal automatic testing method and related device
CN111488152B (en) Application program page previewing method, related device and system

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
GR01 Patent grant
GR01 Patent grant