Debugging information processing method and device for program debugging, equipment and storage medium

By analyzing debugging information from the executable file and automatically finding and parsing the address information of the structure variable members, the problem of cumbersome manual code parsing in the existing technology is solved and efficiency is improved.

CN120216342APending Publication Date: 2025-06-27CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510346999.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In the prior art, it is necessary to manually parse the code to obtain information about structure member variables, which is cumbersome and inefficient.

Method used

By obtaining debug information from the executable file, searching for debug information items of the structure variable members to be found, analyzing their addressing information, and finally obtaining the address information of the structure variable members.

Benefits of technology

It realizes automatic parsing of the storage addresses of structure variable members, improving the resolution efficiency and reducing the need for manual operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216342A_ABST
    Figure CN120216342A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electric digital processing, in particular to a debugging information processing method and device for program debugging, equipment and a storage medium. The method comprises the steps of obtaining debugging information in an executable file and a to-be-searched structural body variable member, and searching a debugging information item of a corresponding structural body variable and a debugging information item of the structural body variable member based on the to-be-searched structural body variable member; addressing information of the to-be-searched structural body variable member is obtained based on the obtained debugging information item; and obtaining address information of the to-be-searched structural body variable member based on the addressing information. According to the method and the device, the address information of the structural member variables can be analyzed from the executable file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of digital signal processing technology, and more particularly, to a method, device, equipment and storage medium for processing debugging information in program debugging. Background Art

[0002] In the fields of computer software development, compilation principle, and data structure and algorithms, an executable file contains object code, data, and other necessary information to enable an operating system to load and execute a program. Among them, various structures are used to organize and manage this data and code.

[0003] Structure member variables are mainly used to describe file metadata, section information, program loading information, and symbol and relocation information. These structures and their member variables are the key to understanding file formats and implementing tools such as linkers and loaders.

[0004] In the prior art, it is necessary to manually parse the code to obtain information about the structure and its members, which is cumbersome and inefficient. Summary of the Invention

[0005] The purpose of the present application is to provide a method, device, equipment and storage medium for processing debugging information in program debugging to parse the address information of structure member variables from an executable file.

[0006] To achieve the above purpose, the present application adopts the following technical solutions: In a first aspect, the present application provides a method for processing debugging information in program debugging, including: Obtaining debugging information in an executable file; the debugging information includes debugging information items of multiple structure variables; Obtaining a structure variable member to be searched for; Based on the structure variable member to be searched for, searching for the corresponding debugging information item of the structure variable and the debugging information item of the structure variable member; Obtaining the addressing information of the structure variable member to be searched for based on the obtained debugging information item; Obtaining the address information of the structure variable member to be searched for based on the addressing information.

[0007] In a second aspect, the present application provides a device for processing debugging information in program debugging, including: A first obtaining module for obtaining debugging information in an executable file; the debugging information includes debugging information items of multiple structure variables; A second obtaining module for obtaining a structure variable member to be searched for; A search module, configured to search for debug information items of a corresponding structure variable and debug information items of structure variable members based on the structure variable members to be searched; An addressing module, configured to obtain addressing information of structure variable members to be searched based on the obtained debug information items; An address obtaining module, configured to obtain address information of structure variable members to be searched based on the addressing information.

[0008] In a third aspect, the present application provides an electronic device, including: At least one processor, and a memory communicatively connected to at least one of the processors; Wherein, the memory stores instructions executable by at least one of the processors, and the instructions are executed by at least one of the processors so that at least one of the processors can execute any of the debug information processing methods for program debugging.

[0009] In a fourth aspect, the present application provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to cause the computer to execute any of the debug information processing methods for program debugging.

[0010] Compared with the prior art, the beneficial effects of the present application are: In the embodiment of the present application, first, debug information in an executable file and structure variable members to be searched are obtained, and then debug information items of corresponding structure variables are searched based on the structure variable members to be searched, so as to obtain addressing information of the structure variable members by parsing the debug information items. Finally, the address information of the structure variable members is obtained according to the addressing information. The embodiment of the present application automatically parses the storage address of the structure variable members according to the debug information, improving the parsing efficiency. Description of the Drawings

[0011] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0012] Figure 1 It is a flowchart of a debug information processing method for program debugging provided by an embodiment of the present application; Figure 2 It is a flowchart of another debug information processing method for program debugging provided by an embodiment of the present application; Figure 3It is a tree structure of debugging information items of structure variables and members provided by an embodiment of the present application; Figure 4 It is a schematic structural diagram of a debugging information processing device for program debugging provided by an embodiment of the present application; Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0013] The following describes exemplary embodiments of the present application with reference to the accompanying drawings. Various details of the embodiments of the present application are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0014] The solution provided by the embodiment of the present application is used to parse the storage addresses of structure variable members from an executable file, and has wide applications in fields such as debugging, reverse engineering, performance optimization, security analysis, and embedded development. By parsing the addresses, precise control and in-depth analysis of program data can be achieved, thereby improving development efficiency, optimizing performance, and enhancing security.

[0015] Figure 1 It is a flowchart of a debugging information processing method for program debugging provided by this embodiment. This method can be executed by an electronic device. As Figure 1 shown, this method includes the following steps: S110. Obtain the debugging information in the executable file.

[0016] The executable file in the embodiment of the present application is a file that contains information such as object code and data and can be loaded and executed, such as elf files and a.out files, etc.

[0017] The elf file is the Executable and Linkable Format. Its full English name is Executable and Linkable Format. Elf is a standard file format used to store executable files, object code, shared libraries, and core dumps. It is widely used in Unix-like systems (such as Linux) to define how a program is loaded into memory and executed. The a.out file is a simple executable file format that contains a code segment, a data segment, a symbol table, etc.

[0018] The debugging information is the description information of the structure variable, including debugging information items of multiple structure variables, such as the type, name, and addressing information of the structure variable, etc.

[0019] Taking the elf file as an example, export the dwarf (Debugging With Arbitrary Record Formats) debugging information from the elf file.

[0020] Among them, dwarf is a debugging information format used to store program debugging information in executable files or object files. Its main functions include source code mapping, recording variable and type information, and debugger support, etc.

[0021] In the dwarf debugging information, DIE (Debugging Information Entry) is the core data structure of the dwarf debugging information. Each DIE data contains debugging information describing an entity (such as a structure variable, a structure member variable, a function, a type, etc.) in the program source code. The structure of the DIE data consists of a tag and a series of attributes.

[0022] Specifically, the tag defines the type of entity described by the DIE. For example, the tags include: variables, basic types (such as int, float), classes, structures, array types, type definitions, and structure member variables, etc.

[0023] The attributes provide specific information related to the tag. For example, the attributes include the name of the entity (such as the name of the structure variable, the type name of the structure variable), a reference to the DIE describing the type (such as the type of the variable), the address range describing the function or code segment, the storage location describing the structure variable or parameter (such as register, memory address), the source file and line number declaring the entity, the size of the entity (such as the size of the structure variable or type), and the offset address of the structure member variable, etc.

[0024] S120. Obtain the structure variable member to be searched.

[0025] A structure is a composite data type used to organize and manage data in programming. Structure variable members refer to the individual fields defined in the structure, and each member can store data of different types. Through the structure, multiple related data items can be combined together to form a logical whole.

[0026] Taking the math score in the nth grade of student m as an example: Student[m].grade[n].math, where Student is the name of the structure variable, m is the serial number of the structure variable. grade is a member of the structure variable, n is the serial number of the member of the structure variable, and math is a member of the structure variable of grade. This structure is a multi-level nested structure, and the structure variable member to be searched for is math. This structure variable member math belongs to the structure variable grade, and the structure variable grade also serves as a member of the structure variable Student at the same time.

[0027] S130. Search for the debug information item of the corresponding structure variable based on the structure variable member to be searched for, as well as the debug information item of the structure variable member.

[0028] The structure variable member is a part of the structure variable and has a corresponding relationship with the structure variable. Moreover, the information of the structure variable member will be recorded in the debug information item of the structure variable. For example, search for the DIE data of the structure variable Student. Similarly, the information of the structure variable member is recorded in the debug information item of the structure variable member. For example, search for the DIE data of the structure variable member grade.

[0029] S140. Obtain the addressing information of the structure variable member to be searched for based on the obtained debug information item.

[0030] S150. Obtain the address information of the structure variable member to be searched for based on the addressing information.

