Debugging information generation method and device, medium and product

By obtaining basic configuration information and user-input file information, and automatically analyzing and generating debugging information, the problems of low efficiency and high error rate of LDBE tools during debugging information compilation process are solved, ensuring the smooth progress of debugging work and the stability of the software.

CN120386711APending Publication Date: 2025-07-29LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510533614.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

The existing LDBE tools are inefficient and have high error rates during the debugging information compilation process, which can easily lead to debugging exceptions and compilation errors, and have a high threshold for use, making it difficult to efficiently troubleshoot problems.

Method used

By obtaining basic configuration information and file information input by users, determining the target file and extracting data definitions, performing dependency analysis based on the data definition type, generating debugging information, automatic calculation without manual intervention, and reducing coding errors.

Benefits of technology

It realizes debugging information generation without manual intervention, reduces the error rate, ensures the smooth progress of debugging work, and improves the stability and reliability of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120386711A_ABST
    Figure CN120386711A_ABST
Patent Text Reader

Abstract

The invention discloses a debugging information generation method and device, a medium and a product, and relates to the technical field of embedding. According to the scheme, by obtaining the basic configuration information and the file information input by the user, the target file is determined, and the data definition in the target file is extracted; determining a data definition type of the data definition according to the basic configuration information, and performing dependency analysis on the data definition in the target file according to the data definition type to obtain dependency path information corresponding to the target file; and finally generating debugging information corresponding to the target file according to the dependency path information. The whole process does not need manual intervention, and the debugging display information can be generated only by carrying out automatic calculation according to the preset basic configuration information and the occupied width and the offset rule specified by the user in the file information, so that manual writing of the debugging display information is avoided, the display disorder of the debugging information caused by coding errors is reduced, and the debugging efficiency is improved. And the debugging work can be smoothly carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of embedded technologies, and particularly to a method, device, medium, and product for generating debugging information. Background Art

[0002] Currently, due to its advantages of open source and high customization, the Linux system is widely used in fields such as servers, embedded systems, and computers. However, the complex interactions among various components in the system make it difficult to troubleshoot problems. As a debugging tool under the Microprocessor Control System (MCS), the Low-Level Debugger and Emulator (LDBE) provides a convenient means for developers and system administrators to locate problems through functions such as online synchronization and remote viewing of memory information, especially performing well when exceptions occur.

[0003] However, currently, the LDBE tool requires manually assembling memory information and formats before compiling debugging information. This process is prone to debugging exceptions and even compilation errors due to offset errors. The current manual organization method not only has low efficiency and high error rates but also requires calculating the byte sizes and offsets of different data types, increasing the difficulty of use and restricting the smooth progress of debugging work.

[0004] In view of the above, how to solve the problems of low efficiency, high error rates, easy occurrence of debugging exceptions and compilation errors, and high usage threshold in the manual assembly of memory information for debugging information compilation based on the current LDBE tool is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0005] The present invention provides a method, device, medium, and product for generating debugging information to at least solve the problems of low efficiency, high error rates, easy occurrence of debugging exceptions and compilation errors, and high usage threshold in the manual assembly of memory information for debugging information compilation based on the current LDBE tool.

[0006] The present invention provides a method for generating debugging information, including:

[0007] Obtaining basic configuration information and file information input by a user; wherein, the basic configuration information at least includes a composite type suffix, a data member type, and a corresponding data occupancy width; the file information at least includes an absolute file path, a name of data to be processed, and a corresponding offset rule;

[0008] Determining a target file for the debugging information to be generated according to the file information, and extracting data definitions in the target file;

[0009] Determining a data definition type of the data definition according to the basic configuration information;

[0010] Perform dependency analysis on the data definitions in the target file according to the data definition type to obtain the dependency path information corresponding to the target file;

[0011] Generate the debug information corresponding to the target file according to the dependency path information.

[0012] The present invention also provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of any of the above debug information generation methods when executing the computer program.

[0013] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program implements the steps of any of the above debug information generation methods when executed by a processor.

[0014] The present invention also provides a computer program product including a computer program, and the computer program implements the steps of any of the above debug information generation methods when executed by a processor.

[0015] The beneficial effect of the present invention is that by obtaining the basic configuration information and the file information input by the user, the target file is determined and the data definitions in the target file are extracted; the data definition type of the data definition is determined according to the basic configuration information, and dependency analysis is performed on the data definitions in the target file according to the data definition type to obtain the dependency path information corresponding to the target file; finally, the debug information corresponding to the target file is generated according to the dependency path information; the whole process does not require manual intervention, and only needs to perform automatic calculation according to the preset basic configuration information and the placeholder width and offset rules specified by the user in the file information, then the debug display information can be generated, avoiding manual writing of the debug display information, reducing the confusion of the debug information display caused by coding errors, and ensuring the smooth progress of the debugging work.

[0016] In addition, the present invention also provides a debug information generation device, medium and product with the same effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0018] Figure 1 It is a flowchart of a debug information generation method provided by an embodiment of the present invention;

[0019] Figure 2 It is a schematic diagram of a debug information generation device provided by an embodiment of the present invention;

[0020] Figure 3 Schematic diagram of an electronic device provided by an embodiment of the present invention. Specific implementation manners

[0021] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.

[0022] It should be noted that in the description of the present invention, the terms "including", "comprising" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present invention are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0023] In order to enable those skilled in the art of the present technology to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.

[0024] Currently, the memory information and format of the LDBE debugging tool need to be manually assembled before compilation, which is prone to debugging exceptions and error location problems due to offset disorders, and incorrect organization may cause compilation errors. This method has low efficiency and high error rate, requires calculating the byte sizes and offsets of different data types, and has a high usage threshold, which is not conducive to debugging. Based on this, the present invention provides a debugging information generation method aimed at solving the above problems. It should be noted that the debugging information generation method provided by the present invention is applied to computing devices such as servers and hosts, and the specific type of the computing device is not limited and depends on the specific implementation situation. The specific steps of the debugging information generation method will be described in detail below in conjunction with specific embodiments.

