Program debugging method and device, electronic equipment and storage medium

By setting the category interface and setting the content interface to identify and obtain the debug parameter set, the inefficiency of program debugging in the existing technology in diverse scenarios is solved, and compatibility and efficient debugging of multiple debugging scenarios are achieved.

CN119669036APending Publication Date: 2025-03-21INST OF SOFTWARE - CHINESE ACAD OF SCI
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411447697.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

The existing program debugging scheme is inefficient in diverse debugging scenarios. The preset language local debugging and debugging type is single, which does not meet the diverse debugging needs. Multi-plugin switching debugging requires additional user operations, which has a lot of data redundancy and cumbersome operation.

Method used

Obtain the debug mode category by setting the category interface and identify different debugging scenarios; obtain the debug parameter set based on the setting content interface and debugging mode category, obtain the debug parameter set in a specific debugging scenario, and then debug the programs to be debugged in different scenarios.

Benefits of technology

It achieves compatibility with many different debugging scenarios, improves the efficiency of program debugging in multiple scenarios, simplifies user operations and page occupation, and improves program debugging efficiency in diverse debugging scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669036A_ABST
    Figure CN119669036A_ABST
Patent Text Reader

Abstract

The invention provides a program debugging method and device, electronic equipment and a storage medium, relates to the technical field of computers, and realizes identification of different debugging scenes by setting a category interface to obtain a debugging mode category. The debugging parameter set is acquired according to the set content interface and the debugging mode category, so that the debugging parameter set in a specific debugging scene is acquired, and the to-be-debugged program in different scenes is debugged. According to the method and the device, compatibility of various different debugging scenes is realized according to the set content interface and the set category interface, and the efficiency of program debugging under multiple scenes is improved. And user operation and page occupation are simplified by setting a category interface and a content interface. Program debugging is carried out according to the debugging category and the debugging parameter set, and the program debugging efficiency under diversified debugging scenes is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a program debugging method, device, electronic equipment and storage medium. Background Art

[0002] In existing integrated development environments, debugging functions are usually only supported for a single language or a single platform. The existing program debugging solutions are as follows. 1. Preset language local debugging: In some integrated development environments (IDEs), the supported languages ​​will be locked. At this time, users only need to fill in the environment directory to debug according to the predetermined debugging solution. The operation is very simple and convenient. 2. Multi-plugin switching debugging: In order to be compatible with more languages, users will be allowed to install multiple plug-ins to adapt to different languages ​​and their debugging needs. This method usually involves dozens of plug-ins to meet user needs together, thereby providing more diverse debugging services.

[0003] The debugging type of the preset language local debugging is single and does not meet the diverse debugging needs. Multiple plug-in switching debugging requires additional user operations, there is a lot of data redundancy, and the operation is cumbersome.

[0004] In summary, existing program debugging is inefficient in various debugging scenarios. Summary of the invention

[0005] The present invention provides a program debugging method, device, electronic device and storage medium, which are used to solve the defect of low efficiency of program debugging in various debugging scenarios in the prior art, and improve the program debugging efficiency in various debugging scenarios.

[0006] The present invention provides a program debugging method, comprising the following steps: obtaining the debugging category of a program to be debugged based on a setting category interface, the debugging category including a debugging mode category, a virtual machine use category and a debugging language category; obtaining a debugging parameter set of the program to be debugged from a setting content interface based on the debugging category, the debugging parameter set including a file location parameter, a debugger location parameter and a debugging configuration constant of the program to be debugged; setting the category interface and the setting content interface as a preset configuration interface; the file location parameter including an executable file location parameter or a source file location parameter; the debugger location parameter is used to obtain a debugger or a debugger server; and debugging the program to be debugged based on the debugging category and the debugging parameter set.

[0007] According to the program debugging method provided by the present invention, a program to be debugged is debugged based on a debugging category and a debugging parameter set, including: when the debugging mode category is local debugging, the virtual machine use category is using a virtual machine, and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes a virtual machine position parameter and a virtual machine debugging command, the virtual machine position parameter includes a virtual machine installation directory and a virtual machine name, the file position parameter includes an executable file position parameter, the executable file position parameter is used to obtain the executable file, and the running command of the virtual machine debugging mode is determined based on the virtual machine position parameter, the executable file position parameter and the virtual machine debugging command to run the executable file; the configuration information of the startup launch configuration file of the workspace corresponding to the program to be debugged is set to a debugging configuration constant to obtain a preset launch configuration file, and a debugging session of the debugger is started based on the preset launch configuration file to debug based on the running result of the executable file.

[0008] According to the program debugging method provided by the present invention, a program to be debugged is debugged based on a debugging category and a debugging parameter set, including: when the debugging mode category is local debugging, and the debugging language category is a language category that does not need to be compiled and run before debugging, the file location parameter includes a source file location parameter, and the source file location parameter is used to obtain the source file, and the configuration information of the startup launch configuration file of the workspace corresponding to the program to be debugged is set to the debugging configuration constant to obtain a preset launch configuration file, and a debugging session of the debugger is started based on the preset launch configuration file to debug based on the source file.

