Method, apparatus, device and storage medium for symbolic call stack
By pre-copying the file reading path of the link mapping file in the target application installation package of the iOS client, batch symbolication of the call stack is achieved during the application running process, solving the problem of low efficiency of symbolic call stack of the Release version and improving the efficiency and timeliness of symbolic call stack.
Patent Information
- Application Number
- CN202411867513.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-12-18
AI Technical Summary
In the existing technology, the symbolic call stack method for the Release version of the iOS client is inefficient, cumbersome to operate, cannot be converted in batches, and cannot dynamically symbolize the call stack when the client program is running, resulting in insufficient efficiency and timeliness of the symbolic call stack.
The file reading path of the link mapping file is pre-copied in the target application installation package. By reading the link mapping file during the application running process, the binary address is converted into symbol information based on the mapping relationship recorded in it, and batch symbolized call stacks are realized without saving dSYM symbol files and third-party tools.
Improves the efficiency and timeliness of symbolic call stacks. It can dynamically symbolize call stacks while the application is running, simplifying the operation process. It is applicable to both Debug and Release versions of iOS clients.
Smart Images

Figure CN119759739B_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] iOS client installation packages come in two forms: Debug (internal debugging) and Release (external distribution). The Debug version contains the binary source code (i.e., binary addresses) and the symbol information corresponding to each binary address, resulting in a larger installation package. The Release version contains the binary source code but removes all symbol information, resulting in a smaller installation package. If iOS client developers want to analyze the client installation package's code logic and perform special operations based on the analysis results, this is easier with the Debug version because it already includes symbol information, but more complex with the Release version. Current industry symbolization solutions allow for breakpoint debugging in the Debug version directly through the IDE (compiler, Xcode for iOS). Because the Debug version includes symbol information, when a breakpoint is triggered, the symbolized call stack of the binary address is directly displayed. However, the Release version lacks symbol information and only displays the call stack containing the binary address. Therefore, for the Release version, the main method is to use relevant 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 Release version installation packages requires saving the dSYM symbol file first and using the third-party tool dwarfdump. Each conversion can only target one binary address and cannot be performed in batches. The operation process is cumbersome, resulting in low efficiency of symbolizing the call stack. Summary of the Invention
[0004] Based on this, it is necessary to provide a method, apparatus, device and storage medium for symbolic call stack that can improve the efficiency of symbolic call stack in order to address the above technical problems.
[0005] In a first aspect, the present application provides a method for symbolicating a call stack, the method comprising:
[0006] Running an application installed based on a target application installation package; the target application installation package has a file reading path of a link map file pre-copied therein; the link map 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;
[0007] During the running of the application, reading the link mapping file based on the file reading path in the target application installation package;
[0008] Obtaining an original business logic stack called during the running of the application; the original business logic stack includes 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, configured to run an application installed based on a target application installation package; the target application installation package has a file reading path of a link map file pre-copied therein; the link map file records a mapping relationship between all binary addresses in the target application installation package and symbolic information contained in the program code of the application;
[0012] a reading module, configured to read the link mapping file based on the file reading path in the target application installation package during the running of the application;
[0013] An acquisition module, configured to acquire an original business logic stack called during the running of the application; the original business logic stack includes at least one binary address;
[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 various 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 various 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 installed based on a target application installation package; the target application installation package is pre-copied with a file reading path of a link mapping file; 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 corresponding mapped symbolic information to obtain the target business logic stack. Compared with the traditional symbolic call stack method, this application pre-copies the file reading path of the link mapping file in the target application installation package. During the operation 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 operation 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 is shown;
[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 for symbolizing a call stack during the running of an application program in one embodiment;
[0024] Figure 6 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] Figure 9 A structural block diagram of an apparatus for symbolizing a call stack in one embodiment;
[0028] Figure 10 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0030] The method for symbolizing call stack provided in this application can be applied to Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can be separately configured to store data that server 104 needs to process. The data storage system can be integrated with server 104 or placed in the cloud or on another server. Terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, in-vehicle terminals, intelligent voice interaction devices, aircraft, smart home appliances, and portable wearable devices. Smart home appliances can include smart speakers, smart TVs, and smart air conditioners. Portable wearable devices can include smart watches, smart bracelets, head-mounted devices, etc. Server 104 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides network security services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, cloud security, host security, CDN, and basic cloud computing services such as big data and artificial intelligence platforms. Terminal 102 and server 104 can be connected directly or indirectly via wired or wireless communication, which is not limited in this application.
[0031] Terminal 102 can download the target application installation package from server 104. Terminal 102 can run the application installed based on the target application installation package; the target application installation package has a file reading path for a link mapping file pre-copied therein; 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, terminal 102 can read the link mapping file based on the file reading path in the target application installation package. 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 symbolic information recorded in the link mapping file, terminal 102 can convert each binary address contained in the original business logic stack into the corresponding mapped symbolic information to obtain the target business logic stack.
[0032] It is understood that this embodiment does not limit this. 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 Taking the terminal 102 in FIG. 1 as an example, the method includes the following steps:
[0034] Step 202: Run the application program installed based on the 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 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.
[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 application's program code. The symbolic information is the name of the method (function) contained in the application's program code. The link map file (i.e., LinkMap file) is a text file on the Apple platform (iOS). The link map file records the mapping relationship between all binary addresses in the target application installation package and the symbolic information contained in the application's program code. It can be understood that the link map file records the symbolic information of the binary addresses generated by the application's program code 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, a terminal may obtain a target application installation package for an application, which has a file read path for a link mapping file pre-copied therein. The terminal may run the target application installation package to locally install the application. After the application is installed, the terminal may run the application installed based on the target application installation package.
[0037] Step 204 : During the application program execution, 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 current application's installation path and cannot access external files. Therefore, if the application needs to be able to obtain the link mapping file at runtime, the only way is to copy the file reading path of the link mapping file into the application's target application installation package.
[0039] Specifically, since the file reading path of the link mapping file is pre-copied in the target application installation package, the terminal can read the link mapping file based on the file reading path in the target application installation package during the application program execution.
[0040] Step 206: Obtain the original business logic stack called during the running of the application; the original business logic stack contains at least one binary address.
[0041] Among them, the original business logic stack is the business logic stack called during the operation of the application. It can be understood that the original business logic stack is a business logic stack that has not yet been symbolized. The original business logic stack contains binary addresses, and only computers can understand their meaning. The application developer cannot understand what they represent. Only after the binary addresses contained in the original business logic stack are symbolized can the application developer understand their meaning and thus optimize or perform secondary development on 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 a target business logic stack.
[0043] The target business logic stack is the business logic stack obtained by symbolizing the binary addresses in the original business logic stack. Based on the symbolic information in the target business logic stack, application developers can quickly understand the application's operational status, facilitating optimization or secondary development of the application.
[0044] In one embodiment, for each binary address in the original service logic stack, the binary address is converted to the corresponding mapped symbolic information based on the mapping relationship between each binary address and each symbolic information recorded in the link map file. After all binary addresses in the original service logic stack are converted to corresponding symbolic information, the target service 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 symbolic information after the binary address is symbolized. For example, ---exceptionPreprocess is a symbolic 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 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 operations based on the target business logic stack that is easy to understand. 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 group's code specifications 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 symbolic call stack method, this application pre-copies the file reading path of the link mapping file in the target application installation package. During the operation 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 operation 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, traditional methods for symbolicating call stacks for release-version installation packages can only perform static analysis and cannot dynamically symbolize the call stack while the client program itself is running. This process is relatively slow, and thus cannot guarantee the timeliness of call stack symbolization. However, this application pre-copies the file reading path of the link mapping file in the target application installation package. During the application's execution, 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 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 for a first theoretical address consistent with the second theoretical address in the link mapping file; 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 is understandable that since the terminal's operating system has enabled the Address Space Layout Randomization mechanism (ASLR) 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 applications in memory, thereby increasing the difficulty for attackers to guess the correct address in memory exploitation attacks. Specifically, if Figure 6 As shown in the figure, when the terminal starts running 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 the 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 during the target application installation package generation phase; determining the 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 using 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 symbolic information mapped by the found first theoretical address in the link mapping file, including: determining the symbol range corresponding to the symbolic information mapped by the found first theoretical address from the symbol record part of the link mapping file according to the found first theoretical address; obtaining the symbolic information mapped by the found first theoretical address from the object file part of the link mapping file according to the symbol range; and converting the actual address in the original business logic stack into the obtained symbolic information.
[0058] Among them, symbol information is the name of the method (function) contained in the program code of the application. Symbol range is the range of addresses covered by the method (function). Figure 7 As shown in the figure, the symbol record section, or the "Symbols" section of the link map file (LinkMap file), records compiled symbol information and symbol ranges. The object file section, or the "Object files" section of the link map file (LinkMap file), records compiled file information. Furthermore, the link map file (LinkMap file) also includes the "Sections" section, which records the address ranges covered by different types of compiled artifacts (such as classes or methods).
[0059] In the above embodiment, by first 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 based on the first theoretical address found, and then obtaining the symbol information mapped to the first theoretical address found from the object file part of the link mapping file based on 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 application's program code using a compiler (such as the Xcode compiler) to generate a link map file (i.e., a LinkMap file). After executing the compiled script, the terminal obtains the application's original installation package. The terminal can copy the file read path of the link map file to the original application installation package to obtain the application's target installation package.
[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, so that during the operation of the application, the link mapping file can be smoothly read based on the file reading path in the target application installation package to realize the symbolization of the business logic stack.
[0063] In one embodiment, the target application installation package is any one of an internal debug 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 either the internal debug version installation package or the 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 the various steps in the flow chart of the above-mentioned embodiments are shown in sequence, these steps are not necessarily performed in sequence. Unless clearly stated herein, the execution of these steps does not have strict order restrictions, and these steps can be performed in other sequences. 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 sequence, 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, Figure 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 installed based on the target application installation package; the target application installation package has a file reading path of the link map file copied in advance; the link map 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;
[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 application program execution;
[0069] An acquisition module 906 is configured to acquire an original business logic stack called during the running of the application; the original business logic stack includes 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 for a first theoretical address consistent with the second theoretical address in the link mapping file; convert 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.
[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 operation 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 during 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 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 based on the first theoretical address found; obtain the symbol information mapped to the first theoretical address found from the object file part of the link mapping file based on the symbol range; 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 further used to compile the program code of the application through a compiler to obtain a link mapping file and the 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 debug 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 operation 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 operation 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 symbolic call stack method, this application pre-copies the file reading path of the link mapping file in the target application installation package. During the operation 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 operation 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, traditional methods for symbolicating call stacks for release-version installation packages can only perform static analysis and cannot dynamically symbolize the call stack while the client program itself is running. This process is relatively slow, and thus cannot guarantee the timeliness of call stack symbolization. However, this application pre-copies the file reading path of the link mapping file in the target application installation package. During the application's execution, 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 call stack symbolization.
[0078] Each module in the aforementioned device for symbolizing a call stack may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[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: Figure 10As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via 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 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 via wired or wireless communication, and the wireless communication can be achieved via Wi-Fi, a mobile cellular network, NFC (near field communication), or other technologies. When executed by the processor, the computer program implements a method for symbolizing a call stack. 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 covering 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 Figure 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 shown in the figure, or combine certain components, or have a different component arrangement.
[0081] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, 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-mentioned method embodiments when executed by a processor.
[0083] In one embodiment, a computer program product is provided, including a computer program. 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 the relevant laws, regulations and standards of relevant countries and regions.
[0085] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, storage, database, or other media used in the embodiments provided herein may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage. Volatile memory may include random access memory (RAM) or external cache memory. By way of 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 can 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-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A method for symbolizing a call stack, characterized in that: The method comprises: Running an application installed based on a target application installation package; the target application installation package has a file reading path of a link map file pre-copied therein; the link map 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; During the running of the application, reading the link mapping file based on the file reading path in the target application installation package; Obtaining an original business logic stack called during the running of the application; the original business logic stack includes 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, convert each binary address contained in the original business logic stack into the corresponding mapped symbol information to obtain a target business logic stack; The binary address in the original business logic stack is an actual address; the binary address in the link map 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 service logic stack, convert the actual address into a theoretical address to obtain a second theoretical address corresponding to the actual address; Searching the link map file for the first theoretical address that is consistent with the second theoretical address; Converting the actual address in the original business logic stack into the symbol information mapped by the found first theoretical address in the link map 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.
2. The method according to claim 1, characterized in that The converting, for each actual address in the original service logic stack, the actual address into a theoretical address to obtain a second theoretical address corresponding to the actual address includes: For each actual address 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; Obtaining 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; Determining 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.
3. The method according to claim 1, 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: Determining, based on the first theoretical address found, from the symbol record portion of the link mapping file, a symbol range corresponding to the symbol information mapped to the first theoretical address found; According to the symbol range, obtaining the found symbol information of the first theoretical address mapping from the object file portion of the link map file; The actual address in the original service logic stack is converted into the obtained symbol information.
4. The method according to claim 1, wherein 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.
5. The method according to any one of claims 1 to 4, 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.
6. A device for symbolizing a call stack, characterized in that: The device comprises: A running module, configured to run an application installed based on a target application installation package; the target application installation package has a file reading path of a link map file pre-copied therein; the link map file records a mapping relationship between all binary addresses in the target application installation package and symbolic information contained in the program code of the application; a reading module, configured to read the link mapping file based on the file reading path in the target application installation package during the running of the application; An acquisition module, configured to acquire an original business logic stack called during the running of the application; the original business logic stack includes at least one binary address; a conversion module, configured to convert each binary address contained in the original business logic stack into the corresponding mapped symbolic information based on the mapping relationship between each binary address and each symbolic information recorded in the link mapping file, so as to obtain a target business logic stack; 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 conversion module 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 for the first theoretical address consistent with the second theoretical address in the link mapping file; convert 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 the corresponding symbolic information, the target business logic stack is obtained.
7. 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 5 are implemented.
8. 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 5 are implemented.
9. 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 5 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