[0025] Figure 1 Flowchart of a debugging information generation method provided by an embodiment of the present invention, as Figure 1 shown, the method includes:

[0026] S10: Obtain basic configuration information and file information input by the user.

[0027] Among them, the basic configuration information at least includes a composite type suffix, a data member type, and the corresponding data occupancy width; the file information at least includes the absolute file path, the name of the data to be processed, and the corresponding offset rule.

[0028] Specifically, first, obtain the basic configuration information and the file information input by the user. The basic configuration information is the basic information for generating the configuration of the debugging information in advance, and at least includes the data member type, the data occupancy width corresponding to the data member type, and the composite type suffix. It may also include other content, which is not limited in this embodiment. The file information input by the user is the file information of the target file for which the debugging information is to be generated this time, and at least includes the absolute file path, the name of the data to be processed, and the corresponding offset rule (i.e., the data address alignment rule).

[0029] For example, if the user specifies that the file range for generating the debugging information is a single file or multiple files, then add the absolute path of the corresponding file to the file information; if the user needs to perform a special offset on the specified data, the name of the data to be processed that requires a special offset can be specified in the exception item, and a special offset rule can be specified for the data members under the data to be processed in the exception item. The format of the exception item can be the name of the data to be processed - the name of the data member - the offset rule. The exception items can be presented in a list form, and multiple exception items can be specified at the same time.

[0030] S11: Determine the target file for which the debugging information is to be generated according to the file information, and extract the data definitions in the target file.

[0031] Furthermore, scan and obtain the corresponding target file according to the absolute path in the file information. It can be understood that since there may be multiple absolute paths in the file information, the target files for which the debugging information is to be generated this time may also correspond to multiple files. At the same time, extract the data definitions in the target file. The data definition refers to the declaration and description of the data type, data structure, or data entity. It defines the attributes, structure, and behavior of the data, including information such as the name, type, size, and range of the data. In this embodiment, the extraction method of the data definitions in the target file is not limited.

[0032] S12: Determine the data definition type of the data definition according to the basic configuration information.

[0033] S13: Perform a dependency analysis on the data definitions in the target file according to the data definition type to obtain the dependency path information corresponding to the target file.

[0034] Subsequently, determine the data definition type of the data definition according to the basic configuration information, specifically by matching the data member type and / or composite type suffix in the basic configuration information. It should be noted that according to the structure and composition method of the data, the data definition type can be divided into the following two categories: Non-Composite Types, also known as Primitive Data Types, which are the most basic data types in programming languages. They are usually provided by the language itself and directly supported by the hardware. Common non-composite types include integer types, floating-point types, character types, and boolean types, etc. Composite Types, data structures composed of basic data types or other composite data types. They allow multiple data items to be combined together to form a more complex data representation. Common composite types include arrays, structures, classes, unions, and enums, etc. This solution determines the data definition type of the data definition to facilitate the dependency analysis of the data definitions in the target file according to the data definition type, so as to obtain the dependency path information corresponding to the target file.

[0035] In addition, dependency analysis is a method to deeply study the internal dependency relationships of data structures. The dependency analysis in this solution particularly focuses on the dependency situations in nested data structures (such as a structure containing a structure, class inheritance hierarchies, etc.). Through this analysis, the mutual influences between the components of complex data structures can be revealed, thereby helping developers better understand program behavior, ensure data consistency, and support code optimization and refactoring. For example, in a structure, a member variable may depend on a member variable of another nested structure, and this nested dependency relationship needs to be accurately identified and processed to avoid potential errors and performance issues. Nested dependency analysis is crucial for the design and maintenance of complex systems. It can provide a comprehensive insight into the internal relationships of data structures, helping to improve software quality and maintainability.

[0036] It should be noted that in this embodiment, there is no limitation on the specific process of determining the data definition type of the data definition, nor is there a limitation on the dependency analysis process, which depends on the specific implementation situation.

[0037] S14: Generate the debug information corresponding to the target file according to the dependency path information.

[0038] Finally, according to the generated dependency path information, debug information corresponding to the target file is generated to help developers locate and diagnose problems during program execution, enabling developers to quickly understand program behavior, identify and fix errors. For example, memory allocation records are used to identify and resolve memory leak problems, thereby enhancing the stability and reliability of the software. It should be noted that in this embodiment, the specific process of generating debug information corresponding to the target file based on the dependency path information is not limited.

[0039] In this embodiment, by obtaining the basic configuration information and the file information input by the user, the target file is determined and the data definitions in the target file are extracted; according to the basic configuration information, the data definition type of the data definition is determined, and dependency analysis is performed on the data definitions in the target file according to the data definition type to obtain the dependency path information corresponding to the target file; finally, debug information corresponding to the target file is generated according to the dependency path information; the entire process requires no manual intervention, and only automatic calculation is performed according to the preset basic configuration information and the placeholder width and offset rules specified by the user in the file information to generate the debug display information, avoiding manual writing of the debug display information and reducing the confusion of debug information display caused by coding errors, ensuring the smooth progress of the debugging work.

[0040] Based on the above embodiment, in some embodiments, determining the target file for which debug information is to be generated according to the file information, and extracting the data definitions in the target file includes:

[0041] S111: Determine the absolute file path in the file information;

[0042] S112: Obtain the corresponding target file according to the absolute file path, and store the header file information of the target file.

[0043] S113: Extract the data definitions in the target file according to the keywords, and save the data definitions.

[0044] Among them, the keywords include at least macro definitions, enumeration variables, structures, unions, and renamings.

[0045] In order to determine the target file for which debug information is to be generated and extract the data definitions in the target file, in this embodiment, the absolute file path in the file information is specifically determined to facilitate scanning and obtaining the corresponding target file according to the absolute file path and storing the header file information of the target file. The storage format is specifically the absolute path of the file name - header file. At the same time, keywords commonly used in data definitions such as macro definitions, enumeration variables, structures, unions, and renamings are matched to extract and store the data definitions in the target file.

