WO2022247441A1 - Log file parsing method and apparatus, and device and storage medium - Google Patents

Log file parsing method and apparatus, and device and storage medium Download PDF

Info

Publication number
WO2022247441A1
WO2022247441A1 PCT/CN2022/083582 CN2022083582W WO2022247441A1 WO 2022247441 A1 WO2022247441 A1 WO 2022247441A1 CN 2022083582 W CN2022083582 W CN 2022083582W WO 2022247441 A1 WO2022247441 A1 WO 2022247441A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
file
location
address
source code
Prior art date
Application number
PCT/CN2022/083582
Other languages
French (fr)
Chinese (zh)
Inventor
丰亚东
周乾
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2022247441A1 publication Critical patent/WO2022247441A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging

Definitions

  • Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a log file parsing method, device, device, and storage medium.
  • embodiments of the present disclosure provide a log file parsing method, device, device, and storage medium.
  • the present disclosure provides a log file parsing method, including:
  • the log file of the application program is received, and the log file includes the first file address of the inline function;
  • the first position refers to the The position before the expansion of the inline function
  • the second position refers to the position after the expansion of the inline function
  • the information of the first location and the information of the second location are displayed.
  • the symbol table includes debugging information and source code segment information of the application program
  • the information of the first location includes a line number
  • the method further includes:
  • the line number is corrected to the line number corresponding to the second file address included in the source code segment information, wherein the second file address is The source code segment information is closest to the address of the first file, and corresponds to a breakpoint location, and the address is smaller than the address of the first file.
  • the presenting the information of the first location and the information of the second location includes:
  • the method further includes:
  • the source file of the inline function is displayed.
  • the source file displaying the inline function includes:
  • a pop-up window is displayed, and the source file of the inline function is displayed in the pop-up window.
  • the method further includes:
  • an analysis device including:
  • the receiving module is used to receive the log file of the application program, and the log file includes the first file address of the inline function;
  • a search module configured to search a preset symbol table based on the first file address to obtain the first position information and the second position information of the inline function in the application source code, the first The position refers to the position before the inline function is expanded, and the second position refers to the position after the inline function is expanded;
  • the first display module is configured to display the information of the first location and the information of the second location.
  • the symbol table includes debugging information and source code segment information of the application program
  • the search module includes:
  • a first search submodule configured to search and obtain information of the first location from the source code segment information based on the first file address
  • the second search submodule is configured to search and obtain the information of the second location from the debugging information based on the first file address.
  • the information of the first location includes a line number
  • the device also includes:
  • a correction module configured to correct the line number to the line number corresponding to the second file address included in the source code segment information when the line number matches a preset error line number, wherein the first The second file address is the address in the source code segment information that is closest to the first file address, corresponds to a breakpoint position, and has an address smaller than the first file address.
  • the first display module includes:
  • the first display submodule is configured to display the source code of the application program, and mark the first position and the second position in the source code.
  • the first display module further includes:
  • the second display submodule is configured to display the source file of the inline function in response to the first trigger operation on the second location.
  • the second display submodule is specifically used for:
  • a pop-up window is displayed, and the source file of the inline function is displayed in the pop-up window.
  • the device also includes:
  • the second display module is configured to jump the display position to the first position in response to the second trigger operation for the second position; or respond to the third trigger operation for the first position, display The location jumps to the second location.
  • the present disclosure provides a computer device, including:
  • a memory and a processor wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method as described in any one of the preceding items is implemented.
  • the present disclosure provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the preceding items is implemented.
  • the first file address of the inline function is searched from the preset symbol table to obtain the inline function in the application.
  • the information of the first position before the program source code is expanded and the second information of the expanded position, and the information of the first position and the information of the second position are displayed.
  • the analysis method provided by the embodiments of the present disclosure can accurately determine the position of the inline function before and after expansion in the application source code, thereby helping technicians to determine the actual position of the fault faster and more accurately. Improve the efficiency and accuracy of fault analysis.
  • FIG. 1 is a flowchart of a symbol analysis method provided by an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram showing information of a first location and information of a second location according to an embodiment of the present disclosure
  • Fig. 3 is a schematic diagram of a log file parsing device provided by an embodiment of the present disclosure
  • Fig. 4 is a schematic structural diagram of a computer device in an embodiment of the present disclosure.
  • Fig. 1 is a flow chart of a symbol analysis method provided by an embodiment of the present disclosure, which can be executed by a computer device; and processing power equipment.
  • the log file parsing method provided by the embodiment of the present disclosure includes steps S101-S103.
  • S101 Receive a log file of an application program, where the log file includes a first file address of an inline function.
  • the application program may be an application program running on the client device; when the application program appears to be in abnormal situations such as flashback or freezing, the method or method executed by the application program when the client device encounters a problem
  • the address of the function is recorded in the log file.
  • the aforementioned client device is connected in communication with the computer device used to analyze the log file, and the client device sends the log file through a communication link (which can be a wired communication link or a wireless communication link) with the computer To the computer device; after the computer device receives the log file of the application program, it can analyze the log file.
  • the log file includes the first file address of the inline function.
  • an inline function (sometimes called an online function or a compile-time expansion function) is a programming language construct used to suggest that the compiler perform inline expansion (sometimes called an online expansion) for some special functions; The compiler inserts the specified function body into and replaces every call to the function.
  • the inline function marked by the keyword inline is generally used.
  • the first file address of the inline function may refer to the address of the source file of the inline function.
  • the pre-expanded position information and the expanded position information of the inline function may be searched directly in the preset symbol table based on the address of the first file.
  • the first file address of the inline function may include a stack address stack_address and a load address load_address of the inline function.
  • the preset symbol table is searched based on the target address to obtain the position information of the inline function before expansion and the position information after expansion.
  • S102 Based on the first file address, search a preset symbol table to obtain information about a first position and information about a second position of the inline function in the application source code.
  • the corresponding relationship between the file address of the function (ie, the address of the source file) and the symbol is stored in the symbol table, where the symbol can include the line number of the source code, the name of the function, and the name of the file.
  • the symbols in the symbol table include the line number and file name before the inline function is expanded, and the line number, file name, and function name after the inline function is expanded.
  • Searching the symbol table based on the address of the first file can obtain the first position information and the second position information of the inline function in the source program code.
  • the first location information is information about a location before the inline function is expanded, and specifically may be information about a location when the inline function is declared or defined.
  • the second location information is information about the location after the inline function is expanded, for example, it may be information about the location when the inline function is called in the application source code.
  • the preset symbol table may include application debugging information and source code segment information, wherein the application debugging information includes the address of the source file of the inline function and the expansion of the inline function
  • the mapping relationship between the information of the expanded position may include, for example, the line number, function name, and file name corresponding to the expanded position.
  • the source code segment information includes the address of the source file of the inline function and the inline
  • S1021 Based on the address of the first file, obtain the information of the first location by searching the information of the source code segment.
  • S1022 Obtain second location information by searching from the debugging information based on the first file address.
  • the symbol table may specifically be a file in DWARF (Debugging with Attributed Record Formats) format.
  • the source code segment information is stored in the debug_line_section of the DWARF format file.
  • mapping relationship between the address of the source file of the inline function and the location of the source code is stored in the debug_line_section, for example, the following table shows an exemplary mapping relationship between the address and the location of the source code.
  • the first file address obtained in step S101 is specifically the address of the source file of the inline function
  • the first file address is 0x0000000100006404, based on the aforementioned table, it is determined that the first position of the inline function in the application source code is located in the file Line 12 of the file labeled 1.
  • the debug information is stored in the debug_info_section.
  • the second location information obtained from the debug information based on the first file address can be specifically: find the first file address from the debug_info_section (here Assuming that the first file address is specified as the address of the source file of the inline function, in the case where the first file address includes the stack address and the load address, the corresponding source file address needs to be calculated according to the stack address and the load address)
  • the tag of DW_TAG_inlined_subroutine is the import of the source code information segment (The Debugging Information Entry, DIE for short), and then find the expanded second position information corresponding to the inline function in the import of the source code information segment.
  • step S101 For example, if the address of the first file obtained in step S101 is 0x0000000100006404, the entry of the corresponding source code information segment is found as follows.
  • the address of the first file can also be obtained from the debug_info_section (here, it is assumed that the address of the first file is specified as the address of the source file of the inline function, and in the case that the address of the first file includes the stack address and the load address, The corresponding source file address needs to be calculated according to the stack address and loading address)
  • the corresponding label is DW_TAG_subprogram DIE to find the content corresponding to the "DW_AT_name” label, and the content corresponding to the "DW_AT_name” label is the function name after the expansion of the inline function .
  • S103 Display the information of the first location and the information of the second location.
  • the first file address of the inline function is searched from the preset symbol table to obtain the inline function in the application.
  • the information of the first position before the program source code is expanded and the second information of the expanded position, and the information of the first position and the information of the second position are displayed.
  • the analysis method provided by the embodiments of the present disclosure can accurately determine the position of the inline function before and after expansion in the application source code, thereby helping technicians to determine the actual position of the fault faster and more accurately. Improve the efficiency and accuracy of fault analysis.
  • the wrong line number parsed from the symbol table may also be corrected.
  • the mapping relationship between the address of the source file stored in the debug_line_section and the line number can be expressed as follows.
  • the information of the first location includes a line number
  • step S104 is further included: in response to the line number matching the preset error line number, Then correct the line number to the line number corresponding to the second file address included in the source code segment information.
  • the second file address is the closest to the first file address in the source code segment information, corresponds to a breakpoint location, and has an address smaller than the first file address.
  • the address of the address less than 0x0000000100006404 is 0x00000001000063fc; therefore, change the line number corresponding to 0x0000000100006404 from 0 to the line corresponding to 0x00000001000063fc.
  • the computer device also stores the source code of the application program in addition to storing the preset symbol table.
  • step S103 displays the information of the first location and the information of the second location, which may specifically include S1031: displaying the source code of the application, and The first position and the second position are marked in the code.
  • FIG. 2 is a schematic diagram showing information of a first location and information of a second location according to an embodiment of the present disclosure.
  • the source code of the application program main.c is shown, and each line of the program code is marked; the information to determine the first position is the 12th line in main.c, and the second After the position information is the 20th line in main.c, the program codes of the 12th line and the 20th line are highlighted at the same time to reflect the first position and the second position.
  • step S105 may be further included: displaying the source file of the inline function in response to the first trigger operation for the second location.
  • a pop-up window may be generated, and the source file of the pre-obtained inline function is displayed in the pop-up window.
  • step S106 may also be included: jumping the display position to the first position in response to the second trigger operation for the second position; or responding Based on a third trigger operation on the first position, jumping the display position to the second position.
  • the current display location is jumped to the first location to realize the display of the program source code at the first location; similarly, if a For the third trigger operation on the first position, the current display position is jumped to the second position. In this way, the user can switch between the first position and the second position without performing a pull-down operation or a page-turning operation, and quickly find the corresponding application source code field.
  • Fig. 3 is a schematic diagram of an apparatus for parsing a log file provided by an embodiment of the present disclosure, and the apparatus for parsing may be understood as the above-mentioned computer device or some functional modules in the above-mentioned computer device.
  • the apparatus 300 for parsing log files includes a receiving module 301 , a searching module 302 and a first displaying module 303 .
  • the receiving module 301 is configured to receive the log file of the application program, and the log file includes the first file address of the inline function.
  • the search module 302 is configured to search a preset symbol table based on the first file address to obtain information about a first position and a second position of the inline function in the application source code, the first The position refers to the position before the inline function is expanded, and the second position refers to the position after the inline function is expanded.
  • the first display module 303 is configured to display the information of the first location and the information of the second location.
  • the symbol table includes debugging information and source code segment information of the application program
  • the search module 302 includes a first search submodule and a second search submodule.
  • the first searching submodule is used for searching and obtaining the information of the first location from the information of the source code segment based on the address of the first file.
  • the second searching submodule is configured to search the debugging information based on the first file address to obtain the information of the second location.
  • the information of the first position includes a line number; the device further includes a correction module, and the correction module is configured to, when the line number matches a preset error line number, The line number is corrected to the line number corresponding to the second file address included in the source code segment information, wherein the second file address is the closest to the first file address in the source code segment information, and Corresponding to the breakpoint location, the address is less than the address of the first file address.
  • the first display module includes: a first display submodule, configured to display the source code of the application program, and in the source code, the first location and The second location is marked.
  • the first display module 303 further includes a second display submodule.
  • the second display submodule is used for displaying the source file of the inline function in response to the first trigger operation for the second location.
  • the second display submodule is specifically configured to: display a pop-up window, and display the source file of the inline function in the pop-up window.
  • the log file parsing apparatus 300 further includes a second display module, and the second display module is configured to jump the display position to the the first position; or in response to a third trigger operation on the first position, jumping the display position to the second position.
  • the device provided in this embodiment can execute the method in any of the foregoing embodiments, and its execution mode and beneficial effect are similar, and details are not repeated here.
  • An embodiment of the present disclosure also provides a computer device, the computer device includes a processor and a memory, wherein a computer program is stored in the memory, and any of the above implementations can be implemented when the computer program is executed by the processor. example method.
  • FIG. 4 is a schematic structural diagram of a computer device in an embodiment of the present disclosure.
  • FIG. 4 shows a schematic structural diagram of a computer device 400 suitable for implementing an embodiment of the present disclosure.
  • the computer device 400 in the embodiments of the present disclosure may include, but not limited to, devices with computing and processing capabilities such as mobile phones, notebook computers, PADs (tablet computers), servers, and the like.
  • the computer device shown in FIG. 4 is only an example, and should not limit the functions and scope of use of the embodiments of the present disclosure.
  • computer device 400 may include processing means (e.g. central processing unit, graphics processing unit, etc.) 401 which may be accessed randomly according to a program stored in read-only memory (ROM) 402 or loaded from storage means 408 Various appropriate actions and processes are executed by programs in the memory (RAM) 403 . In the RAM 403, various programs and data necessary for the operation of the computer device 400 are also stored.
  • the processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404.
  • An input/output (I/O) interface 405 is also connected to bus 404 .
  • the following devices can be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 407 such as a computer; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409.
  • the communication means 409 may allow the computer device 400 to communicate with other devices wirelessly or by wire to exchange data. While FIG. 4 shows computer device 400 having various means, it should be understood that implementing or possessing all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 409, or from storage means 408, or from ROM 402.
  • the processing device 401 When the computer program is executed by the processing device 401, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
  • the client and the server can communicate using any currently known or future network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium
  • HTTP HyperText Transfer Protocol
  • the communication eg, communication network
  • Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned computer device, or may exist independently without being incorporated into the computer device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the computer device, the computer device: receives the log file of the application program, and the log file includes the inline function First file address; based on the first file address, obtain the information of the first position and the second position of the inline function in the application source code from a preset symbol table, the first The position refers to the position before the inline function is expanded, and the second position refers to the position after the inline function is expanded; the information of the first position and the information of the second position are displayed.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as AT&T, MCI, Sprint, EarthLink, MSN, GTE, etc.
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of a unit does not constitute a limitation of the unit itself under certain circumstances.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs System on Chips
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • An embodiment of the present disclosure also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method in any of the above-mentioned embodiments can be implemented, and its execution method and benefits The effects are similar and will not be repeated here.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiments of the present disclosure relate to a log file parsing method and apparatus, and a device and a storage medium. The method comprises: when a received log file comprises a first file address of an inline function, searching a preset symbol table on the basis of the first file address of the inline function, so as to obtain information of a first position of the inline function before an application program source code is expanded, and information of a second position of the inline function after the application program source code is expanded, and then presenting the information of the first position and the information of the second position.

