CN116149660A - Method for acquiring compiling information and related equipment - Google Patents

Method for acquiring compiling information and related equipment Download PDF

Info

Publication number
CN116149660A
CN116149660A CN202111411699.7A CN202111411699A CN116149660A CN 116149660 A CN116149660 A CN 116149660A CN 202111411699 A CN202111411699 A CN 202111411699A CN 116149660 A CN116149660 A CN 116149660A
Authority
CN
China
Prior art keywords
command
compiling
execution
execution command
processor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111411699.7A
Other languages
Chinese (zh)
Inventor
沈栋
邱国平
赵文宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Cloud Computing Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Cloud Computing Technologies Co Ltd filed Critical Huawei Cloud Computing Technologies Co Ltd
Priority to CN202111411699.7A priority Critical patent/CN116149660A/en
Publication of CN116149660A publication Critical patent/CN116149660A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis

Landscapes

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

Abstract

The embodiment of the application discloses a method and related equipment for acquiring compiling information, which are used for reducing the duration of a compiling process under the condition of acquiring the compiling information. The method comprises the following steps: and acquiring an execution command and determining a command type of the execution command, wherein the command type of the execution command comprises a compiling class command and a non-compiling class command, the compiling class command is a compiling command or a link command, and the non-compiling class command is other execution commands except the compiling class command. If the command type of the execution command is a compiling command, the execution command is saved without executing the execution command, so that the compiling command or the link command can be obtained as compiling information, and meanwhile, a great amount of time is saved because the execution command is not executed.

Description