[0046] In this embodiment, the corresponding target file is obtained according to the absolute file path, and the data definition in the target file is extracted according to the keyword, so as to accurately obtain the data definition, which is convenient for subsequent dependency analysis based on the data definition.

[0047] Based on the above embodiment, in some embodiments, determining the data definition type of the data definition according to the basic configuration information includes:

[0048] S121: Determine each data member in the data definition.

[0049] S122: Determine whether the types of each data member match the data member types in the basic configuration information; if so, go to step S123; if not, go to step S124.

[0050] S123: Determine that the data definition type is a non-composite type.

[0051] S124: Determine that the data definition type of the data definition is a composite type.

[0052] S125: Determine the nested composite information of the data definition according to the composite type suffix.

[0053] A data definition is a declaration and description of a data type, data structure, or data entity, which defines the attributes, structure, and behavior of the data. As part of the data definition, a data member is a variable or field contained in a data structure or object, which is used to store the specific value of an instance of the data structure. In this embodiment, in order to determine the type of the data definition, it is first necessary to determine each data member in the data definition.

[0054] Furthermore, each data member is matched with the data member type in the basic configuration information to determine whether the matching is successful. If it is confirmed that the types of the data members all match the data member types in the basic configuration information, it is determined that the data definition type is a non-composite type. If it is confirmed that there is a data member type that fails to match the data member type in the basic configuration information, it is determined that the data definition type of the data definition is a composite type. At this time, it is necessary to determine the nested composite information of the data definition according to the composite type suffix in the basic configuration information. The specific process is as follows:

[0055] In some embodiments, determining the nested composite information of the data definition according to the composite type suffix includes:

[0056] S126: Determine whether the composite type suffix matches the type of the data member; if not, go to step S127; if so, go to step S128.

[0057] S127: End the debugging information generation process and output an error message.

[0058] S128: Determine the nested composite information of the data definition according to the data structure of the target file.

[0059] Specifically, determine whether the composite type suffix matches the type of the data member successfully. If it is confirmed that the composite type suffix fails to match the type of the data member, end the debugging information generation process and output an error message to provide a basis for later manual intervention. The format of the error message can be the absolute path containing the file name - the data name that failed to match - the data member name. If it is confirmed that the composite type suffix matches the type of the data member successfully, determine the nested composite information of the data definition according to the data structure of the target file.

[0060] It should be noted that whenever the composite type rule is needed for matching, whether the matching is successful or not, the nested composite information needs to be stored. The nested composite information includes non-nested composite type information and nested composite type information. The format of the non-nested composite type information is the absolute path containing the target file name, the data definition type, and the corresponding data name; the format of the nested composite type information is the absolute path containing the target file name, the data definition type, and the corresponding data name, the data member type, and the data member name. After determining the nested composite information, it needs to be stored for the next step of processing.

[0061] In this way, the determination of the nested composite information of the data definition is realized, so as to determine the mutual influence between the components in the complex data structure according to the nested composite information in the subsequent dependency analysis, thereby helping developers better understand the program behavior and ensure data consistency.

[0062] Since there can be one or more target files, in the process of dependency analysis, a single target file only needs to perform single-file dependency analysis and does not need to perform cross-file analysis. Multiple target files need to perform both single-file dependency analysis and cross-file analysis. Therefore, the following will combine the number of different target files to elaborate on the dependency analysis process in detail:

[0063] (1) When there is only one target file;

[0064] Based on the above embodiments, in some embodiments, perform dependency analysis on the data definitions in the target file according to the data definition type, including:

[0065] S130: Select the current non-nested composite type information from all the non-nested composite type information corresponding to the target file.

[0066] S131: Select the current nested composite type information from all the nested composite type information corresponding to the target file.

[0067] S132: Determine whether the current nested composite type information uses the current non-nested composite type information; if so, proceed to step S133; if not, end the current determination process.

[0068] S133: Delete the current nested composite type information.

[0069] S134: Select the next current nested composite type information from the remaining nested composite type information, and return to step S132 until all nested composite type information has been selected.

[0070] S135: Select the next current non-nested composite type information from the remaining non-nested composite type information, and return to step S131 until all non-nested composite type information has been selected.

[0071] S136: Determine whether there is any nested composite type information that does not use any non-nested composite type information; if so, proceed to step S137; if not, proceed to step S138.

[0072] S137: Output an alarm message indicating that cross-file analysis is required.

[0073] S138: End the dependency analysis process and generate dependency path information.

[0074] Specifically, when there is only one target file, only single-file dependency analysis needs to be performed. First, select the current non-nested composite type information from all the non-nested composite type information corresponding to the target file. It can be understood that the current non-nested composite type information can be any one of all the non-nested composite type information. Subsequently, select the current nested composite type information from all the nested composite type information corresponding to the target file. It can be understood that the current nested composite type information can be any one of all the nested composite type information.

[0075] Determine whether the current nested composite type information uses the current non-nested composite type information, that is, determine whether the current nested composite type information is nested and composite-included by the current non-nested composite type information. If it is confirmed that the current nested composite type information uses the current non-nested composite type information, it means that there is a member definition of a composite type in the target file that depends on the data definition corresponding to the current non-nested composite type information. Therefore, cross-file dependency analysis is no longer required, and the current nested composite type information can be deleted. If it is confirmed that the current nested composite type information does not use the current non-nested composite type information, end the current determination process.

[0076] Further, select the next current nested composite type information from the remaining nested composite type information, and return to the step of determining whether the current nested composite type information uses the current non-nested composite type information, so as to loop through and read each nested composite type information corresponding to the target file until all nested composite type information is selected.

[0077] After all nested composite type information is selected, select the next current non-nested composite type information from the remaining non-nested composite type information, and return to the step of selecting the current nested composite type information from all nested composite type information corresponding to the target file, so as to loop through and read each non-nested composite type information corresponding to the target file until all non-nested composite type information is selected.

[0078] Finally, after all non-nested composite type information and all nested composite type information in the target file are successfully matched, determine whether there is any nested composite type information that does not use any non-nested composite type information. If it is confirmed that there is nested composite type information that does not use any non-nested composite type information, it indicates that the corresponding composite type data definition does not depend on the composite type data definition of the current target file. Output an alarm message indicating that cross-file analysis is required to prompt the user to add file information content. If it is confirmed that there is no nested composite type information that does not use any non-nested composite type information, end the dependency analysis process of the target file and generate dependency path information.

[0079] It should be noted that in this embodiment, the generation process of the dependency path information is not restricted.

[0080] (2) When there are multiple target files,

[0081] Based on the above embodiment, in some embodiments, the dependency analysis of the data definitions in the target files according to the data definition type includes:

[0082] S139: Perform single-file dependency analysis on each target file according to the corresponding non-nested composite type information and nested composite type information, so as to obtain the non-nested composite type information and nested composite type information after the corresponding single-file dependency analysis.

[0083] S140: Perform cross-file dependency analysis on each target file respectively according to the non-nested composite type information and nested composite type information after the corresponding single-file dependency analysis, and generate dependency path information.

[0084] When there are multiple target files, it is first necessary to perform single-file dependency analysis on each target file according to the non-nested composite type information and nested composite type information corresponding to each target file, so as to obtain the non-nested composite type information and nested composite type information after the corresponding single-file dependency analysis. Further, according to the non-nested composite type information and nested composite type information after the single-file dependency analysis corresponding to each target file, cross-file dependency analysis is performed on each target file respectively, and dependency path information is generated. The following is a specific description:

[0085] (1) Single-file dependency analysis of multiple target files;

[0086] According to the corresponding non-nested composite type information and nested composite type information, perform single-file dependency analysis on each target file, including:

[0087] S141: Select the current file from all target files.

[0088] S142: Select the current non-nested composite type information from all non-nested composite type information corresponding to the current file.

[0089] S143: Select the current nested composite type information from all nested composite type information corresponding to the current file.

[0090] S144: Determine whether the current nested composite type information uses the current non-nested composite type information; if so, go to step S145; if not, end the current judgment process.

[0091] S145: Delete the current nested composite type information.

[0092] S146: Select the next current nested composite type information from the remaining nested composite type information, and return to step S144 until all nested composite type information is selected.

[0093] S147: Select the next current non-nested composite type information from the remaining non-nested composite type information, and return to step S143 until all non-nested composite type information is selected.

[0094] S148: Select the next current file from the remaining target files, and return to step S142 until all target files are selected, obtaining the non-nested composite type information and nested composite type information after the single-file dependency analysis corresponding to each target file.

[0095] First, select the current file from all target files. It can be understood that the current file can be any one of all target files. Select the current non-nested composite type information from all non-nested composite type information corresponding to the current file; the current non-nested composite type information can be any one of all non-nested composite type information corresponding to the current file. Select the current nested composite type information from all nested composite type information corresponding to the current file; the current nested composite type information can be any one of all nested composite type information corresponding to the current file.

[0096] Determine whether the current nested composite type information uses the current non-nested composite type information, that is, determine whether the current nested composite type information is nested and included by the current non-nested composite type information. If it is confirmed that the current nested composite type information uses the current non-nested composite type information, it means that there is a member definition of a composite type in the target file that depends on the data definition corresponding to the current non-nested composite type information. Therefore, there is no need to perform cross-file dependency analysis, and the current nested composite type information can be deleted. If it is confirmed that the current nested composite type information does not use the current non-nested composite type information, end the current judgment process.

[0097] Further select the next current nested composite type information from the remaining nested composite type information, and return to the step of determining whether the current nested composite type information uses the current non-nested composite type information, so as to loop through each nested composite type information corresponding to the current file until all nested composite type information is selected.

[0098] After all nested composite type information is selected, select the next current non-nested composite type information from the remaining non-nested composite type information, and return to the step of selecting the current nested composite type information from all nested composite type information corresponding to the current file, so as to loop through each non-nested composite type information corresponding to the current file until all non-nested composite type information is selected.

[0099] After all non-nested composite type information is selected, it means that the matching process of the non-nested composite type information and the nested composite type information of the current file has ended. Select the next current file from the remaining target files, and return to the step of selecting the current non-nested composite type information from all non-nested composite type information corresponding to the current file until all target files are selected and matched, and obtain the non-nested composite type information and nested composite type information after single-file dependency analysis corresponding to each target file.

[0100] (2) Cross-file dependency analysis of multiple target files;

[0101] According to the non-nested composite type information and nested composite type information after the corresponding single-file dependency analysis, perform cross-file dependency analysis on each target file respectively, including:

[0102] S150: Determine the specified file corresponding to the target file, and select the current specified file from each specified file.

[0103] S151: Select the current nested composite type information from all the nested composite type information corresponding to the target file.

[0104] S152: Select the current non-nested composite type information from all the non-nested composite type information corresponding to the current specified file.

[0105] S153: Determine whether the current nested composite type information matches the current non-nested composite type information; if so, go to step S154; if not, end the current judgment process.

[0106] S154: Delete the current nested composite type information.

[0107] S155: Select the next current non-nested composite type information from the remaining non-nested composite type information corresponding to the current specified file, and return to step S153 until all the non-nested composite type information of the current specified file is selected.

[0108] S156: Select the next current nested composite type information from the remaining nested composite type information corresponding to the target file, and return to step S152 until all the nested composite type information of the target file is selected.

[0109] S157: Select the next current specified file from each specified file, and return to step S151 until all the specified files are selected, completing the cross-file dependency analysis of the target file.