[0009] According to the program debugging method provided by the present invention, the debugging parameter set also includes a debugging port, and the program to be debugged is debugged based on the debugging category and the debugging parameter set, including: when the debugging mode is remote debugging, and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, the file location parameter includes an executable file location parameter, the executable file location parameter is used to obtain the executable file, the executable file is sent to the target hardware of the remote hardware IP based on the secure shell protocol SSH, so as to run the executable file based on the target hardware, and the startup port of the debugger server corresponding to the target hardware is determined based on the debugging port, so as to transmit the debugging result to the local workspace corresponding to the program to be debugged; the configuration information of the startup launch configuration file of the workspace is set to the debugging configuration constant to obtain a preset launch configuration file, and the debugging session of the debugger server is started based on the preset launch configuration file to debug based on the running result of the executable file.

[0010] According to the program debugging method provided by the present invention, the debugging parameter set also includes a debugging port, and debugging the program to be debugged is performed based on the debugging category and the debugging parameter set, including: when the debugging mode is remote debugging, and the debugging language category is a language category that does not need to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, the file location parameter includes a source file location parameter, the source file location parameter is used to obtain the source file, and the source file is sent to the target hardware of the remote hardware IP based on SSH to run the source file based on the target hardware, and the startup port of the debugger server corresponding to the target hardware is determined based on the debugging port to transmit the debugging result to the local workspace corresponding to the program to be debugged; the configuration information of the startup launch configuration file of the workspace is set to the debugging configuration constant to obtain a preset launch configuration file, and the debugging session of the debugger server is started based on the preset launch configuration file to debug based on the running result of the source file.

[0011] According to the program debugging method provided by the present invention, the debugging configuration constants are determined based on the following steps: determining the debugger type based on the debugging language category; determining the path of the program to be debugged based on the executable file location parameter or the source file location parameter; determining the debugging configuration constants based on the debugger type, the path of the program to be debugged, the debugging request mode, the debugging configuration name, the debugger installation directory and the working directory.

[0012] According to the program debugging method provided by the present invention, the debugging language category is determined based on the following steps: obtaining the language type data of the program to be debugged based on the language category in the setting category interface; if there are uppercase letters in the language type data, converting the uppercase letters into lowercase letters to obtain the converted language type data; assigning values ​​to the converted language type data to obtain the debugging language category.

[0013] The present invention also provides a program debugging device, including: a debugging category determination module, used to obtain the debugging category of the program to be debugged based on a setting category interface, the debugging category includes a debugging mode category, a virtual machine usage category and a debugging language category; a debugging parameter set determination module, used to obtain the debugging parameter set of the program to be debugged from a setting content interface based on the debugging category, the debugging parameter set includes the file location parameter, debugger location parameter and debugging configuration constant of the program to be debugged; the setting category interface and the setting content interface are preset configuration interfaces; the file location parameter includes an executable file location parameter or a source file location parameter; the debugger location parameter is used to obtain a debugger or a debugger server; a debugging module, used to debug the program to be debugged based on the debugging category and the debugging parameter set.

[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned program debugging methods when executing the computer program.

[0015] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned program debugging methods is implemented.

[0016] The program debugging method, device, electronic device and storage medium provided by the present invention obtain the debugging mode category by setting the category interface, thereby realizing the identification of different debugging scenarios. The debugging parameter set is obtained according to the setting content interface and the debugging mode category, thereby realizing the acquisition of the debugging parameter set in a specific debugging scenario, and then debugging the program to be debugged in different scenarios. The present invention realizes compatibility with a variety of different debugging scenarios according to the setting content interface and the setting category interface, thereby improving the efficiency of program debugging in multiple scenarios. The user operation and page occupancy are simplified by setting the category interface and the setting content interface. The present invention debugs the program according to the debugging category and the debugging parameter set, thereby improving the program debugging efficiency in various debugging scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 This is one of the flow charts of the program debugging method provided by the present invention.

[0019] Figure 2 It is a schematic diagram of a flow chart of determining a configuration file provided by the present invention.

[0020] Figure 3 It is a schematic diagram of a flow chart for determining a debugging category provided by the present invention.

[0021] Figure 4 This is the second flow chart of the program debugging method provided by the present invention.

[0022] Figure 5 This is the third flow chart of the program debugging method provided by the present invention.

[0023] Figure 6 This is the fourth flow chart of the program debugging method provided by the present invention.

[0024] Figure 7 This is the fifth flow chart of the program debugging method provided by the present invention.

[0025] Figure 8 It is a structural schematic diagram of the program debugging device provided by the present invention.

[0026] Fig. 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] Combine the following Figure 1-Figure 9 The program debugging method, device and electronic device of the present invention are described.

[0029] Figure 1 It is one of the flowcharts of the program debugging method provided by the present invention, such as Figure 1 As shown, the program debugging method includes steps S100 to S300, and each step is specifically as follows.

[0030] S100: Obtaining a debugging category of a program to be debugged based on a setting category interface, where the debugging category includes a debugging mode category, a virtual machine usage category, and a debugging language category.

[0031] The debugging language category is determined based on the following steps: based on the language category in the setting category interface, the language type data of the program to be debugged is obtained; if there are uppercase letters in the language type data, the uppercase letters are converted to lowercase letters to obtain the converted language type data; and values ​​are assigned to the converted language type data to obtain the debugging language category.

[0032] like Figure 2 As shown, first, build a user setting interface (setting module) to provide a preset configuration interface. The preset configuration interface includes a setting category interface and a setting content interface. The setting category interface includes debugging module options, debugging language categories, and virtual machine names. The preset content interface includes toolchain executable file directory, debugger installation directory, debugger name, compiler custom commands, debugging port, virtual machine debugging commands, remote hardware IP, executable file storage directory, virtual machine custom commands, virtual machine installation directory, and middleware commands. Users edit the preset configuration interface (including setting category interface and setting content interface) according to their own development needs. Save the preset configuration interface and assign the set content to the corresponding parameters to generate a setting configuration (setting.json) file.

[0033] The debug module option is used to obtain the debug mode category of the program to be debugged, for example, local debugging and remote debugging. The virtual machine name is used to obtain the virtual machine usage category of the program to be debugged. If the virtual machine name is not empty, the virtual machine is used by default; if the virtual machine name is empty, the virtual machine is not used by default.

[0034] The language category is used to obtain the debugging language category of the program to be debugged, for example, C language, C++ language, Java, JavaScript, Python, etc. Obtain the language type data of the program to be debugged according to the language category. Traverse each character in the language type data and check whether it is an uppercase letter. If the character is an uppercase letter, convert it to the corresponding lowercase letter. If the character is not an uppercase letter, it remains unchanged. According to the above steps, the converted language type data is obtained. Assign a value to the converted language type data, and obtain the debugging language type according to the assignment result of the language type data.

[0035] The present invention obtains the debugging language type by assigning values ​​to the language type data of lowercase letters, thereby improving the accuracy and efficiency of obtaining the debugging language type.

[0036] Check whether there is an active text editor (the editor window of the text file that the user is currently viewing or editing). If so, get the folder of the workspace where the currently active text editor is located, the file name of the currently open file, and output the file name to the console so that the source file location parameters and executable file location parameters can be obtained later. The program corresponding to the currently active text editor is the program to be debugged.

[0037] S200: Acquire a debugging parameter set of the program to be debugged from a setting content interface based on the debugging category.

[0038] The debugging parameter set includes file location parameters, debugger location parameters and debugging configuration constants of the program to be debugged; the setting category interface and the setting content interface are preset configuration interfaces; the file location parameters include executable file location parameters or source file location parameters; the debugger location parameters are used to obtain a debugger or a debugger server.

[0039] like Figure 3 As shown, after the user sets and saves the setting.json file, click the debug code command, for example, the fifth-generation reduced instruction set computer (RISC-V) debug code command, to obtain the setting.json file. The modulation mode category of the program to be debugged is obtained according to the preset configuration interface of the setting.json file.

[0040] If the debugging mode category is local debugging, obtain the virtual machine installation directory and virtual machine name of the program to be debugged. Determine whether the virtual machine is used based on the virtual machine name. If the virtual machine is used (the virtual machine name is not empty), register the virtual machine location parameter (absolute virtual machine location) based on the virtual machine installation directory and virtual machine name. For example, the virtual machine location parameter is "${virtual machine installation directory} / ${virtual machine name}". Obtain the executable file storage directory of the program to be debugged. Register the executable file location parameter (absolute executable file location) based on the current file name and executable file storage directory. For example, the executable file location parameter is "${executable file storage directory} / ${file name}". In local debugging, the remote hardware IP is empty.

[0041] If the modulation mode category is remote debugging, obtain the remote hardware IP of the program to be debugged. Obtain the executable file storage directory of the program to be debugged. Register the executable file location parameter (executable file absolute location) according to the current file name and executable file storage directory.

[0042] Then, the debugging language category of the program to be debugged is obtained. If the debugging language category is a language category that needs to be compiled and run before debugging, the executable file position parameter of the program to be debugged is obtained to obtain the executable file for debugging. If the debugging language category is a language category that does not need to be compiled and run before debugging, the source file position parameter of the program to be debugged is directly obtained according to the file name to obtain the source file for debugging.

[0043] like Figure 4 As shown, the debugger installation directory and debugger name are obtained to construct the debugger position parameter. For example, a GNU debugger path variable is declared according to the debugger installation directory and debugger name to obtain the debugger position parameter. The debugger position parameter is used to obtain the debugger or debugger server.

[0044] Further, the debugging configuration constants are determined based on the following steps: determining the debugger type based on the debugging language category; determining the path of the program to be debugged based on the executable file location parameter or the source file location parameter; determining the debugging configuration constants based on the debugger type, the path of the program to be debugged, the debugging request mode, the debugging configuration name, the debugger installation directory and the working directory.

[0045] like Figure 4As shown, the debug configuration constants are declared. The debug configuration constants are text data in JavaScript Object Notation (JSON), including debugger type, program path to be debugged, debug request method, debug configuration name, debugger installation directory and working directory, etc. The debugger type that needs to be stored is determined by the debug language category. The debug request method is set to launch, which is used to be compatible with the debugging rules of third-party plug-ins. The debug configuration name is named RISC-V debug. If the debug language category is a language category that needs to be compiled and run before debugging, the executable file location parameter is set to the program path to be debugged. If the debug language category is a language category that does not need to be compiled and run before debugging, the source file location parameter is set to the program path to be debugged. Get the directory of the currently opened file name and set the directory of the currently opened file name as the working directory. Get the debugger installation directory.

[0046] Furthermore, for C language or C++ language, the debug configuration constant also includes the debugger server address. For local debugging, the debug port of the program to be debugged is obtained, and the debugger server address is set according to the local IP and the debug port. For remote debugging, the debug server address is set according to the debug port and the address of the remote debug server. If the debug port is empty, the debugger server address is not set.

[0047] Optionally, for Java, JavaScript or Python, obtain the debugging port of the program to be debugged, and set the debugging port as the port parameter of the debugger server. If the debugging port is empty, the debugger server is not set.

[0048] S300: Debugging the program to be debugged based on the debugging category and the debugging parameter set.

[0049] Read the launch configuration file in the current workspace corresponding to the program to be debugged. If the debug configuration name of the launch configuration file contains RISC-V debug, it means that there are original debug configuration constants in the launch configuration file. Replace the original debug configuration constants with the latest debug configuration constants to obtain the preset launch configuration file. If the debug configuration name of the launch configuration file does not contain RISC-V debug, it means that there are no debug configuration constants in the launch configuration file. Then directly add the latest debug configuration constants to the launch configuration file to obtain the preset launch configuration file.

[0050] Start the debugging session of the debugger according to the preset launch configuration file to debug the program to be debugged.

[0051] like Figure 5As shown in the figure, generate a configuration file, invoke the debug menu bar, start the terminal process in the background, select the command format according to the debugger type, select the debug startup process according to the debug request method, generate a connection address through the debug port, obtain the debugger installation directory and working directory to prevent environment conflicts. Generate debug commands according to the preset launch configuration file and run the debug commands. Jump to the debug mode interaction page. When the user clicks the relevant icon in the user interface, the debug command is passed to the terminal and the output is obtained and passed back to the interaction page. After debugging is completed, the debugging ends.

[0052] The program debugging method provided by the embodiment of the present invention obtains the debugging mode category by setting the category interface, thereby realizing the identification of different debugging scenarios. The debugging parameter set is obtained according to the setting content interface and the debugging mode category, thereby realizing the acquisition of the debugging parameter set under a specific debugging scenario, and then debugging the program to be debugged under different scenarios. The present invention realizes compatibility with a variety of different debugging scenarios according to the setting content interface and the setting category interface, thereby improving the efficiency of program debugging under multiple scenarios. The user operation and page occupancy are simplified by setting the category interface and the setting content interface. The present invention debugs the program according to the debugging category and the debugging parameter set, thereby improving the efficiency of program debugging under various debugging scenarios.

[0053] Based on the above embodiment, debugging the program to be debugged is performed based on the debugging category and the debugging parameter set, including steps S310 to S320, and each step is specifically as follows.

[0054] S310: When the debugging mode category is local debugging, the virtual machine usage category is using a virtual machine, and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes virtual machine location parameters and virtual machine debugging commands. The virtual machine location parameters include the virtual machine installation directory and the virtual machine name. The file location parameters include executable file location parameters. The executable file location parameters are used to obtain the executable file. Based on the virtual machine location parameters, the executable file location parameters and the virtual machine debugging command, the running command of the virtual machine debugging mode is determined to run the executable file.

[0055] S320: Setting the configuration information of the launch configuration file of the workspace corresponding to the program to be debugged as the debugging configuration constant, obtaining a preset launch configuration file, and starting a debugging session of the debugger based on the preset launch configuration file to debug based on the running result of the executable file.

[0056] like Figure 4As shown, for example, when the debugging mode category is local debugging, the virtual machine usage category is using a virtual machine, and the debugging language category is C language or C++ language (a language category that needs to be compiled and run before debugging), the running command of the virtual machine debugging mode is determined based on the virtual machine position parameter, the executable file position parameter, and the virtual machine debugging command. A new terminal window is created in the window function of the console, and the running command of the virtual machine debugging mode is run to run the executable file and output the running results to the terminal window. Optionally, if the virtual machine position parameter is empty (or the virtual machine name is empty), it means that the virtual machine is not used, and no new terminal window is created.

[0057] Furthermore, if the debugging mode category is local debugging, the virtual machine usage category is using a virtual machine, and the debugging language category is java. Then obtain the tool chain execution file directory and virtual machine debugging command of the program to be debugged, and construct the running command (java command) of the virtual machine debugging mode according to the virtual machine position parameter, tool chain execution file directory, virtual machine debugging command and executable file position parameter. This is because, due to the characteristics of the Java language, a java command is required to run regardless of whether there is a virtual machine. In essence, it is to call a virtual machine named Java Virtual Machine (JVM), so when there is a virtual machine, the java command needs to be set in the virtual machine debugging command, and when the virtual machine is not used, the virtual machine name is JVM. Create a new terminal window in the window function, run the running command of the virtual machine debugging mode to run the executable file, and output the running results to the terminal window. Optionally, if the virtual machine position parameter is empty (or the virtual machine name is empty), it means that the virtual machine is not used, and no new terminal window is created.

[0058] Optionally, get the middleware command of the program to be debugged. If the middleware command is not empty, create a new terminal window in the window function of the console to run the middleware command and output the result. If the middleware command is empty, no new terminal window is created.

[0059] Get debugger position parameters and debug configuration constants. Set the configuration information of the launch configuration file of the workspace corresponding to the program to be debugged to the debug configuration constants, obtain the preset launch configuration file, and start the debug session based on the preset launch configuration file. Debug the program to be debugged according to the running command of the virtual machine debug mode, the middleware command and the started debug session.

[0060] The present invention realizes partial cross-platform program debugging according to the language category that needs to be compiled when the virtual machine runs, thereby enriching the program debugging scenarios.

[0061] Based on the above embodiment, debugging the program to be debugged based on the debugging category and the debugging parameter set includes step S330.

[0062] S330: When the debugging mode category is local debugging and the debugging language category is a language category that does not require compilation and running before debugging, the file location parameters include source file location parameters, and the source file location parameters are used to obtain the source file, set the configuration information of the startup launch configuration file of the workspace corresponding to the program to be debugged to the debugging configuration constant, obtain the preset launch configuration file, and start the debugging session of the debugger based on the preset launch configuration file to debug based on the source file.

[0063] like Figure 6 As shown in the figure, when the debugging mode category is local debugging and the debugging language category is a language category that does not need to be compiled and run before debugging, for example, javascript or python, the source file location parameter of the program to be debugged is directly obtained as the path of the program to be debugged. This is because the code function of javascript can be displayed through the interpreter, so there is no need for a compilation process, and there is no compiled executable file. Only the debugging source file location parameter is needed for debugging.

[0064] Get the debugger position parameters and debug configuration constants of the program to be debugged to get the preset launch configuration file, and start the debugging session based on the preset launch configuration file. Call the source file position parameters to get the source file. Debug according to the source file.

[0065] The present invention directly calls source file position parameters for language categories that do not require compilation, thereby enriching the application scenarios of program debugging.

[0066] Based on the above embodiment, the debugging parameter set also includes a debugging port, and debugging the program to be debugged is performed based on the debugging category and the debugging parameter set, including steps S340 to S350, and each step is specifically as follows.

[0067] S340: When the debugging mode is remote debugging and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, and the file location parameters include executable file location parameters. The executable file location parameters are used to obtain the executable file, and send the executable file to the target hardware of the remote hardware IP based on the secure shell protocol SSH to run the executable file based on the target hardware. The startup port of the debugger server corresponding to the target hardware is determined based on the debugging port to transmit the debugging result to the local workspace corresponding to the program to be debugged.

[0068] S350: Setting the configuration information of the launch configuration file of the workspace as the debugging configuration constant, obtaining a preset launch configuration file, and starting a debugging session of the debugger server based on the preset launch configuration file to debug based on the running result of the executable file.

[0069] like Figure 7 As shown, when the debugging mode is remote debugging, the debugging language category is a language category that needs to be compiled and run before debugging, such as C language, C++ language or Java, and the remote hardware IP of the program to be debugged is read. Use the Secure Shell (SSH) protocol to connect to the remote hardware IP and obtain remote control rights. Use the file transfer function of SSH to send the executable file to the target hardware of the remote hardware IP, and run the executable file through the target hardware. Get the debugging port of the program to be debugged, and inject the command of the debugger server to start at the port indicated by the debugging port into the command line of the target hardware to determine that the startup port of the debugger server corresponding to the target hardware is the port corresponding to the debugging port, so as to transmit the debugging results to the local workspace. Start the debugger server.

[0070] Get the debugger position parameters and debug configuration constants to get the preset launch configuration file, and start the debug session based on the preset launch configuration file. Debug according to the running results of the executable file. At this time, the debug configuration constants include the remote hardware IP.

[0071] The present invention controls remote hardware through SSH, thereby realizing remote program control and enriching the application scenarios of program control. For language categories that need to be compiled and run before debugging, program debugging is realized by running executable files. The present invention realizes cross-platform program debugging through remote hardware IP.

[0072] Based on the above embodiment, the debugging parameter set also includes a debugging port, and debugging the program to be debugged is performed based on the debugging category and the debugging parameter set, including steps S360 to S370, and each step is specifically as follows.

[0073] S360: When the debugging mode is remote debugging and the debugging language category is a language category that does not need to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, and the file location parameters include source file location parameters. The source file location parameters are used to obtain the source file, send the source file to the target hardware of the remote hardware IP based on SSH, run the source file based on the target hardware, determine the startup port of the debugger server corresponding to the target hardware based on the debugging port, and transmit the debugging result to the local workspace corresponding to the program to be debugged.

[0074] S370: Setting the configuration information of the launch configuration file of the workspace as the debugging configuration constant, obtaining a preset launch configuration file, and starting a debugging session of the debugger server based on the preset launch configuration file to debug based on the running result of the source file.

[0075] like Figure 7 As shown, when the debugging mode is remote debugging, the debugging language category is a language category that does not need to be compiled and run before debugging, such as javascript or python, and the remote hardware IP of the program to be debugged is read. Use the Secure Shell (SSH) protocol to connect to the remote hardware IP and obtain remote control. Use the file transfer function of SSH to send the source file to the target hardware of the remote hardware IP, and run the source file through the target hardware. Get the debugging port of the program to be debugged, and inject the command of the debugger server to start at the port indicated by the debugging port into the command line of the target hardware to determine that the startup port of the debugger server corresponding to the target hardware is the port corresponding to the debugging port, so as to transmit the debugging results to the local workspace. Start the debugging server.

[0076] Get the debugger position parameters and debug configuration constants to get the preset launch configuration file, and start the debug session based on the preset launch configuration file. Debug according to the running results of the source file. At this time, the debug configuration constants include the remote hardware IP.

[0077] The present invention controls remote hardware through SSH, thereby realizing remote program control and enriching the application scenarios of program control. For language categories that do not need to be compiled and run before debugging, program debugging is realized by running source files.

[0078] The program debugging device provided by the present invention is described below. The program debugging device described below and the program debugging method described above can be referenced to each other.

[0079] like Figure 8 As shown, a program debugging device includes: a debugging category determination module 801, which is used to obtain the debugging category of the program to be debugged based on a setting category interface, and the debugging category includes a debugging mode category, a virtual machine usage category and a debugging language category.

[0080] The debugging parameter set determination module 802 is used to obtain the debugging parameter set of the program to be debugged from the setting content interface based on the debugging category, and the debugging parameter set includes the file location parameter, debugger location parameter and debugging configuration constant of the program to be debugged; the setting category interface and the setting content interface are preset configuration interfaces; the file location parameter includes the executable file location parameter or the source file location parameter; the debugger location parameter is used to obtain a debugger or a debugger server.

[0081] The debugging module 803 is used to debug the program to be debugged based on the debugging category and the debugging parameter set.

[0082] The program debugging device provided by the embodiment of the present invention obtains the debugging mode category by setting the category interface, thereby realizing the identification of different debugging scenarios. The debugging parameter set is obtained according to the setting content interface and the debugging mode category, thereby realizing the acquisition of the debugging parameter set under a specific debugging scenario, and then debugging the program to be debugged under different scenarios. The present invention realizes compatibility with a variety of different debugging scenarios according to the setting content interface and the setting category interface, thereby improving the efficiency of program debugging under multiple scenarios. The user operation and page occupancy are simplified by setting the category interface and the setting content interface. The present invention debugs the program according to the debugging category and the debugging parameter set, thereby improving the efficiency of program debugging under various debugging scenarios.

[0083] In one embodiment, the debugging module 803 is used for: when the debugging mode category is local debugging, the virtual machine usage category is using a virtual machine, and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes a virtual machine location parameter and a virtual machine debugging command, the virtual machine location parameter includes a virtual machine installation directory and a virtual machine name, the file location parameter includes an executable file location parameter, the executable file location parameter is used to obtain the executable file, and the running command of the virtual machine debugging mode is determined based on the virtual machine location parameter, the executable file location parameter and the virtual machine debugging command to run the executable file; the configuration information of the startup launch configuration file of the workspace corresponding to the program to be debugged is set to the debugging configuration constant to obtain a preset launch configuration file, and the debugging session of the debugger is started based on the preset launch configuration file to debug based on the running result of the executable file.