Method for acquiring compiling information and related equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and related device for obtaining compiled information.
Background
The static analysis (static code analysis, SCA) of codes is a code analysis technique for analyzing codes by means of techniques such as lexical analysis, syntax analysis, control flow, data flow analysis, etc., and verifying whether the codes meet the standards of normative, security, reliability, maintainability, etc., without executing the codes.
Currently, for acquiring compiling information of a code, a function provided by an SCA tool may generate a compiling database (for storing compiling information such as a compiling command in a compiling process, and is currently generally stored in a manner of a json file). For example, using a CMake as the SCA tool, the support usage options include cmake_export_comple_commands, the Commands include CMake-cmake_export_comple_commands= …, thereby generating commands_commands. However, this method cannot completely restore the compiling process, and when the environment preparation information is lost, the non-compiling command is lost, and the environment variable is lost, the SCA tool cannot effectively and correctly run the compiling information.
Currently, the SCA tool can also acquire compiling information in the compiling process, so that the compiling process can be restored, and the method is a method for acquiring the compiling information of codes, which is commonly adopted in commercial tools at present, for example, the method is adopted by commercial tools coverage and Fortify. The method mainly loads and analyzes a system command interception program of the SCA tool in a dynamic loading mode provided by an operating system, and acquires compiling information in a mode of adapting to a configuration engineering compiler. However, since the complete compiling process is performed, a large amount of compiling time is wasted.
Disclosure of Invention
The embodiment of the application provides a method and related equipment for acquiring compiling information, which are used for reducing the duration of a compiling process under the condition of acquiring the compiling information.
The first aspect of the present application provides a method for obtaining compiling information, which includes obtaining an execution command, and determining a command type of the execution command, where the command type of the execution command includes a compiling class command and a non-compiling class command, the compiling class command is a compiling command or a linking command, and the non-compiling class command is another execution command except the compiling class command. If the command type of the execution command is a compiling command, the execution command is saved without executing the execution command, so that the compiling command or the link command can be obtained as compiling information, and meanwhile, a great amount of time is saved because the execution command is not executed.
Since the compiling class commands are compiling commands and linking commands, these executing commands are compiling information required by the SCA tool, but these executing commands are not necessarily executed in the compiling process, and it takes a lot of time to execute these executing commands. Therefore, by identifying the compiling command and the linking command, a great amount of time can be saved and required compiling information can be obtained while ensuring the compiling process.
In some possible implementations, after the save of the execution command, an empty file with the same file name as the execution command is generated to avoid the examination of the compiler.
In some possible implementations, the non-compiled class commands are compiled process commands or negligible commands. And if the execution command is the compiling process command, executing the execution command. The compiling process command is an executing command necessary in the compiling process, but is not compiling information required by the SCA tool, so the compiling process command is not saved, but the compiling process command is continuously executed, and the compiling process is not influenced. If the execution command is the negligible command, the execution command is not executed and the execution command is not saved, so as to reduce the duration of the compiling process.
A second aspect of the present application provides an apparatus for obtaining compiled information, the apparatus being configured to perform the method according to any one of the first aspects.
In a third aspect, the present application provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method of any one of the first aspects described above.
A fourth aspect of the present application provides a computer program product comprising computer-executable instructions stored in a computer-readable storage medium; the at least one processor of the apparatus may read the computer-executable instructions from a computer-readable storage medium, the at least one processor executing the computer-executable instructions causing the apparatus to implement the method provided by the first aspect or any one of the possible implementations of the first aspect.
A fifth aspect of the present application provides a communication device that may include at least one processor, a memory, and a communication interface. At least one processor is coupled with the memory and the communication interface. The memory is for storing instructions, the at least one processor is for executing the instructions, and the communication interface is for communicating with other communication devices under control of the at least one processor. The instructions, when executed by at least one processor, cause the at least one processor to perform the method of the first aspect or any possible implementation of the first aspect.
A sixth aspect of the present application provides a chip system comprising a processor for supporting a device for obtaining compiled information to implement the functionality referred to in the first aspect or any one of the possible implementations of the first aspect.
In one possible design, the chip system may further include a memory to hold program instructions and data necessary for the device to obtain the compiled information. The chip system can be composed of chips, and can also comprise chips and other discrete devices.
The technical effects of the fourth to seventh aspects or any one of the possible implementation manners of the fourth to seventh aspects may be referred to the technical effects of the first aspect or the technical effects of the different possible implementation manners of the first aspect, which are not described herein.
Drawings
FIG. 1-1 is a schematic diagram of an embodiment of a compiled information acquisition system;
1-2 illustrate an embodiment of the analysis process of code by the SCA tool of the compile class;
FIGS. 1-3 are schematic illustrations of an embodiment of a compiled information acquisition system according to embodiments of the present application;
FIGS. 1-4 are schematic illustrations of embodiments in which a compiler performs a compilation process;
FIG. 2 is a schematic diagram of an embodiment of a method for obtaining compiled information;
FIG. 3 is a schematic diagram of an embodiment for sequentially determining whether an execution command is a compile command, a link command, a negligible command, and a compile process command;
FIG. 4 is a schematic diagram of an embodiment of an apparatus for obtaining compiled information provided in the present application;
fig. 5 is a schematic diagram of an embodiment of a communication device provided in the present application.
Detailed Description
The embodiment of the application provides a method for acquiring compiling information, which is used for reducing the duration of a compiling process under the condition of acquiring the compiling information.
Embodiments of the present application are described below with reference to the accompanying drawings.
The terms first, second and the like in the description and in the claims of the present application and in the above-described figures, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances and are merely illustrative of the manner in which the embodiments of the application described herein have been described for objects of the same nature. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of elements is not necessarily limited to those elements, but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
The static analysis (static code analysis, SCA) of codes refers to a code analysis technique for analyzing codes by means of technologies such as lexical analysis, syntax analysis, control flow and data flow analysis, and verifying whether the codes meet indexes such as normalization, security, reliability and maintainability, without executing the codes.
The SCA tools can be classified into SCA tools of compiled classes and SCA tools of non-compiled classes according to whether the compilation process is relied upon in the analysis process. The SCA tool of the non-compiled class needs to find the compiled dependency by itself, and in general, because the compiler of the SCA tool and the engineering of the code are not in the same directory, the SCA tool cannot effectively obtain the system header file of the compiler, thereby causing the library function deletion or definition deletion of the analysis code. Meanwhile, the SCA tool of the non-compiling class also has the problems that codes participating in engineering, test codes and description documents cannot be effectively distinguished, and the use difference among codes caused by the fact that the same set of codes correspond to different compiling targets. Thus, a non-compiled class of SCA tools may be much worse in terms of accuracy of analysis than a compiled class of SCA tools. Therefore, currently, the leading commercial SCA tools in the industry mostly employ compiled SCA tools for code analysis.
1-1, to compile information acquisition system 100, includes a compilation tool 110 and a SCA tool 120, wherein SCA tool 120 includes a middleware generation module 121 and an analysis module 122.
Wherein the compiling tool 110 is configured to perform a compiling process, and comprises: (1) acquiring codes; (2) generating a compiled script from the code; (3) Compiling the compiling script to obtain a target file; (4) generating the executable file according to the link of the target file.
1-2, the analysis of code by the SCA tool of the compiled class may include:
(1) The SCA tool generates compiler configuration information.
I.e. the SCA tool generates compiler configuration information such as gcc, g++, etc.
(2) The SCA tool starts a program that listens for compiled commands.
The program that listens to the compile commands is configured to intercept the compile commands that the compile process directs to the operating system, such that the SCA tool intercepts each compile command before the operating system executes the compile commands.
(3) The compiling tool starts a compiling script and executes a compiling process.
The compiling tool sends each compiling command of the compiling process to the SCA tool, and the SCA tool forwards the compiling command to the operating system.
(4) The SCA tool extracts the compiling information in the compiling command through a program listening for the compiling command.
The program of the SCA tool for intercepting the compiling command selects the compiling command consistent with the command type of the compiler configured by the SCA tool through a filter, for example, the compiling command of gcc or g++ set in the previous configuration step is selected from various compiling commands, and then the compiling command is sent to the pre-compiler of the SCA tool.
(5) The SCA tool generates an analysis intermediate file (intermediate representation, IR) from the compiled commands via a pre-compiler.
The SCA tool will generate analysis intermediate files (intermediate representation, IR) of the SCA tool through the pre-compiler based on the compiling parameters, source code files, dependency files in the compiling command.
(6) The SCA tool performs code analysis on the IR through an analysis engine in an analysis module.
The SCA tool analyzes the generated IR according to analysis rules, so as to find defects or security holes in the code, and finally gives an inspection report.
In the step (4), the SCA tool may obtain the compiled information and aggregate the compiled information into the compiled database. For ease of storage and parsing, compilation databases typically employ JSON files to structure stored compilation information. The JSON file is made up of an array of multiple command objects, where each command object indicates the method of generating a compilation unit in an item. Each command object contains a master file of the compiling unit, a working directory of the compiling operation, and an actual compiling command. Wherein the command object consists of the following fields:
1. directory (directory): representing a working catalog of the compilation process.
The path in the command object is an absolute path or a relative path.
2. File (file): the main compiling unit of the current compiling step.
This is the main field of the compiled database, and for the same file there may be multiple command objects. For example, the same source file is compiled using different configurations.
3. Command (command): and compiling the command to be executed.
After JSON escape (unescaping), this must be a valid compile command in order for the build operating system to be able to recreate the correct generation of the compile unit in the use environment.
4. Parameters (parameters): the compile command is executed as a string table.
5. Output): the name of the output created by this compiling step.
This field is optional. It can be used to distinguish between different processing modes of the same input file.
Illustrating:
Figure BDA0003370630410000041
in the above step (4), the SCA tool needs to obtain the compilation information by having two methods, one of which is to obtain the compilation information by a function in the SCA tool and the other is to obtain the compilation information by performing a complete compilation process. The analysis is performed separately below.
1. The compiled information is obtained by a function in the SCA tool.
Currently, for acquiring compiling information of a code, the SCA tool may generate a compiling database (for storing compiling information such as a compiling command of a compiling process, and is currently generally stored in a manner of a json file) by providing a built-in function. For example, using a CMake as the SCA tool, the support functions include cmake_export_comple_commands, the Commands include CMake-cmake_export_comple_commands= …, thereby generating commands_commands under the current folder.
The method has the advantages that the compiling database can be obtained without a compiling process, but only the compiling unit is analyzed, the complexity of engineering-level project compiling is not considered, and influence factors such as commands prepared by a compiling environment and dependence of a compiling system on environment variables in a compiling script are not considered.
In particular, this method has the following drawbacks: 1. the compiling process cannot be completely restored, and when the environment preparation information is lost, the non-compiling command is lost and the environment variable is lost, the SCA tool cannot effectively and correctly run the compiling information; 2. the method is not suitable for acquiring project compiling information of engineering level, is only suitable for some small-sized test projects, and lacks practical value.
2. The compilation information is obtained by performing a complete compilation process.
Specifically, the SCA tool can acquire compiling information in the compiling process, so that the compiling process is restored, and the method for acquiring the compiling information of the code, which is commonly adopted in the SCA tool for current business, is adopted, for example, coverage, fortify. The method mainly loads and analyzes a command interception program of the SCA tool in a dynamic loading mode provided by an operating system, and acquires compiling information in a mode of adapting to a configuration engineering compiler.
For example, in Linux systems, ld_preload environment variables are typically used, which can affect links (runtime links) at program runtime, allowing dynamic link libraries to be defined that are loaded preferentially before the program is run.
The interception process of the execution command is as follows:
(1) Defining functions which are identical to the objective functions, including names, variables and types, return values and types, and the like;
(2) Compiling source codes containing replacement functions into a dynamic link library;
(3) By the command export ld_reload= "library file path", a dynamically linked library to be replaced preferentially is set.
Therefore, after the intercepted dynamic link library is loaded, when the running code calls the target function, the system loads the same target function and uses the replaced target function, so that the function of command interception is realized.
The method has the advantage that the usability of the compiling database is ensured by executing the complete compiling process (execution of various non-compiling commands and setting of environment variables). The disadvantage is that a lot of time is wasted to perform the compilation, since the complete compilation process is performed.
Referring to fig. 1-3, a schematic structural diagram of a compiling information obtaining system 100 according to an embodiment of the present application includes: compiler 110, operating system 120, and command interceptor 130. The compiled information acquisition system 100 is used to acquire compiled information, and allows the SCA tool to analyze the compiled information.
1-4, compiler 110 is configured to perform a compilation process, including: 1. starting a compiling script; 2. judging whether the execution of the compiling script is finished; 3. if yes, ending the compiling; 4. otherwise, the execution command in the compiled script is executed and sent to the command interceptor 130.
The command interceptor 130 is used for loading ld_reload, starting execv command interceptor, and obtaining execution command through the compiling information fast obtaining command interceptor, and extracting compiling information from the execution command. When the command interceptor 130 finishes extracting the compiled information, a Linux execution command (e.g., execv) and a Linux command return are returned to the operating system 120.
The operating system 120 is configured to receive Linux execution commands (e.g., execv) and Linux command returns sent by the command interceptor 130, and send the execution returns to the compiler 110.
The compiler 110 is further configured to, after receiving the execution return, continue to determine whether the execution of the compiled script is finished, if so, finish the compiling, otherwise, execute the execution command in the compiled script, and send the execution command to the command interceptor 130, so as to cycle until the execution command in the compiled script is all executed.
In this embodiment of the present application, by improving the compiling information fast obtaining command interceptor in the command interceptor 130, obtaining an execution command, and determining a command type of the execution command, where the command type of the execution command includes a compiling command and a non-compiling command, the compiling command is a compiling command or a linking command, and the non-compiling command is another execution command other than the compiling command. If the command type of the execution command is a compiling command, the execution command is saved without executing the execution command, so that the compiling command or the link command can be obtained as compiling information, and meanwhile, a great amount of time is saved because the execution command is not executed. Finally, the method achieves the aim of efficiently and quickly acquiring the compiling information, provides a reliable compiling database for the SCA tool, and greatly reduces the time for acquiring the compiling information by the static analysis tool.
The foregoing embodiment describes the compiled information acquisition system 100 provided in the present application, and next describes a method for acquiring compiled information executed by the interceptor 130 based on the compiled information speed acquisition command, and referring to fig. 2, the method for acquiring compiled information provided in the embodiment of the present application mainly includes the following steps:
201. an execution command is acquired.
The compiling script is composed of a plurality of execution commands for instructing a compiling process. In the embodiment of the application, when the compiler executes one execution command in the compiling script, the execution command can be sent to the command interceptor, and then the command interceptor acquires the execution command through the compiling information very fast acquisition command interceptor.
202. Determining a command type of an execution command, wherein the command type of the execution command comprises a compiling class command and a non-compiling class command, the compiling class command is a compiling command or a link command, and the non-compiling class command is other execution commands except the compiling class command.
In the embodiment of the application, the command types of the execution commands include compiled class commands and uncompiled class commands. In some possible implementations, the compiled class commands are compiled commands or linked commands, and the non-compiled class commands are compiled process commands or negligible commands.
Note that the compiling command is used to complete basic processing of the code by the compiling unit. In some possible implementations, the compile commands may include compiler information, compile dependency files, compile macro definitions, source code files, and output files. The compiling command is compiling information required by the SCA tool, but is not an executing command which is indispensable in the compiling process, so the compiling command needs to be saved and then processed by the SCA tool, but the compiling command does not need to be executed.
It should be noted that, the linking command is to link the single file information (for example, the compiling command) of the compiling output into a larger module file, or convert it into an execution file available to the target system. The link command may include information of compiling the linker, a file to be linked, an output file of the linked file. It should be noted that, the link command is also the compiling information required by the SCA tool, the compiling command needs to be saved, and then the SCA tool is allowed to process, but the compiling command does not need to be executed.
The compiling process command is to set up the compiled environment variable, the code preparation and other auxiliary operations. Note that the compiling process command is not compiling information required by the SCA tool, but is an execution command indispensable in the compiling process, and the compiling command does not need to be saved but needs to be executed.
It should be noted that the negligible command may be a white list set according to the item, so as to bypass the verification command in the compiling process, thereby avoiding terminating the compiling process due to verification failure. What needs to be stated is that the negligible command is not the compiling information required by the SCA tool, nor is it an execution command that is indispensable in the compiling process, and the compiling command does not need to be saved or executed.
203. The execution command is processed according to the command type of the compiling command.
In some possible implementations, if the command type of the execution command is a compile class command, i.e., a compile command or a link command, the execution command is saved and output for use by a subsequent SCA tool, but is not executed. In some possible implementations, if the command type of the execution command is a compile class command, an empty file with the same file name as the execution command is generated to avoid the examination of the compiler. In some possible implementations, if the execution command is a compiled process command, the execution command is executed, but the execution command is not saved. In some possible implementations, if the execution command is a negligible command, the execution command is not executed and the execution command is not saved.
It should be noted that, the compiling command and the linking command are the most time-consuming steps in the compiling process, but the compiled output thereof has no effect on the SCA tool. Therefore, in the embodiment of the application, the compiling command and the linking command are not executed, thereby saving time for executing the steps of the compiling command or the linking command. In some possible implementations, a null file having the same file name as the execution command may also be generated, thereby generating a false output target to bypass the compiler's examination of the output target. For a compiler which does not do output check, the step of outputting the empty file can be omitted and the compiler can directly return. Therefore, in the embodiment of the application, the collection of the compiling information is completed, and meanwhile, a large amount of compiling time spent in the conventional common practice is greatly saved.
In some possible implementations, the negligible command may be determined by setting a white list, and if the execute command is a negligible command, the direct return is performed without execution or save. If the execution command is a compiling process command, the execution command is executed, but the execution module may not be saved, so as to ensure the normal operation of the compiling process.
In the embodiment of the application, as the compiling command and the linking command are the most time-consuming steps in the whole compiling process, and are not indispensable, the compiling command and the linking command are saved but not executed, the method not only meets the effect that the SCA tool quickly obtains the compiling information to carry out subsequent analysis work, but also plays a role in greatly reducing the time of the whole compiling process. In addition, the normal execution of the compiling process is ensured and the time consumption is saved to the greatest extent due to the fact that the compiling process command is executed and the negligible command is ignored.
In some possible implementations, when an execution command is received, it may be determined whether the execution command is a compile command, a link command, a negligible command, and a compile process command in order. For example, referring to fig. 3, step 203 includes:
2031. if the command type of the execution command is a compiling command, the execution command is saved, and the execution command is not executed.
In the embodiment of the application, after identifying that the execution command is a compiling command, the command interceptor does not execute the execution command, but directly stores and outputs the execution command for analysis by a subsequent SCA tool. In some possible implementations, the command interceptor may also extract the output file in the execution command, and change the execution command to generate an empty file with the same file name, so as to avoid that the compiler checks whether the compiled output file exists or not or the timestamp of the compiled output file after receiving the command of the operating system, so as to avoid that the compiler generates an error report due to such an error and stops the compiling process.
2032. If the command type of the execution command is a link command, the execution command is saved, and the execution command is not executed.
In the embodiment of the application, after recognizing that the execution command is a link command, the command interceptor does not execute the execution command, but directly stores and outputs the execution command for analysis by a subsequent SCA tool. In some possible implementations, the command interceptor may also extract the output file in the execution command, and change the execution command to generate an empty file with the same file name, so as to avoid that the compiler checks whether the compiled output file exists or not or the timestamp of the compiled output file after receiving the command of the operating system, so as to avoid that the compiler generates an error report due to such an error and stops the compiling process.
2033. If the execution command is a negligible command, the execution command is not executed and the execution command is not saved.
In the embodiment of the application, the white list can be set according to the project, the white list is a negligible command, and the common negligible command is a checking command in the compiling process, so that the compiling process is prevented from being terminated due to checking failure. Since the negligible command is not information required by the SCA tool, when the execute command is determined to be a negligible command, the execute command may be ignored, but returned directly.
2034. If the execution command is a compiling process command, the execution command is executed, but the execution command is not saved.
In some possible implementations, if the execution command is not a compile command, a link command, or a negligible command as described above, then the execution command may be determined to be a compile process command. In some possible implementations, the compile process command may also be identified separately, without limitation. It should be noted that, the compiling process command is not the information required by the SCA tool, but plays an important role in the compiling process, and these executing commands need to be continuously executed by the compiler, so as to avoid that setting errors of various parameters cannot enable the following compiling commands to be executed correctly.
In some possible implementations, the identification of the different types of execution commands may be in accordance with the order of steps 2031-2034 described above, or in other orders. For example, it is not limited herein to identify whether an execution command is a negligible command, a link command, a compile command, or a compile process command.
In the application, by acquiring an execution command and determining a command type of the execution command, the command type of the execution command includes a compiling command and a non-compiling command, wherein the compiling command is a compiling command or a link command, and the non-compiling command is other execution commands except the compiling command. If the command type of the execution command is a compiling command, the execution command is saved without executing the execution command, so that the compiling command or the link command can be obtained as compiling information, and meanwhile, a great amount of time is saved because the execution command is not executed.
In the embodiment of the application, the method for acquiring the compiling information by executing the complete compiling process, which is generally adopted in the industry, is improved, and different processing modes are adopted for the executing command of each command type by identifying the command type of the executing command of the compiling process, so that the compiling process is executed, and meanwhile, a large amount of time of the compiling process can be saved. Therefore, the method and the device solve the defects of acquiring the compiling information through the function in the SCA tool and acquiring the compiling information through executing the complete compiling process, achieve the effect of efficiently and quickly acquiring the compiling information, provide a reliable compiling database for the SCA tool, and reduce the time for the SCA tool to acquire the compiling information.
By way of example, since the compiling command and the linking command are the most time-consuming steps in the compiling process, the improved processing mode ensures the normal execution of the compiling process, bypasses the specific compiling command and the linking command, and achieves the effect of saving time. The method can not only meet the requirement that the SCA tool can quickly acquire the compiling information to carry out subsequent analysis work, but also greatly reduce the compiling process time.
Specifically, for medium-or large-scale projects, the compiling time of the current technical scheme may be different from 1 hour to several hours, and then the SCA tool of the compiling class needs to wait for the execution of the compiling process to complete before performing subsequent analysis work. By the method for acquiring the compiling information, the whole compiling process can start subsequent analysis work only by a few minutes, and the efficiency is obviously improved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required in the present application.
In order to facilitate better implementation of the above-described aspects of the embodiments of the present application, the following further provides related devices for implementing the above-described aspects.
Referring to fig. 4, an apparatus 400 for obtaining compiled information according to an embodiment of the present application may include: an acquisition module 401 and a processing module 402. Wherein, the liquid crystal display device comprises a liquid crystal display device,
the acquiring module 401 is configured to acquire an execution command.
The processing module 402 is configured to determine a command type of the execution command, where the command type of the execution command includes a compiled class command and a non-compiled class command, the compiled class command is a compiled command or a link command, and the non-compiled class command is another execution command except the compiled class command.
The processing module 402 is further configured to save the execution command without executing the execution command if the command type of the execution command is a compile class command.
In some possible implementations, the processing module 402 is further configured to generate an empty file having the same file name as the execution command.
In some possible implementations the non-compiled class commands are compiled process commands or negligible commands.
In some possible implementations, the processing module 402 is further configured to execute the execution command if the execution command is the compiling process command.
In some possible implementations, the processing module 402 is further configured to not execute the execution command if the execution command is the negligible command.
It should be noted that, because the content of information interaction and execution process between the modules/units of the above-mentioned device is based on the same concept as the method embodiment of the present application, the technical effects brought by the content are the same as the method embodiment of the present application, and specific content can be referred to the description in the method embodiment shown in the foregoing application, which is not repeated here.
The embodiment of the application also provides a computer storage medium, wherein the computer storage medium stores a program, and the program executes part or all of the steps described in the embodiment of the method.
Referring to fig. 5, referring to another communication device provided in the embodiment of the present application, a communication device 500 includes:
a receiver 501, a transmitter 502, a processor 503 and a memory 504. In some embodiments of the present application, the receiver 501, transmitter 502, processor 503, and memory 504 may be connected by a bus or other means, where a bus connection is illustrated in fig. 5.
Memory 504 may include read only memory and random access memory and provides instructions and data to processor 503. A portion of the memory 504 may also include non-volatile random access memory (NVRAM). Memory 504 stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, where the operating instructions may include various operating instructions for performing various operations. The operating system may include various system programs for implementing various underlying services and handling hardware-based tasks.
The processor 503 controls the operation of the communication device, the processor 503 may also be referred to as a central processing unit (central processing unit, CPU). In a specific application, the various components of the communication device are coupled together by a bus system that may include, in addition to a data bus, a power bus, a control bus, a status signal bus, and the like. For clarity of illustration, however, the various buses are referred to in the figures as bus systems.
The method disclosed in the embodiments of the present application may be applied to the processor 503 or implemented by the processor 503. The processor 503 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry of hardware in the processor 503 or instructions in the form of software. The processor 503 may be a general purpose processor, a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in hardware, in a decoded processor, or in a combination of hardware and software modules in a decoded processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 504 and the processor 503 reads the information in the memory 504 and in combination with its hardware performs the steps of the method described above.
Receiver 501 may be used to receive input digital or character information and to generate signal inputs related to XXX related settings and function control, transmitter 502 may include a display device such as a display screen, and transmitter 502 may be used to output digital or character information via an external interface.
In the embodiment of the present application, the processor 503 is configured to execute the method for acquiring compiled information executed by the foregoing communication device.
In another possible design, when the communication device is a chip, the method includes: a processing unit, which may be, for example, a processor, and a communication unit, which may be, for example, an input/output interface, pins or circuitry, etc. The processing unit may execute the computer-executable instructions stored in the storage unit to cause the chip in the terminal to perform the method for transmitting wireless report information according to any one of the above first aspects. Alternatively, the storage unit is a storage unit in the chip, such as a register, a cache, or the like, and the storage unit may also be a storage unit in the terminal located outside the chip, such as a read-only memory (ROM) or other type of static storage device that may store static information and instructions, a random access memory (random access memory, RAM), or the like.
The processor mentioned in any of the above may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the programs of the above method.
It should be further noted that the above-described apparatus embodiments are merely illustrative, and that the units described as separate units may or may not be physically separate, and that units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the embodiment of the device provided by the application, the connection relation between the modules represents that the modules have communication connection therebetween, and can be specifically implemented as one or more communication buses or signal lines.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present application may be implemented by means of software plus necessary general purpose hardware, or of course may be implemented by dedicated hardware including application specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions can be varied, such as analog circuits, digital circuits, or dedicated circuits. However, a software program implementation is a preferred embodiment in many cases for the present application. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk or an optical disk of a computer, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy Disk, a hard Disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.

Claims (14)

1. A method for obtaining compiled information, comprising:
acquiring an execution command;
determining a command type of the execution command, wherein the command type of the execution command comprises a compiling class command and a non-compiling class command, the compiling class command is a compiling command or a link command, and the non-compiling class command is other execution commands except the compiling class command;
if the command type of the execution command is a compiling type command, the execution command is saved, and the execution command is not executed.
2. The method of claim 1, wherein after said saving said execution command, further comprising:
and generating an empty file with the same file name as the execution command.
3. The method of claim 1 or 2, wherein the non-compiled class command is a compiled process command or a negligible command.
4. The method of claim 3, wherein after determining the command type of the execution command, further comprising:
and if the execution command is the compiling process command, executing the execution command.
5. The method according to claim 3 or 4, wherein after determining the command type of the execution command, further comprising:
and if the execution command is the negligible command, not executing the execution command.
6. An apparatus for obtaining compiled information, comprising:
the acquisition module is used for acquiring the execution command;
the processing module is used for determining the command type of the execution command, wherein the command type of the execution command comprises a compiling command and a non-compiling command, the compiling command is a compiling command or a link command, and the non-compiling command is other execution commands except the compiling command;
and the processing module is further used for storing the execution command without executing the execution command if the command type of the execution command is a compiling type command.
7. The apparatus of claim 6, wherein the device comprises a plurality of sensors,
the processing module is further configured to generate an empty file having the same file name as the execution command.
8. The apparatus of claim 6 or 7, wherein the non-compiled class command is a compiled process command or a negligible command.
9. The apparatus of claim 8, wherein the device comprises a plurality of sensors,
the processing module is further configured to execute the execution command if the execution command is the compiling process command.
10. The apparatus according to claim 8 or 9, wherein,
the processing module is further configured to not execute the execution command if the execution command is the negligible command.
11. A computer readable storage medium, characterized in that the computer readable storage medium stores a program that causes a computer device to execute the method according to any one of claims 1-5.
12. A computer program product, the computer program product comprising computer-executable instructions stored on a computer-readable storage medium; at least one processor of a device reads the computer-executable instructions from the computer-readable storage medium, the at least one processor executing the computer-executable instructions causing the device to perform the method of any one of claims 1-5.
13. A communication device comprising at least one processor, a memory, and a communication interface;
the at least one processor is coupled with the memory and the communication interface;
the memory is used for storing instructions, the processor is used for executing the instructions, and the communication interface is used for communicating with other communication devices under the control of the at least one processor;
the instructions, when executed by the at least one processor, cause the at least one processor to perform the method of any of claims 1-5.
14. A chip system, characterized in that it comprises a processor and a memory, said memory and said processor being interconnected by wires, said memory having instructions stored therein, said processor being adapted to perform the method according to any of claims 1-5.
CN202111411699.7A 2021-11-23 2021-11-23 Method for acquiring compiling information and related equipment Pending CN116149660A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111411699.7A CN116149660A (en) 2021-11-23 2021-11-23 Method for acquiring compiling information and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111411699.7A CN116149660A (en) 2021-11-23 2021-11-23 Method for acquiring compiling information and related equipment