[0110] First, determine the specified file corresponding to the target file. It should be noted that the specified file is associated or dependent on the target file. The specified file can be located in multiple target files that need to generate debug information this time, or it can be none of the target files. At the same time, select the current specified file from each specified file. It can be understood that the current specified file can be any file among the specified files. Subsequently, select the current nested composite type information from all the nested composite type information corresponding to the target file. It can be understood that the current nested composite type information can be any one of the nested composite type information in all the nested composite type information. Select the current non-nested composite type information from all the non-nested composite type information corresponding to the current specified file; the current non-nested composite type information can be any one of the non-nested composite type information in all the non-nested composite type information.

[0111] Further determine whether the current nested composite type information matches the current non-nested composite type information. If it is confirmed that the current nested composite type information matches the current non-nested composite type information, delete the current nested composite type information. If the current nested composite type information does not match the current non-nested composite type information, end the current judgment process. Subsequently, select the next current non-nested composite type information from the remaining non-nested composite type information corresponding to the current specified file, so as to cyclically read all the non-nested composite type information corresponding to the current specified file, and return to the step of determining whether the current nested composite type information matches the current non-nested composite type information to perform the next round of matching until all the non-nested composite type information of the current specified file is selected.

[0112] After all the non-nested composite type information of the current specified file is selected, select the next current nested composite type information from the remaining nested composite type information corresponding to the target file, so as to cyclically read all the nested composite type information matching the target file, and return to the step of selecting the current non-nested composite type information from all the non-nested composite type information corresponding to the current specified file to perform the next round of selection and matching until all the nested composite type information of the target file is selected.

[0113] After all the nested composite type information of the target file is selected, further select the next current specified file from each specified file, and return to the step of selecting the current nested composite type information from all the nested composite type information corresponding to the target file, so as to use the non-nested composite type information of the remaining specified files to match the nested composite type information of the target file until all the specified files are selected, and complete the cross-file dependency analysis of the target file.

[0114] In this way, when there is one target file, single-file dependency analysis is performed using the nested composite type information and non-nested composite type information of the target file; when there are multiple target files, single-file dependency analysis is performed using the nested composite type information and non-nested composite type information of the target file, and cross-file dependency analysis is performed using the nested composite type information of the target file and the non-nested composite type information of the corresponding specified files, realizing the determination of the dependency relationship between data definitions in the target file, which can help understand program behavior, optimize performance, ensure data consistency, and support code refactoring and maintenance.

[0115] On the basis of the above embodiments, after all the specified files are selected, it further includes:

[0116] S158: Determine whether there is nested composite type information in the target file that does not match the non-nested composite type information of each specified file; if so, enter step S159; if not, end.

[0117] S159: Recursively search for the files corresponding to each specified file.

[0118] S160: Obtain the non-nested composite type information of the files corresponding to each specified file.

[0119] S161: Match the remaining nested composite type information of the target file with the non-nested composite type information of the files corresponding to each specified file, so as to delete the corresponding nested composite type information when the matching is successful.

[0120] In a specific implementation, when performing cross-file dependency analysis on the target file and after all specified files are selected, further determine whether the target file has nested composite type information that does not match any of the non-nested composite type information of the specified files. If it exists, it means that all non-nested composite type information of the specified files corresponding to the target file does not match, and the files corresponding to each specified file can be further recursively searched.

[0121] It should be noted that when recursively searching for the files corresponding to the specified file, specifically, first search for file A corresponding to the specified file, and obtain the non-nested composite type information of file A corresponding to each specified file. Match the remaining nested composite type information of the target file with the non-nested composite type information of file A corresponding to each specified file, so as to delete the corresponding nested composite type information when the matching is successful. The specific process is the same as that in the above embodiment and will not be elaborated in this embodiment. If all non-nested composite type information of file A corresponding to the specified file does not match, it means that all non-nested composite type information of file A corresponding to the specified file also does not match. Further recursively search for file B corresponding to file A and repeat the matching process until there is no unmatched nested composite type information.

[0122] In addition, after all specified files are selected, it further includes:

[0123] S162: Determine whether the target file has nested composite type information that does not match any of the non-nested composite type information of the specified files; if not, end; if so, enter step S163.

[0124] S163: Obtain all files in the system.

[0125] S164: Obtain the non-nested composite type information corresponding to all files.

[0126] S165: Match the remaining nested composite type information of the target file with the non-nested composite type information corresponding to all files, so as to delete the corresponding nested composite type information when the matching is successful.

[0127] In a specific implementation, during the cross-file dependency analysis of the target file, after all the specified files are selected, it is further determined whether the target file has nested composite type information that does not match any of the non-nested composite type information of the specified files. If it exists, it means that all the non-nested composite type information of the specified files corresponding to the target file does not match. All files in the system can be further obtained, and the remaining nested composite type information of the target file is respectively matched with the non-nested composite type information corresponding to all files, so that when the matching is successful, the corresponding nested composite type information can be deleted. The specific matching process is the same as that in the above embodiment and will not be elaborated here.

[0128] In this embodiment, when the target file has nested composite type information that does not match any of the non-nested composite type information of the specified files, the non-nested composite type information of the files corresponding to the specified files or all files in the system is used to match the remaining nested composite type information of the target file, which can ensure the deletion of all nested composite type information of the target file, achieve deduplication of the composite type, and improve the efficiency of generating debugging information.

[0129] Based on the above embodiment, in some embodiments, generating dependency path information includes:

[0130] S171: Determine the target non-nested composite type information corresponding to the target file after dependency analysis.

[0131] S172: Merge the absolute path of the target non-nested composite type information with the target non-nested composite type information to generate dependency path information.

[0132] To generate dependency path information, after the dependency analysis of the target file is completed, it is necessary to determine the target non-nested composite type information corresponding to the target file after dependency analysis, that is, the finally remaining non-nested composite type information. Further, the absolute path of the target non-nested composite type information is merged with the target non-nested composite type information, and the format is absolute path - target non-nested composite type information, realizing the generation of dependency path information, so as to generate debugging information based on accurate dependency path information.

[0133] Finally, to generate the debugging information corresponding to the target file, the dependency path information is specifically added to the header file information of the target file, and the modification of the target file is completed to generate the debugging information corresponding to the target file.

[0134] In addition, after generating the debugging information of the target file, the memory allocation records recorded in the debugging information can be used, including the address, size, allocation location (such as file name and line number) of each memory allocation, and the call stack information, to track the life cycle of the memory block and check whether there are memory blocks that have not been released. For example, when the program ends or a specific module is unloaded, it should be ensured that all allocated memory is correctly released. If it is found that some memory blocks still exist after the expected release point, there may be a memory leak. By promptly discovering and fixing memory leak problems, the program crash or performance degradation caused by memory exhaustion can be avoided, thereby improving the stability and reliability of the software.

[0135] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0136] Figure 2 It is a schematic diagram of a debugging information generation device provided by an embodiment of the present invention. As Figure 2 described, the device includes:

[0137] An acquisition module 10, configured to acquire basic configuration information and file information input by a user; wherein, the basic configuration information at least includes a composite type suffix, a data member type, and a corresponding data occupancy width; the file information at least includes an absolute file path, a name of data to be processed, and a corresponding offset rule.

[0138] A first determination module 11, configured to determine a target file for which debugging information is to be generated according to the file information, and extract data definitions in the target file.

[0139] A second determination module 12, configured to determine a data definition type of the data definition according to the basic configuration information.

[0140] An analysis module 13, configured to perform dependency analysis on the data definitions in the target file according to the data definition type to obtain dependency path information corresponding to the target file.

[0141] A generation module 14, configured to generate debugging information corresponding to the target file according to the dependency path information.

[0142] In some embodiments, the first determination module 11 includes:

[0143] A first determination sub-module, configured to determine the absolute file path in the file information;

[0144] A first acquisition sub-module, configured to acquire a corresponding target file according to the absolute file path and store header file information of the target file;

[0145] The first extraction sub-module is used to extract data definitions from the target file according to keywords and save the data definitions;

[0146] Among them, the keywords at least include macro definitions, enumeration variables, structures, unions, and renaming.

[0147] In some embodiments, the second determination module 12 includes:

[0148] The second determination sub-module is used to determine each data member in the data definition;

[0149] The first judgment sub-module is used to judge whether the types of each data member match the data member types in the basic configuration information; if so, determine that the data definition type is a non-composite type; if not, determine that the data definition type of the data definition is a composite type;

[0150] The third determination sub-module is used to determine the nested composite information of the data definition according to the composite type suffix.

[0151] In some embodiments, the third determination sub-module includes:

[0152] The second judgment sub-module is used to judge whether the composite type suffix matches the type of the data member successfully; if not, end the debugging information generation process and output an error message; if so, determine the nested composite information of the data definition according to the data structure of the target file;

[0153] Among them, the nested composite information includes non-nested composite type information and nested composite type information; the non-nested composite type information includes the absolute path of the target file, the data definition type, and the corresponding data name; the nested composite type information includes the absolute path of the target file, the data definition type, and the corresponding data name, the data member type, and the data member name.

[0154] In some embodiments, the analysis module 13 includes:

[0155] The first selection sub-module is used to select the current non-nested composite type information from all the non-nested composite type information corresponding to the target file;

[0156] The second selection sub-module is used to select the current nested composite type information from all the nested composite type information corresponding to the target file;

[0157] The third judgment sub-module is used to judge whether the current nested composite type information uses the current non-nested composite type information; if it is confirmed that the current nested composite type information uses the current non-nested composite type information, delete the current nested composite type information; if it is confirmed that the current nested composite type information does not use the current non-nested composite type information, end the current judgment process;

[0158] The third selection sub-module is used to select the next current nested composite type information from the remaining nested composite type information, triggering the third judgment sub-module until all nested composite type information is selected;

[0159] The fourth selection sub-module is used to select the next current non-nested composite type information from the remaining non-nested composite type information, triggering the second selection sub-module until all non-nested composite type information is selected;

[0160] The fourth judgment sub-module is used to judge whether there is any nested composite type information that does not use any non-nested composite type information; if it is confirmed that there is nested composite type information that does not use any non-nested composite type information, an alarm message indicating that cross-file analysis is required is output; if it is confirmed that there is no nested composite type information that does not use any non-nested composite type information, the dependency analysis process is ended, and the dependency path information generation module is triggered;

[0161] The dependency path information generation module is used to generate dependency path information.

[0162] In some embodiments, the analysis module 13 includes:

[0163] The single-file dependency analysis module is used to perform single-file dependency analysis on each target file according to the corresponding non-nested composite type information and nested composite type information, so as to obtain the non-nested composite type information and nested composite type information after single-file dependency analysis;

[0164] The cross-file dependency analysis module is used to perform cross-file dependency analysis on each target file according to the non-nested composite type information and nested composite type information after the corresponding single-file dependency analysis, and trigger the dependency path information generation module.

[0165] In some embodiments, the single-file dependency analysis module includes:

[0166] The fifth selection sub-module is used to select the current file from all target files;

[0167] The sixth selection sub-module is used to select the current non-nested composite type information from all non-nested composite type information corresponding to the current file;

[0168] The seventh selection sub-module is used to select the current nested composite type information from all nested composite type information corresponding to the current file;

[0169] The fifth judgment sub-module is used to determine whether the current nested composite type information uses the current non-nested composite type information; if it is confirmed that the current nested composite type information uses the current non-nested composite type information, the current nested composite type information is deleted; if it is confirmed that the current nested composite type information does not use the current non-nested composite type information, the current judgment process ends;

[0170] The eighth selection sub-module is used to select the next current nested composite type information from the remaining nested composite type information, trigger the fifth judgment sub-module until all nested composite type information is selected;

[0171] The ninth selection sub-module is used to select the next current non-nested composite type information from the remaining non-nested composite type information, trigger the seventh selection sub-module until all non-nested composite type information is selected;

[0172] The tenth selection sub-module is used to select the next current file from the remaining target files, trigger the sixth selection sub-module until all target files are selected, and obtain the non-nested composite type information and nested composite type information after single-file dependency analysis corresponding to each target file.

[0173] In some embodiments, the cross-file dependency analysis module includes:

[0174] The eleventh selection sub-module is used to determine the specified file corresponding to the target file and select the current specified file from each specified file;

[0175] The twelfth selection sub-module is used to select the current nested composite type information from all the nested composite type information corresponding to the target file;

[0176] The thirteenth selection sub-module is used to select the current non-nested composite type information from all the non-nested composite type information corresponding to the current specified file;

[0177] The sixth judgment sub-module is used to determine whether the current nested composite type information matches the current non-nested composite type information; if it is confirmed that the current nested composite type information matches the current non-nested composite type information, the current nested composite type information is deleted; if the current nested composite type information does not match the current non-nested composite type information, the current judgment process ends;

[0178] The fourteenth selection sub-module is used to select the next current non-nested composite type information from the remaining non-nested composite type information corresponding to the current specified file, trigger the sixth judgment sub-module until all the non-nested composite type information of the current specified file is selected;

[0179] The fifteenth selection sub-module selects the next current nested composite type information from the remaining nested composite type information corresponding to the target file, triggers the thirteenth selection sub-module until all the nested composite type information of the target file is selected;

[0180] The sixteenth selection sub-module is used to select the next current specified file from each specified file, trigger the twelfth selection sub-module until all specified files are selected, and complete the cross-file dependency analysis of the target file.

[0181] In some embodiments, it further includes:

[0182] The seventh judgment sub-module is used to judge whether the target file has nested composite type information that does not match any of the non-nested composite type information of each specified file; if so, recursively search for the files corresponding to each specified file;

[0183] The second acquisition sub-module is used to acquire the non-nested composite type information of the files corresponding to each specified file;

[0184] The first matching sub-module is used to match the remaining nested composite type information of the target file with the non-nested composite type information of the files corresponding to each specified file, so as to delete the corresponding nested composite type information when the matching is successful.

[0185] In some embodiments, it further includes:

[0186] The eighth judgment sub-module is used to judge whether the target file has nested composite type information that does not match any of the non-nested composite type information of each specified file; if so, acquire all the files in the system;

[0187] The third acquisition sub-module is used to acquire the non-nested composite type information corresponding to all the files;

[0188] The second matching sub-module is used to match the remaining nested composite type information of the target file with the non-nested composite type information corresponding to all the files, so as to delete the corresponding nested composite type information when the matching is successful.

[0189] In some embodiments, the dependency path information generation module includes:

[0190] The fourth determination sub-module is used to determine the target non-nested composite type information corresponding to the target file after the dependency analysis;

[0191] The merging sub-module is used to merge the absolute path of the target non-nested composite type information with the target non-nested composite type information to generate dependency path information.

[0192] In some embodiments, the generation module 14 includes:

[0193] An adding module, configured to add dependency path information to the header file information of a target file to generate debugging information corresponding to the target file.

[0194] For the description of the features in the embodiments corresponding to the debugging information generation device, reference can be made to the relevant description in the embodiments corresponding to the debugging information generation method, which will not be elaborated here one by one.

[0195] Figure 3 The following is a schematic diagram of an electronic device provided by an embodiment of the present invention. As Figure 3 shown, an embodiment of the present invention further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above embodiments of the debugging information generation method.

[0196] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the above embodiments of the debugging information generation method when running.

[0197] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk or optical disc, etc., various media that can store computer programs.

[0198] An embodiment of the present invention further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the above embodiments of the debugging information generation method.

[0199] An embodiment of the present invention further provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the above embodiments of the debugging information generation method.

[0200] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present invention.

[0201] The above has introduced in detail a method, device, medium and product for generating debugging information provided by the present invention. Specific examples are used in this article to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the present invention.

Claims

1. A method for generating debugging information, characterized in that, Including: Obtain basic configuration information and file information input by the user; wherein, the basic configuration information at least includes a composite type suffix, a data member type, and a corresponding data occupancy width; the file information at least includes a file absolute path, a name of data to be processed, and a corresponding offset rule; Determine a target file for which debugging information is to be generated according to the file information, and extract data definitions in the target file; Determine a data definition type of the data definition according to the basic configuration information; Perform a dependency analysis on the data definition in the target file according to the data definition type to obtain dependency path information corresponding to the target file; Generate debugging information corresponding to the target file according to the dependency path information.

2. The debugging information generation method according to claim 1, wherein Determine a target file for which debugging information is to be generated according to the file information, and extract data definitions in the target file, including: Determine the file absolute path in the file information; Obtain the corresponding target file according to the file absolute path, and store header file information of the target file; Extract the data definition in the target file according to keywords, and save the data definition; Wherein, the keywords at least include macro definitions, enumerated variables, structures, unions, and renaming.

3. The debugging information generation method according to claim 1, wherein Determine a data definition type of the data definition according to the basic configuration information, including: Determine each data member in the data definition; Judge whether types of all the data members match types of the data members in the basic configuration information; If so, determine that the data definition type is a non-composite type; If not, determine that the data definition type of the data definition is a composite type; Determine nested composite information of the data definition according to the composite type suffix.

4. The debugging information generation method according to claim 3, wherein Determine nested composite information of the data definition according to the composite type suffix, including: Judge whether the composite type suffix matches the type of the data member successfully; If not, end the debugging information generation process and output an error message; If so, determine the nested composite information of the data definition according to a data structure of the target file; Wherein, the nested composite information includes non-nested composite type information and nested composite type information; the non-nested composite type information includes the absolute path of the target file, the data definition type, and a corresponding data name; the nested composite type information includes the absolute path of the target file, the data definition type, and a corresponding data name, a data member type, and a data member name.

5. The debugging information generation method according to claim 4, wherein When there is only one target file, perform a dependency analysis on the data definition in the target file according to the data definition type, including: Select current non-nested composite type information from all the non-nested composite type information corresponding to the target file; Select current nested composite type information from all the nested composite type information corresponding to the target file; Judge whether the current nested composite type information uses the current non-nested composite type information; If it is confirmed that the current nested composite type information uses the current non-nested composite type information, delete the current nested composite type information; If it is confirmed that the current nested composite type information does not use the current non-nested composite type information, end the current judgment process; Select the next current nested composite type information from the remaining nested composite type information, and return to the step of judging whether the current nested composite type information uses the current non-nested composite type information until all the nested composite type information is selected; Select the next current non-nested composite type information from the remaining non-nested composite type information, and return to the step of selecting the current nested composite type information from all the nested composite type information corresponding to the target file until all the non-nested composite type information is selected; Judge whether there is any nested composite type information that does not use any non-nested composite type information; If it is confirmed that there is any nested composite type information that does not use any non-nested composite type information, output an alarm message indicating that cross-file analysis is required; If it is confirmed that there is no nested composite type information that does not use any non-nested composite type information, end the dependency analysis process and generate the dependency path information.

6. The debugging information generation method according to claim 4, wherein When there are multiple target files, perform dependency analysis on the data definitions in the target files according to the data definition type, including: Perform single-file dependency analysis on each target file according to the corresponding non-nested composite type information and nested composite type information to obtain the non-nested composite type information and nested composite type information after the corresponding single-file dependency analysis; Perform cross-file dependency analysis on each target file respectively according to the non-nested composite type information and nested composite type information after the corresponding single-file dependency analysis, and generate the dependency path information.

7. The debugging information generation method according to claim 6, characterized in that, Perform single-file dependency analysis on each target file according to the corresponding non-nested composite type information and nested composite type information, including: Select the current file from all the target files; Select the current non-nested composite type information from all the non-nested composite type information corresponding to the current file; Select the current nested composite type information from all the nested composite type information corresponding to the current file; Judge whether the current nested composite type information uses the current non-nested composite type information; If it is confirmed that the current nested composite type information uses the current non-nested composite type information, delete the current nested composite type information; If it is confirmed that the current nested composite type information does not use the current non-nested composite type information, end the current judgment process; Select the next current nested composite type information from the remaining nested composite type information, and return to the step of judging whether the current nested composite type information uses the current non-nested composite type information until all the nested composite type information is selected; Select the next current non-nested composite type information from the remaining non-nested composite type information, and return to the step of selecting the current nested composite type information from all the nested composite type information corresponding to the current file until all the non-nested composite type information is selected; Select the next current file from the remaining target files, and return to the step of selecting the current non-nested composite type information from all the non-nested composite type information corresponding to the current file, until all the target files are selected, so as to obtain the non-nested composite type information and the nested composite type information after single-file dependency analysis corresponding to each target file.

8. The debugging information generation method according to claim 6, wherein According to the non-nested composite type information and the nested composite type information after single-file dependency analysis, perform cross-file dependency analysis on each target file respectively, including: Determine the specified file corresponding to the target file, and select the current specified file from each specified file; Select the current nested composite type information from all the nested composite type information corresponding to the target file; Select the current non-nested composite type information from all the non-nested composite type information corresponding to the current specified file; Judge whether the current nested composite type information matches the current non-nested composite type information; If it is confirmed that the current nested composite type information matches the current non-nested composite type information, delete the current nested composite type information; If the current nested composite type information does not match the current non-nested composite type information, end the current judgment process; Select the next current non-nested composite type information from the remaining non-nested composite type information corresponding to the current specified file, and return to the step of judging whether the current nested composite type information matches the current non-nested composite type information, until all the non-nested composite type information corresponding to the current specified file is selected; Select the next current nested composite type information from the remaining nested composite type information corresponding to the target file, and return to the step of selecting the current non-nested composite type information from all the non-nested composite type information corresponding to the current specified file, until all the nested composite type information corresponding to the target file is selected; Select the next current specified file from each specified file, and return to the step of selecting the current nested composite type information from all the nested composite type information corresponding to the target file, until all the specified files are selected, and complete the cross-file dependency analysis of the target file.

9. The debugging information generation method according to claim 8, wherein After all the specified files are selected, it further includes: Judge whether the target file has nested composite type information that does not match the non-nested composite type information of each specified file; If so, recursively search for the files corresponding to each specified file; Obtain the non-nested composite type information of the files corresponding to each specified file; Match the remaining nested composite type information of the target file with the non-nested composite type information of the files corresponding to each specified file, so as to delete the corresponding nested composite type information when the matching is successful.

10. The debugging information generation method according to claim 7, wherein After all the specified files are selected, it further includes: Judge whether the target file has nested composite type information that does not match the non-nested composite type information of each specified file; If so, obtain all the files in the system; Obtain the non-nested composite type information corresponding to all the files; Match the remaining nested composite type information of the target file with the non-nested composite type information corresponding to all files, so as to delete the corresponding nested composite type information when the matching is successful.

11. The debugging information generation method according to any one of claims 5 to 10, characterized in that, Generate the dependency path information, including: Determine the target non-nested composite type information corresponding to the target file after dependency analysis; Merge the absolute path of the target non-nested composite type information with the target non-nested composite type information to generate the dependency path information.

12. The debugging information generation method according to claim 11, wherein Generate the debug information corresponding to the target file according to the dependency path information, including: Add the dependency path information to the header file information of the target file to generate the debug information corresponding to the target file.

13. An electronic device, characterized in that, Including: A memory for storing a computer program; A processor for implementing the steps of the debug information generation method according to any one of claims 1 to 12 when executing the computer program.

14. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of the debug information generation method according to any one of claims 1 to 12 when executed by a processor.

15. A computer program product, comprising a computer program, characterized in that, The computer program implements the steps of the debug information generation method according to any one of claims 1 to 12 when executed by a processor.