[0084] In one embodiment, the debugging module 803 is used for: when the debugging mode category is local debugging, and the debugging language category is a language category that does not need to be compiled and run before debugging, the file location parameter includes a source file location parameter, and the source file location parameter is used to obtain the source file, set the configuration information of the startup launch configuration file of the workspace corresponding to the program to be debugged to the debugging configuration constant, obtain the preset launch configuration file, and start the debugging session of the debugger based on the preset launch configuration file to debug based on the source file.

[0085] In one embodiment, the debugging parameter set also includes a debugging port, and the debugging module 803 is used for: when the debugging mode is remote debugging and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, and the file location parameter includes an executable file location parameter, and the executable file location parameter is used to obtain the executable file, send the executable file to the target hardware of the remote hardware IP based on the secure shell protocol SSH, so as to run the executable file based on the target hardware, determine the startup port of the debugger server corresponding to the target hardware based on the debugging port, so as to transmit the debugging result to the local workspace corresponding to the program to be debugged; set the configuration information of the startup launch configuration file of the workspace to the debugging configuration constant, obtain the preset launch configuration file, and start the debugging session of the debugger server based on the preset launch configuration file to debug based on the running result of the executable file.

[0086] In one embodiment, the debugging parameter set also includes a debugging port, and the debugging module 803 is used for: when the debugging mode is remote debugging and the debugging language category is a language category that does not need to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, and the file location parameter includes a source file location parameter, the source file location parameter is used to obtain the source file, send the source file to the target hardware of the remote hardware IP based on SSH, run the source file based on the target hardware, determine the startup port of the debugger server corresponding to the target hardware based on the debugging port, and transmit the debugging result to the local workspace corresponding to the program to be debugged; set the configuration information of the startup launch configuration file of the workspace to the debugging configuration constant, obtain the preset launch configuration file, and start the debugging session of the debugger server based on the preset launch configuration file to debug based on the running result of the source file.

[0087] In one embodiment, the debugging parameter set determination module 802 is used to: determine the debugger type based on the debugging language category; determine the path of the program to be debugged based on the executable file location parameter or the source file location parameter; determine the debugging configuration constants based on the debugger type, the path of the program to be debugged, the debugging request mode, the debugging configuration name, the debugger installation directory and the working directory.

[0088] In one embodiment, the debugging category determination module 801 is used to: obtain the language type data of the program to be debugged based on the language category in the setting category interface; if there are uppercase letters in the language type data, convert the uppercase letters into lowercase letters to obtain the converted language type data; assign values ​​to the converted language type data to obtain the debugging language category.

[0089] Fig. 9 An example of a physical structure diagram of an electronic device is shown in FIG. Fig. 9As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the program debugging method, the method comprising: obtaining the debugging category of the program to be debugged based on the setting category interface, the debugging category including the debugging mode category, the virtual machine usage category and the debugging language category; obtaining the debugging parameter set of the program to be debugged from the setting content interface based on the debugging category, the debugging parameter set including the file location parameter, the debugger location parameter and the debugging configuration constant of the program to be debugged; setting the category interface and the setting content interface as the preset configuration interface; the file location parameter including the executable file location parameter or the source file location parameter; the debugger location parameter is used to obtain the debugger or the debugger server; debugging the program to be debugged based on the debugging category and the debugging parameter set.

[0090] The electronic device of the present invention supports devices equipped with multiple chips of different architectures, such as RISC-V, Advanced RISCMachine (ARM), x86, etc., or the electronic device of the present invention supports simulating debugging results on a device of another architecture on a device using one of the above architectures.

[0091] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0092] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the program debugging method provided by the above methods, the method comprising: obtaining a debugging category of a program to be debugged based on a setting category interface, the debugging category comprising a debugging mode category, a virtual machine usage category and a debugging language category; obtaining a debugging parameter set of the program to be debugged from a setting content interface based on the debugging category, the debugging parameter set comprising a file location parameter, a debugger location parameter and a debugging configuration constant of the program to be debugged; setting the category interface and the setting content interface as preset configuration interfaces; the file location parameter comprising an executable file location parameter or a source file location parameter; the debugger location parameter is used to obtain a debugger or a debugger server; and debugging the program to be debugged based on the debugging category and the debugging parameter set.

[0093] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A program debugging method, characterized in that: include: Acquire the debugging category of the program to be debugged based on the setting category interface, wherein the debugging category includes a debugging mode category, a virtual machine usage category, and a debugging language category; Acquire a debugging parameter set of the program to be debugged from a setting content interface based on the debugging category, wherein the debugging parameter set includes a file location parameter, a debugger location parameter, and a debugging configuration constant of the program to be debugged; The setting category interface and the setting content interface are preset configuration interfaces; the file location parameter includes an executable file location parameter or a source file location parameter; the debugger location parameter is used to obtain a debugger or a debugger server; The program to be debugged is debugged based on the debugging category and the debugging parameter set.

2. The program debugging method according to claim 1, characterized in that: The debugging of the program to be debugged based on the debugging category and the debugging parameter set includes: When the debugging mode category is local debugging, the virtual machine usage category is using a virtual machine, and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes a virtual machine location parameter and a virtual machine debugging command, the virtual machine location parameter includes a virtual machine installation directory and a virtual machine name, the file location parameter includes an executable file location parameter, the executable file location parameter is used to obtain an executable file, and a running command of a virtual machine debugging mode is determined based on the virtual machine location parameter, the executable file location parameter, and the virtual machine debugging command to run the executable file; The configuration information of the launch configuration file of the workspace corresponding to the program to be debugged is set to the debugging configuration constant to obtain a preset launch configuration file, and the debugging session of the debugger is started based on the preset launch configuration file to debug based on the running result of the executable file.

3. The program debugging method according to claim 1, characterized in that: The debugging of the program to be debugged based on the debugging category and the debugging parameter set includes: When the debugging mode category is local debugging, and the debugging language category is a language category that does not require compilation and running before debugging, the file location parameter includes the source file location parameter, and the source file location parameter is used to obtain the source file, set the configuration information of the startup launch configuration file of the workspace corresponding to the program to be debugged to the debugging configuration constant, obtain the preset launch configuration file, and start the debugging session of the debugger based on the preset launch configuration file to debug based on the source file.

4. The program debugging method according to claim 1, characterized in that: The debugging parameter set also includes a debugging port, and the debugging of the program to be debugged based on the debugging category and the debugging parameter set includes: When the debugging mode is remote debugging, and the debugging language category is a language category that needs to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, and the file location parameter includes the executable file location parameter, the executable file location parameter is used to obtain an executable file, send the executable file to the target hardware of the remote hardware IP based on the secure shell protocol SSH, run the executable file based on the target hardware, determine the startup port of the debugger server corresponding to the target hardware based on the debugging port, and transmit the debugging result to the local workspace corresponding to the program to be debugged; The configuration information of the launch configuration file of the workspace is set to the debugging configuration constant to obtain a preset launch configuration file, and the debugging session of the debugger server is started based on the preset launch configuration file to debug based on the running result of the executable file.

5. The program debugging method according to claim 1, characterized in that: The debugging parameter set also includes a debugging port, and the debugging of the program to be debugged based on the debugging category and the debugging parameter set includes: When the debugging mode is remote debugging, and the debugging language category is a language category that does not need to be compiled and run before debugging, the debugging parameter set also includes a remote hardware IP, and the file location parameter includes a source file location parameter, and the source file location parameter is used to obtain a source file, send the source file to the target hardware of the remote hardware IP based on SSH, run the source file based on the target hardware, determine the startup port of the debugger server corresponding to the target hardware based on the debugging port, and transmit the debugging result to the local workspace corresponding to the program to be debugged; The configuration information of the launch configuration file of the workspace is set to the debugging configuration constant to obtain a preset launch configuration file, and the debugging session of the debugger server is started based on the preset launch configuration file to debug based on the running result of the source file.

6. The program debugging method according to claim 1, characterized in that: The debug configuration constants are determined based on the following steps: Determine a debugger type based on the debugging language category; Determine the path of the program to be debugged based on the executable file location parameter or the source file location parameter; The debugging configuration constant is determined based on the debugger type, the path of the program to be debugged, the debugging request mode, the debugging configuration name, the debugger installation directory and the working directory.

7. The program debugging method according to claim 1, characterized in that: The debugging language category is determined based on the following steps: Acquire the language type data of the program to be debugged based on the language category in the setting category interface; If there are uppercase letters in the language type data, convert the uppercase letters into lowercase letters to obtain converted language type data; Assign a value to the converted language type data to obtain the debugging language category.

8. A program debugging device, characterized in that: include: A debugging category determination module, used to obtain the debugging category of the program to be debugged based on the setting category interface, wherein the debugging category includes a debugging mode category, a virtual machine usage category, and a debugging language category; A debugging parameter set determination module, configured to obtain a debugging parameter set of the program to be debugged from a setting content interface based on the debugging category, wherein the debugging parameter set includes a file location parameter, a debugger location parameter, and a debugging configuration constant of the program to be debugged; The setting category interface and the setting content interface are preset configuration interfaces; the file location parameter includes an executable file location parameter or a source file location parameter; the debugger location parameter is used to obtain a debugger or a debugger server; A debugging module is used to debug the program to be debugged based on the debugging category and the debugging parameter set.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the program debugging method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the program debugging method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Compiling method and device, electronic equipment, storage medium and product

    CN120491976A

  • Compiling method and device, electronic equipment, storage medium and product

    CN120491976B

  • Execution environment configuration method and device, electronic equipment, storage medium and product

    CN120492021A

  • An execution environment configuration method and apparatus, an electronic device, a storage medium, and a product

    CN120492021B