Publications (1)

Publication Number Publication Date
CN116149660A true CN116149660A (en) 2023-05-23

Family

ID=86353191

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111411699.7A Pending CN116149660A (en) 2021-11-23 2021-11-23 Method for acquiring compiling information and related equipment

Country Status (1)

Country Link
CN (1) CN116149660A (en)

Similar Documents

Publication Publication Date Title
US5651111A (en) Method and apparatus for producing a software test system using complementary code to resolve external dependencies
US9134966B2 (en) Management of mixed programming languages for a simulation environment
CN106970880B (en) Distributed automatic software testing method and system
CN103793326A (en) Assembly test method and device
US9946628B2 (en) Embedding and executing trace functions in code to gather trace data
US9594670B2 (en) Managing software dependencies during software testing and debugging
CN104050080B (en) User space debugs the method and system of linux kernel
US9645911B2 (en) System and method for debugging firmware/software by generating trace data
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
CN111813412B (en) Method and system for constructing test data set for evaluating binary code comparison tool
KR20120083800A (en) Apparatus and method for compression of trace data
CN108132876B (en) Embedded software object code unit testing method based on injection mode
CN104134039A (en) Virus checking and killing method, virus checking and killing client, virus checking and killing server and virus checking and killing system
CN112558942A (en) Operator registration method and related product
US20200143061A1 (en) Method and apparatus for tracking location of input data that causes binary vulnerability
CN111813672B (en) Non-invasive coverage rate statistical method for various processor architectures
EP2972880B1 (en) Kernel functionality checker
CN110609703B (en) Performance detection tool implementation method and device, readable storage medium and terminal equipment
KR102165747B1 (en) Lightweight crash report based debugging method considering security
CN116149660A (en) Method for acquiring compiling information and related equipment
US9710360B2 (en) Optimizing error parsing in an integrated development environment
CN110096888B (en) Method and system for accelerating verification and analyzing SMM potential safety hazard
CN107977315B (en) Embedded software object code unit testing method based on Bootloader mode
CN110134405B (en) Method and device for flexibly uploading data to manufacturing execution system
CN117992359B (en) Method and device for observing service software and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication