Method and device for symbolizing call stack, equipment and storage medium
By pre-copying the file reading path of the linked map file in the Release version installation package of the iOS client, reading and using the recorded mapping relationships, batch converting the binary address in the call stack, solving the problems of cumbersome and inefficient operation in the existing technology, and achieving efficient symbolized call stack conversion.
Patent Information
- Application Number
- CN202411867513.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-18
AI Technical Summary
In the existing technology, when symbolizing the call stack of the Release version of the iOS client, the dSYM symbol file needs to be saved first, and the third-party tool dwarfdump can only be converted separately, which is cumbersome and inefficient.
By pre-copying the file read path of the link map file in the target application installation package, the link map file is read during the application running process, and based on the mapping relationship between the binary address and the symbolic information recorded, the binary address in the call stack is batch converted to obtain the symbolized business logic stack.
There is no need to save the dSYM symbol file, nor do you need to use third-party tools. It can convert all binary addresses in the call stack in batches. It is simple to operate and improves the efficiency and timeliness of the symbolized call stack.
Smart Images

Figure CN119759739A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for symbolizing a call stack. Background Art
[0002] There are two forms of iOS client installation packages: Debug version (internal debugging version) and Release version (external release version). The Debug version contains binary source code (i.e. binary address) and symbol information corresponding to each binary address, and the installation package size is large. The Release version contains binary source code, removes all symbol information, and the installation package size is small. If iOS client developers want to perform some code logic analysis on the client installation package and do some special operations based on the analysis results, it is easier for the Debug version because it already contains symbol information, but it is more troublesome for the Release version. The current industry symbolization solution, for the Debug version, can be directly used through the IDE (compiler, iOS is Xcode) for breakpoint debugging. Since the Debug version contains symbol information, when the breakpoint is triggered, the call stack after the binary address is symbolized can be directly displayed. But for the Release version, there is no symbol information, and only the call stack containing the binary address can be displayed. Therefore, for the Release version, currently the main method is to use related tools (such as dwarfdump) to search and convert symbols for each binary address in the call stack in the dSYM file (DebugSymbolfile, which is the symbol file on the Apple platform) of the separate installation package after symbol separation.
[0003] However, the traditional method of symbolizing the call stack for the Release version installation package requires saving the dSYM symbol file first, and using the third-party tool dwarfdump. Each conversion can only target one binary address, and batch conversion is not possible. The operation process is cumbersome, resulting in low efficiency of the symbolized call stack. Summary of the invention
[0004] Based on this, it is necessary to provide a method, apparatus, device and storage medium for symbolizing call stacks that can improve the efficiency of symbolizing call stacks in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for symbolizing a call stack, the method comprising:
[0006] Running an application program installed based on a target application installation package; the target application installation package has a file reading path of a link mapping file copied in advance; the link mapping file records a mapping relationship between all binary addresses in the target application installation package and symbol information included in the program code of the application program;
[0007] During the running of the application program, reading the link mapping file based on the file reading path in the target application installation package;
[0008] Acquire an original business logic stack called during the running of the application; the original business logic stack contains at least one of the binary addresses;
[0009] Based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, each binary address contained in the original business logic stack is converted into the corresponding mapped symbol information to obtain a target business logic stack.
[0010] In a second aspect, the present application provides a device for symbolizing a call stack, the device comprising:
[0011] A running module, used to run an application program installed based on a target application installation package; the target application installation package has a file reading path of a link mapping file copied in advance; the link mapping file records a mapping relationship between all binary addresses in the target application installation package and symbol information contained in the program code of the application program;
[0012] A reading module, used for reading the link mapping file based on the file reading path in the target application installation package during the running of the application program;
[0013] An acquisition module, used for acquiring an original business logic stack called during the running of the application; the original business logic stack contains at least one of the binary addresses;
[0014] The conversion module is used to convert each binary address contained in the original business logic stack into the corresponding mapped symbol information based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, so as to obtain a target business logic stack.
[0015] In a third aspect, the present application provides a computer device including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in the method embodiments of the present application are implemented.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the method embodiments of the present application.
[0017] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps in the method embodiments of the present application when the computer program is executed by a processor.
[0018] The above-mentioned method, device, equipment and storage medium for symbolizing the call stack are implemented by running an application program installed based on a target application installation package; the file reading path of a link mapping file is pre-copied in the target application installation package; the link mapping file records the mapping relationship between all binary addresses in the target application installation package and the symbol information contained in the program code of the application program; during the running of the application program, the link mapping file is read based on the file reading path in the target application installation package; the original business logic stack called during the running of the application program is obtained; the original business logic stack contains at least one binary address; based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, each binary address contained in the original business logic stack is converted into the corresponding mapped symbol information to obtain the target business logic stack. Compared with the traditional method of symbolizing the call stack, the present application pre-copies the file reading path of the link mapping file in the target application installation package. During the running of the application, the link mapping file can be read based on the file reading path in the target application installation package. Then, based on the mapping relationship between all binary addresses in the target application installation package recorded in the link mapping file and the symbolic information contained in the program code of the application, the binary addresses in the business logic stack called during the running of the application can be symbolized. The symbolization process does not require saving the dSYM symbol file first, nor does it require the use of third-party tools. All binary addresses in the call stack can be converted in batches. The operation process is simple, which improves the efficiency of the symbolic call stack. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 An application environment diagram of a method for symbolizing a call stack in one embodiment;
[0020] Figure 2 A flowchart of a method for symbolizing a call stack in one embodiment;
[0021] Figure 3 is a schematic diagram of an original business logic stack in one embodiment;
[0022] Figure 4 is a schematic diagram of a target business logic stack in one embodiment;
[0023] Figure 5A schematic diagram of a process of symbolizing a call stack during the running of an application program in one embodiment;
[0024] Figure 6 A schematic diagram of the working principle of the ASLR mechanism in one embodiment;
[0025] Figure 7 A schematic diagram of the structure of a link mapping file in one embodiment;
[0026] Figure 8 A schematic diagram of a process for generating a target application installation package in one embodiment;
[0027] Fig. 9 A structural block diagram of an apparatus for symbolizing a call stack in one embodiment;
[0028] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0030] The method for symbolizing the call stack provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can be set up separately and can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other servers. Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, vehicle-mounted terminals, intelligent voice interaction devices, aircraft, smart home appliances and portable wearable devices. Smart home appliances can be smart speakers, smart TVs and smart air conditioners. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, cloud security, host security and other network security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 102 and the server 104 can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.
[0031] The terminal 102 can download the target application installation package from the server 104. The terminal 102 can run the application installed based on the target application installation package; the file reading path of the link mapping file is pre-copied in the target application installation package; the link mapping file records the mapping relationship between all binary addresses in the target application installation package and the symbol information contained in the program code of the application. The terminal 102 can read the link mapping file based on the file reading path in the target application installation package during the running of the application. The terminal 102 can obtain the original business logic stack called during the running of the application; the original business logic stack contains at least one binary address. Based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, the terminal 102 can convert each binary address contained in the original business logic stack into the corresponding mapped symbol information to obtain the target business logic stack.
[0032] It is understood that this embodiment does not limit this. It is understood that Figure 1 The application scenarios are only for illustration and are not limited to this.
[0033] In one embodiment, Figure 2 As shown, a method for symbolizing a call stack is provided. In this embodiment, the method is applied to Figure 1 The terminal 102 in the example is used as an example to illustrate, and the following steps are included:
[0034] Step 202, running the application installed based on the target application installation package; the target application installation package has a file reading path of the link mapping file copied in advance; the link mapping file records the mapping relationship between all binary addresses in the target application installation package and the symbol information contained in the program code of the application.
[0035] Among them, the binary address is the binary code source in the target application installation package. It can be understood that the binary address is used in the target application installation package to represent the symbolic information contained in the program code of the application. The symbolic information is the name of the method (function) contained in the program code of the application. The link mapping file (i.e. LinkMap file) is a text file on the Apple platform (iOS). The link mapping file records the mapping relationship between all binary addresses in the target application installation package and the symbolic information contained in the program code of the application. It can be understood that the link mapping file records the symbolic information of the binary address generated by the program code of the application during the compilation process. It can be used to analyze and optimize the size of the application and understand the distribution of symbols.
[0036] In one embodiment, the terminal may obtain a target application installation package of the application, in which the file reading path of the link mapping file is pre-copied. The terminal may run the target application installation package to install the application locally. After the application is installed, the terminal may run the application installed based on the target application installation package.
[0037] Step 204: during the running of the application program, the link mapping file is read based on the file reading path in the target application installation package.
[0038] It should be noted that due to the characteristics of iOS applications (APPs), when an application is running, it can only read files under the installation path of the current application and cannot access external files. Therefore, if the application needs to be able to obtain the link mapping file when it is running, the only way is to copy the file reading path of the link mapping file into the target application installation package of the application.
[0039] Specifically, since the file reading path of the link mapping file is pre-copied in the target application installation package, during the running of the application program, the terminal can read the link mapping file based on the file reading path in the target application installation package.
[0040] Step 206, obtaining the original business logic stack called during the running of the application; the original business logic stack includes at least one binary address.
[0041] Among them, the original business logic stack is the business logic stack called during the running of the application. It can be understood that the original business logic stack is a business logic stack that has not been symbolized. The original business logic stack contains binary addresses, and only computers can understand their meanings. Application developers cannot understand their meanings. Only after the binary addresses contained in the original business logic stack are symbolized can application developers understand their meanings and thus optimize or redevelop the application.
[0042] Step 208 : based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, each binary address included in the original business logic stack is converted into corresponding mapped symbol information to obtain the target business logic stack.
[0043] The target business logic stack is a business logic stack obtained by symbolizing the binary address in the original business logic stack. It can be understood that based on the symbol information in the target business logic stack, the application developer can quickly understand the running status of the application, thereby facilitating the optimization or secondary development of the application.
[0044] In one embodiment, for each binary address contained in the original business logic stack, based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, the binary address contained in the original business logic stack is converted into the corresponding mapped symbol information. After all binary addresses contained in the original business logic stack are converted into corresponding symbol information, the target business logic stack is obtained.
[0045] In one embodiment, Figure 3 It is an original business logic stack, which contains 7 binary addresses. For example, 0x0000000515151511 is a binary address. Figure 4 is a target business logic stack, which consists of Figure 3 The original business logic stack shown is symbolized. It can be seen that the target business logic stack contains symbol information after the binary address is symbolized. For example, ---exceptionPreprocess is a symbol information.
[0046] In one embodiment, Figure 5 As shown, the terminal can run the application installed based on the target application installation package, execute the pre-written Hook code during the operation, trigger the call function contained in the Hook code, and read the link mapping file based on the file reading path in the target application installation package. After reading the link mapping file, the terminal can convert each binary address contained in the original business logic stack into the corresponding mapped symbol information based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, and obtain the target business logic stack. Furthermore, the application developer can perform the desired operation based on the easy-to-understand target business logic stack. For example, when the application is running, the application continuously symbolizes the current call stack to determine whether the code written by the developers in the group meets the code specifications in the group at runtime.
[0047] In the above-mentioned method of symbolizing the call stack, an application installed based on a target application installation package is run; a file reading path of a link mapping file is pre-copied in the target application installation package; the link mapping file records the mapping relationship between all binary addresses in the target application installation package and the symbolic information contained in the program code of the application; during the running of the application, the link mapping file is read based on the file reading path in the target application installation package; the original business logic stack called during the running of the application is obtained; the original business logic stack contains at least one binary address; based on the mapping relationship between each binary address and each symbolic information recorded in the link mapping file, each binary address contained in the original business logic stack is converted into the corresponding mapped symbolic information to obtain the target business logic stack. Compared with the traditional method of symbolizing the call stack, the present application pre-copies the file reading path of the link mapping file in the target application installation package. During the running of the application, the link mapping file can be read based on the file reading path in the target application installation package. Then, based on the mapping relationship between all binary addresses in the target application installation package recorded in the link mapping file and the symbolic information contained in the program code of the application, the binary addresses in the business logic stack called during the running of the application can be symbolized. The symbolization process does not require saving the dSYM symbol file first, nor does it require the use of third-party tools. All binary addresses in the call stack can be converted in batches. The operation process is simple, which improves the efficiency of the symbolic call stack.
[0048] In addition, the traditional method of symbolizing the call stack for the Release version installation package can only be a static analysis, and cannot dynamically symbolize the call stack when the client program itself is running. The process is relatively lagging, and the timeliness of the call stack symbolization cannot be guaranteed. However, this application pre-copies the file reading path of the link mapping file in the target application installation package. During the application running process, the link mapping file can be read based on the file reading path in the target application installation package to symbolize the call stack, thereby improving the timeliness of the call stack symbolization.
[0049] In one embodiment, the binary address in the original business logic stack is the actual address; the binary address in the link mapping file is the first theoretical address; based on the mapping relationship between each binary address and each symbolic information recorded in the link mapping file, each binary address contained in the original business logic stack is converted into the corresponding mapped symbolic information to obtain the target business logic stack, including: for each actual address in the original business logic stack, the actual address is converted into a theoretical address to obtain a second theoretical address corresponding to the actual address; searching the link mapping file for a first theoretical address consistent with the second theoretical address; converting the actual address in the original business logic stack into the symbolic information mapped by the found first theoretical address in the link mapping file; after all the actual addresses contained in the original business logic stack are converted into corresponding symbolic information, the target business logic stack is obtained.
[0050] The first theoretical address is the theoretical address recorded in the link mapping file, and the second theoretical address is the theoretical address obtained by performing address conversion on the actual address in the original business logic stack.
[0051] It can be understood that since the terminal's operating system has enabled the Address Space Layout Randomization (ASLR) mechanism to prevent malicious attacks, the binary address recorded in the original business logic stack called by the application during runtime will be different from the binary address recorded in the link mapping file generated during the target application installation package generation phase. Therefore, before symbolizing the business logic stack, address conversion is required to ensure address consistency. Among them, the ASLR mechanism is a security technology of modern operating systems that aims to prevent malware and attackers from executing malicious code using known addresses in memory. The ASLR mechanism randomizes the loading location of the application in memory, thereby increasing the difficulty for attackers to guess the correct address in memory exploitation attacks. Specifically, if Figure 6 As shown, when the terminal starts to run an application (App), due to the ASLR mechanism, the application (App) will be loaded into a random starting address in the memory to ensure the security and stability of the application.
[0052] In the above embodiment, by converting each actual address in the original business logic stack into a corresponding theoretical address, the consistency of the address in the business logic stack and the address in the link mapping file is ensured, so that the corresponding symbol information can be accurately found from the link mapping file, the symbolization of the address is realized, and the accuracy of the symbolization of the business logic stack is improved.
[0053] In one embodiment, for each actual address in the original business logic stack, the actual address is converted into a theoretical address to obtain a second theoretical address corresponding to the actual address, including: for each actual address in the original business logic stack, obtaining an actual base address of the actual address; the actual base address is the starting address of the actual address randomly loaded into the memory based on the address space layout randomization mechanism during the running of the application; obtaining the theoretical base address of the second theoretical address corresponding to the actual address; the theoretical base address is the starting address of the second theoretical address pre-set in the target application installation package generation stage; determining an address offset based on the actual address and the actual base address; determining the second theoretical address corresponding to the actual address based on the address offset and the theoretical base address.
[0054] In one embodiment, the second theoretical address can be calculated by the following formula:
[0055] The second theoretical address = address offset (actual address - actual base address) + theoretical base address.
[0056] In the above embodiment, the address offset is determined by each actual address in the original business logic stack and its corresponding actual base address, and then the second theoretical address corresponding to the actual address is determined according to the address offset and the theoretical base address, which can improve the accuracy of address conversion.
[0057] In one embodiment, the actual address in the original business logic stack is converted into the symbol information mapped by the found first theoretical address in the link mapping file, including: according to the found first theoretical address, from the symbol record part of the link mapping file, determining the symbol range corresponding to the symbol information mapped by the found first theoretical address; according to the symbol range, obtaining the symbol information mapped by the found first theoretical address from the object file part of the link mapping file; converting the actual address in the original business logic stack into the obtained symbol information.
[0058] The symbol information is the name of the method (function) contained in the program code of the application. The symbol range is the range of addresses covered by the method (function). Figure 7 As shown in the figure, the symbol record part is the Symbols part in the link map file (LinkMap file), which records the compiled symbol information and symbol range. The object file part is the Object files part in the link map file (LinkMap file), which records the compiled file information. In addition, the link map file (LinkMap file) also includes the Sections part, which records the address range covered by different types of compiled products (such as classes or methods).
[0059] In the above embodiment, by first determining the symbol range corresponding to the symbol information mapped by the first theoretical address found from the symbol record part of the link mapping file according to the first theoretical address found, and then obtaining the symbol information mapped by the first theoretical address found from the object file part of the link mapping file according to the symbol range, the efficiency of symbol information search can be improved, thereby further improving the efficiency of symbolization of the business logic stack.
[0060] In one embodiment, the method further includes: compiling the program code of the application through a compiler to obtain a link mapping file and an original application installation package of the application; copying the file reading path of the link mapping file to the original application installation package to obtain a target application installation package of the application.
[0061] In one embodiment, Figure 8 As shown, the terminal compiles the program code of the application through a compiler (such as the Xcode compiler) to obtain a link mapping file (i.e., LinkMap file), and obtains the original application installation package of the application after executing the compiled script. The terminal can copy the file reading path of the link mapping file to the original application installation package to obtain the target application installation package of the application.
[0062] In the above embodiment, during the application installation package generation stage, the file reading path of the link mapping file is copied to the application installation package to obtain the target application installation package of the application, thereby facilitating the application to smoothly read the link mapping file based on the file reading path in the target application installation package during operation to realize the symbolization of the business logic stack.
[0063] In one embodiment, the target application installation package is any one of an internal debugging version installation package or an external release version installation package of the application program.
[0064] In the above embodiment, by limiting the target application installation package to be either an internal debug version installation package or an external release version installation package of the application, the method of symbolizing the call stack of the present application can be applied to the internal debug version installation package or the external release version installation package without being restricted by the form of the installation package, thereby improving the optimization efficiency and flexibility of the application.
[0065] It should be understood that, although each step in the flow chart of the above-mentioned embodiments is shown in order, these steps are not necessarily performed in order. Unless there is a clear explanation in this article, the execution of these steps does not have strict order restrictions, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned embodiments may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in order, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0066] In one embodiment, Fig. 9 As shown, a device 900 for symbolizing a call stack is provided, and the device specifically includes:
[0067] The running module 902 is used to run the application program installed based on the target application installation package; the target application installation package has a file reading path of the link mapping file copied in advance; the link mapping file records the mapping relationship between all binary addresses in the target application installation package and the symbol information contained in the program code of the application program;
[0068] The reading module 904 is used to read the link mapping file based on the file reading path in the target application installation package during the running of the application program;
[0069] The acquisition module 906 is used to acquire the original business logic stack called during the running of the application; the original business logic stack contains at least one binary address;
[0070] The conversion module 908 is used to convert each binary address contained in the original business logic stack into corresponding mapped symbol information based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, so as to obtain a target business logic stack.
[0071] In one embodiment, the binary address in the original business logic stack is the actual address; the binary address in the link mapping file is the first theoretical address; the conversion module 908 is also used to convert the actual address into a theoretical address for each actual address in the original business logic stack, and obtain a second theoretical address corresponding to the actual address; search the link mapping file for a first theoretical address consistent with the second theoretical address; convert the actual address in the original business logic stack into symbolic information mapped by the found first theoretical address in the link mapping file; after all the actual addresses contained in the original business logic stack are converted into corresponding symbolic information, the target business logic stack is obtained.
[0072] In one embodiment, the conversion module 908 is also used to obtain the actual base address of the actual address for each actual address in the original business logic stack; the actual base address is the starting address of the actual address randomly loaded into the memory based on the address space layout randomization mechanism during the running of the application; obtain the theoretical base address of the second theoretical address corresponding to the actual address; the theoretical base address is the starting address of the second theoretical address pre-set in the target application installation package generation phase; determine the address offset based on the actual address and the actual base address; determine the second theoretical address corresponding to the actual address based on the address offset and the theoretical base address.
[0073] In one embodiment, the conversion module 908 is also used to determine, based on the first theoretical address found, from the symbol record part of the link mapping file, the symbol range corresponding to the symbol information mapped to the first theoretical address found; based on the symbol range, obtain the symbol information mapped to the first theoretical address found from the object file part of the link mapping file; and convert the actual address in the original business logic stack into the obtained symbol information.
[0074] In one embodiment, the acquisition module 906 is also used to compile the program code of the application through a compiler to obtain a link mapping file and an original application installation package of the application; copy the file reading path of the link mapping file to the original application installation package to obtain the target application installation package of the application.
[0075] In one embodiment, the target application installation package is any one of an internal debugging version installation package or an external release version installation package of the application program.
[0076] The above-mentioned device for symbolizing the call stack runs an application installed based on a target application installation package; the file reading path of the link mapping file is pre-copied in the target application installation package; the link mapping file records the mapping relationship between all binary addresses in the target application installation package and the symbolic information contained in the program code of the application; during the running of the application, the link mapping file is read based on the file reading path in the target application installation package; the original business logic stack called during the running of the application is obtained; the original business logic stack contains at least one binary address; based on the mapping relationship between each binary address and each symbolic information recorded in the link mapping file, each binary address contained in the original business logic stack is converted into the corresponding mapped symbolic information to obtain the target business logic stack. Compared with the traditional method of symbolizing the call stack, the present application pre-copies the file reading path of the link mapping file in the target application installation package. During the running of the application, the link mapping file can be read based on the file reading path in the target application installation package. Then, based on the mapping relationship between all binary addresses in the target application installation package recorded in the link mapping file and the symbolic information contained in the program code of the application, the binary addresses in the business logic stack called during the running of the application can be symbolized. The symbolization process does not require saving the dSYM symbol file first, nor does it require the use of third-party tools. All binary addresses in the call stack can be converted in batches. The operation process is simple, which improves the efficiency of the symbolic call stack.
[0077] In addition, the traditional method of symbolizing the call stack for the Release version installation package can only be a static analysis, and cannot dynamically symbolize the call stack when the client program itself is running. The process is relatively lagging, and the timeliness of the call stack symbolization cannot be guaranteed. However, this application pre-copies the file reading path of the link mapping file in the target application installation package. During the application running process, the link mapping file can be read based on the file reading path in the target application installation package to symbolize the call stack, thereby improving the timeliness of the call stack symbolization.
[0078] Each module in the above-mentioned device for symbolizing the call stack can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0079] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.10As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for symbolizing a call stack is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0080] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0081] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0082] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0083] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0084] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0085] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0086] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0087] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for symbolizing a call stack, characterized in that: The method comprises: Running an application program installed based on a target application installation package; the target application installation package has a file reading path of a link mapping file copied in advance; the link mapping file records a mapping relationship between all binary addresses in the target application installation package and symbol information included in the program code of the application program; During the running of the application program, reading the link mapping file based on the file reading path in the target application installation package; Acquire an original business logic stack called during the running of the application; the original business logic stack contains at least one of the binary addresses; Based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, each binary address contained in the original business logic stack is converted into the corresponding mapped symbol information to obtain a target business logic stack.
2. The method according to claim 1, characterized in that: The binary address in the original business logic stack is an actual address; the binary address in the link mapping file is a first theoretical address; The step of converting each binary address contained in the original business logic stack into the corresponding mapped symbol information based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file to obtain a target business logic stack includes: For each actual address in the original business logic stack, convert the actual address into a theoretical address to obtain a second theoretical address corresponding to the actual address; Searching the link mapping file for the first theoretical address that is consistent with the second theoretical address; Convert the actual address in the original business logic stack into the symbol information mapped by the first theoretical address found in the link mapping file; After all the actual addresses contained in the original service logic stack are converted into the corresponding symbol information, a target service logic stack is obtained.
3. The method according to claim 2, characterized in that The converting, for each actual address in the original business logic stack, the actual address into a theoretical address to obtain a second theoretical address corresponding to the actual address includes: For each of the actual addresses in the original business logic stack, obtaining an actual base address of the actual address; the actual base address is a starting address of the actual address randomly loaded into the memory based on an address space layout randomization mechanism during the running of the application; Acquire a theoretical base address of the second theoretical address corresponding to the actual address; the theoretical base address is a starting address of the second theoretical address pre-set during the target application installation package generation phase; Determine an address offset according to the actual address and the actual base address; A second theoretical address corresponding to the actual address is determined according to the address offset and the theoretical base address.
4. The method according to claim 2, characterized in that: The converting the actual address in the original business logic stack into the symbol information mapped by the found first theoretical address in the link mapping file includes: According to the first theoretical address found, determining the symbol range corresponding to the symbol information mapped to the first theoretical address found from the symbol record part of the link mapping file; According to the symbol range, obtaining the found symbol information of the first theoretical address mapping from the object file portion of the link mapping file; The actual address in the original business logic stack is converted into the acquired symbol information.
5. The method according to claim 1, characterized in that The method further comprises: Compiling the program code of the application program by a compiler to obtain a link mapping file and an original application installation package of the application program; The file reading path of the link mapping file is copied to the original application installation package to obtain the target application installation package of the application program.
6. The method according to any one of claims 1 to 5, characterized in that The target application installation package is any one of an internal debugging version installation package or an external release version installation package of the application program.
7. A device for symbolizing a call stack, characterized in that: The device comprises: A running module, used to run an application program installed based on a target application installation package; the target application installation package has a file reading path of a link mapping file copied in advance; the link mapping file records a mapping relationship between all binary addresses in the target application installation package and symbol information contained in the program code of the application program; A reading module, used for reading the link mapping file based on the file reading path in the target application installation package during the running of the application program; An acquisition module, used for acquiring an original business logic stack called during the running of the application; the original business logic stack contains at least one of the binary addresses; The conversion module is used to convert each binary address contained in the original business logic stack into the corresponding mapped symbol information based on the mapping relationship between each binary address and each symbol information recorded in the link mapping file, so as to obtain a target business logic stack.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Application stack information acquisition method and apparatus, stack information analysis method and apparatus
CN107943520A
Process updating method and device, storage medium and electronic equipment
CN111782302A
Stack analysis method and device, electronic equipment and storage medium
CN118550742A