[0031] Structures are stored continuously in memory, and each member is stored in sequence according to the defined order. The offset address is the byte offset of the structure variable member relative to the base address (or called the starting address) of the structure variable. Therefore, optionally, the debug information item is parsed to obtain the addressing information of the structure variable member, such as the size and offset address, and the size and offset address indicate the memory occupation size and the actual storage address of the structure variable member. Therefore, based on the obtained storage address of the structure variable, according to the size and offset address of the structure variable member, the actual address information of the structure variable member can be obtained.

[0032] In the embodiments of the present application, first, the debug information in the executable file and the structure variable member to be searched for are obtained, and then the debug information item of the corresponding structure variable is searched for based on the structure variable member to be searched for, so as to parse the addressing information of the structure variable member from the debug information item. Finally, the address information of the structure variable member is obtained according to the addressing information. The embodiments of the present application automatically parse the storage address of the structure variable member according to the debug information, improving the parsing efficiency.

[0033] Optionally, the addressing information of the structure variable member to be searched is obtained based on the obtained debugging information items, including the following three steps: The first step: Obtain the size of the structure variable based on the debugging information item of the type of the structure variable; If the type of the structure variable is an array, for example, the structure variable is uint8 a.b[8], according to the writing format of this array, it can be directly distinguished that the type of this structure variable is an array, then search for the debugging information item of the array type; from the debugging information item of the array type, search for the size of the array type and the length of the array elements; according to the size of the array type and the length of the array elements, calculate the size of the structure variable.

[0034] For example, search for the DIE data of the array type. The size of the array type and the length of the array elements are recorded in the attributes of this DIE data and can be directly obtained. The size of the structure variable (i.e., the size of the array) = the size of the array type × the length of the array elements.

[0035] If the type of the structure variable is an alias, it is necessary to first identify the alias type according to the debugging information item, and then continue to search for the original type of the structure variable. Optionally, according to the debugging information item of the type of the structure variable, determine that the type of the structure variable is an alias; according to the attributes of the alias, search for the original type of the structure variable; search for the size of the structure variable from the debugging information item of the original type.

[0036] For example, in the DIE data of the type of the structure variable, if the type attribute is an alias, it is necessary to find the original type of this structure variable through the attributes of the alias, and then obtain the size of the structure variable from the DIE data of the original type.

[0037] If the type of the structure variable is neither an alias nor an array, for example, it is int, float, then the DIE of the type of the structure variable directly records the size of the structure variable and can be directly obtained.

[0038] The second step: According to the debugging information item of the structure member variable, search for the offset address of the structure member variable.

[0039] The debugging information item of the structure member variable records the offset address of the structure member variable and can be directly obtained.

[0040] The third step: According to the debugging information item of the type of the structure member variable, search for the size of the structure member variable.

[0041] If the type of a structure member variable is an array, search for the debug information item of the array type; from the debug information item of the array type, search for the size of the array type and the length of the array elements; calculate the size of the structure variable member according to the size of the array type and the length of the array elements.

[0042] If, according to the debug information item of the type of the structure variable member, it is determined that the type of the structure variable member is an alias, search for the original type of the structure variable according to the attributes of the alias; search for the size of the structure variable member from the debug information item of the original type.

[0043] If the type of the structure variable member is neither an array nor an alias, directly search for and obtain the debug information item of the structure variable member.

[0044] The structure in the embodiment of the present application is a nested structure. If you want to find the address information of a structure variable member, you need to first determine the storage address of the structure variable. Then, according to the storage rules of the structure and its members, parse the address information of the structure member variable. When the structure has multiple levels of nesting, in the recursive order from the outer layer to the inner layer, parse the storage address of each structure variable member layer by layer. Optionally, multiply the size of the structure variable by the serial number and then add the offset address of the structure variable member in the adjacent inner layer to obtain the first-level addressing information; for each layer of structure variable members, multiply the size of the structure variable member of this layer by the serial number and then add the offset address of the structure variable member in the adjacent inner layer to obtain the lower-level addressing information until the structure variable member in the adjacent inner layer is the structure variable member to be searched; add the storage address of the structure variable, the first-level addressing information, and all the lower-level addressing information to obtain the address information of the structure variable member to be searched.

[0045] When the structure has multiple levels, there will be multiple lower-level addressing information. Then, it is necessary to add all the lower-level addressing information to the storage address of the structure variable and the first-level addressing information to obtain the address information of the structure variable member to be searched. Assume that the structure is a three-level structure, the outermost layer is the structure variable, the middle layer is the structure variable member not to be searched, and the innermost layer is the structure variable member to be searched. See the following formula for details: The address information of the structure variable member = the storage address of the structure variable + the size of the structure variable × the serial number + the offset address of the structure variable member not to be searched + the size of the structure variable member not to be searched × the serial number + the offset address of the structure variable member to be searched; In this embodiment, when the structure has multiple levels of nesting, in the recursive order from the outer layer to the inner layer, parse the storage address of each structure variable member layer by layer, without manual participation, and the efficiency is relatively high.

[0046] Figure 2This is another method for processing debugging information in program debugging provided by an embodiment of the present application. Based on the above embodiment, the information storage and reading processes are refined to improve device performance and processing efficiency. Figure 2 The method shown includes the following operations: S210. Search for the code segment related to the structure variable in the executable file.

[0047] The code segment includes the symbol table of the executable file and the debugging information item of the structure variable.

[0048] S220. Load the code segment into the memory.

[0049] S230. Read the code segment from the memory and parse the code segment to obtain the debugging information.

[0050] For example, if the name of the structure variable to be parsed is Student, then find the code segment where Student is located in the elf file, and load the code segment and the symbol table into the memory. Then, read the code segment from the memory and export the dwarf debugging information from the code segment.

[0051] In this embodiment, only the code segment related to the structure variable is loaded into the memory, and it is not necessary to load the entire executable file into the memory, which can reduce the memory occupancy.

[0052] S240. Store the structure variable name and the storage address of the structure variable into a dictionary.

[0053] Based on the symbol table of the executable file, the storage address of the structure variable can be read, and after binding the storage address with the structure variable name, it is stored in the dictionary. In this way, the storage addresses of all structure variables in the executable file are stored in the dictionary.

[0054] S250. Store the structure variable name and the debugging information item of the structure variable into a hash table.

[0055] A hash table is an efficient data structure for storing and retrieving key-value pairs. Its core idea is to map the key to a specific location of the value through a hash function, so as to achieve fast access. Table 1 is the hash table provided by this embodiment.

[0056] Table 1 Hash Table

[0057] S260. Store the correspondence between the debugging information item of the structure variable and the debugging information item of the structure variable member in a tree structure.

[0058] Since the structure of the debug information items is similar to a tree structure, the debug information items can be stored in a tree structure. Taking the structure variable member Student[2].grade[3].math as an example, Figure 3 The tree structure of the debug information items for each variable and member is shown.

[0059] S270. Obtain the structure variable member to be searched.

[0060] S280. Read the number of the debug information item of the structure variable from the hash table, and index in the debug information according to the number to obtain the debug information item of the structure variable; traverse on the tree structure according to the debug information item of the structure variable to obtain the debug information item of the structure variable member to be searched.

[0061] S290. Obtain the addressing information of the structure variable member to be searched based on the obtained debug information item.

[0062] S300. Read the storage address of the structure variable from the dictionary; obtain the address information of the structure variable member to be searched based on the storage address of the structure variable and the addressing information.

[0063] The addressing information includes the first-layer addressing information and all lower-layer addressing information. The solution for obtaining the address information of the structure variable member to be searched can be found in the description of the above embodiments and will not be elaborated here.

[0064] In this embodiment, by organizing the debug information items through a hash table and a tree structure, the cache mechanism of the computer can be better utilized, the memory consumption can be reduced, and the processing efficiency can be improved. By establishing a dictionary, it is convenient to find the storage address of the structure variable, and the cache pressure and search time of the computer can be reduced.

[0065] Optionally, when searching for the debug information item of the corresponding structure variable and the debug information item of the structure variable member based on the structure variable member to be searched, the multi-thread technology is adopted to allocate different search tasks to different threads; the debug information items of each structure variable and member are obtained through the search of each thread. For example, start multiple threads, and each thread executes the search task of the debug information of different structure variables and different members. For example, one thread executes the search task of the size of the structure variable, and another thread executes the search task of the offset address of the structure variable member.

[0066] In this embodiment, through the multi-thread technology, the multi-core processing ability of modern computers can be fully utilized, the processing efficiency can be improved, and the running and processing time can be shortened.

[0067] Next, taking the structure variable member Student[m].grade[n].math and the executable file elf as examples, the method for processing debugging information in program debugging provided by the embodiments of the present application will be described in detail. First, preprocess the elf file: search for the code segment related to Student (including the symbol table) in the elf file, and record this code segment in memory. Read this code segment from memory and parse to obtain dwarf debugging information (the dwarf debugging information exists in the form of a file). Then, process and store the DIE data in the dwarf debugging information. In this way, it is possible to reduce the storage addresses of multiple structure member variables in the same elf file searched multiple times, reduce the execution flow of the program in the case of multiple searches, optimize the running time of the program and the management of key data storage, and make it easier to obtain and search for the required data, helping to calculate and obtain the storage addresses of structure member variables.

[0068] Considering various complex scenarios, such as whether it contains arrays, whether it is an alias, whether there is structure nesting, etc., branch processing operations for various situations are added in the program processing. First, obtain the storage address of the structure variable Student, and then, based on this storage address, search for the size and offset address of its variable members, and finally calculate the address information of the structure variable members.

[0069] For example: to obtain the address of the structure variable member Student[2].grade[3].math, it is necessary to first obtain the address of the structure variable Student from the dictionary. Then, to confirm the address of Student[2], it is also necessary to search for the size of the structure type corresponding to the structure variable Student. Specifically, search for the DIE number of the type corresponding to the structure variable Student in the hash table, and index to the DIE data of the structure variable Student based on this number in the tree structure. If this type is an alias or an array, further searches or calculations are required to determine the size of this structure type. Then, it is necessary to search for the offset address and size of the structure variable member grade. The offset address is obtained by searching for the DIE data of the structure variable member grade, and the size of grade is obtained by the DIE data of the type of the structure variable member grade. If the type of the structure variable member grade is an alias or an array, further searches or calculations are still required. Finally, the offset address of the structure variable member math is recursively searched in the same way as above.

[0070] Finally, the storage address of the structure variable member math is obtained by the following formula operation: The storage address of math = The storage address of Student + The size of Student × 2 + The offset address of grade + The size of grade × 3 + The offset address of math; In summary of the above embodiments, the embodiments of the present application have the following technical effects: 1) Memory optimization: Through the optimization of the executable file, the memory consumption is reduced. Different from the prior art that needs to load the entire executable file into the memory for parsing, the present application only loads and parses the required information through segmented loading and dynamic parsing, thus reducing the memory occupation. This is of great significance for systems with limited memory resources.

[0071] 2) Time optimization: The embodiments of the present application greatly improve the efficiency of processing large executable files by utilizing the multi-core processing power and cache mechanism of modern computers. Compared with the prior art, the parsing of large executable files can be completed in a shorter time, thereby improving the system performance. This is particularly important for real-time systems that require quick response.

[0072] 3) Flexibility: Through the parsing of the executable file, the embodiments of the present application can not only determine the storage address of the member variables of a certain structure in the file, but also be applicable to various situations, such as arrays, nested structures, and nested structure arrays, and can adapt to different application scenarios and requirements.

[0073] 4) Scalability: The embodiments of the present application adopt a modular design and can be easily extended and upgraded as needed. For example, more optimization algorithms and data structures can be added to improve the processing efficiency. This provides great convenience for the maintenance and upgrade of the system.

[0074] Generally speaking, compared with the prior art, the present application has better performance, higher flexibility, and better scalability, and is a more advanced executable file processing technology.

[0075] The embodiments of the present application provide a debugging information processing device for program debugging. Refer to Figure 4 , which includes a first obtaining module 310, a second obtaining module 320, a searching module 330, an addressing module 340, and an address obtaining module 350 that are sequentially connected.

[0076] The first obtaining module 310 is used to obtain the debugging information in the executable file; the debugging information includes debugging information items of multiple structure variables; The second obtaining module 320 is used to obtain the member of the structure variable to be searched; A search module 330, configured to search for debug information items of a corresponding structure variable and debug information items of structure variable members based on the structure variable members to be searched; An addressing module 340, configured to obtain addressing information of the structure variable members to be searched based on the obtained debug information items; An address obtaining module 350, configured to obtain address information of the structure variable members to be searched based on the addressing information.

[0077] Optionally, the addressing module 340 is configured to obtain the size of the structure variable based on the debug information item of the type of the structure variable; search for the offset address of the structure member variable according to the debug information item of the structure member variable; search for the size of the structure member variable according to the debug information item of the type of the structure member variable.

[0078] Optionally, when obtaining the size of the structure variable based on the debug information item of the type of the structure variable, the addressing module 340 is configured to: if the type of the structure variable is an array, search for the debug information item of the array type; search for the size of the array type and the length of the array elements from the debug information item of the array type; calculate the size of the structure variable according to the size of the array type and the length of the array elements.

[0079] Optionally, when obtaining the size of the structure variable based on the debug information item of the type of the structure variable, the addressing module 340 is configured to: determine that the type of the structure variable is an alias according to the debug information item of the type of the structure variable; search for the original type of the structure variable according to the attribute of the alias; search for the size of the structure variable from the debug information item of the original type.

[0080] Optionally, the address obtaining module 350 is configured to: multiply the size of the structure variable by the serial number and then add the offset address of the structure variable member in the internal adjacent layer to obtain the first-layer addressing information; for each layer of structure variable members, multiply the size of the structure variable member in this layer by the serial number and then add the offset address of the structure variable member in the internal adjacent layer to obtain the lower-layer addressing information until the structure variable member in the internal adjacent layer is the structure variable member to be searched; add the storage address of the structure variable, the first-layer addressing information and all the lower-layer addressing information to obtain the address information of the structure variable member to be searched.

[0081] Optionally, the device further includes a storage module, which is configured to store the structure variable name and the storage address of the structure variable in a dictionary after obtaining the debug information in the executable file; store the structure variable name and the number of the debug information item of the structure variable in a hash table; store the corresponding relationship between the debug information item of the structure variable and the debug information item of the structure variable member in a tree structure; correspondingly, the searching module 330 is configured to read the number of the debug information item of the structure variable from the hash table, and index the debug information item of the structure variable in the debug information according to the number; traverse the tree structure according to the debug information item of the structure variable to obtain the debug information item of the structure variable member to be searched. The address obtaining module 350 is configured to read the storage address of the structure variable from the dictionary; obtain the address information of the structure variable member to be searched based on the storage address of the structure variable and the addressing information.

[0082] Optionally, the device further includes a preprocessing module, which is configured to search for a code segment related to the structure variable in the executable file before obtaining the debug information in the executable file; load the code segment into the memory; correspondingly, the first obtaining module 310 is configured to read the code segment from the memory and parse the code segment to obtain the debug information.

[0083] An embodiment of the present application provides an electronic device, see Figure 5 , including at least one processor 301 and a memory 302 communicatively connected to the at least one processor 301; The memory 302 stores instructions executable by the at least one processor 301. The instructions are executed by the at least one processor 301 so that the at least one processor 301 can execute the debug information processing method for program debugging described above, and thus has at least the same advantages as the above method.

[0084] Optionally, the electronic device further includes an interface for connecting various components, including a high-speed interface and a low-speed interface. Each component is interconnected using different buses and can be mounted on a common motherboard or otherwise as needed. The processor can process instructions executed within the electronic device, including instructions stored in the memory or on the memory to display graphical information of a GUI (Graphical User Interface) on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and multiple memories can be used together, and / or multiple buses and multiple memories can be used together. Similarly, multiple electronic devices (such as a server array, a set of blade servers, or a multi-processor system) can be connected, and each device provides some necessary operations.

[0085] The memory 302, being a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the debugging information processing method for program debugging in the embodiments of the present application. The processor 301 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 301, that is, implements the above-mentioned debugging information processing method for program debugging.

[0086] The memory 301 may mainly include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory 302 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some instances, the memory 302 may further include a memory remotely provided relative to the processor, and these remote memories can be connected to the device through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0087] The electronic device further includes: an input device 303 and an output device 304. The processor 301, the memory 301, the input device 303, and the output device 304 can be connected through a bus or other means.

[0088] The input device 303 can receive input digital or character information, and the output device 304 may include a display device, an auxiliary lighting device (e.g., an LED), a tactile feedback device (e.g., a vibration motor), etc. The display device may include but is not limited to a liquid crystal display (LCD), a light-emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.

[0089] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in the present application can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and no limitations are imposed herein.

[0090] The above specific embodiments do not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present application shall be included within the protection scope of the present application.

Claims

1. A debugging information processing method for program debugging, characterized in that: include: Get debugging information in the executable file; The debugging information includes debugging information items of multiple structure variables; Get the structure variable member to be searched; Searching for the debugging information item of the corresponding structure variable and the debugging information item of the structure variable member based on the structure variable member to be searched; Obtain addressing information of the structure variable member to be searched based on the obtained debugging information item; The address information of the structure variable member to be searched is obtained based on the addressing information.

2. The debugging information processing method for program debugging according to claim 1, characterized in that: Based on the obtained debugging information items, the addressing information of the structure variable member to be searched is obtained, including: Obtaining the size of the structure variable based on the debugging information item of the type of the structure variable; According to the debugging information item of the structure member variable, searching for the offset address of the structure member variable; The size of the structure member variable is found according to the debugging information item of the type of the structure member variable.

3. The debugging information processing method for program debugging according to claim 2, characterized in that: The size of the structure variable is obtained based on the debugging information item of the type of the structure variable, including: If the type of the structure variable is an array, search for a debugging information item of the array type; Find the size of the array type and the length of the array element from the debugging information item of the array type; The size of the structure variable is calculated according to the size of the array type and the length of the array element.

4. The debugging information processing method for program debugging according to claim 2, characterized in that: The size of the structure variable is obtained based on the debugging information item of the type of the structure variable, including: According to the debugging information item of the type of the structure variable, determining that the type of the structure variable is an alias; According to the attribute of the alias, searching the original type of the structure variable; The size of the structure variable is found from the debugging information item of the original type.

5. The debugging information processing method for program debugging according to claim 2, characterized in that: Obtaining address information of a structure variable member to be searched based on the addressing information includes: After multiplying the size and serial number of the structure variable, add it to the offset address of the structure variable member of the adjacent layer to obtain the first layer addressing information; For each layer of structure variable members, multiply the size and sequence number of the structure variable member of this layer, and then add it to the offset address of the structure variable member of the inner adjacent layer to obtain the lower layer addressing information, until the structure variable member of the inner adjacent layer is the structure variable member to be searched; The storage address of the structure variable, the first layer addressing information and all lower layer addressing information are added together to obtain the address information of the structure variable member to be searched.

6. The debugging information processing method for program debugging according to any one of claims 1 to 5, characterized in that: After obtaining the debugging information in the executable file, it also includes: Store the structure variable name and the storage address of the structure variable in a dictionary; Store the structure variable name and the number of the debugging information item of the structure variable in a hash table; The corresponding relationship between the debugging information items of the structure variable and the debugging information items of the structure variable members is stored in a tree structure; Searching for the debugging information item of the corresponding structure variable and the debugging information item of the structure variable member based on the structure variable member to be searched includes: Reading the serial number of the debugging information item of the structure variable from the hash table, and obtaining the debugging information item of the structure variable by indexing in the debugging information according to the serial number; According to the debugging information items of the structure variable, traverse the tree structure to obtain the debugging information items of the structure variable member to be found; Obtaining address information of a structure variable member to be searched based on the addressing information includes: Read the storage address of the structure variable from the dictionary; The address information of the structure variable member to be searched is obtained based on the storage address of the structure variable and the addressing information.

7. The debugging information processing method for program debugging according to any one of claims 1 to 5, characterized in that: Before getting debug information in the executable file, also include: Searching for a code segment related to the structure variable in the executable file; loading the code segment into memory; Get debugging information from the executable file, including: The code segment is read from the memory, and the code segment is parsed to obtain debugging information.

8. A debugging information processing device for program debugging, characterized in that: include: A first obtaining module is used to obtain debugging information in an executable file; The debugging information includes debugging information items of multiple structure variables; The second acquisition module is used to obtain the structure variable member to be searched; A search module, used for searching the debugging information item of the corresponding structure variable and the debugging information item of the structure variable member based on the structure variable member to be searched; An addressing module, used for obtaining addressing information of a structure variable member to be searched based on the obtained debugging information item; The address obtaining module is used to obtain the address information of the structure variable member to be searched based on the addressing information.

9. An electronic device, characterized in that: include: at least one processor, and a memory communicatively coupled to at least one of the processors; The memory stores instructions executable by at least one of the processors, and the instructions are executed by at least one of the processors so that at least one of the processors can execute the debugging information processing method for program debugging according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The medium stores computer instructions, and the computer instructions are used to enable the computer to execute the debugging information processing method for program debugging according to any one of claims 1 to 7.