Description

日志文件的解析方法、装置、设备及存储介质Log file analysis method, device, equipment and storage medium
本公开要求于2021年05月27日提交的,申请名称为“日志文件的解析方法、装置、设备及存储介质”的、中国专利申请号为“202110586891.3”的优先权,该中国专利申请的全部内容通过引用结合在本公开中。This disclosure claims the priority of the Chinese patent application number "202110586891.3" filed on May 27, 2021, with the application name "analysis method, device, equipment and storage medium for log files", and all of the Chinese patent application The contents are incorporated by reference in this disclosure.
技术领域technical field
本公开实施例涉及计算机技术领域,尤其涉及一种日志文件的解析方法、装置、设备及存储介质。Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a log file parsing method, device, device, and storage medium.
背景技术Background technique
相关技术可以基于日志文件和符号表解析出代码出现崩溃的位置。但是如果崩溃位置定位不准确或者不全面,则会影响问题的排查和修复。因此,如何准确全面的定位出代码中的崩溃位置是本领据技术人员亟需解决的技术问题。Related technologies can analyze the location where the code crashes based on the log file and the symbol table. However, if the location of the crash is inaccurate or incomplete, it will affect the troubleshooting and repair of the problem. Therefore, how to accurately and comprehensively locate the crash location in the code is a technical problem urgently needed to be solved by those skilled in the art.
发明内容Contents of the invention
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开实施例提供了一种日志文件的解析方法、装置、设备及存储介质。In order to solve the above technical problem or at least partly solve the above technical problem, embodiments of the present disclosure provide a log file parsing method, device, device, and storage medium.
一方面,本公开提供一种日志文件的解析方法,包括:On the one hand, the present disclosure provides a log file parsing method, including:
接收到应用程序的日志文件,所述日志文件中包括内联函数的第一文件地址;The log file of the application program is received, and the log file includes the first file address of the inline function;
基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,所述第一位置是指所述内联函数展开前的位置,所述第二位置是指所述内联函数展开后的位置;Based on the first file address, information about a first position and a second position of the inline function in the application source code are searched from a preset symbol table, and the first position refers to the The position before the expansion of the inline function, the second position refers to the position after the expansion of the inline function;
展示所述第一位置的信息和所述第二位置的信息。The information of the first location and the information of the second location are displayed.
在一些实施例中,所述符号表中包括所述应用程序的调试信息和源代码段信息;In some embodiments, the symbol table includes debugging information and source code segment information of the application program;
所述基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,包括:The searching and obtaining the information of the first position and the information of the second position of the inline function in the application source code from a preset symbol table based on the first file address includes:
基于所述第一文件地址从所述源代码段信息中查找获得所述第一位置的信息;Obtaining the information of the first location by searching the information of the source code segment based on the address of the first file;
基于所述第一文件地址从所述调试信息中查找获得所述第二位置的信息。Obtaining the information of the second location from the debugging information based on the first file address.
在一些实施例中,所述第一位置的信息包括行号;In some embodiments, the information of the first location includes a line number;
所述展示所述第一位置的信息和所述第二位置的信息之前,所述方法还包括:Before displaying the information of the first location and the information of the second location, the method further includes:
响应于所述行号与预设的错误行号匹配,则将所述行号校正为所述源代码段信息中包括的第二文件地址对应的行号,其中,所述第二文件地址是所述源代码段信息中与所述第一文件地址最接近,且对应于断点位置,地址小于所述第一文件地址的地址。In response to the line number matching the preset error line number, the line number is corrected to the line number corresponding to the second file address included in the source code segment information, wherein the second file address is The source code segment information is closest to the address of the first file, and corresponds to a breakpoint location, and the address is smaller than the address of the first file.
在一些实施例中,所述展示所述第一位置的信息和所述第二位置的信息,包括:In some embodiments, the presenting the information of the first location and the information of the second location includes:
显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进 行标注。Displaying the source code of the application program, and marking the first position and the second position in the source code.
在一些实施例中,所述显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注之后,所述方法还包括:In some embodiments, after displaying the source code of the application program and marking the first location and the second location in the source code, the method further includes:
响应于针对所述第二位置的第一触发操作,展示所述内联函数的源文件。In response to the first trigger operation directed to the second location, the source file of the inline function is displayed.
在一些实施例中,所述展示所述内联函数的源文件,包括:In some embodiments, the source file displaying the inline function includes:
展示弹出窗口,并在所述弹出窗口中展示所述内联函数的源文件。A pop-up window is displayed, and the source file of the inline function is displayed in the pop-up window.
在一些实施例中,所述显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注之后,所述方法还包括:In some embodiments, after displaying the source code of the application program and marking the first location and the second location in the source code, the method further includes:
响应于针对所述第二位置的第二触发操作,将显示位置跳转到所述第一位置;或者jumping the display position to the first position in response to a second trigger operation directed to the second position; or
响应于针对所述第一位置的第三触发操作,将显示位置跳转到所述第二位置。In response to a third trigger operation on the first position, jumping the display position to the second position.
另一方面,本公开提供一种解析装置,包括:In another aspect, the present disclosure provides an analysis device, including:
接收模块,用于接收到应用程序的日志文件,所述日志文件中包括内联函数的第一文件地址;The receiving module is used to receive the log file of the application program, and the log file includes the first file address of the inline function;
查找模块,用于基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,所述第一位置是指所述内联函数展开前的位置,所述第二位置是指所述内联函数展开后的位置;A search module, configured to search a preset symbol table based on the first file address to obtain the first position information and the second position information of the inline function in the application source code, the first The position refers to the position before the inline function is expanded, and the second position refers to the position after the inline function is expanded;
第一展示模块,用于展示所述第一位置的信息和所述第二位置的信息。The first display module is configured to display the information of the first location and the information of the second location.
在一些实施例中,所述符号表中包括所述应用程序的调试信息和源代码段信息;In some embodiments, the symbol table includes debugging information and source code segment information of the application program;
所述查找模块,包括:The search module includes:
第一查找子模块,用于基于所述第一文件地址从所述源代码段信息中查找获得所述第一位置的信息;A first search submodule, configured to search and obtain information of the first location from the source code segment information based on the first file address;
第二查找子模块,用于基于所述第一文件地址从所述调试信息中查找获得所述第二位置的信息。The second search submodule is configured to search and obtain the information of the second location from the debugging information based on the first file address.
在一些实施例中,所述第一位置的信息包括行号;In some embodiments, the information of the first location includes a line number;
所述装置还包括:The device also includes:
校正模块,用于在所述行号与预设的错误行号匹配时,将所述行号校正为所述源代码段信息中包括的第二文件地址对应的行号,其中,所述第二文件地址是所述源代码段信息中与所述第一文件地址最接近,且对应于断点位置,地址小于所述第一文件地址的地址。A correction module, configured to correct the line number to the line number corresponding to the second file address included in the source code segment information when the line number matches a preset error line number, wherein the first The second file address is the address in the source code segment information that is closest to the first file address, corresponds to a breakpoint position, and has an address smaller than the first file address.
在一些实施例中,所述第一展示模块包括:In some embodiments, the first display module includes:
第一展示子模块,用于显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注。The first display submodule is configured to display the source code of the application program, and mark the first position and the second position in the source code.
在一些实施例中,所述第一展示模块还包括:In some embodiments, the first display module further includes:
第二展示子模块,用于响应于针对所述第二位置的第一触发操作,展示所述内联函数的源文件。The second display submodule is configured to display the source file of the inline function in response to the first trigger operation on the second location.
在一些实施例中,所述第二展示子模块,具体用于:In some embodiments, the second display submodule is specifically used for:
展示弹出窗口,并在所述弹出窗口中展示所述内联函数的源文件。A pop-up window is displayed, and the source file of the inline function is displayed in the pop-up window.
在一些实施例中,所述装置还包括:In some embodiments, the device also includes:
第二展示模块,用于响应于针对所述第二位置的第二触发操作,将显示位置跳转到所述第一位置;或者响应于针对所述第一位置的第三触发操作,将显示位置跳转到所述第二位置。The second display module is configured to jump the display position to the first position in response to the second trigger operation for the second position; or respond to the third trigger operation for the first position, display The location jumps to the second location.
再一方面,本公开提供一种计算机设备,包括:In yet another aspect, the present disclosure provides a computer device, including:
存储器和处理器,其中,所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,实现如前任一项所述的方法。A memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method as described in any one of the preceding items is implemented.
再一方面,本公开提供一种计算机可读存储介质,所述存储介质中存储有计算机程序,当所述计算机程序被处理器执行时,实现如前任一项所述的方法。In another aspect, the present disclosure provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the preceding items is implemented.
本公开实施例提供的技术方案与现有技术相比具有如下优点:Compared with the prior art, the technical solutions provided by the embodiments of the present disclosure have the following advantages:
本公开实施例提供的符号解析方法在接收到的日志文件中包括内联函数的第一文件地址时,基于内联函数的第一文件地址从预设的符号表中查找获得内联函数在应用程序源代码展开前的第一位置的信息和展开后的位置的第二信息,并对第一位置的信息和第二位置的信息进行展示。本公开实施例提供的解析方法能够准确地确定出内联函数在应用程序源代码中展开前的位置和展开后的位置,从而能够帮助技术人员更快更准确的确定出故障发生的实际位置,提高故障解析的效率和准确性。In the symbol parsing method provided by the embodiment of the present disclosure, when the received log file includes the first file address of the inline function, the first file address of the inline function is searched from the preset symbol table to obtain the inline function in the application. The information of the first position before the program source code is expanded and the second information of the expanded position, and the information of the first position and the information of the second position are displayed. The analysis method provided by the embodiments of the present disclosure can accurately determine the position of the inline function before and after expansion in the application source code, thereby helping technicians to determine the actual position of the fault faster and more accurately. Improve the efficiency and accuracy of fault analysis.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, In other words, other drawings can also be obtained from these drawings without paying creative labor.
图1是本公开实施例提供的一种符号解析方法的流程图;FIG. 1 is a flowchart of a symbol analysis method provided by an embodiment of the present disclosure;
图2为本公开实施例一种展示第一位置的信息和第二位置的信息的示意图;FIG. 2 is a schematic diagram showing information of a first location and information of a second location according to an embodiment of the present disclosure;
图3是本公开实施例提供的一种日志文件的解析装置的示意图;Fig. 3 is a schematic diagram of a log file parsing device provided by an embodiment of the present disclosure;
图4是本公开实施例中的一种计算机设备的结构示意图。Fig. 4 is a schematic structural diagram of a computer device in an embodiment of the present disclosure.
具体实施方式Detailed ways
为了能够更清楚地理解本公开的上述目的、特征和优点,下面将对本公开的方案进行进一步描述。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。In order to more clearly understand the above objects, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that, in the case of no conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.
在下面的描述中阐述了很多具体细节以便于充分理解本公开,但本公开还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本公开的一部分实施例,而不是全部的实施例。In the following description, many specific details are set forth in order to fully understand the present disclosure, but the present disclosure can also be implemented in other ways than described here; obviously, the embodiments in the description are only some of the embodiments of the present disclosure, and Not all examples.
图1是本公开实施例提供的一种符号解析方法的流程图,该方法可以由一种计算机设备执行;计算机设备可以示例性的理解为笔记本电脑、台式机、云端服务器、服务器集群等具有计算和处理能力的设备。如图1所示,本公开实施例提供的日志文件的解析方法包括步骤S101-S103。Fig. 1 is a flow chart of a symbol analysis method provided by an embodiment of the present disclosure, which can be executed by a computer device; and processing power equipment. As shown in FIG. 1 , the log file parsing method provided by the embodiment of the present disclosure includes steps S101-S103.
S101:接收到应用程序的日志文件,所述日志文件中包括内联函数的第一文件地址。S101: Receive a log file of an application program, where the log file includes a first file address of an inline function.
本公开实施例的一个应用中,应用程序可以是运行在用户端设备上的应用程序;在应用程序出现闪退、卡死等异常情况时,用户端设备将出现问题时应用程序执行的方法或函数的地址记录在日志文件中。前述用户端设备与用于分析日志文件的计算机设备通信连接,用户端设备通过与计算机设置之间的通信链路(可以是有线的通信链路也可以是无线的通信链路)将日志文件发送给计算机设备;计算机设备在接收到应用程序的日志文件后,可以解析日志文件。In an application of an embodiment of the present disclosure, the application program may be an application program running on the client device; when the application program appears to be in abnormal situations such as flashback or freezing, the method or method executed by the application program when the client device encounters a problem The address of the function is recorded in the log file. The aforementioned client device is connected in communication with the computer device used to analyze the log file, and the client device sends the log file through a communication link (which can be a wired communication link or a wireless communication link) with the computer To the computer device; after the computer device receives the log file of the application program, it can analyze the log file.
本公开实施例中,日志文件包括内联函数的第一文件地址。其中,内联函数(有时称作在线函数或编译时期展开函数)是一种编程语言结构,用来建议编译器对一些特殊函数进行内联扩展(有时称作在线扩展);也就是说建议编译器将指定的函数体插入并取代每一处调用该函数的地方。在程序源代码中,一般采用关键字inline来标注的内联函数。In the embodiment of the present disclosure, the log file includes the first file address of the inline function. Among them, an inline function (sometimes called an online function or a compile-time expansion function) is a programming language construct used to suggest that the compiler perform inline expansion (sometimes called an online expansion) for some special functions; The compiler inserts the specified function body into and replaces every call to the function. In the program source code, the inline function marked by the keyword inline is generally used.
本公开实施例的一个实施方式中,内联函数的第一文件地址可以是指内联函数源文件的地址。此时,可以直接基于第一文件地址在预设的符号表中查找内联函数展开前的位置的信息和展开后的位置的信息。In an implementation manner of the embodiment of the present disclosure, the first file address of the inline function may refer to the address of the source file of the inline function. At this time, the pre-expanded position information and the expanded position information of the inline function may be searched directly in the preset symbol table based on the address of the first file.
在本公开实施例的另一个实施方式中,内联函数的第一文件地址可以包括内联函数的堆栈地址stack_address和加载地址load_address。在这种实施方式中,可以先用stack_address减去load_address得到内联函数的偏移地址,然后再用偏移地址加上内联函数的起始地址(一般为已知的固定值)得到目标地址。进一步的再基于目标地址查找预设的符号表得到内联函数展开前的位置的信息和展开后的位置的信息。In another implementation manner of the embodiment of the present disclosure, the first file address of the inline function may include a stack address stack_address and a load address load_address of the inline function. In this implementation, you can first subtract load_address from stack_address to get the offset address of the inline function, and then add the offset address to the start address of the inline function (usually a known fixed value) to get the target address . Further, the preset symbol table is searched based on the target address to obtain the position information of the inline function before expansion and the position information after expansion.
S102:基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息。S102: Based on the first file address, search a preset symbol table to obtain information about a first position and information about a second position of the inline function in the application source code.
符号表中存储有函数的文件地址(即源文件的地址)与符号之间的对应关系,其中符号 可以包括源代码的行号、函数名、文件名。其中在函数为内联函数时,符号表中的符号包括内联函数展开前的行号、文件名,以及内联函数展开后的行号、文件名和函数名等。The corresponding relationship between the file address of the function (ie, the address of the source file) and the symbol is stored in the symbol table, where the symbol can include the line number of the source code, the name of the function, and the name of the file. When the function is an inline function, the symbols in the symbol table include the line number and file name before the inline function is expanded, and the line number, file name, and function name after the inline function is expanded.
基于第一文件地址查找符号表,可以获得内联函数在源程序代码中的第一位置的信息和第二位置信息。Searching the symbol table based on the address of the first file can obtain the first position information and the second position information of the inline function in the source program code.
第一位置信息是内联函数展开前的位置的信息,具体的可以是内联函数进行声明或者定义时的位置的信息。The first location information is information about a location before the inline function is expanded, and specifically may be information about a location when the inline function is declared or defined.
第二位置信息是内联函数展开后的位置的信息,例如,可以是内联函数在应用程序源代码中被调用时的位置的信息。The second location information is information about the location after the inline function is expanded, for example, it may be information about the location when the inline function is called in the application source code.
在本公开实施例的一个应用中,预设的符号表可以包括应用程序的调试信息和源代码段信息,其中,应用程序的调试信息中包括内联函数的源文件的地址与内联函数展开后的位置的信息之间的映射关系,展开后的位置的信息比如可以包括展开位置对应的行号、函数名、文件名等,源代码段信息中包括内联函数的源文件的地址与内联函数展开前的位置的信息之间的映射关系,展开前的位置的信息,比如可以包括展开前的位置对应的行号、文件名等;对应的,基于第一文件地址,从符号表中获取内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,可以包括步骤S1021-S1022。In an application of an embodiment of the present disclosure, the preset symbol table may include application debugging information and source code segment information, wherein the application debugging information includes the address of the source file of the inline function and the expansion of the inline function The mapping relationship between the information of the expanded position. The information of the expanded position may include, for example, the line number, function name, and file name corresponding to the expanded position. The source code segment information includes the address of the source file of the inline function and the inline The mapping relationship between the information of the position before the expansion of the linked function, the information of the position before the expansion may include, for example, the line number and file name corresponding to the position before the expansion; correspondingly, based on the address of the first file, from the symbol table Acquiring the information of the first position and the information of the second position of the inline function in the application source code may include steps S1021-S1022.
S1021:基于第一文件地址从源代码段信息中查找获得第一位置的信息。S1021: Based on the address of the first file, obtain the information of the first location by searching the information of the source code segment.
S1022:基于第一文件地址从调试信息中查找获得第二位置信息。S1022: Obtain second location information by searching from the debugging information based on the first file address.
在本公开实施例的一个具体应用中,符号表具体可以是DWARF(Debugging with Attributed Record Formats)格式的文件。In a specific application of the disclosed embodiment, the symbol table may specifically be a file in DWARF (Debugging with Attributed Record Formats) format.
在DWARF格式的符号表中,源代码段信息存储在DWARF格式文件的debug_line_section中。In the DWARF format symbol table, the source code segment information is stored in the debug_line_section of the DWARF format file.
在debug_line_section中存储有内联函数的源文件的地址和源程序代码位置的映射关系,例如下表为一种示例性的地址和源程序代码位置的映射关系。The mapping relationship between the address of the source file of the inline function and the location of the source code is stored in the debug_line_section, for example, the following table shows an exemplary mapping relationship between the address and the location of the source code.
假如步骤S101中获取的第一文件地址被具体为内联函数的源文件的地址,第一文件地址为0x0000000100006404,基于前述表格,确定内联函数在应用程序源代码中的第一位置为位于文件标号为1的文件的第12行。If the first file address obtained in step S101 is specifically the address of the source file of the inline function, the first file address is 0x0000000100006404, based on the aforementioned table, it is determined that the first position of the inline function in the application source code is located in the file Line 12 of the file labeled 1.
进一步的,通过查找debug_line_section中“file_names”的条目的信息,即可获得内联函数展开前的文件名。Further, by searching the information of the "file_names" entry in the debug_line_section, the file name before the expansion of the inline function can be obtained.
Figure PCTCN2022083582-appb-000001
Figure PCTCN2022083582-appb-000001
Figure PCTCN2022083582-appb-000002
Figure PCTCN2022083582-appb-000002
在DWARF格式的符号表中,调试信息存储在debug_info_section中,在此情况下,基于第一文件地址从调试信息中查找获得第二位置信息可以具体为:从debug_info_section中查找获得第一文件地址(这里假设第一文件地址被具体为内联函数的源文件的地址的情况,在第一文件地址包括堆栈地址和加载地址的情况下,需要根据堆栈地址和加载地址计算出对应的源文件地址)对应的标签为DW_TAG_inlined_subroutine的源代码信息段的进口(The Debugging Information Entry,简称DIE),随后在源代码信息段的进口中找到内联函数对应的展开后的第二位置信息。In the symbol table of the DWARF format, the debug information is stored in the debug_info_section. In this case, the second location information obtained from the debug information based on the first file address can be specifically: find the first file address from the debug_info_section (here Assuming that the first file address is specified as the address of the source file of the inline function, in the case where the first file address includes the stack address and the load address, the corresponding source file address needs to be calculated according to the stack address and the load address) The tag of DW_TAG_inlined_subroutine is the import of the source code information segment (The Debugging Information Entry, DIE for short), and then find the expanded second position information corresponding to the inline function in the import of the source code information segment.
例如,在步骤S101中获取的第一文件地址为0x0000000100006404,则查找到对应的源代码信息段的进口如下。For example, if the address of the first file obtained in step S101 is 0x0000000100006404, the entry of the corresponding source code information segment is found as follows.
0x0005ecd2:DW_TAG_inlined_subroutine0x0005ecd2:DW_TAG_inlined_subroutine
DW_AT_abstract_origin(0x0005ec41"Add")DW_AT_abstract_origin (0x0005ec41 "Add")
DW_AT_low_pc(0x00000001000063fc)DW_AT_low_pc (0x00000001000063fc)
DW_AT_high_pc(0x0000000100006408)DW_AT_high_pc (0x0000000100006408)
DW_AT_call_file("/Users/fengyadong/work/projectDW_AT_call_file("/Users/fengyadong/work/project
/inlinetest/inlinetest/main.c")/inlinetest/inlinetest/main.c")
DW_AT_call_line(20)DW_AT_call_line(20)
解析前述源代码信息段的进口,确定内联函数被展开后的文件名为“main.c”,内联函数被展开后的行号为20,因此第二位置的信息为是文件名为“main.c”的应用程序源代码的第20行。Analyze the import of the aforementioned source code information section, and determine that the file name after the inline function is expanded is "main.c", and the line number after the inline function is expanded is 20, so the information at the second position is the file name " main.c" on line 20 of the application source code.
进一步的,还可以从debug_info_section中查找获得第一文件地址(这里假设第一文件地址被具体为内联函数的源文件的地址的情况,在第一文件地址包括堆栈地址和加载地址的情况下,需要根据堆栈地址和加载地址计算出对应的源文件地址)对应的标签为DW_TAG_subprogram的DIE中查找获得“DW_AT_name”标签对应的内容,“DW_AT_name”标签对应的内容即为内联函数展开后的函数名。Further, the address of the first file can also be obtained from the debug_info_section (here, it is assumed that the address of the first file is specified as the address of the source file of the inline function, and in the case that the address of the first file includes the stack address and the load address, The corresponding source file address needs to be calculated according to the stack address and loading address) The corresponding label is DW_TAG_subprogram DIE to find the content corresponding to the "DW_AT_name" label, and the content corresponding to the "DW_AT_name" label is the function name after the expansion of the inline function .
S103:展示所述第一位置的信息和所述第二位置的信息。S103: Display the information of the first location and the information of the second location.
本公开实施例提供的符号解析方法在接收到的日志文件中包括内联函数的第一文件地址时,基于内联函数的第一文件地址从预设的符号表中查找获得内联函数在应用程序源代码展开前的第一位置的信息和展开后的位置的第二信息,并对第一位置的信息和第二位置的信息进行展示。In the symbol parsing method provided by the embodiment of the present disclosure, when the received log file includes the first file address of the inline function, the first file address of the inline function is searched from the preset symbol table to obtain the inline function in the application. The information of the first position before the program source code is expanded and the second information of the expanded position, and the information of the first position and the information of the second position are displayed.
本公开实施例提供的解析方法能够准确地确定出内联函数在应用程序源代码中展开前 的位置和展开后的位置,从而能够帮助技术人员更快更准确的确定出故障发生的实际位置,提高故障解析的效率和准确性。The analysis method provided by the embodiments of the present disclosure can accurately determine the position of the inline function before and after expansion in the application source code, thereby helping technicians to determine the actual position of the fault faster and more accurately. Improve the efficiency and accuracy of fault analysis.
在本公开实施例的又一个实施例中,还可以对符号表中解析出的错误行号进行校正。例如,在一个示例中,debug_line_section中存储的源文件的地址和行号之间的映射关系可以表示如下。In still another embodiment of the embodiment of the present disclosure, the wrong line number parsed from the symbol table may also be corrected. For example, in an example, the mapping relationship between the address of the source file stored in the debug_line_section and the line number can be expressed as follows.
Figure PCTCN2022083582-appb-000003
Figure PCTCN2022083582-appb-000003
其中地址0x0000000100006404对应的是应用程序源代码中的第0行,而这一对应关系明显并不合理,也就是这一对应关系是错误的。The address 0x0000000100006404 corresponds to line 0 in the application source code, and this correspondence is obviously unreasonable, that is, this correspondence is wrong.
为解决前述问题,本公开实施例的一些应用中,所述第一位置的信息包括行号,在执行步骤S103前还包括步骤S104:响应于所述行号与预设的错误行号匹配,则将所述行号校正为所述源代码段信息中包括的第二文件地址对应的行号。In order to solve the foregoing problems, in some applications of the embodiments of the present disclosure, the information of the first location includes a line number, and before step S103 is performed, step S104 is further included: in response to the line number matching the preset error line number, Then correct the line number to the line number corresponding to the second file address included in the source code segment information.
步骤S104中,第二文件地址是源代码段信息中与第一文件地址最接近,且对应于一个断点位置,地址小于第一文件地址的地址。In step S104, the second file address is the closest to the first file address in the source code segment information, corresponds to a breakpoint location, and has an address smaller than the first file address.
参见上表,与0x0000000100006404最接近,且对应于一个断点位置,地址小于0x0000000100006404的地址为0x00000001000063fc;因此,将0x0000000100006404对应的行号由0修改为0x00000001000063fc对应的行号12。Refer to the above table, it is closest to 0x0000000100006404 and corresponds to a breakpoint location, the address of the address less than 0x0000000100006404 is 0x00000001000063fc; therefore, change the line number corresponding to 0x0000000100006404 from 0 to the line corresponding to 0x00000001000063fc.
在本公开实施例的又一个实施例中,计算机设备除了存储有预设的符号表外,还存储有应用程序的源代码。在此前情况下,在本公开一个应用中,步骤S103展示所述第一位置的信息和所述第二位置的信息,具体可以包括S1031:显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注。In still another embodiment of the disclosed embodiment, the computer device also stores the source code of the application program in addition to storing the preset symbol table. In the previous case, in an application of the present disclosure, step S103 displays the information of the first location and the information of the second location, which may specifically include S1031: displaying the source code of the application, and The first position and the second position are marked in the code.
图2为本公开实施例一种展示第一位置的信息和第二位置的信息的示意图。如图2所示,其中展示了main.c这一应用程序的源代码,并且标示出了这一程序代码的各行;在确定第一位置的信息为main.c中的第12行,第二位置的信息为main.c中的第20行后,则同时对第12行和第20行的程序代码进行突出显示,以体现第一位置和第二位置。FIG. 2 is a schematic diagram showing information of a first location and information of a second location according to an embodiment of the present disclosure. As shown in Figure 2, the source code of the application program main.c is shown, and each line of the program code is marked; the information to determine the first position is the 12th line in main.c, and the second After the position information is the 20th line in main.c, the program codes of the 12th line and the 20th line are highlighted at the same time to reflect the first position and the second position.
在本公开实施例的一个具体应用中,在执行步骤S1031后,还可以包括步骤S105:响应于针对所述第二位置的第一触发操作,展示所述内联函数的源文件。In a specific application of the embodiment of the present disclosure, after step S1031 is performed, step S105 may be further included: displaying the source file of the inline function in response to the first trigger operation for the second location.
具体应用中,在接收到针对第二位置的第一触发操作时,可以生成一弹出窗口,并在弹 出窗口中展示预先得到的内联函数的源文件。In a specific application, when the first trigger operation for the second location is received, a pop-up window may be generated, and the source file of the pre-obtained inline function is displayed in the pop-up window.
在本公开实施例的一些应用中,在执行步骤S1031后,还可以包括步骤S106:响应于针对所述第二位置的第二触发操作,将显示位置跳转到所述第一位置;或者响应于针对所述第一位置的第三触发操作,将显示位置跳转到所述第二位置。In some applications of the embodiments of the present disclosure, after step S1031 is performed, step S106 may also be included: jumping the display position to the first position in response to the second trigger operation for the second position; or responding Based on a third trigger operation on the first position, jumping the display position to the second position.
在本公开的一些应用中,如果接收到针对第二位置的第二触发操作,则将当前显示位置跳转到第一位置,实现第一位置处程序源代码的显示;类似的,如果接收到针对第一位置的第三触发操作,则将当前显示位置跳转到第二位置。如此,用户无需通过下拉操作或者翻页操作,即可以在第一位置和第二位置之间切换,快速查找到对应的应用程序源代码字段。In some applications of the present disclosure, if the second trigger operation for the second location is received, the current display location is jumped to the first location to realize the display of the program source code at the first location; similarly, if a For the third trigger operation on the first position, the current display position is jumped to the second position. In this way, the user can switch between the first position and the second position without performing a pull-down operation or a page-turning operation, and quickly find the corresponding application source code field.
图3是本公开实施例提供的一种日志文件的解析装置的示意图,该解析装置可以被理解为上述计算机设备或者上述计算机设备中的部分功能模块。Fig. 3 is a schematic diagram of an apparatus for parsing a log file provided by an embodiment of the present disclosure, and the apparatus for parsing may be understood as the above-mentioned computer device or some functional modules in the above-mentioned computer device.
如图3所示,日志文件的解析装置300包括接收模块301、查找模块302和第一展示模块303。As shown in FIG. 3 , the apparatus 300 for parsing log files includes a receiving module 301 , a searching module 302 and a first displaying module 303 .
接收模块301用于接收到应用程序的日志文件,所述日志文件中包括内联函数的第一文件地址。The receiving module 301 is configured to receive the log file of the application program, and the log file includes the first file address of the inline function.
查找模块302用于基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,所述第一位置是指所述内联函数展开前的位置,所述第二位置是指所述内联函数展开后的位置。The search module 302 is configured to search a preset symbol table based on the first file address to obtain information about a first position and a second position of the inline function in the application source code, the first The position refers to the position before the inline function is expanded, and the second position refers to the position after the inline function is expanded.
第一展示模块303用于展示所述第一位置的信息和所述第二位置的信息。The first display module 303 is configured to display the information of the first location and the information of the second location.
在本公开实施例的一个应用中,所述符号表中包括所述应用程序的调试信息和源代码段信息;In an application of an embodiment of the present disclosure, the symbol table includes debugging information and source code segment information of the application program;
所述查找模块302包括第一查找子模块和第二查找子模块。The search module 302 includes a first search submodule and a second search submodule.
第一查找子模块用于基于所述第一文件地址从所述源代码段信息中查找获得所述第一位置的信息。The first searching submodule is used for searching and obtaining the information of the first location from the information of the source code segment based on the address of the first file.
第二查找子模块用于基于所述第一文件地址从所述调试信息中查找获得所述第二位置的信息。The second searching submodule is configured to search the debugging information based on the first file address to obtain the information of the second location.
在本公开实施例的一个应用中,所述第一位置的信息包括行号;所述装置还包括校正模块,校正模块用于在所述行号与预设的错误行号匹配时,将所述行号校正为所述源代码段信息中包括的第二文件地址对应的行号,其中,所述第二文件地址是所述源代码段信息中与所述第一文件地址最接近,且对应于断点位置,地址小于所述第一文件地址的地址。In an application of an embodiment of the present disclosure, the information of the first position includes a line number; the device further includes a correction module, and the correction module is configured to, when the line number matches a preset error line number, The line number is corrected to the line number corresponding to the second file address included in the source code segment information, wherein the second file address is the closest to the first file address in the source code segment information, and Corresponding to the breakpoint location, the address is less than the address of the first file address.
在本公开实施例的另一应用中,所述第一展示模块包括:第一展示子模块,用于显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注。In another application of the embodiments of the present disclosure, the first display module includes: a first display submodule, configured to display the source code of the application program, and in the source code, the first location and The second location is marked.
在本公开实施例的另一应用中,第一展示模块303还包括第二展示子模块。第二展示子 模块用于响应于针对所述第二位置的第一触发操作,展示所述内联函数的源文件。In another application of the embodiment of the present disclosure, the first display module 303 further includes a second display submodule. The second display submodule is used for displaying the source file of the inline function in response to the first trigger operation for the second location.
在一个具体应用中,所述第二展示子模块具体用于:展示弹出窗口,并在所述弹出窗口中展示所述内联函数的源文件。In a specific application, the second display submodule is specifically configured to: display a pop-up window, and display the source file of the inline function in the pop-up window.
在本公开实施例的一个应用中,日志文件的解析装置300还包括第二展示模块,第二展示模块用于响应于针对所述第二位置的第二触发操作,将显示位置跳转到所述第一位置;或者响应于针对所述第一位置的第三触发操作,将显示位置跳转到所述第二位置。In an application of an embodiment of the present disclosure, the log file parsing apparatus 300 further includes a second display module, and the second display module is configured to jump the display position to the the first position; or in response to a third trigger operation on the first position, jumping the display position to the second position.
本实施例提供的装置能够执行上述任一实施例的方法,其执行方式和有益效果类似,在这里不再赘述。The device provided in this embodiment can execute the method in any of the foregoing embodiments, and its execution mode and beneficial effect are similar, and details are not repeated here.
本公开实施例还提供一种计算机设备,该计算机设备包括处理器和存储器,其中,所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时可以实现上述中任一实施例的方法。An embodiment of the present disclosure also provides a computer device, the computer device includes a processor and a memory, wherein a computer program is stored in the memory, and any of the above implementations can be implemented when the computer program is executed by the processor. example method.
示例的,图4是本公开实施例中的一种计算机设备的结构示意图。下面具体参考图4,其示出了适于用来实现本公开实施例中的计算机设备400的结构示意图。本公开实施例中的计算机设备400可以包括但不限于诸如移动电话、笔记本电脑、PAD(平板电脑)、服务器等具有计算和处理能力的设备。图4示出的计算机设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。As an example, FIG. 4 is a schematic structural diagram of a computer device in an embodiment of the present disclosure. Referring to FIG. 4 in detail below, it shows a schematic structural diagram of a computer device 400 suitable for implementing an embodiment of the present disclosure. The computer device 400 in the embodiments of the present disclosure may include, but not limited to, devices with computing and processing capabilities such as mobile phones, notebook computers, PADs (tablet computers), servers, and the like. The computer device shown in FIG. 4 is only an example, and should not limit the functions and scope of use of the embodiments of the present disclosure.
如图4所示,计算机设备400可以包括处理装置(例如中央处理器、图形处理器等)401,其可以根据存储在只读存储器(ROM)402中的程序或者从存储装置408加载到随机访问存储器(RAM)403中的程序而执行各种适当的动作和处理。在RAM 403中,还存储有计算机设备400操作所需的各种程序和数据。处理装置401、ROM 402以及RAM 403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。As shown in FIG. 4 , computer device 400 may include processing means (e.g. central processing unit, graphics processing unit, etc.) 401 which may be accessed randomly according to a program stored in read-only memory (ROM) 402 or loaded from storage means 408 Various appropriate actions and processes are executed by programs in the memory (RAM) 403 . In the RAM 403, various programs and data necessary for the operation of the computer device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input/output (I/O) interface 405 is also connected to bus 404 .
通常,以下装置可以连接至I/O接口405:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置406;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置407;包括例如磁带、硬盘等的存储装置408;以及通信装置409。通信装置409可以允许计算机设备400与其他设备进行无线或有线通信以交换数据。虽然图4示出了具有各种装置的计算机设备400,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Typically, the following devices can be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 407 such as a computer; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication means 409 may allow the computer device 400 to communicate with other devices wirelessly or by wire to exchange data. While FIG. 4 shows computer device 400 having various means, it should be understood that implementing or possessing all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置409从网络上被下载和安装,或者从存储装置408被安装,或者从ROM 402被安装。在该计算机程序被处理装置401执行时,执行本公开实施 例的方法中限定的上述功能。In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 409, or from storage means 408, or from ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device . Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and the server can communicate using any currently known or future network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium The communication (eg, communication network) interconnections. Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
上述计算机可读介质可以是上述计算机设备中所包含的;也可以是单独存在,而未装配入该计算机设备中。The above-mentioned computer-readable medium may be included in the above-mentioned computer device, or may exist independently without being incorporated into the computer device.
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该计算机设备执行时,使得该计算机设备:接收到应用程序的日志文件,所述日志文件中包括内联函数的第一文件地址;基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,所述第一位置是指所述内联函数展开前的位置,所述第二位置是指所述内联函数展开后的位置;展示所述第一位置的信息和所述第二位置的信息。The above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the computer device, the computer device: receives the log file of the application program, and the log file includes the inline function First file address; based on the first file address, obtain the information of the first position and the second position of the inline function in the application source code from a preset symbol table, the first The position refers to the position before the inline function is expanded, and the second position refers to the position after the inline function is expanded; the information of the first position and the information of the second position are displayed.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完 全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of a unit does not constitute a limitation of the unit itself under certain circumstances.
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described herein above may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), System on Chips (SOCs), Complex Programmable Logical device (CPLD) and so on.
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
本公开实施例还提供一种计算机可读存储介质,所述存储介质中存储有计算机程序,当所述计算机程序被处理器执行时可以实现上述中任一实施例的方法,其执行方式和有益效果类似,在这里不再赘述。An embodiment of the present disclosure also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method in any of the above-mentioned embodiments can be implemented, and its execution method and benefits The effects are similar and will not be repeated here.
需要说明的是,在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体 或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relative terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these No such actual relationship or order exists between entities or operations. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
以上所述仅是本公开的具体实施方式,使本领域技术人员能够理解或实现本公开。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本公开的精神或范围的情况下,在其它实施例中实现。因此,本公开将不会被限制于本文所述的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above descriptions are only specific implementation manners of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (16)

  1. 一种日志文件的解析方法,其包括:A method for parsing a log file, comprising:
    接收到应用程序的日志文件,所述日志文件中包括内联函数的第一文件地址;The log file of the application program is received, and the log file includes the first file address of the inline function;
    基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,所述第一位置是指所述内联函数展开前的位置,所述第二位置是指所述内联函数展开后的位置;Based on the first file address, information about a first position and a second position of the inline function in the application source code are searched from a preset symbol table, and the first position refers to the The position before the expansion of the inline function, the second position refers to the position after the expansion of the inline function;
    展示所述第一位置的信息和所述第二位置的信息。The information of the first location and the information of the second location are displayed.
  2. 根据权利要求1所述的方法,其中,所述符号表中包括所述应用程序的调试信息和源代码段信息;The method according to claim 1, wherein the symbol table includes debugging information and source code segment information of the application program;
    所述基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,包括:The searching and obtaining the information of the first position and the information of the second position of the inline function in the application source code from a preset symbol table based on the first file address includes:
    基于所述第一文件地址从所述源代码段信息中查找获得所述第一位置的信息;Obtaining the information of the first location by searching the information of the source code segment based on the address of the first file;
    基于所述第一文件地址从所述调试信息中查找获得所述第二位置的信息。Obtaining the information of the second location from the debugging information based on the first file address.
  3. 根据权利要求2所述的方法,其中,所述第一位置的信息包括行号;The method according to claim 2, wherein the information of the first location includes a line number;
    所述展示所述第一位置的信息和所述第二位置的信息之前,所述方法还包括:Before displaying the information of the first location and the information of the second location, the method further includes:
    响应于所述行号与预设的错误行号匹配,则将所述行号校正为所述源代码段信息中包括的第二文件地址对应的行号,其中,所述第二文件地址是所述源代码段信息中与所述第一文件地址最接近,且对应于断点位置,地址小于所述第一文件地址的地址。In response to the line number matching the preset error line number, the line number is corrected to the line number corresponding to the second file address included in the source code segment information, wherein the second file address is The source code segment information is closest to the address of the first file, and corresponds to a breakpoint location, and the address is smaller than the address of the first file.
  4. 根据权利要求1所述的方法,其中,所述展示所述第一位置的信息和所述第二位置的信息,包括:The method according to claim 1, wherein the presenting the information of the first location and the information of the second location comprises:
    显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注。The source code of the application program is displayed, and the first position and the second position are marked in the source code.
  5. 根据权利要求4所述的方法,其中,所述显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注之后,所述方法还包括:The method according to claim 4, wherein, after displaying the source code of the application program and marking the first position and the second position in the source code, the method further comprises :
    响应于针对所述第二位置的第一触发操作,展示所述内联函数的源文件。In response to the first trigger operation directed to the second location, the source file of the inline function is displayed.
  6. 根据权利要求5所述的方法,其中,所述展示所述内联函数的源文件,包括:The method according to claim 5, wherein the source file displaying the inline function comprises:
    展示弹出窗口,并在所述弹出窗口中展示所述内联函数的源文件。A pop-up window is displayed, and the source file of the inline function is displayed in the pop-up window.
  7. 根据权利要求4所述的方法,其中,所述显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注之后,所述方法还包括:The method according to claim 4, wherein, after displaying the source code of the application program and marking the first position and the second position in the source code, the method further comprises :
    响应于针对所述第二位置的第二触发操作,将显示位置跳转到所述第一位置;或者jumping the display position to the first position in response to a second trigger operation directed to the second position; or
    响应于针对所述第一位置的第三触发操作,将显示位置跳转到所述第二位置。In response to a third trigger operation on the first position, jumping the display position to the second position.
  8. 一种解析装置,其包括:An analysis device comprising:
    接收模块,用于接收到应用程序的日志文件,所述日志文件中包括内联函数的第一文件地址;The receiving module is used to receive the log file of the application program, and the log file includes the first file address of the inline function;
    查找模块,用于基于所述第一文件地址,从预设的符号表中查找获得所述内联函数在应用程序源代码中的第一位置的信息和第二位置的信息,所述第一位置是指所述内联函数展开前的位置,所述第二位置是指所述内联函数展开后的位置;A search module, configured to search a preset symbol table based on the first file address to obtain the first position information and the second position information of the inline function in the application source code, the first The position refers to the position before the inline function is expanded, and the second position refers to the position after the inline function is expanded;
    第一展示模块,用于展示所述第一位置的信息和所述第二位置的信息。The first display module is configured to display the information of the first location and the information of the second location.
  9. 根据权利要求8所述的装置,其中,所述符号表中包括所述应用程序的调试信息和源代码段信息;The device according to claim 8, wherein the symbol table includes debugging information and source code segment information of the application program;
    所述查找模块,包括:The search module includes:
    第一查找子模块,用于基于所述第一文件地址从所述源代码段信息中查找获得所述第一位置的信息;A first search submodule, configured to search and obtain information of the first location from the source code segment information based on the first file address;
    第二查找子模块,用于基于所述第一文件地址从所述调试信息中查找获得所述第二位置的信息。The second search submodule is configured to search and obtain the information of the second location from the debugging information based on the first file address.
  10. 根据权利要求9所述的装置,其中,所述第一位置的信息包括行号;The apparatus according to claim 9, wherein the information of the first location comprises a line number;
    所述装置还包括:The device also includes:
    校正模块,用于在所述行号与预设的错误行号匹配时,将所述行号校正为所述源代码段信息中包括的第二文件地址对应的行号,其中,所述第二文件地址是所述源代码段信息中与所述第一文件地址最接近,且对应于断点位置,地址小于所述第一文件地址的地址。A correction module, configured to correct the line number to the line number corresponding to the second file address included in the source code segment information when the line number matches a preset error line number, wherein the first The second file address is the address in the source code segment information that is closest to the first file address, corresponds to a breakpoint position, and has an address smaller than the first file address.
  11. 根据权利要求8所述的装置,其中,所述第一展示模块包括:The device according to claim 8, wherein the first display module comprises:
    第一展示子模块,用于显示所述应用程序的源代码,并在所述源代码中对所述第一位置和所述第二位置进行标注。The first display submodule is configured to display the source code of the application program, and mark the first position and the second position in the source code.
  12. 根据权利要求11所述的装置,其中,所述第一展示模块还包括:The device according to claim 11, wherein the first display module further comprises:
    第二展示子模块,用于响应于针对所述第二位置的第一触发操作,展示所述内联函数的源文件。The second display submodule is configured to display the source file of the inline function in response to the first trigger operation on the second location.
  13. 根据权利要求12所述的装置,其中,所述第二展示子模块,具体用于:The device according to claim 12, wherein the second display submodule is specifically used for:
    展示弹出窗口,并在所述弹出窗口中展示所述内联函数的源文件。A pop-up window is displayed, and the source file of the inline function is displayed in the pop-up window.
  14. 根据权利要求13所述的装置,其中,所述装置还包括:The device according to claim 13, wherein the device further comprises:
    第二展示模块,用于响应于针对所述第二位置的第二触发操作,将显示位置跳转到所述第一位置;或者响应于针对所述第一位置的第三触发操作,将显示位置跳转到所述第二位置。The second display module is configured to jump the display position to the first position in response to the second trigger operation for the second position; or respond to the third trigger operation for the first position, display The location jumps to the second location.
  15. 一种计算机设备,其包括:A computer device comprising:
    存储器和处理器,其中,所述存储器中存储有计算机程序,当所述计算机程序被所述处理器执行时,实现如权利要求1-7中任一项所述的方法。A memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method according to any one of claims 1-7 is implemented.
  16. 一种计算机可读存储介质,其中,所述存储介质中存储有计算机程序,当所述计算机程序被处理器执行时,实现如权利要求1-7中任一项所述的方法。A computer-readable storage medium, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1-7 is realized.
