Information acquisition method, device, computer equipment and storage medium
By prestoring the second stack traceback table of the target application on the server, the debugging problem caused by the client being unable to obtain or obtaining incomplete unwind tables is solved, and timely debugging of the application and saving memory space is achieved.
Patent Information
- Application Number
- CN202111495794.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2041-12-08
AI Technical Summary
During the running process of the target application, the unwind table that cannot be obtained or obtained is incomplete, resulting in the inability to implement backtracking of the call stack and application debugging.
By pre-stored the second stack traceback table generated by the target application at runtime on the server, the client sends a stack traceback request to the server when it cannot obtain or obtains the incomplete first stack traceback table, and uses the server to base the second stack traceback table on the second stack traceback table. The second stack backtracking table obtains the complete stack backtracking result.
Ensure that the client can obtain complete stack traceback results under any circumstances, thereby realizing timely debugging of the application and saving local memory storage space.
Smart Images

Figure CN114185598B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to an information acquisition method, apparatus, computer equipment and storage medium. Background Art
[0002] In order to debug the target application, the target application obtains the unwind table included in the binary file generated during its operation to trace the call stack to obtain the stack backtrace table, and then debugs the application based on the stack information of each layer of the stack called by the target application included in the stack backtrace table.
[0003] However, if the target application cannot obtain the unwind table, for example, the unwind table stored in the memory corresponding to the target application is lost or damaged, the call stack cannot be backtraced, that is, the complete stack backtracing result cannot be obtained, and thus, the application cannot be debugged. Summary of the invention
[0004] The embodiments of the present disclosure at least provide an information acquisition method, apparatus, computer device and storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides an information acquisition method, which is applied to a client and includes:
[0006] In response to a stack backtrace trigger operation for a target application, obtaining first data address information corresponding to a most recently executed target layer stack stored in a register;
[0007] Based on the first data address information, the stack information of the target layer stack is obtained from the memory corresponding to the target application; and in the case where the first stack backtrace table is stored in the memory, it is determined whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtrace table; wherein the stack backtrace table stores address calculation data for calculating the data address information of the next layer stack of at least one layer of stack in the register;
[0008] If the second data address information cannot be determined on the client, a stack backtrace request is generated based on the first data address information, and the stack backtrace request is sent to the server corresponding to the target application; the stack backtrace request is used to request the server to determine and feedback the stack backtrace result corresponding to the target application based on the stack backtrace request and a pre-stored second stack backtrace table; the stack backtrace result includes stack information of each layer of the stack called by the target application.
[0009] In a possible implementation, the method further includes:
[0010] If the second data address information is determined in the client, the stack information of the next layer stack stored in the memory address indicated by the second data address information is obtained in the memory; the stack information of the next layer stack is used as the stack information of the new target layer stack, and the step of judging whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtracing table is returned until the complete stack backtracing result is obtained.
[0011] In a possible implementation manner, the situation where the second data address information cannot be determined at the client includes:
[0012] The first stack backtrace table cannot be found in the memory; or,
[0013] The first stack backtracking table is found in the memory, but the first stack backtracking table does not store address calculation data of the next layer stack corresponding to the target layer stack.
[0014] In a possible implementation, if second data address information of a continuous partial layer stack is determined based on the first stack backtracking table, and the second data address information of the remaining partial layer stack is determined by the server based on the second stack backtracking table, then generating a stack backtracking request based on the first data address information includes:
[0015] The stack backtrace request is generated based on the stack information of the partial layer stack found in the memory, the first data address information of the target layer stack in the partial layer stack, and the stack information of all currently called stacks stored in the memory.
[0016] In a possible implementation, the method further includes:
[0017] Obtaining a second stack backtrace table included in each binary file generated by the target application during runtime;
[0018] The second stack backtrace table is sent to the server, so that the server stores the second stack backtrace table and uses the stored second stack backtrace table to determine a stack backtrace result corresponding to the target application.
[0019] In a possible implementation manner, after obtaining the stack traceback result fed back by the server, the method further includes:
[0020] Based on the stack information of each layer of stack in the stack backtrace result, determining an abnormal exception stack having an exception from each layer of stack;
[0021] An abnormal application code corresponding to the abnormal stack is determined, and the abnormal application code is updated to obtain an updated application code.
[0022] In a second aspect, the present disclosure provides an information acquisition method, which is applied to a server, including:
[0023] Receive a stack backtrace request for a target application sent by a client, wherein the stack backtrace request carries first data address information corresponding to a target layer stack that is most recently run and stored in a register by the client;
[0024] Based on the first data address information and the second stack backtrace table generated by the target application at runtime and obtained in advance, the stack backtrace result corresponding to the target application is determined and fed back; the stack backtrace result includes the stack information of each layer of stack called by the target application; wherein, the stack backtrace table stores address calculation data for calculating the data address information of the next layer of stack of at least one layer of stack in the register.
[0025] In a possible implementation, determining and feeding back a stack backtrace result corresponding to the target application based on the first data address information and a pre-acquired second stack backtrace table generated by the target application when running, includes:
[0026] Based on the first data address information, acquiring stack information of a target layer stack corresponding to the first data address information from stack information of all currently called stacks stored in the memory carried in the stack backtrace request;
[0027] Based on the second stack backtrace table and the stack information of the target layer stack, determine the address calculation data corresponding to the next layer stack that matches the stack information, and based on the address calculation data and the stack information of the target layer stack, determine the second data address information of the next layer stack in the register, and obtain in the memory the stack information of the next layer stack stored in the memory address indicated by the second data address information;
[0028] The stack information of the next layer stack is used as the stack information of the new target layer stack, and the step of determining the address calculation data corresponding to the next layer stack that matches the stack information is returned based on the second stack backtracing table and the stack information of the target layer stack, until a complete stack backtracing result is obtained, and the stack backtracing result is fed back to the client.
[0029] In one possible implementation, the stack backtrace result includes stack information of a continuous partial layer stack found in the memory and carried in the stack backtrace request, and stack information of a remaining partial layer stack determined by the server based on the first data address information and the second stack backtrace table.
[0030] In a possible implementation manner, determining, based on the second stack backtrace table and the stack information of the target layer stack, address calculation data corresponding to a next layer stack that matches the stack information includes:
[0031] When it is determined that the stack information of the target layer stack corresponding to the first data address information is consistent with the stack information of the target layer stack in the stack information of the continuous partial layer stack found in the memory and carried in the stack backtrace request, the address calculation data corresponding to the next layer stack matching the stack information is determined based on the second stack backtrace table and the stack information of the target layer stack.
[0032] In a third aspect, the embodiments of the present disclosure further provide an information acquisition device, which is applied to a client and includes:
[0033] An acquisition module, configured to acquire, in response to a stack backtrace trigger operation for a target application, first data address information corresponding to a target layer stack that is most recently executed and stored in a register;
[0034] A judgment module, used for obtaining the stack information of the target layer stack from the memory corresponding to the target application based on the first data address information; and in the case where a first stack backtrace table is stored in the memory, judging whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtrace table; wherein the stack backtrace table stores address calculation data for calculating the data address information of the next layer stack of at least one layer of stack in the register;
[0035] A generation module is used to generate a stack backtrace request based on the first data address information if the second data address information cannot be determined on the client, and send the stack backtrace request to the server corresponding to the target application; the stack backtrace request is used to request the server to determine and feedback the stack backtrace result corresponding to the target application based on the stack backtrace request and a pre-stored second stack backtrace table; the stack backtrace result includes the stack information of each layer of the stack called by the target application.
[0036] In a possible implementation, the device further includes:
[0037] A loop module is used to obtain the stack information of the next layer stack stored in the memory address indicated by the second data address information in the memory if the second data address information is determined in the client; use the stack information of the next layer stack as the stack information of the new target layer stack, and return to the step of judging whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtracing table, until the complete stack backtracing result is obtained.
[0038] In a possible implementation manner, the situation where the generating module fails to determine the second data address information on the client includes:
[0039] The generation module fails to find the first stack backtrace table in the memory; or,
[0040] The generating module finds the first stack backtrace table in the memory, but the first stack backtrace table does not store address calculation data of the next stack layer corresponding to the target stack layer.
[0041] In a possible implementation, if the second data address information of a continuous partial layer stack is determined based on the first stack backtrace table, and the second data address information of the remaining partial layer stack is determined by the server based on the second stack backtrace table, the generation module is used to generate the stack backtrace request based on the stack information of the partial layer stack found in the memory, the first data address information of the target layer stack in the partial layer stack, and the stack information of all currently called stacks stored in the memory.
[0042] In a possible implementation, the device further includes:
[0043] A sending module, used for obtaining a second stack backtrace table included in each binary file generated by the target application when running;
[0044] The second stack backtrace table is sent to the server, so that the server stores the second stack backtrace table and uses the stored second stack backtrace table to determine a stack backtrace result corresponding to the target application.
[0045] In a possible implementation, the device further includes:
[0046] An updating module, configured to determine an abnormal stack having an abnormality from each layer of the stack based on the stack information of each layer of the stack in the stack backtracing result after obtaining the stack backtracing result fed back by the server;
[0047] An abnormal application code corresponding to the abnormal stack is determined, and the abnormal application code is updated to obtain an updated application code.
[0048] In a fourth aspect, the embodiments of the present disclosure further provide an information acquisition device, which is applied to a server, and includes:
[0049] A receiving module, configured to receive a stack backtrace request for a target application sent by a client, wherein the stack backtrace request carries first data address information corresponding to a target layer stack that is most recently run and stored in a register by the client;
[0050] A determination module is used to determine and feedback a stack backtracing result corresponding to the target application based on the first data address information and a pre-acquired second stack backtracing table generated by the target application during runtime; the stack backtracing result includes stack information of each layer of stack called by the target application; wherein the stack backtracing table stores address calculation data for calculating the data address information of the next layer of stack of at least one layer of stack in the register.
[0051] In a possible implementation, the determination module is used to obtain, based on the first data address information, the stack information of the target layer stack corresponding to the first data address information from the stack information of all currently called stacks stored in the memory carried in the stack backtrace request;
[0052] Based on the second stack backtrace table and the stack information of the target layer stack, determine the address calculation data corresponding to the next layer stack that matches the stack information, and based on the address calculation data and the stack information of the target layer stack, determine the second data address information of the next layer stack in the register, and obtain in the memory the stack information of the next layer stack stored in the memory address indicated by the second data address information;
[0053] The stack information of the next layer stack is used as the stack information of the new target layer stack, and the step of determining the address calculation data corresponding to the next layer stack that matches the stack information is returned based on the second stack backtracing table and the stack information of the target layer stack, until a complete stack backtracing result is obtained, and the stack backtracing result is fed back to the client.
[0054] In one possible implementation, the stack backtrace result includes stack information of a continuous partial layer stack found in the memory and carried in the stack backtrace request, and stack information of a remaining partial layer stack determined by the server based on the first data address information and the second stack backtrace table.
[0055] In one possible implementation, the determination module is used to determine the address calculation data corresponding to the next layer stack that matches the stack information based on the second stack backtrace table and the stack information of the target layer stack, when it is determined that the acquired stack information of the target layer stack corresponding to the first data address information is consistent with the stack information of the target layer stack in the stack information of the continuous partial layer stack found in the memory and carried in the stack backtrace request.
[0056] In a fifth aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions execute the above-mentioned first aspect, or the steps in any possible implementation of the first aspect; or, when the machine-readable instructions are executed by the processor, the machine-readable instructions execute the above-mentioned second aspect, or the steps in any possible implementation of the second aspect;.
[0057] In a sixth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the computer program executes the above-mentioned first aspect, or the steps in any possible implementation of the first aspect; or, when the computer program is executed, the computer program executes the above-mentioned second aspect, or the steps in any possible implementation of the second aspect.
[0058] For a description of the effects of the above-mentioned information acquisition device, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned information acquisition method, which will not be repeated here.
[0059] The information acquisition method, device, computer equipment and storage medium provided by the embodiments of the present disclosure store the second stack backtrace table generated by the target application at runtime for stack backtrace on the server in advance. When the client (i.e., the target application) cannot obtain a complete stack backtrace result due to the incomplete first stack backtrace table obtained or the inability to obtain the first stack backtrace table, the client usually sends a stack backtrace request to the server, and obtains a complete stack backtrace result based on the second stack backtrace table by the server; then, the client can obtain the completed stack backtrace result from the server. Compared with the prior art, when the client cannot obtain the unwind table or cannot obtain the complete unwind table, the complete stack backtrace result cannot be obtained. The embodiment of the present disclosure stores the second stack backtrace table on the server in advance, ensuring that the client can obtain the complete stack backtrace result in any of the above situations, thereby realizing timely debugging of the application. In addition, after the client obtains and stores the second stack backtrace table on the server, it can actively delete at least part of the content in the stack backtrace table stored in the local memory, thereby saving the storage space of the local memory.
[0060] Furthermore, the information acquisition method, apparatus, computer equipment and storage medium provided by the embodiments of the present disclosure can accurately determine the data address information in the register corresponding to each layer of stack called by the target application at runtime based on the first data address information and the address calculation data stored in the second stack backtrace table generated by the target application at runtime after the server obtains the stack backtrace request sent by the client. Then, based on the determined data address information, the stack information of each layer of stack called by the target application at runtime can be accurately obtained, that is, the complete stack backtrace result can be accurately obtained. Then, by sending the obtained complete stack backtrace result to the client, it is ensured that the client can obtain the complete stack backtrace result.
[0061] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0063] Figure 1 A flowchart of an information acquisition method applied to a client provided by an embodiment of the present disclosure is shown;
[0064] Figure 2 A flow chart of an information acquisition method applied to a server provided by an embodiment of the present disclosure is shown;
[0065] Figure 3 A flowchart of the interaction between a client and a server provided by an embodiment of the present disclosure is shown;
[0066] Figure 4 A schematic diagram showing an information acquisition device applied to a client provided by an embodiment of the present disclosure;
[0067] Figure 5 A schematic diagram of an information acquisition device applied to a server provided by an embodiment of the present disclosure is shown;
[0068] Figure 6 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0070] In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0071] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0072] Research has found that for any target application (ie, client), during the operation of the target application, it is usually necessary to compile the source code corresponding to the target application into a binary file that can be recognized by the machine (ie, client), and then start the target application by loading the binary file.
[0073] In order to debug the target application, it is necessary to use the stack backtrace table included in the compiled binary file to backtrace the call stack to obtain the stack backtrace table, and then debug the application according to the stack information of each layer of stack called by the target application included in the stack backtrace table. However, in the prior art, if the client cannot obtain the unwindtable, it will not be possible to backtrace the call stack, and then it will not be possible to obtain a complete stack backtrace table, and thus it will not be possible to debug the target application according to the stack backtrace table.
[0074] Based on the above research, the present disclosure provides an information acquisition method, device, computer equipment and storage medium. By pre-storing the second stack backtrace table generated by the target application at runtime for stack backtrace on the server, the client (i.e., the target application) can send a stack backtrace request to the server when the first stack backtrace table obtained is incomplete or the first stack backtrace table cannot be obtained, resulting in the inability to obtain a complete stack backtrace result. The server obtains a complete stack backtrace result based on the second stack backtrace table; then, the client can obtain the completed stack backtrace result from the server. Compared with the prior art, when the client cannot obtain the unwind table or cannot obtain the complete unwind table, the complete stack backtrace result cannot be obtained. The embodiment of the present disclosure ensures that the client can obtain the complete stack backtrace result in any of the above situations by pre-storing the second stack backtrace table on the server, thereby realizing timely debugging of the application. In addition, after the client obtains and stores the second stack backtrace table on the server, it can actively delete at least part of the content in the stack backtrace table stored in the local memory, thereby achieving the purpose of saving storage space of the local memory.
[0075] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0076] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0077] It should be noted that the specific terms mentioned in the embodiments of the present disclosure include:
[0078] Unwind Table: Stack backtrace table is runtime auxiliary information in general binary files under Linux system, dedicated to stack backtrace.
[0079] To facilitate understanding of this embodiment, an information acquisition method disclosed in the embodiment of the present disclosure is first introduced in detail. The executor of the information acquisition method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities. In some possible implementation methods, the information acquisition method can be implemented by a processor calling computer-readable instructions stored in a memory.
[0080] The information acquisition method provided by the embodiment of the present disclosure is described below by taking the execution subject as a client as an example.
[0081] like Figure 1As shown, it is a flowchart of an information acquisition method applied to a client provided by an embodiment of the present disclosure, which may include the following steps:
[0082] S101: In response to a stack backtrace triggering operation for a target application, first data address information corresponding to a most recently executed target layer stack and stored in a register is obtained.
[0083] Here, the application scenario of the information acquisition method provided by the embodiment of the present disclosure is first introduced, wherein the client mentioned in the embodiment of the present disclosure can be a target application. In the process of the target application corresponding to its source code, it is usually necessary to compile it into a binary file that can be recognized by the client, or obtain a binary file that has been written by other clients, and then realize the reasonable operation of the target application by loading the binary file.
[0084] The binary file includes a stack backtrace table, i.e., an unwind table, which can be used for stack backtrace. The complete unwind table can be used to obtain the stack information of each layer of the stack called by the target application at runtime, that is, to obtain the call stack information corresponding to the target application. Obtaining the call stack information is a necessary monitoring and debugging method in the process of developing the target application, and the unwind table is necessary information for obtaining the call stack information. Obtaining the complete unwind table has become a necessary process for developing and debugging the target application.
[0085] Although storing the unwind table in the client's memory can ensure that the client can obtain the unwind table to debug the target application, it will inevitably occupy a certain amount of storage space, which may cause problems such as application running lag. In addition, some binary files may have been written for other clients, and the client running the target application will not be able to obtain the unwind table in these binary files, and thus cannot debug the target application.
[0086] In order to solve the above problems, the embodiment of the present disclosure provides an information acquisition method, which pre-stores the unwind table used for stack backtracing of the target application to the server, and uses the server to implement stack backtracing for the target application based on the stored unwind table. When the client does not store the unwind table or the stored unwind table is incomplete, the stack backtracing result can also be obtained, which saves storage space and ensures the timeliness and feasibility of debugging the target application. The information acquisition method provided by the embodiment of the present disclosure will be described in detail as follows:
[0087] With respect to S101, the stack backtrace triggering operation may be an operation initiated by a user during the running process of the target application, for obtaining stack information of each layer of stacks called during the running process of the target application; or, the stack backtrace triggering operation may be an operation initiated by a user at any time after the running of the target application ends, for obtaining stack information of each layer of stacks called during the most recent running process of the target application. The stack information of each layer of stacks may specifically be information of each layer of functions called by the target application during running.
[0088] The register stores the data address information of each layer of stack called by the target application during operation. The data address information corresponding to each layer of stack is the register value corresponding to the layer of stack stored in the register. The first data address information is the current register information, which is the data address information corresponding to the target layer stack that the target application has recently run to. The target layer stack is the layer of stack most recently called by the target application. For example, the target application calls 1, 2, 3, and 4 layers of stacks in sequence during operation. The 4th layer of stack is the target layer stack most recently called by the target application, and the first data address information is the data address information corresponding to the 4th layer of stack.
[0089] In specific implementation, when the user wants to obtain the call stack information corresponding to the target application, a stack backtrace trigger operation can be executed for the target application. After that, the target application can respond to the stack backtrace trigger operation, obtain the current register information, and use the register value corresponding to the current register information as the first data address information corresponding to the target layer stack that the target application most recently ran to.
[0090] S102: Based on the first data address information, obtain the stack information of the target layer stack from the memory corresponding to the target application; and when the first stack backtrace table is stored in the memory, determine whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtrace table.
[0091] The stack backtracking table stores address calculation data for calculating the data address information of the next layer of stack of at least one layer of stack in the register. Specifically, the next layer of stack of one layer of stack is the previous layer of stack of the layer of stack. For example, if one layer of stack is the 6th layer of stack, the next layer of stack can be the 5th layer of stack.
[0092] Here, the memory corresponding to the target application stores the stack information of each layer of the stack called by the target application during its operation, the various binary files required for the operation of the target application (including binary files generated by the target application during its operation and / or other clients), and other information required for the operation of the target application, such as environmental information, configuration information, etc.
[0093] In addition, in one embodiment, the memory may also store a first stack backtrace table for stack backtrace of the target application, and the first stack backtrace table stores address calculation data for calculating the data address information of the next layer of the at least one layer of the stack in the register. Each layer of the at least one layer of the stack here is a stack called by the target application during operation. Specifically, it may be a partial stack called by the target application during operation, that is, the address calculation data stored in the first stack backtrace table is incomplete, and the first stack backtrace table is an incomplete stack backtrace table; and the first stack backtrace table does not store address calculation data for calculating the data address information of the next layer of the stack corresponding to the last layer of the stack called by the target application in the register.
[0094] The stack information of the target layer stack may specifically include the calling function information, stack name information, etc. corresponding to the target layer stack. The second data address information is the data address information of the next layer stack of the target layer stack called by the target application in the register. For example, when the target application sequentially calls four layers of stacks, 1, 2, 3, and 4, during operation, the 4th layer stack is the target layer stack, and the 3rd layer stack is the next layer stack of the target layer stack. The second data address information is the data address information of the 3rd layer stack.
[0095] In specific implementation, the memory address indicated by the first data address information can be determined, and then the stack information of the target layer stack can be obtained from the memory address of the memory corresponding to the target application. Furthermore, it can be determined whether the first stack backtrace table corresponding to the target application is stored in the memory. If so, it can be determined whether there is address calculation data in the register of the next layer stack that matches the stack information of the target layer stack based on the content stored in the first stack backtrace table. If so, it can be determined based on the address calculation data. The second data address information in the register of the next layer stack that matches the stack information of the target layer stack; that is, it is determined whether it is possible to determine whether there is a next layer stack pair that matches the stack information of the target layer stack based on the content stored in the first stack backtrace table; if not, it means that the first stack backtrace table is an incomplete stack backtrace table, and it is determined that the second data address information in the register of the next layer stack that matches the stack information of the target layer stack cannot be determined based on the first stack backtrace table.
[0096] In another embodiment, the address calculation data stored in the stack backtrace table may be a mapping relationship between the stack information of the stack called later and the data address information corresponding to the stack information of the stack called earlier in every two adjacent layers of all the layer stacks called by the target application. For example, when the target application sequentially calls four layers of stacks, 1, 2, 3, and 4, in total, during operation, the first stack backtrace table may store a mapping relationship between the stack information corresponding to the 4th layer stack and the data address information of the 3rd layer stack in the register.
[0097] In this embodiment, after obtaining the stack information of the target layer stack, it can be determined whether a first stack backtrace table corresponding to the target application is stored in the memory. If so, it can be determined whether there is a mapping relationship corresponding to the stack information of the target layer stack based on the various mapping relationships stored in the first stack backtrace table, that is, whether there is second data address information that has a mapping relationship with the stack information of the target layer stack.
[0098] S103: If the second data address information cannot be determined on the client, a stack backtrace request is generated based on the first data address information, and the stack backtrace request is sent to a server corresponding to the target application.
[0099] The stack backtrace request is used to request the server to determine and feedback the stack backtrace result corresponding to the target application based on the stack backtrace request and the pre-stored second stack backtrace table, and the stack backtrace request may include the first data address information. The stack backtrace result includes the stack information of each layer of stack called by the target application, and the stack backtrace result may also include the call sequence information of each layer of stack called by the target application.
[0100] The second stack backtracking table stores address calculation data for calculating data address information in registers of each stack layer in all stack layers called by the target application during operation. Since the first stack layer called by the target application does not have a previous stack layer, the second stack backtracking table does not store address calculation data corresponding to the next stack layer of the first stack called by the target application. According to the second stack backtracking table, the data address information corresponding to each stack layer called by the target application can be determined.
[0101] In specific implementation, if according to S102, the client (the client mentioned in the embodiments of the present disclosure may be the target application) fails to determine the second data address information corresponding to the first data address information, that is, fails to determine the data address information of the next layer stack corresponding to the target layer stack in the register, the target application may generate a stack backtrace request including the first data address information based on the first data address information, and send the stack backtrace request to the server corresponding to the target application.
[0102] Afterwards, after receiving the stack backtrace request, the server can obtain the stack information of the target layer stack corresponding to the first data address information according to the first data address information included therein. Then, the server can determine the address calculation data of the next layer stack corresponding to the target layer stack from the address calculation data stored in the pre-acquired and stored second stack backtrace table according to the stack information of the target layer stack; further, the existing address calculation algorithm can be used to determine the second data address information of the next layer stack according to the determined address calculation data of the next layer stack and the stack information of the target layer stack.
[0103] Furthermore, the server can determine the stack information of the stack corresponding to the second data address information based on the second data address information, and then determine the second data address information of the next layer of the stack corresponding to the stack information based on the stack information and the second stack backtrace table, and return to the step of returning the stack information of the stack corresponding to the second data address information based on the second data address information, and go through multiple cycles of steps until the stack information of each layer of the stack called by the target application is determined, and it is used as the stack backtrace result corresponding to the target application and fed back to the client.
[0104] In this way, by pre-storing the second stack backtrace table generated by the target application during runtime and used for stack backtrace on the server side, when the client (i.e., the target application) cannot obtain a complete stack backtrace result due to the incomplete first stack backtrace table obtained or the inability to obtain the first stack backtrace table, a stack backtrace request is usually sent to the server side, and the server side obtains a complete stack backtrace result based on the second stack backtrace table; then, the client can obtain the completed stack backtrace result from the server side. Compared with the prior art, when the client cannot obtain the unwind table or cannot obtain the complete unwind table, the complete stack backtrace result cannot be obtained. The embodiment of the present disclosure ensures that the client can obtain the complete stack backtrace result in any of the above situations by pre-storing the second stack backtrace table on the server side, thereby realizing timely debugging of the application. In addition, after the client obtains and stores the second stack backtrace table on the server side, it can actively delete at least part of the content in the stack backtrace table stored in the local memory, thereby achieving the purpose of saving storage space of the local memory.
[0105] In one embodiment, for the above S102, if the second data address information corresponding to the next layer stack of the target layer stack is determined in the client, the memory address indicated by the second data address information can be determined first, and then the stack information of the next layer stack stored in the memory corresponding to the target application can be obtained from the memory address. Then, the step of judging whether the first data address information of the next layer stack in the register matching the stack information can be determined based on the first stack backtracking table in S102, that is, judging whether the data address information corresponding to the next layer stack of the stack corresponding to the latest acquired stack information can be determined using the first stack backtracking table stored in the client. In specific implementation, the stack corresponding to the latest acquired stack information can be used as the new target layer stack, and the stack information can also be used as the stack information corresponding to the new target layer stack, and then, the step of judging whether the second data address information corresponding to the next layer stack of the stack information can be determined based on the first stack backtracking table is returned.
[0106] If the data address information corresponding to the next layer stack of the new target layer stack is determined by using the first stack backtracking table, the stack information corresponding to the new target layer stack stored in the memory address indicated by the data address information is obtained in the memory. Then, the stack corresponding to the obtained stack information can continue to be used as the new target layer stack, and the step of judging whether the first data address information in the register of the next layer stack matching the stack information can be determined based on the first stack backtracking table in S102, until a complete stack backtracking result is obtained according to the first stack backtracking table. Alternatively, after one or more loop executions of the step of judging whether the first data address information in the register of the next layer stack matching the stack information can be determined based on the first stack backtracking table in S102, if the client fails to determine the second data address information of the next layer stack of the latest target layer stack based on the stored first stack backtracking table, the stack backtracking request carrying the first data address information can be generated based on the determination of the first data address information of the latest target layer stack and sent to the server.
[0107] Then, the server can determine the final stack backtrace result based on the latest received stack backtrace request according to the steps of determining the stack backtrace result corresponding to the target application based on the stack backtrace request and the pre-stored second stack backtrace table as described in S103; then, the determined stack backtrace result can be fed back to the client.
[0108] In one embodiment, if the second data address information cannot be determined on the client in S103, the following two situations may be specifically included:
[0109] Case 1: Failed to find the first stack backtrace table in memory.
[0110] In this case, in order to meet the demand of saving storage space of the memory corresponding to the target application, the target application can unwind the table in the generated binary file. In this way, when the stack is backtraced later, the unwind table cannot be found in the memory. Therefore, the target application cannot determine the second data address information based on the unwind table.
[0111] Case 2: The first stack backtrace table is found in the memory, but the first stack backtrace table does not store the address calculation data of the next stack layer corresponding to the target stack layer.
[0112] Here, even if the unwind table is found in the memory, the information stored in the unwind table may be incomplete or even empty. Therefore, even if the unwind table is obtained, it may not be possible to obtain the address calculation data of the next layer stack corresponding to the target layer stack, that is, it is impossible to determine the second data address information of the next layer stack corresponding to the target layer stack.
[0113] Specifically, in any of the above two situations, it can be determined that the second data address information cannot be determined on the client.
[0114] In one embodiment, the following situations occur when determining the data address information corresponding to each layer stack called by the target application:
[0115] The second data address information of the continuous partial layer stack is determined based on the first stack backtrace table, and the second data address information of the remaining partial layer stack is determined by the server based on the second stack backtrace table. For example, when the target application sequentially calls six layers of stacks, 1, 2, 3, 4, 5, and 6, in the running process, the second data address information of the continuous partial layer stack determined based on the first stack backtrace table can be: the second data address information corresponding to the two stacks of layer 6 and layer 5 respectively; the second data address information of the remaining partial layer stack determined by the server based on the second stack backtrace table can be: the second data address information corresponding to layer 4, layer 3, layer 2, and layer 1 respectively.
[0116] In this case, a stack backtrace request can be generated based on the stack information of the partial layer stack found in the memory, the first data address information of the target layer stack in the partial layer stack, and the stack information of all currently called stacks stored in the memory.
[0117] Here, the target layer stack in the partial layer stack is the stack in the partial layer stack that most recently served as the target layer stack; the stack information of all stacks currently called stored in the memory may include the stack information of the stack called by the target application each time it runs.
[0118] In specific implementation, the stack information of the partial layer stack found in the memory can be used as the first stack backtracing result, and then a stack backtracing request is generated, carrying the first stack backtracing result, the first data address information of the target layer stack in the partial layer stack, and the stack information of all the currently called stacks stored in the memory.
[0119] In one embodiment, the information acquisition method provided by the embodiment of the present disclosure also includes a method for storing a second stack backtrace table on the server side. Specifically, the second stack backtrace table included in each binary file generated by the target application at runtime can be obtained. Among them, the binary file can be a compiled file generated when running the source code corresponding to the target application, which may include a second stack backtrace table for stack backtrace, and the second stack backtrace table stores address calculation data for calculating the data address information of each layer of stack in the register except the most recent target layer stack called by the target application during operation. For example, in the case where the target application sequentially calls six layers of stacks, 1, 2, 3, 4, 5, and 6, during operation, the second stack backtrace table stores address calculation data for calculating the data address information of the 5th, 4th, 3rd, 2nd, and 1st layers of stack in the register.
[0120] In addition, when the binary file running the target application includes binary files generated by running other clients, the stack backtrace tables in the binary files generated by running other clients can be obtained in advance, and these stack backtrace tables can be merged with the second stack backtrace tables included in each binary file generated by the above-mentioned target application at runtime to obtain a merged second stack backtrace table.
[0121] Afterwards, the merged second stack backtrace table may be sent to the server, so that the server stores the second stack backtrace table and determines the stack backtrace result corresponding to the target application by using the stored second stack backtrace table.
[0122] In this way, by sending and storing the second stack backtrace table to the server in advance, and the second stack backtrace table includes both the second stack backtrace table generated when the target application is running and the stack backtrace table generated by other clients, it can be ensured that the second stack backtrace table stored in the server is a complete second stack backtrace table, and further, it can be ensured that the server can use the stored second stack backtrace table to determine the complete stack backtrace result corresponding to the target application.
[0123] In one embodiment, after obtaining the stack backtrace result fed back by the server, the abnormal exception stack with the exception can be determined from each layer of the stack according to the stack information of each layer of the stack in the stack backtrace result. For example, in the stack information of each layer of the stack corresponding to the stack backtrace result, it can be determined that the corresponding function is the stack information of the function that generates the crash information, and the stack corresponding to the stack information is used as the abnormal stack; or, in the stack information of each layer of the stack corresponding to the stack backtrace result, it can be determined that the corresponding stack information does not meet the standard information amount, and the stack corresponding to the stack information is used as the abnormal stack.
[0124] Further, the abnormal application code corresponding to the abnormal stack can be determined, that is, the source code corresponding to the abnormal stack can be determined. Since the source code corresponds to the abnormal stack, the source code is the abnormal application code. Then, the abnormal application code can be updated to obtain the updated application code, that is, the abnormal application code can be modified and debugged to obtain the normal application code.
[0125] In addition, the embodiment of the present disclosure also provides an information acquisition method applied to the server, which determines the stack traceback result corresponding to the target application through the interaction between the server and the client. Figure 2 As shown, it is a flowchart of an information acquisition method applied to a server provided by an embodiment of the present disclosure, which may include the following steps:
[0126] S201: Receive a stack backtrace request for a target application sent by a client, where the stack backtrace request carries first data address information corresponding to a target layer stack that is most recently executed and stored in a register by the client.
[0127] Here, the stack backtrace request is determined by the client based on the first data address information corresponding to the target layer stack after failing to determine the second data address information of the next layer stack of the target layer stack, and is used to request the server to determine the stack backtrace result corresponding to the target application.
[0128] In one embodiment, if the client, in response to a stack backtrace trigger operation for a target application, obtains the first data address information corresponding to the target layer stack that was most recently run and stored in the register, and can only obtain the stack information of the target layer stack corresponding to the first data address information from the memory corresponding to the target application based on the first data address information, and cannot obtain the second data address information corresponding to the next layer stack of the target layer stack, then the first data address information carried in the stack backtrace request is the first data address information corresponding to the target layer stack that was most recently run and stored in the register by the client.
[0129] If the client cannot obtain the second data address information corresponding to the next layer stack in the continuous partial layer stack that is most recently the target layer stack after determining the second data address information of the continuous partial layer stack based on the first stack backtracking table, then the first data address information carried in the stack backtracking request is the data address information corresponding to the next layer stack in the continuous partial layer stack that is most recently the target layer stack.
[0130] During specific implementation, the server may receive a stack traceback request for a target application sent by the client at any time.
[0131] S202: Based on the first data address information and the pre-acquired second stack backtrace table generated by the target application during runtime, determine and feed back a stack backtrace result corresponding to the target application; the stack backtrace result includes stack information of each layer of stack called by the target application.
[0132] The stack backtracking table stores address calculation data for calculating data address information of a next layer of stack of at least one layer of stack in a register.
[0133] The second stack backtrace table is pre-acquired and stored by the server, and stores address calculation data for calculating the data address information in the register of each stack layer except the most recent target layer stack called by the target application during the running process. If the binary file running the target application includes a binary file generated by running other clients, the second stack backtrace table may also include stack backtrace tables generated by running other clients.
[0134] In addition, in addition to the first data address information, the stack backtrace request may also carry the following information: stack information of all currently called stacks stored in the memory, and stack information of continuous partial layer stacks found by the client in the memory.
[0135] In one embodiment, S202 may be implemented according to the following steps:
[0136] Step 1: Based on the first data address information, obtain the stack information of the target layer stack corresponding to the first data address information from the stack information of all currently called stacks stored in the memory carried in the stack backtrace request.
[0137] In specific implementation, the server can determine the memory address indicated by the first data address information, and then obtain the stack information of the stack corresponding to the memory address from the stack information of all currently called stacks stored in the memory carried in the stack backtrace request, and use the stack as the target layer stack corresponding to the first data address information. The stack information of the stack is the stack information of the target layer stack.
[0138] Here, since the stack backtrace request carries the stack information of all stacks currently called by the target application stored in the memory, regardless of whether the first data address carried in the stack backtrace request is the first data address information corresponding to the target layer stack most recently run and stored in the register by the client, or the data address information corresponding to the most recent target layer stack in the continuous partial layer stack determined by the client, the server can obtain the stack information of the stack corresponding to the first data address information.
[0139] Step 2: Based on the second stack backtrace table and the stack information of the target layer stack, determine the address calculation data corresponding to the next layer stack that matches the stack information, and based on the address calculation data and the stack information of the target layer stack, determine the second data address information of the next layer stack in the register, and obtain the stack information of the next layer stack stored in the memory address indicated by the second data address information in the memory.
[0140] In specific implementation, after obtaining the stack information of the target layer stack based on the above step one, the mapping relationship between the stack information of the previous layer stack and the address calculation data corresponding to the next layer stack in every two layers of the stack stored in the second stack backtracking table can be determined to match the stack information of the target layer stack, and the next layer stack corresponding to the mapping relationship can be used as the next layer stack of the target layer stack; furthermore, the existing address calculation algorithm can be used to determine the second data address information of the next layer stack according to the determined address calculation data of the next layer stack and the stack information of the target layer stack.
[0141] Afterwards, the stack information of the next stack stored in the memory address indicated by the second data address information can be obtained in the memory (from the stack information of all currently called stacks stored in the memory carried in the stack backtrace request) in the manner described in step one.
[0142] Step three: use the stack information of the next layer stack as the stack information of the new target layer stack, and return the stack information based on the second stack backtrace table and the target layer stack to determine the address calculation data corresponding to the next layer stack that matches the stack information, until a complete stack backtrace result is obtained, and then feed back the stack backtrace result to the client.
[0143] By using the stack information of the next layer stack determined in the above step 2 as the stack information of the new target layer stack and looping through the above steps, it is possible to use the second stack backtrace table to determine the stack backtrace results of the stack information of each layer stack called by the target application.
[0144] In one embodiment, the stack backtrace result may include the stack information of the continuous partial layer stack found in the memory carried in the stack backtrace request, and the stack information of the remaining partial layer stack determined by the server based on the first data address information and the second stack backtrace table.
[0145] Here, when the first data address carried in the stack backtrace request is the first data address information corresponding to the target layer stack most recently run and stored in the register by the client, the stack information of each layer of the stack included in the stack backtrace result is determined by the server.
[0146] In the case where the stack backtrace request also includes the stack information of the continuous partial layer stack that the client has found in the memory, that is, in the case where the stack backtrace request includes the first stack backtrace result mentioned in the above embodiment, the server only needs to obtain the stack information of the target layer stack corresponding to the first data address carried in the stack backtrace request and the stack information of the next layer stack, the next layer stack, etc. of the target layer stack, and does not need to obtain the stack information of each layer stack except the stack information of the target layer stack in the first stack backtrace result. In this case, the server can use the stack information of the remaining layer stacks it has obtained as the second stack backtrace result, and then merge the first stack backtrace result with the second stack backtrace result to obtain the final stack backtrace result.
[0147] Afterwards, the final stack backtrace result can be fed back to the client.
[0148] In this way, through the interaction between the client and the server, the client can obtain a complete stack backtrace result even when the stack backtrace table is not stored or the stored stack backtrace table is incomplete.
[0149] In one embodiment, with respect to the step of determining the address calculation data corresponding to the next layer stack that matches the stack information based on the second stack backtrace table and the stack information of the target layer stack in the above step 2, when the stack backtrace request includes the first stack backtrace result, the server can also determine the stack information of the target layer stack based on the first data address information carried in the stack backtrace request, and then compare the stack information of the target layer stack with the stack information of the most recent target layer stack in the first stack backtrace result, and when it is determined that the two are consistent, execute the above step of determining the address calculation data corresponding to the next layer stack that matches the stack information based on the second stack backtrace table and the stack information of the target layer stack. Otherwise, the server will generate an exception prompt message and send it to the client.
[0150] In this way, since the first data address information carried in the stack backtrace request is the data address information corresponding to the stack information of the most recent target layer stack in the first stack backtrace result, the stack information of the target layer stack searched by the server according to the first data address information should be the same as the stack information of the most recent target layer stack in the first stack backtrace result, otherwise it is an abnormal situation. Through the above comparison steps, effective monitoring of this abnormality can be achieved.
[0151] like Figure 3 As shown, it is a flowchart of the interaction between a client and a server provided by an embodiment of the present disclosure, which may include the following steps:
[0152] S301: In response to a stack backtrace triggering operation for a target application, first data address information corresponding to a most recently executed target layer stack and stored in a register is obtained.
[0153] S302: Based on the first data address information, obtain stack information of the target layer stack from the memory corresponding to the target application.
[0154] S303: Determine whether there is a first stack backtrace table in the memory corresponding to the target application.
[0155] If yes, execute S304; if no, execute S306.
[0156] S304: Determine whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtracking table.
[0157] If yes, execute S305; if no, execute S306.
[0158] S305: If the second data address information is determined on the client, the stack information of the next layer stack stored in the memory address indicated by the second data address information is obtained in the memory; the stack information of the next layer stack is used as the stack information of the new target layer stack, and the step of judging in S304 whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtracking table is returned to execute.
[0159] Here, in the process of returning to execute S304 to judge whether the second data address information of the next layer of stack matching the stack information in the register can be determined based on the first stack backtrace table, if the target application determines the second data address information of a continuous partial layer stack based on the first stack backtrace table and cannot obtain the second data address information of the remaining layer stack, S306 is executed.
[0160] S306: If the second data address information cannot be determined on the client, generate a stack backtrace request based on the first data address information, and send the stack backtrace request to the server.
[0161] Here, the situation where the second data address information cannot be determined in the target application may include: the first stack backtrace table cannot be found in the memory; or the first stack backtrace table is found in the memory, but the address calculation data of the next layer stack corresponding to the target layer stack is not stored in the found first stack backtrace table; or the target application determines the second data address information of a continuous partial layer stack based on the first stack backtrace table, and cannot obtain the second data address information of the remaining layer stack.
[0162] In specific implementation, for the first two situations mentioned above, a stack backtrace request can be generated and sent to the server directly based on the first data address information corresponding to the target layer stack that was most recently run and stored in the register and the stack information of all currently called stacks stored in the memory.
[0163] For the third situation mentioned above, a stack backtrace request can be generated and sent to the server based on the stack information of the partial layer stack found in the memory, the first data address information of the target layer stack in the partial layer stack, and the stack information of all the currently called stacks stored in the memory.
[0164] The above S301 to S306 are all steps executed by the client.
[0165] S307: Receive a stack backtrace request for the target application sent by the client.
[0166] S308: Based on the first data address information, obtain the stack information of the target layer stack corresponding to the first data address information from the stack information of all currently called stacks stored in the memory carried in the stack backtrace request.
[0167] S309: Based on the second stack backtrace table and the stack information of the target layer stack, determine the address calculation data corresponding to the next layer stack that matches the stack information, and based on the address calculation data and the stack information of the target layer stack, determine the second data address information of the next layer stack in the register, and obtain the stack information of the next layer stack stored in the memory address indicated by the second data address information in the memory.
[0168] S310: The stack information of the next stack layer is used as the stack information of the new target stack layer, and the process returns to S309 until a complete stack backtrace result is obtained, and the stack backtrace result is fed back to the client.
[0169] The above S307 to S310 are all steps executed by the server.
[0170] Regarding the specific implementation steps of S301 to S310 above, reference may be made to the above embodiments, which will not be described in detail here.
[0171] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0172] Based on the same inventive concept, an information acquisition device corresponding to the information acquisition method applied to the client is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned information acquisition method applied to the client in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0173] like Figure 4 FIG. 1 is a schematic diagram of an information acquisition device applied to a client provided by an embodiment of the present disclosure, including:
[0174] The acquisition module 401 is used to obtain the first data address information corresponding to the target layer stack that is most recently executed and stored in the register in response to the stack backtrace trigger operation for the target application;
[0175] A judgment module 402 is used to obtain the stack information of the target layer stack from the memory corresponding to the target application based on the first data address information; and in the case where a first stack backtrace table is stored in the memory, judge whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtrace table; wherein the stack backtrace table stores address calculation data for calculating the data address information of the next layer stack of at least one layer of stack in the register;
[0176] A generation module 403 is used to generate a stack backtrace request based on the first data address information if the second data address information cannot be determined on the client, and send the stack backtrace request to the server corresponding to the target application; the stack backtrace request is used to request the server to determine and feedback the stack backtrace result corresponding to the target application based on the stack backtrace request and a pre-stored second stack backtrace table; the stack backtrace result includes the stack information of each layer of the stack called by the target application.
[0177] In a possible implementation, the device further includes:
[0178] The loop module 404 is used to obtain the stack information of the next layer stack stored in the memory address indicated by the second data address information in the memory if the second data address information is determined in the client; use the stack information of the next layer stack as the stack information of the new target layer stack, and return to the step of judging whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtracing table, until the complete stack backtracing result is obtained.
[0179] In a possible implementation manner, the situation where the generating module 403 fails to determine the second data address information at the client includes:
[0180] The generation module fails to find the first stack backtrace table in the memory; or,
[0181] The generating module finds the first stack backtrace table in the memory, but the first stack backtrace table does not store address calculation data of the next stack layer corresponding to the target stack layer.
[0182] In a possible implementation, if the second data address information of a continuous partial layer stack is determined based on the first stack backtrace table, and the second data address information of the remaining partial layer stack is determined by the server based on the second stack backtrace table, then the generation module 403 is used to generate the stack backtrace request based on the stack information of the partial layer stack found in the memory, the first data address information of the target layer stack in the partial layer stack, and the stack information of all currently called stacks stored in the memory.
[0183] In a possible implementation, the device further includes:
[0184] A sending module 405 is used to obtain a second stack backtrace table included in each binary file generated by the target application when running;
[0185] The second stack backtrace table is sent to the server, so that the server stores the second stack backtrace table and uses the stored second stack backtrace table to determine a stack backtrace result corresponding to the target application.
[0186] In a possible implementation, the device further includes:
[0187] The updating module 406 is used to determine an abnormal stack with an abnormality from each layer of the stack based on the stack information of each layer of the stack in the stack backtracing result after obtaining the stack backtracing result fed back by the server;
[0188] An abnormal application code corresponding to the abnormal stack is determined, and the abnormal application code is updated to obtain an updated application code.
[0189] Based on the same inventive concept, an information acquisition device corresponding to the information acquisition method applied to the server is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the information acquisition method applied to the server in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0190] like Figure 5 FIG. 1 is a schematic diagram of an information acquisition device applied to a server provided by an embodiment of the present disclosure, including:
[0191] The receiving module 501 is used to receive a stack backtrace request for a target application sent by a client, wherein the stack backtrace request carries first data address information corresponding to a target layer stack that is most recently run and stored in a register by the client;
[0192] The determination module 502 is used to determine and feedback the stack backtracing result corresponding to the target application based on the first data address information and the second stack backtracing table generated by the target application at runtime and obtained in advance; the stack backtracing result includes the stack information of each layer of stack called by the target application; wherein, the stack backtracing table stores address calculation data for calculating the data address information of the next layer of stack of at least one layer of stack in the register.
[0193] In a possible implementation, the determination module 502 is used to obtain, based on the first data address information, the stack information of the target layer stack corresponding to the first data address information from the stack information of all currently called stacks stored in the memory carried in the stack backtrace request;
[0194] Based on the second stack backtrace table and the stack information of the target layer stack, determine the address calculation data corresponding to the next layer stack that matches the stack information, and based on the address calculation data and the stack information of the target layer stack, determine the second data address information of the next layer stack in the register, and obtain in the memory the stack information of the next layer stack stored in the memory address indicated by the second data address information;
[0195] The stack information of the next layer stack is used as the stack information of the new target layer stack, and the step of determining the address calculation data corresponding to the next layer stack that matches the stack information is returned based on the second stack backtracing table and the stack information of the target layer stack, until a complete stack backtracing result is obtained, and the stack backtracing result is fed back to the client.
[0196] In one possible implementation, the stack backtrace result includes stack information of a continuous partial layer stack found in the memory and carried in the stack backtrace request, and stack information of a remaining partial layer stack determined by the server based on the first data address information and the second stack backtrace table.
[0197] In one possible implementation, the determination module 502 is used to determine the address calculation data corresponding to the next layer stack that matches the stack information based on the second stack backtrace table and the stack information of the target layer stack, when it is determined that the acquired stack information of the target layer stack corresponding to the first data address information is consistent with the stack information of the target layer stack in the stack information of the continuous partial layer stack found in the memory and carried in the stack backtrace request.
[0198] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0199] The present disclosure also provides a computer device, such as Figure 6 FIG. 1 is a schematic diagram of a computer device structure provided by an embodiment of the present disclosure, including:
[0200] Processor 61 and memory 62; the memory 62 stores machine-readable instructions executable by the processor 61, and the processor 61 is used to execute the machine-readable instructions stored in the memory 62. When the machine-readable instructions are executed by the processor 61, the processor 61 performs the following steps: S101: In response to a stack backtrace trigger operation for a target application, obtain the first data address information corresponding to the target layer stack that is most recently run and stored in the register; S102: Based on the first data address information, obtain the stack information of the target layer stack from the memory corresponding to the target application; and when a first stack backtrace table is stored in the memory, determine whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtrace table; and S103: If the second data address information cannot be determined on the client, generate a stack backtrace request based on the first data address information, and send the stack backtrace request to the server corresponding to the target application; or,
[0201] Processor 61 and memory 62; the memory 62 stores machine-readable instructions executable by the processor 61, and the processor 61 is used to execute the machine-readable instructions stored in the memory 62. When the machine-readable instructions are executed by the processor 61, the processor 61 performs the following steps: S201: receiving a stack backtrace request for a target application sent by a client, the stack backtrace request carrying the first data address information corresponding to the target layer stack that is most recently run and stored in a register by the client, and S202: based on the first data address information and a second stack backtrace table generated by the pre-acquired target application at runtime, determining and feeding back a stack backtrace result corresponding to the target application; the stack backtrace result includes stack information of each layer of stack called by the target application.
[0202] The above-mentioned memory 62 includes internal memory 621 and external memory 622; the memory 621 here is also called internal memory, which is used to temporarily store the calculation data in the processor 61, as well as the data exchanged with the external memory 622 such as the hard disk. The processor 61 exchanges data with the external memory 622 through the internal memory 621.
[0203] The specific execution process of the above instructions can refer to the steps of the information acquisition method described in the embodiment of the present disclosure, which will not be repeated here.
[0204] The present disclosure also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the steps of the information acquisition method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0205] The computer program product of the information acquisition method provided in the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the information acquisition method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0206] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0207] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0208] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0209] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0210] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0211] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for obtaining information, characterized in that: Applied to the client, including: In response to a stack backtrace trigger operation for a target application, obtaining first data address information corresponding to a most recently executed target layer stack stored in a register; Based on the first data address information, the stack information of the target layer stack is obtained from the memory corresponding to the target application; and in the case where the first stack backtrace table is stored in the memory, it is determined whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtrace table; wherein the stack backtrace table stores address calculation data for calculating the data address information of the next layer stack of at least one layer of stack in the register; If the second data address information cannot be determined on the client, a stack backtrace request is generated based on the first data address information, and the stack backtrace request is sent to the server corresponding to the target application; the stack backtrace request is used to request the server to determine and feedback the stack backtrace result corresponding to the target application based on the stack backtrace request and a pre-stored second stack backtrace table; the stack backtrace result includes stack information of each layer of the stack called by the target application.
2. The method according to claim 1, characterized in that: The method further comprises: If the second data address information is determined in the client, the stack information of the next layer stack stored in the memory address indicated by the second data address information is obtained in the memory; the stack information of the next layer stack is used as the stack information of the new target layer stack, and the step of judging whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtracing table is returned until the complete stack backtracing result is obtained.
3. The method according to claim 1, characterized in that The situation where the second data address information cannot be determined at the client includes: The first stack backtrace table cannot be found in the memory; or, The first stack backtracking table is found in the memory, but the first stack backtracking table does not store address calculation data of the next layer stack corresponding to the target layer stack.
4. The method according to claim 2, characterized in that: If second data address information of a continuous portion of the layer stack is determined based on the first stack backtracking table, and the server determines second data address information of the remaining portion of the layer stack based on the second stack backtracking table, then generating a stack backtracking request based on the first data address information includes: The stack backtrace request is generated based on the stack information of the partial layer stack found in the memory, the first data address information of the target layer stack in the partial layer stack, and the stack information of all currently called stacks stored in the memory.
5. The method according to claim 1, characterized in that The method further comprises: Obtaining a second stack backtrace table included in each binary file generated by the target application during runtime; The second stack backtrace table is sent to the server, so that the server stores the second stack backtrace table and uses the stored second stack backtrace table to determine a stack backtrace result corresponding to the target application.
6. The method according to any one of claims 1 to 5, characterized in that: After obtaining the stack traceback result fed back by the server, the method further includes: Based on the stack information of each layer of stack in the stack backtrace result, determining an abnormal exception stack having an exception from each layer of stack; An abnormal application code corresponding to the abnormal stack is determined, and the abnormal application code is updated to obtain an updated application code.
7. An information acquisition method, characterized in that: Applied to the server, including: Receive a stack backtrace request for a target application sent by a client, wherein the stack backtrace request carries first data address information corresponding to a target layer stack that is most recently run and stored in a register by the client; Based on the first data address information and the second stack backtrace table generated by the target application at runtime and obtained in advance, the stack backtrace result corresponding to the target application is determined and fed back; the stack backtrace result includes the stack information of each layer of stack called by the target application; wherein, the stack backtrace table stores address calculation data for calculating the data address information of the next layer of stack of at least one layer of stack in the register.
8. The method according to claim 7, characterized in that The determining and feeding back a stack backtrace result corresponding to the target application based on the first data address information and a pre-acquired second stack backtrace table generated by the target application when running, includes: Based on the first data address information, acquiring stack information of a target layer stack corresponding to the first data address information from stack information of all currently called stacks stored in the memory carried in the stack backtrace request; Based on the second stack backtrace table and the stack information of the target layer stack, determine the address calculation data corresponding to the next layer stack that matches the stack information, and based on the address calculation data and the stack information of the target layer stack, determine the second data address information of the next layer stack in the register, and obtain in the memory the stack information of the next layer stack stored in the memory address indicated by the second data address information; The stack information of the next layer stack is used as the stack information of the new target layer stack, and the step of determining the address calculation data corresponding to the next layer stack that matches the stack information is returned based on the second stack backtracing table and the stack information of the target layer stack, until a complete stack backtracing result is obtained, and the stack backtracing result is fed back to the client.
9. The method according to claim 8, characterized in that The stack backtrace result includes stack information of a continuous partial layer stack found in the memory and carried in the stack backtrace request, and stack information of a remaining partial layer stack determined by the server based on the first data address information and the second stack backtrace table.
10. The method according to claim 8, characterized in that The determining, based on the second stack backtrace table and the stack information of the target layer stack, address calculation data corresponding to the next layer stack matching the stack information comprises: When it is determined that the stack information of the target layer stack corresponding to the first data address information is consistent with the stack information of the target layer stack in the stack information of the continuous partial layer stack found in the memory and carried in the stack backtrace request, the address calculation data corresponding to the next layer stack matching the stack information is determined based on the second stack backtrace table and the stack information of the target layer stack.
11. An information acquisition device, characterized in that: Applied to the client, including: An acquisition module, configured to acquire, in response to a stack backtrace trigger operation for a target application, first data address information corresponding to a target layer stack that is most recently executed and stored in a register; A judgment module, used for obtaining the stack information of the target layer stack from the memory corresponding to the target application based on the first data address information; and in the case where a first stack backtrace table is stored in the memory, judging whether the second data address information of the next layer stack in the register that matches the stack information can be determined based on the first stack backtrace table; wherein the stack backtrace table stores address calculation data for calculating the data address information of the next layer stack of at least one layer of stack in the register; A generation module is used to generate a stack backtrace request based on the first data address information if the second data address information cannot be determined on the client, and send the stack backtrace request to the server corresponding to the target application; the stack backtrace request is used to request the server to determine and feedback the stack backtrace result corresponding to the target application based on the stack backtrace request and a pre-stored second stack backtrace table; the stack backtrace result includes the stack information of each layer of the stack called by the target application.
12. An information acquisition device, characterized in that: Applied to the server, including: A receiving module, configured to receive a stack backtrace request for a target application sent by a client, wherein the stack backtrace request carries first data address information corresponding to a target layer stack that is most recently run and stored in a register by the client; A determination module is used to determine and feedback a stack backtracing result corresponding to the target application based on the first data address information and a pre-acquired second stack backtracing table generated by the target application during runtime; the stack backtracing result includes stack information of each layer of stack called by the target application; wherein the stack backtracing table stores address calculation data for calculating the data address information of the next layer of stack of at least one layer of stack in the register.
13. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the information acquisition method according to any one of claims 1 to 10.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the information acquisition method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Method for tracking memory usages of a data processing system
CN103123604A
System vulnerability detection method and device, equipment and medium
CN111177726A