An execution environment configuration method and apparatus, an electronic device, a storage medium, and a product
By obtaining the target program's configuration information, determining the debugging mode and language category, and configuring the execution environment, the problem of emulators in IDEs only supporting a single language is solved. This enables seamless debugging of multiple languages and remote hardware, improving the flexibility and efficiency of program execution.
Patent Information
- Application Number
- CN202510978909.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-07-16
AI Technical Summary
The simulators integrated in existing integrated development environments (IDEs) are usually only for a single programming language and cannot accurately simulate the operation of real hardware.
By obtaining the target program's configuration information, the debugging mode and language category are determined, and the execution environment is configured. This supports multi-language and remote real hardware execution environment configuration, including execution environment configuration in local and remote debugging modes.
It enables seamless debugging of different languages and real hardware within the IDE, supports multi-language and remote real hardware execution environment configuration, and improves the flexibility and efficiency of program execution.
Smart Images

Figure CN120492021B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of code execution technology, and in particular to an execution environment configuration method, apparatus, electronic device, storage medium, and product. Background Technology
[0002] Existing Integrated Development Environments (IDEs) typically come bundled with a compiler and an emulator. Specifically, IDEs usually rely on external plugins to integrate emulators, and users can select the desired emulator to use in the IDE's project configuration to build the execution environment.
[0003] However, the simulators integrated into IDEs are usually only for a single programming language and cannot accurately simulate the operation of real hardware. Summary of the Invention
[0004] This invention provides an execution environment configuration method, apparatus, electronic device, storage medium, and product to address the shortcomings of existing IDE-integrated simulators, which typically only support a single programming language and cannot accurately simulate the execution results of real hardware. This invention enables the configuration of an execution environment that supports multiple languages and remote real hardware.
[0005] This invention provides a method for configuring an execution environment, comprising the following steps:
[0006] Obtain the configuration information of the target program, which is an executable program;
[0007] Based on the debugger mode information in the configuration information, determine the debugging mode of the target program;
[0008] Based on the language information in the configuration information, determine the language category of the target program;
[0009] Configure the execution environment for the target program based on the debugging mode and language category.
[0010] According to an execution environment configuration method provided by the present invention, if it is determined that the debugging mode of the target program is local debugging and the language category of the target program is a compiled language, then the execution environment is configured for the target program based on the debugging mode and the language category, including:
[0011] Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is empty;
[0012] If the simulator name corresponding to the target program is not empty, the configuration information is used to assign values to the execution environment configuration parameters corresponding to the compiled language simulation command, the target simulation command of the target program is generated, and the target simulation command is executed through the console terminal;
[0013] If the emulator name corresponding to the target program is empty, execute the target program through the console.
[0014] According to an execution environment configuration method provided by the present invention, if the debugging mode of the target program is determined to be remote debugging and the language category of the target program is determined to be a compiled language, then the execution environment is configured for the target program based on the debugging mode and the language category, including:
[0015] Obtain the remote hardware IP address from the configuration information;
[0016] Establish a link with the remote hardware IP using a remote access tool;
[0017] The target program is transferred to the target hardware via a link to the remote hardware IP address.
[0018] Control the target hardware to execute the target program.
[0019] According to an execution environment configuration method provided by the present invention, if it is determined that the debugging mode of the target program is local debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then the execution environment is configured for the target program based on the debugging mode and the language category, including:
[0020] Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is a predefined type;
[0021] If the simulator name corresponding to the target program is a predefined type, then the configuration information is used to assign values to the first execution environment configuration parameters corresponding to the semi-compiled and semi-interpreted language simulation command, generating the target simulation command of the target program, and executing the target simulation command through the console terminal; wherein, the first execution environment configuration parameters do not include the simulation tool and the system root directory;
[0022] If the simulator name corresponding to the target program is not a predefined type, the target simulation tool corresponding to the target program is determined based on the file extension of the target program; and the configuration information and the target simulation tool are used to assign values to the corresponding second execution environment configuration parameters in the semi-compiled and semi-interpreted language simulation command to generate the target simulation command of the target program, and execute the target simulation command through the console terminal; wherein, the second execution environment configuration parameters include the simulation tool and the system root directory.
[0023] According to an execution environment configuration method provided by the present invention, if the debugging mode of the target program is determined to be remote debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then the execution environment is configured for the target program based on the debugging mode and the language category, including:
[0024] Obtain the remote hardware IP address from the configuration information;
[0025] Establish a link with the remote hardware IP using a remote access tool;
[0026] The target program is transferred to the target hardware via a link to the remote hardware IP address.
[0027] The target simulation tool corresponding to the target program is determined based on the file extension of the target program;
[0028] Control the target hardware to call the target simulation tool to execute the target program.
[0029] According to an execution environment configuration method provided by the present invention, before obtaining the configuration information of the target program, the execution environment configuration method further includes:
[0030] Identify an active text editor, obtain its filename, and output the filename to the console.
[0031] The present invention also provides an execution environment configuration device, comprising the following modules:
[0032] The configuration information acquisition module is used to acquire the configuration information of the target program, which is an executable program;
[0033] The debug mode determination module is used to determine the debug mode of the target program based on the debugger mode information in the configuration information.
[0034] The language category determination module is used to determine the language category of the target program based on the language category information in the configuration information;
[0035] The execution environment configuration module is used to configure the execution environment for the target program based on the debugging mode and language category.
[0036] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the execution environment configuration methods described above.
[0037] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the execution environment configuration methods described above.
[0038] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the execution environment configuration methods described above.
[0039] The execution environment configuration method, apparatus, electronic device, storage medium, and product provided by this invention can determine the debugging mode and language category of a target program by using debugger mode information and language category information in the configuration information. Since the debugging mode includes local debugging and remote debugging based on real hardware, the execution environment configured based on the debugging mode and language category can not only adapt to different language categories, but also meet the user's needs for execution based on real hardware, thus realizing the configuration of an execution environment that supports multiple languages and remote real hardware. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0041] Figure 1 This is one of the flowcharts illustrating the execution environment configuration method provided by the present invention.
[0042] Figure 2 This is the second flowchart illustrating the execution environment configuration method provided by the present invention.
[0043] Figure 3 This is the third flowchart of the execution environment configuration method provided by the present invention.
[0044] Figure 4 This is the fourth flowchart of the execution environment configuration method provided by the present invention.
[0045] Figure 5 This is the fifth flowchart illustrating the execution environment configuration method provided by the present invention.
[0046] Figure 6 This is a schematic diagram of the execution environment configuration device provided by the present invention.
[0047] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0049] Existing Integrated Development Environments (IDEs) typically come bundled with a compiler and an emulator. Specifically, IDEs usually rely on external plugins to integrate emulators, and users can select the desired emulator to use in the IDE's project configuration to build the simulation environment.
[0050] However, the simulators integrated into IDEs are usually only for a single programming language and cannot accurately simulate the operation of real hardware.
[0051] To address the aforementioned deficiencies, the present invention provides an execution environment configuration method, apparatus, electronic device, storage medium, and product.
[0052] Figure 1 This is one of the flowcharts illustrating the execution environment configuration method provided by the present invention, such as... Figure 1 As shown, the method includes the following:
[0053] Step 101: Obtain the configuration information of the target program;
[0054] In one embodiment, the target program is an executable program;
[0055] In one embodiment, since the executable program is generated by compiling source code, the action of obtaining the configuration information of the target program can be performed after the compilation instructions are executed. Taking an IDE based on the Reduced Instruction Set Computer-V (RISC-V) architecture as an example, its code compilation and execution instructions can be represented as RISC-V Compile and Run Code. The storage path of the executable program generated after the source code is compiled is typically {the directory where the executable file is stored}.
[0056] In one embodiment, compilation information is essential metadata required for converting source code into an executable program; it is indispensable for compilation. Users can input specific compilation information through relevant operations on the IDE user interface or through a user settings interface used to collect compilation information. The user settings interface can be pre-built and provide a customizable interface for users to input personalized compilation information according to their own compilation needs. The compilation information can also be pre-saved by the user or other users in the form of a configuration file. When needed, the required configuration information can be retrieved from the configuration file.
[0057] Step 102: Determine the debugging mode of the target program based on the debugger mode information in the configuration information;
[0058] In one embodiment, debugging modes are divided into local debugging and remote debugging. Local debugging refers to the user directly debugging the target program on their local computer. The execution environment of the target program (such as the operating system and dependent libraries) is consistent with the development environment, and the debugging tool (such as the debugger bound to the IDE) is directly linked to the locally running program, enabling real-time monitoring of the target program's execution. Remote debugging refers to a debugging method where the debugging tool and the target program run on different computers (or containers, virtual machines) and interact via a network connection. For example, the user connects to a program running on a remote server locally using a remote access tool to monitor its status in real time. Compared to local debugging, remote debugging can directly debug programs deployed on real hardware or hardware emulation platforms.
[0059] In one embodiment, the debug module option information in the configuration information indicates the debug mode of the target program; for example, the identifier for local debugging is usually local, and the identifier for remote debugging is usually remote.
[0060] Step 103: Determine the language category of the target program based on the language information in the configuration information;
[0061] In one embodiment, the configuration information typically includes language type information, emulator name, virtual machine installation directory information, virtual machine name information, virtual machine custom command information, executable file storage directory information, and file name information. It's important to note that different language types of target programs have different requirements for the execution environment. For example, semi-compiled / semi-interpreted languages are higher-level compiled languages, and target programs based on these languages require their own accompanying software development kits to provide the execution environment. Therefore, when an executable program based on a semi-compiled / semi-interpreted language is identified, it's assumed that the user needs to execute the target program using a virtual machine, and the emulator name is also used to determine whether the user needs to configure the execution environment using an unconventional emulator. If the user needs to configure the execution environment using an unconventional emulator, a simulation tool variable needs to be generated, and the execution environment is configured using the corresponding simulation tool in the system root directory. Conversely, since target programs based on compiled languages are directly called by the operating system during execution, there's no need to determine whether the user needs to configure the execution environment using an unconventional emulator based on the emulator name; it only needs to check if the emulator name is empty. If the emulator name is empty, the target program can be executed directly through the console.
[0062] In one embodiment, the language type information in the configuration information includes three preset parameters: Compiled language, Compiler Interpreter language, and Interpreted language. When the user inputs or selects the configuration information, they can select the language type of the target program or the source program that generates the target program; thus, the language type of the target program can be determined through the language type information in the configuration information.
[0063] Step 104: Configure the execution environment for the target program based on the debugging mode and language category.
[0064] The execution environment configuration method, apparatus, electronic device, storage medium, and product provided by this invention can determine the debugging mode and language category of a target program by using debugger mode information and language category information in the configuration information. Since the debugging mode includes local debugging and remote debugging based on real hardware, the execution environment configured based on the debugging mode and language category can not only adapt to different language categories, but also meet the user's needs for execution based on real hardware, thus realizing the configuration of an execution environment that supports multiple languages and remote real hardware.
[0065] In one embodiment, based on the description in step 103, if it is determined that the debugging mode of the target program is local debugging and the language category of the target program is a compiled language, then as follows: Figure 2 As shown, step 104 includes the following steps:
[0066] Step 201: Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is empty;
[0067] In one embodiment, if the emulator name information in the target program's configuration information is not empty, it indicates that the emulator name corresponding to the target program is not empty, meaning that the execution of the target program depends on the specified virtual machine. In this case, the execution environment configuration parameters corresponding to the compiled language simulation command include the virtual machine installation directory, virtual machine name, virtual machine custom command, executable file storage directory, and filename. The virtual machine installation directory indicates the path to call the virtual machine, the virtual machine name indicates the name of the virtual machine being called, the virtual machine custom command indicates user-defined requirements, the executable file storage directory indicates the storage path of the target program, and the filename indicates the name of the folder where the target program is stored. If the emulator name information in the target program's configuration information is empty, it indicates that the emulator name corresponding to the target program is empty, meaning that the execution of the target program does not depend on the specified virtual machine and can be directly called by the operating system. Therefore, the execution environment configuration parameters corresponding to the compiled language simulation command only include the executable file storage directory and filename, and do not include parameters associated with the virtual machine.
[0068] Based on this, if it is determined that the debugging mode of the target program is local debugging, and the language category of the target program is a compiled language, then step 104 further includes step 202, which includes:
[0069] Step 2021: If the simulator name corresponding to the target program is not empty, then use the configuration information to assign values to the execution environment configuration parameters corresponding to the compiled language simulation command, generate the target simulation command of the target program, and execute the target simulation command through the console terminal;
[0070] In one embodiment, when the emulator name corresponding to the target program is not empty, since the target program requires a specified virtual machine to execute, the target emulation command is executed through a console terminal. Furthermore, the execution result of the target program can also be output.
[0071] In one embodiment, the target simulation command is in the form of {Virtual machine installation directory} / {Virtual machine name} {Custom commands for virtual machines} {Directory where executable files are stored} / {file name}.
[0072] Step 2022: If the emulator name corresponding to the target program is empty, execute the target program through the console.
[0073] In one embodiment, when the emulator name corresponding to the target program is empty, since the target program is directly invoked by the operating system during execution, it is executed directly through the console. Specifically, the user can input the calling path of the target program in the console, in the form of... {Directory where executable files are stored} / {file name}.
[0074] Furthermore, it can also output the execution results of the target program.
[0075] The solutions shown in steps 201 to 2022, for target programs in compiled languages debugged locally, flexibly configure the execution environment based on whether the simulator name is empty: when it is not empty, the target simulation command is automatically generated and executed based on the configuration information, realizing parameterized operation in the simulation environment; when it is empty, the program is executed directly, simplifying the process in scenarios without a simulator. This balances flexibility and convenience, improving program execution efficiency in different scenarios.
[0076] In one embodiment, based on the description in step 103, if it is determined that the debugging mode of the target program is remote debugging, and the language category of the target program is a compiled language, then as follows: Figure 3 As shown, step 104 includes the following steps:
[0077] Step 301: Obtain the remote hardware IP address from the configuration information;
[0078] In one embodiment, the remote hardware IP address is a unique identifier for the remote hardware on the network. Through the remote hardware IP address, a link can be established with the remote hardware corresponding to that IP address, enabling communication with the remote hardware. In this invention, the remote hardware IP address refers to the IP address of the target hardware executing the target program.
[0079] Step 302: Establish a connection with the remote hardware IP using a remote access tool;
[0080] In one embodiment, the remote access tool can be based on the Secure Shell Protocol (SSH) or a TCP / UDP protocol. Specifically, SSH is an encrypted network transport protocol used to securely log in and manage devices (target hardware) remotely in insecure networks. It prevents data leakage and man-in-the-middle attacks through encrypted communication and is widely used in scenarios such as server management and remote debugging.
[0081] In one embodiment, for ease of operation, a terminal window can be constructed using window functions to display the process of secure login and management of target hardware.
[0082] Step 303: Transfer the target program to the target hardware via a link to the remote hardware IP address;
[0083] Step 304: Control the target hardware to execute the target program.
[0084] The solutions shown in steps 301 to 304, for target programs of compiled languages that are remotely debugged, achieve seamless collaboration between the local development environment and remote hardware by obtaining the remote hardware IP address, transmitting the target program to the target hardware and executing it; and verifying the target program directly in the real hardware execution environment, avoiding problems caused by differences in execution environments.
[0085] In one embodiment, based on the description in step 103, if it is determined that the debugging mode of the target program is local debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then as follows: Figure 4 As shown, step 104 includes the following steps:
[0086] Step 401: Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is a predefined type;
[0087] In one embodiment, semi-compiled / semi-interpreted languages and interpreted languages are higher-level compiled languages. Target programs based on semi-compiled / semi-interpreted languages require their own accompanying software development kits (SDKs) to provide an execution environment. Therefore, when an executable program based on a semi-compiled / semi-interpreted language or an interpreted language is identified, it is assumed that the user needs a virtual machine to execute the target program. Furthermore, the emulator name is used to determine whether the user needs to configure the execution environment using an unconventional emulator. If the user needs to configure the execution environment using an unconventional emulator, a simulation tool variable needs to be generated, and the execution environment is configured using the corresponding simulation tool in the system root directory. It is important to note that unconventional emulators refer to emulators that are not of a predefined type. Taking semi-compiled / semi-interpreted languages as an example, such as Java, .NET, Python, and Kotlinc, these languages are commonly used. Therefore, when the emulator name belongs to the Java, .NET, Python, or Kotlinc type, the corresponding emulator is usually integrated into the IDE as a predefined type. Taking interpreted languages as an example, such as JavaScript, Python RB, Ruby, PHP, Perl, and Shell, the corresponding emulator is usually integrated into the IDE as a predefined type when the emulator name belongs to JavaScript, Python RB, Ruby, PHP, Perl, or Shell. If the emulator is identified as being based on a semi-compiled / semi-interpreted language or an interpreted language and requires configuration of the execution environment through a non-predefined type emulator, then a simulation instrument variable also needs to be generated.
[0088] Based on this, if it is determined that the debugging mode of the target program is local debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then step 104 further includes step 402, which includes:
[0089] Step 4021: If the simulator name corresponding to the target program is a predefined type, then use the configuration information to assign values to the first execution environment configuration parameters corresponding to the semi-compiled and semi-interpreted language simulation command, generate the target simulation command of the target program, and execute the target simulation command through the console terminal; wherein, the first execution environment configuration parameters do not include the simulation tool and the system root directory;
[0090] In one embodiment, when determining whether the simulator name (or interpreter name for interpreted languages) is of a predefined type, the suffix of the target program can be used.
[0091] Specifically, taking semi-compiled and semi-interpreted languages as an example, .java corresponds to java, .cs to dotnet, .py to python, and .kt to kotlinc; if the target program's file extension is .java, .cs, .py, or .kt, the generated target simulation command will look like this: {Virtual machine installation directory} / {Virtual machine name} {Custom commands for virtual machines} {Directory where executable files are stored} / {file name}.
[0092] Taking interpreted languages as an example, .py corresponds to Python, .js to JavaScript, .rb to Ruby, .php to PHP, .pl to Perl, and .sh to Shell. If the target program's file extension is one of .py, .js, .rb, .php, .pl, or .sh, the generated target simulation command will look like this: {Virtual machine installation directory} / {Virtual machine name} {Custom commands for virtual machines} {Directory where executable files are stored} / {filename}. It's important to note that in interpreted languages, since target programs with the .mbt extension belong to a newly developed language category, their corresponding interpreter name is moonbit; to integrate with an IDE, their target simulation commands are as follows: {Virtual machine installation directory} / {virtual machine name} run {Custom commands for virtual machines} {Directory where executable files are stored}.
[0093] Step 4022: If the simulator name corresponding to the target program is not a predefined type, then determine the target simulation tool corresponding to the target program based on the file extension of the target program; and use the configuration information and the target simulation tool to assign values to the corresponding second execution environment configuration parameters in the semi-compiled and semi-interpreted language simulation command, generate the target simulation command of the target program, and execute the target simulation command through the console terminal; wherein, the second execution environment configuration parameters include the simulation tool and the system root directory.
[0094] In one embodiment, if the simulator name corresponding to the target program is not of a predefined type, that is, when the target program is in local debugging mode and requires a user-defined simulator to configure the execution environment, it is also necessary to obtain the simulation tool of the user-defined simulator and the system root directory for storing the simulation tool.
[0095] In one embodiment, if the simulator name corresponding to the target program is not a predefined type, the target simulation tool corresponding to the target program can be determined by generating simulation tool variables. Then, the target simulation command is generated.
[0096] Specifically, taking a semi-compiled, semi-interpreted language as an example, simulated instrumental variables take the form of: {Simulation tool} generates target simulation commands in the form of: {Virtual machine installation directory} / {virtual machine name} - {System Root Directory} {Simulation Tools} {Custom commands for virtual machines} {Directory where executable files are stored} / {file name}.
[0097] Taking interpreted languages as an example, simulated instrumental variables take the form of: {Simulation tool} generates target simulation commands in the form of: {Virtual machine installation directory} / {virtual machine name} - {System Root Directory} {Simulation Tools} {Custom commands for virtual machines} {Directory where executable files are stored} / {filename}. It's also important to note that target programs with the .mbt extension have target emulation commands in the form of: {Virtual machine installation directory} / {virtual machine name} - {System Root Directory} {Simulation Tools} {Custom commands for virtual machines} {Directory where executable files are stored}.
[0098] It should be noted that when the target program's language category is an interpreted language, if the emulator name corresponding to the target program is not a predefined type, a prompt message such as "Language category not set or this tool does not yet support this language" can also be output to the user.
[0099] The scheme shown in steps 401 to 4022 is designed for locally debugged semi-compiled / semi-interpreted or interpreted language programs. It dynamically adjusts the execution environment configuration based on whether the emulator name is a predefined type. If the emulator name is a predefined type, it directly generates target simulation commands without simulation tools and the system root directory, simplifying the simulation command generation process for common scenarios. If the emulator name is not a predefined type, it determines the simulation tools based on the file extension and adds the system root directory, ensuring correct configuration of the execution environment under special conditions, reducing configuration complexity and minimizing human error.
[0100] In one embodiment, based on the description in step 103, if it is determined that the debugging mode of the target program is remote debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then as follows: Figure 5 As shown, step 104 includes the following steps:
[0101] Step 501: Obtain the remote hardware IP address from the configuration information;
[0102] Step 502: Establish a connection with the remote hardware IP using a remote access tool;
[0103] Step 503: Transfer the target program to the target hardware via a link to the remote hardware IP address;
[0104] In one embodiment, steps 501 to 503 can refer to steps 301 to 303, and will not be repeated here.
[0105] Step 504: Determine the target simulation tool corresponding to the target program based on the file extension of the target program;
[0106] Specifically, as shown in step 401, taking semi-compiled and semi-interpreted languages as an example, .java corresponds to java, .cs corresponds to dotnet, .py corresponds to python, and .kt corresponds to kotlinc. Taking interpreted languages as an example, .py corresponds to python, .js corresponds to JavaScript, .rb corresponds to Ruby, .php corresponds to PHP, .pl corresponds to Perl, .sh corresponds to Shell, and .mbt corresponds to moonbit.
[0107] Step 505: Control the target hardware to call the target simulation tool to execute the target program.
[0108] The solutions shown in steps 501 to 505, for target programs in semi-compiled / semi-interpreted languages or interpreted languages that are remotely debugged, achieve seamless collaboration between the local development environment and the remote hardware by obtaining the remote hardware IP address, transmitting the target program to the target hardware and executing it; and verifying the target program directly in the real hardware execution environment, avoiding problems caused by differences in execution environments.
[0109] In one embodiment, prior to step 101, the execution environment configuration method provided by the present invention further includes:
[0110] Receive configuration information from the target program through a custom interface;
[0111] In response to receiving a storage instruction, the configuration information is stored as a configuration file.
[0112] Among these features, a user settings interface can be built on the IDE to provide a custom interface for users to customize configuration information, so as to adapt to the compilation and execution needs of different users and different languages.
[0113] After entering configuration information through the user settings interface, users can save the configuration information as a configuration file by clicking the save button on the IDE interface or using the save shortcut. When the same configuration information is needed again for compilation and execution, there is no need to manually enter the configuration information; it can be retrieved from the configuration file, further improving compilation and execution efficiency.
[0114] In one embodiment, since users typically open the target program through a text editor when compiling it, in order to avoid errors in the configuration information manually entered by the user, such as incorrect filenames, the IDE will also determine whether an active text editor exists. If it does, the IDE will obtain the filename of the text editor and output the filename to the console.
[0115] Based on this, prior to step 101, the execution environment configuration method provided by the present invention further includes:
[0116] Identify an active text editor, obtain its filename, and output the filename to the console.
[0117] The execution environment configuration apparatus provided by the present invention will be described below. The execution environment configuration apparatus described below can be referred to in correspondence with the execution environment configuration method described above.
[0118] like Figure 6 As shown, the execution environment configuration device 600 provided by the present invention includes the following modules:
[0119] The configuration information acquisition module 601 is used to acquire the configuration information of the target program, which is an executable program;
[0120] The debug mode determination module 602 is used to determine the debug mode of the target program based on the debugger mode information in the configuration information;
[0121] The language category determination module 603 is used to determine the language category of the target program based on the language category information in the configuration information;
[0122] The execution environment configuration module 604 is used to configure the execution environment for the target program based on the debugging mode and language category.
[0123] In one embodiment, if it is determined that the debugging mode of the target program is local debugging and that the language category of the target program is a compiled language, then the execution environment configuration module 604 is specifically used for:
[0124] Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is empty;
[0125] If the simulator name corresponding to the target program is not empty, the configuration information is used to assign values to the execution environment configuration parameters corresponding to the compiled language simulation command, the target simulation command of the target program is generated, and the target simulation command is executed through the console terminal;
[0126] If the emulator name corresponding to the target program is empty, execute the target program through the console.
[0127] In one embodiment, if it is determined that the debugging mode of the target program is remote debugging and the language category of the target program is a compiled language, then the execution environment configuration module 604 is specifically used for:
[0128] Obtain the remote hardware IP address from the configuration information;
[0129] Establish a link with the remote hardware IP using a remote access tool;
[0130] The target program is transferred to the target hardware via a link to the remote hardware IP address.
[0131] Control the target hardware to execute the target program.
[0132] In one embodiment, if it is determined that the debugging mode of the target program is local debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then the execution environment configuration module 604 is specifically used for:
[0133] Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is a predefined type;
[0134] If the simulator name corresponding to the target program is a predefined type, then the configuration information is used to assign values to the first execution environment configuration parameters corresponding to the semi-compiled and semi-interpreted language simulation command, generating the target simulation command of the target program, and executing the target simulation command through the console terminal; wherein, the first execution environment configuration parameters do not include the simulation tool and the system root directory;
[0135] If the simulator name corresponding to the target program is not a predefined type, the target simulation tool corresponding to the target program is determined based on the file extension of the target program; and the configuration information and the target simulation tool are used to assign values to the corresponding second execution environment configuration parameters in the semi-compiled and semi-interpreted language simulation command to generate the target simulation command of the target program, and execute the target simulation command through the console terminal; wherein, the second execution environment configuration parameters include the simulation tool and the system root directory.
[0136] In one embodiment, if it is determined that the debugging mode of the target program is remote debugging, and it is determined that the language category of the target program is a semi-compiled / semi-interpreted language or an interpreted language, then the execution environment configuration module 604 is specifically used for:
[0137] Obtain the remote hardware IP address from the configuration information;
[0138] Establish a link with the remote hardware IP using a remote access tool;
[0139] The target program is transferred to the target hardware via a link to the remote hardware IP address.
[0140] The target simulation tool corresponding to the target program is determined based on the file extension of the target program;
[0141] Control the target hardware to call the target simulation tool to execute the target program.
[0142] In one embodiment, the execution environment configuration device 600 provided by the present invention further includes a text editor acquisition module, which is used for:
[0143] Identify an active text editor, obtain its filename, and output the filename to the console.
[0144] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7As shown, the electronic device may include a processor 701, a communications interface 702, a memory 703, and a communication bus 704. The processor 701, communications interface 702, and memory 703 communicate with each other via the communication bus 704. The processor 701 can call logical instructions in the memory 703 to execute an execution environment configuration method. This method includes: obtaining configuration information of a target program, where the target program is an executable program; determining the debugging mode of the target program based on debugger mode information in the configuration information; determining the language category of the target program based on language type information in the configuration information; and configuring the execution environment for the target program based on the debugging mode and language category.
[0145] Furthermore, the logical instructions in the aforementioned memory 703 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0146] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the execution environment configuration method provided by the above methods. The method includes: obtaining configuration information of a target program, wherein the target program is an executable program; determining the debugging mode of the target program based on debugger mode information in the configuration information; determining the language category of the target program based on language type information in the configuration information; and configuring an execution environment for the target program based on the debugging mode and the language category.
[0147] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements an execution environment configuration method for performing the above-described methods. The method includes: obtaining configuration information of a target program, wherein the target program is an executable program; determining a debugging mode of the target program based on debugger mode information in the configuration information; determining a language category of the target program based on language type information in the configuration information; and configuring an execution environment for the target program based on the debugging mode and the language category.
[0148] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0149] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.
[0150] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for configuring an execution environment, characterized in that, include: Obtain the configuration information of the target program, which is an executable program; Based on the debugger mode information in the configuration information, the debugging mode of the target program is determined; Based on the language type information in the configuration information, the language category of the target program is determined; Based on the debugging mode and the language category, configure an execution environment for the target program; if the debugging mode of the target program is determined to be local debugging, and the language category of the target program is determined to be a compiled language, then configure an execution environment for the target program based on the debugging mode and the language category, including: Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is empty; If the simulator name corresponding to the target program is not empty, the configuration information is used to assign values to the execution environment configuration parameters corresponding to the compiled language simulation command, the target simulation command of the target program is generated, and the target simulation command is executed through the console terminal; If the emulator name corresponding to the target program is empty, execute the target program via the console; If the debugging mode of the target program is determined to be local debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then based on the debugging mode and the language category, an execution environment is configured for the target program, including: Based on the emulator name information in the configuration information, determine whether the emulator name corresponding to the target program is a predefined type; If the simulator name corresponding to the target program is a predefined type, then the configuration information is used to assign values to the first execution environment configuration parameters corresponding to the semi-compiled and semi-interpreted language simulation command, generating the target simulation command of the target program, and executing the target simulation command through the console terminal; wherein, the first execution environment configuration parameters do not include the simulation tool and the system root directory; If the simulator name corresponding to the target program is not a predefined type, then the target simulation tool corresponding to the target program is determined based on the suffix of the target program; and the configuration information and the target simulation tool are used to assign values to the second execution environment configuration parameters corresponding to the semi-compiled and semi-interpreted language simulation command to generate the target simulation command of the target program, and the target simulation command is executed through the console terminal; wherein, the second execution environment configuration parameters include the simulation tool and the system root directory.
2. The method according to claim 1, characterized in that, If the debugging mode of the target program is determined to be remote debugging, and the language category of the target program is determined to be a compiled language, then based on the debugging mode and the language category, an execution environment is configured for the target program, including: Obtain the remote hardware IP address from the configuration information; Establish a link with the remote hardware IP using a remote access tool; The target program is transmitted to the target hardware via a link to the remote hardware IP address; Control the target hardware to execute the target program.
3. The method according to claim 1, characterized in that, If the debugging mode of the target program is determined to be remote debugging, and the language category of the target program is determined to be a semi-compiled / semi-interpreted language or an interpreted language, then based on the debugging mode and the language category, an execution environment is configured for the target program, including: Obtain the remote hardware IP address from the configuration information; Establish a link with the remote hardware IP using a remote access tool; The target program is transmitted to the target hardware via a link to the remote hardware IP address; The target simulation tool corresponding to the target program is determined based on the file extension of the target program; The target hardware is controlled to invoke the target simulation tool to execute the target program.
4. The method according to claim 1, characterized in that, Before obtaining the configuration information of the target program, the method further includes: If an active text editor is identified, the filename of the text editor is obtained and output to the console.
5. An execution environment configuration apparatus, employing the execution environment configuration method as described in claim 1, characterized in that, include: The configuration information acquisition module is used to acquire the configuration information of the target program, which is an executable program; The debug mode determination module is used to determine the debug mode of the target program based on the debugger mode information in the configuration information. The language category determination module is used to determine the language category of the target program based on the language category information in the configuration information; The execution environment configuration module is used to configure the execution environment for the target program based on the debugging mode and the language category.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the execution environment configuration method as described in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the execution environment configuration method as described in any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the execution environment configuration method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Program debugging method and device, electronic equipment and storage medium
CN119669036A