PCT/CN2022/083582 2021-05-27 2022-03-29 Log file parsing method and apparatus, and device and storage medium WO2022247441A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110586891.3A CN113176989A (en) 2021-05-27 2021-05-27 Log file analysis method, device, equipment and storage medium
CN202110586891.3 2021-05-27

Publications (1)

Publication Number Publication Date
WO2022247441A1 true WO2022247441A1 (en) 2022-12-01

Family

ID=76927291

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/083582 WO2022247441A1 (en) 2021-05-27 2022-03-29 Log file parsing method and apparatus, and device and storage medium

Country Status (2)

Country Link
CN (1) CN113176989A (en)
WO (1) WO2022247441A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113176989A (en) * 2021-05-27 2021-07-27 北京字节跳动网络技术有限公司 Log file analysis method, device, equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5583988A (en) * 1994-03-09 1996-12-10 National Instruments Corporation Method and apparatus for providing runtime checking features in a compiled programming development environment
JP2002073371A (en) * 2000-09-04 2002-03-12 Nec Microsystems Ltd Program debugging method
US20110246964A1 (en) * 2010-04-02 2011-10-06 Apple Inc. Archiving a Build Product
US20130019227A1 (en) * 2011-07-15 2013-01-17 Microsoft Corporation Debugging Inline Functions in Optimized Code
US20150033211A1 (en) * 2013-07-29 2015-01-29 International Business Machines Corporation Program debugger and program debugging
US9104797B1 (en) * 2013-03-21 2015-08-11 Intuit Inc. Efficient cloud-based annotation of crash reports
CN110764945A (en) * 2019-10-23 2020-02-07 北京博睿宏远数据科技股份有限公司 Crash log processing method, device, equipment and storage medium
CN113176989A (en) * 2021-05-27 2021-07-27 北京字节跳动网络技术有限公司 Log file analysis method, device, equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103197942B (en) * 2013-03-18 2016-03-02 华为技术有限公司 A kind of generation method of patch, the method for patch installing and device
CN104123218B (en) * 2013-04-23 2015-06-24 腾讯科技(深圳)有限公司 Method, device and system for code coverage test
CN107092554B (en) * 2016-02-18 2021-03-02 阿里巴巴集团控股有限公司 Method and device for confirming fault code of application program

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5583988A (en) * 1994-03-09 1996-12-10 National Instruments Corporation Method and apparatus for providing runtime checking features in a compiled programming development environment
JP2002073371A (en) * 2000-09-04 2002-03-12 Nec Microsystems Ltd Program debugging method
US20110246964A1 (en) * 2010-04-02 2011-10-06 Apple Inc. Archiving a Build Product
US20130019227A1 (en) * 2011-07-15 2013-01-17 Microsoft Corporation Debugging Inline Functions in Optimized Code
US9104797B1 (en) * 2013-03-21 2015-08-11 Intuit Inc. Efficient cloud-based annotation of crash reports
US20150033211A1 (en) * 2013-07-29 2015-01-29 International Business Machines Corporation Program debugger and program debugging
CN110764945A (en) * 2019-10-23 2020-02-07 北京博睿宏远数据科技股份有限公司 Crash log processing method, device, equipment and storage medium
CN113176989A (en) * 2021-05-27 2021-07-27 北京字节跳动网络技术有限公司 Log file analysis method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113176989A (en) 2021-07-27

Similar Documents

Publication Publication Date Title
CN111625473B (en) Interface test case generation method and device, storage medium and electronic equipment
US20120159449A1 (en) Call Stack Inspection For A Thread Of Execution
WO2021104009A1 (en) Schematic circuit diagram checking method, apparatus and system
WO2021068634A1 (en) Page jump method and apparatus, electronic device and computer-readable storage medium
US9195567B1 (en) Debugging data format conversion
US9600567B2 (en) Local context search results improvements
CN111506900B (en) Vulnerability detection method and device, electronic equipment and computer storage medium
WO2022247442A1 (en) Symbol parsing method and apparatus, and device and storage medium
WO2022105563A1 (en) Indexed file generation method, terminal device, electronic device, and medium
CN115757400B (en) Data table processing method, device, electronic equipment and computer readable medium
WO2022247441A1 (en) Log file parsing method and apparatus, and device and storage medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN110188366B (en) Information processing method, device and storage medium
US10606580B2 (en) Cognitive identification of related code changes
KR101767481B1 (en) Method and device for analyzing program
CN111124541B (en) Configuration file generation method, device, equipment and medium
CN110188166B (en) Document searching method and device and electronic equipment
CN111752644A (en) Interface simulation method, device, equipment and storage medium
US10628428B1 (en) Stack trace search
CN112084086B (en) Information collection method, device, medium and electronic equipment
CN111027281B (en) Word segmentation method, device, equipment and storage medium
CN111539200B (en) Method, device, medium and electronic equipment for generating rich text
CN111309323B (en) Parameter initialization method and device and electronic equipment
KR20190020363A (en) Method and apparatus for analyzing program by associating dynamic analysis with static analysis
US20130191813A1 (en) Metamodeling Contextual Navigation of Computer Software Applications

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22810175

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE