A method for obtaining a call stack when a simulation application is running and a computing device
By obtaining the call stack of the second architecture registers during simulator debugging, the problem of not being able to intuitively view the error context of Windows software x86 instructions on ARM architecture Linux systems is solved, enabling intuitive error viewing in the interrupt context.
Patent Information
- Application Number
- CN202210768798.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2042-06-30
AI Technical Summary
On Linux systems based on the ARM architecture, when running the Wine compatibility layer via box86 emulation, it is impossible to directly observe the x86 instruction error state of the Windows software, resulting in frequent runtime errors.
By inputting extended commands during the debugging process of the simulator, the second architecture registers of the interrupt context of the first architecture processor are obtained. Based on these registers, stack backtracking is performed to obtain the call stack of the second architecture instructions of the compatibility layer or application.
This invention enables the direct acquisition of the call stack of the second architecture instructions of the compatibility layer or application during simulation, allowing for a direct view of the error situation and solving the problem of the inability to view the error situation directly in existing technologies.
Smart Images

Figure CN115185638B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a method for obtaining a call stack when an application is simulated to run and a computing device. BACKGROUND
[0002] With the continuous upgrading of computers, operating systems are also constantly upgraded. Windows operating system has occupied a large part of the computer operating system market, and the software ecology on the Windows operating system is also extremely rich. In recent years, with the rise of Linux operating system, more and more computers choose to use Linux operating system. Due to reasons such as hardware and system interface not supporting, the software of Windows operating system cannot run on Linux operating system.
[0003] According to the difference of CPU architecture, on the Linux system of X86 and X86_64 architecture, Wine (Wine is not an emulator, a compatibility layer that makes Windows programs run normally on the Linux system of X86 architecture by implementing the system functions of Windows on the Linux system of X86 architecture) can be used to compatibly run the software of Windows operating system. However, Wine only provides support for X86 and X86_64 architecture, and ARM architecture cannot directly run Wine.
[0004] On the Linux system of ARM architecture, box86 needs to be used to simulate the running of Wine compatibility layer. The principle of box86 is to analyze and translate X86 instructions into ARM instructions for execution, or to use c code to simulate the function of X86 instructions to realize its behavior. However, box86 still has some problems of untranslated instructions or imperfect instruction translation, and the robustness is insufficient, so that when Wine is simulated to run on the Linux system of ARM architecture to compatibly execute Windows software, running errors often occur. The error performance includes, for example, that the execution result of the software does not meet the expectation, the software crashes during execution, the software is stuck during execution, and the like.
[0005] In order to solve the running error of the box86 emulation running Wine to compatible execute Windows software, the gdb needs to be used to debug the box86. During the debugging of the box86, the X86 instruction is translated into the ARM instruction and stored in the heap for execution, or simulated into the c code for execution, so that the error interrupt field is in the converted ARM instruction, only the call stack of the box86 (the function call chain of the box86 in the interrupt field under the ARM is presented), the ARM register and other ARM interrupt field information can be viewed, and the error field of the X86 instruction of the compatible layer or the Windows software cannot be directly viewed.
[0006] Therefore, a method for acquiring the call stack during the emulation running of the application program is needed to solve the problems in the above scheme. SUMMARY
[0007] Therefore, the application provides a method for acquiring the call stack during the emulation running of the application program to solve or at least alleviate the above problems.
[0008] According to one aspect of the application, a method for acquiring the call stack during the emulation running of the application program is provided, which is executed in a computing device, wherein the computing device comprises a first architecture processor and runs a first operating system; an emulator and a compatible layer of a second operating system are arranged on the first operating system, so as to emulate running of the compatible layer by the emulator and running of a second application program of the second operating system based on the compatible layer; the method comprises: converting and executing the second architecture instruction of the compatible layer and the second application program into the first architecture instruction by the emulator; in response to the running interrupt of the first architecture processor, debugging the emulator and acquiring an input extended command; executing the extended command to acquire the current second architecture register of the second architecture field from the interrupt field of the first architecture processor; and acquiring the call stack of the second architecture instruction of the compatible layer or the second application program based on the current second architecture register.
[0009] Optionally, in the method for acquiring the call stack during the emulation running of the application program according to the application, the acquiring of the current second architecture register of the second architecture field from the interrupt field of the first architecture processor comprises: acquiring the second architecture field structure body pointer of the interrupt field; and acquiring the current second architecture register of the second architecture field based on the second architecture field structure body pointer.
[0010] Optionally, in the method for acquiring the call stack during the emulation running of the application program according to the application, the acquiring of the second architecture field structure body pointer of the interrupt field comprises: acquiring the first architecture register from the interrupt field of the first architecture processor; and acquiring the second architecture field structure body pointer based on the first architecture register.
[0011] Optionally, in the method for acquiring a call stack when an application is simulated to run according to the application, the acquiring the call stack of the second architecture instruction of the compatibility layer or the second application based on the current second architecture register comprises: performing stack backtracking based on the current second architecture register to acquire the call stack of the second architecture instruction of the compatibility layer or the second application.
[0012] Optionally, in the method for acquiring a call stack when an application is simulated to run according to the application, the performing stack backtracking based on the current second architecture register comprises: acquiring a return address based on the current second architecture register; backtracking to a previous function based on the return address and acquiring an upper-layer second architecture register corresponding to the previous function, the upper-layer second architecture register storing a previous stack frame.
[0013] Optionally, in the method for acquiring a call stack when an application is simulated to run according to the application, the performing stack backtracking based on the current second architecture register further comprises: acquiring a new return address based on the upper-layer second architecture register; backtracking to a new previous function based on the new return address and acquiring a new upper-layer second architecture register corresponding to the new previous function, until a complete call stack is acquired, wherein the new upper-layer architecture register stores a new previous stack frame.
[0014] Optionally, in the method for acquiring a call stack when an application is simulated to run according to the application, the debugging the simulator comprises: debugging the simulator by using a debugging tool.
[0015] Optionally, in the method for acquiring a call stack when an application is simulated to run according to the application, the first architecture is an ARM architecture, and the second architecture is an X86 architecture; the first operating system is a Linux operating system, and the second operating system is a Windows operating system.
[0016] Optionally, in the method for acquiring a call stack when an application is simulated to run according to the application, the compatibility layer is Wine, and the simulator is box86.
[0017] According to an aspect of the application, there is provided a computing device, comprising: at least one processor; a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, and the program instructions comprise instructions for executing the method for acquiring a call stack when an application is simulated to run.
[0018] According to one aspect of the present application, there is provided a readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to perform the method of acquiring a call stack when emulating running an application program as described above.
[0019] According to the technical solution of the present application, there is provided a method of acquiring a call stack when emulating running an application program, wherein, in a computing device arranged with a first architecture processor and a first operating system, when an application program of a second operating system is emulated to run by a compatibility layer based on an emulator, if a running interruption occurs due to a second architecture instruction error, when the emulator is debugged by using a debugging tool, the current second architecture register of the second architecture site can be acquired from the interruption site of the first architecture processor by inputting an extended command and executing the extended command, and based on the current second architecture register, stack backtracking can be performed to acquire the call stack of the second architecture instruction of the compatibility layer or the second application program. In this way, in the debugging process of the emulator, the call stack of the second architecture instruction of the compatibility layer or the application program can be directly acquired from the interruption site, so that the error site of the second architecture instruction can be intuitively viewed.
[0020] The above description is only a summary of the technical solution of the present application. In order to enable the technical means of the present application to be more clearly understood, the present application can be implemented according to the contents of the description, and in order to enable the above and other purposes, features and advantages of the present application to be more apparent and easy to understand, the specific embodiments of the present application are described below. BRIEF DESCRIPTION OF DRAWINGS
[0021] To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings. These aspects are indicative of various ways in which the principles disclosed herein can be practiced and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The foregoing and other objects, features, and advantages of the disclosure will be apparent from the following description of certain aspects as taken in connection with the accompanying drawings in which like reference numbers in the drawings represent like elements throughout. The detailed description set forth below in connection with the appended drawings is intended as a description of certain aspects and is not intended to represent the only ways in which the concepts described herein can be practiced. The below detailed description is therefore not intended to limit the scope of the disclosure, but is presented to aid understanding of the concepts described herein. The detailed description includes specific details for the purpose of providing a thorough understanding of the concepts described herein. However, it will be apparent to those skilled in the art that the concepts described herein can be practiced without these specific details. In some instances, well-known structures and components are shown in block diagram form in order to avoid obscuring the concepts described herein. As such, it will be appreciated that the concepts described herein can be practiced in a variety of ways.
[0022] Figure 1 A schematic diagram of a computing device 100 according to one embodiment of the present application is shown;
[0023] Figure 2 A schematic diagram of a computing device 100 running a first operating system according to one embodiment of the present application is shown;
[0024] Figure 3 A flowchart of a method 300 of acquiring a call stack when emulating running an application program according to one embodiment of the present application is shown;
[0025] Figure 4A distribution diagram of a call stack is shown according to one embodiment of the present application.
[0026] Figure 5 A flow diagram of step 340 is shown according to one embodiment of the present application. DETAILED DESCRIPTION
[0027] Exemplary embodiments of the present disclosure will be described herein below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
[0028] The method for acquiring a call stack when a simulation running application program according to the present application is directed to the technical problem that when a simulation running application program of a second operating system based on a simulator simulating a compatibility layer is executed, a running interruption occurs, but the error site of the second architecture instruction of the application program of the compatibility layer or the second operating system cannot be directly observed. In the debugging process of the simulator, an extended command is inputted to directly acquire the call stack of the second architecture instruction of the application program or the compatibility layer at the interruption site.
[0029] Figure 1 A schematic diagram of a computing device 100 according to one embodiment of the present application is shown. As shown in Figure 1 In a basic configuration, the computing device 100 includes at least one processing unit 102 and a system memory 160, according to one aspect. Depending on the configuration and type of computing device, the processing unit 102 can be implemented as a processor or processors, according to one aspect. In embodiments of the application, the processing unit 102 can be implemented as a first architecture processor. In one embodiment, the first architecture processor can be, for example, an ARM processor. The system memory 160 can include, without limitation, volatile memory (e.g., random access memory), non-volatile memory (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, the system memory 160 includes an operating system 150.
[0030] According to one embodiment of the present application, the operating system 150 can be implemented as a first operating system, adapted to run application programs of the first operating system.
[0031] According to one aspect, the operating system 150 is adapted to control the operation of the computing device 100, for example. Moreover, the examples are practiced in conjunction with a graphics library, other operating systems, or any other application programs, and are not limited to any particular application or system. The exemplary embodiments have been described herein in reference to particular embodiments. Figure 1The basic configuration is shown by those components within the dashed line. According to an aspect, computing device 100 has additional features or functionality. For example, according to an aspect, computing device 100 includes additional data storage devices (removable and / or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in Figure 1 illustrated by removable storage device 109 and non-removable storage device 110.
[0032] As stated above, according to an aspect, program module 140 is stored in system memory 160. According to an aspect, program module 140 can include one or more applications that can include applications running directly on the first operating system, and applications adapted to the second operating system. Here, the present application does not limit the type of applications, for example, the applications can include: email and contact applications, word processing applications, spreadsheet applications, database applications, slide presentation applications, drawing or computer-aided applications, web browser applications, etc.
[0033] In embodiments according to the present application, program module 140 can further include an emulator 230 that can run on the first operating system, and through the emulator 230, a compatible layer 240 of the second operating system can be emulated to run on the first operating system on the first architecture processor, so as to run applications of the second operating system (second applications 250) based on the compatible layer 240. It should be noted that in order to distinguish the applications of the second operating system from the applications of the first operating system, the applications of the second operating system can be referred to as "second applications", and the applications of the first operating system can be referred to as "first applications". In addition, program module 140 can further include a debugging tool 260 for debugging the emulator.
[0034] According to an aspect, the examples can be practiced with circuitry integrated on one chip, with discrete components or a combination of one or more Figure 1Each or many of the components illustrated in FIG. 1 can be practiced on a system-on-a-chip (SOC) integrated on a single integrated circuit in accordance with examples. According to one aspect, such an SOC device can include one or more processing units, graphics units, communications units, system virtualization units, and various application functionality all of which are integrated (or "burned") onto the chip substrate according to an embodiment. When operating via an SOC, the functionality described herein can be operated via application-specific logic integrated with other components of the computing device 100 on the single integrated circuit (chip). Embodiments of the application can also be practiced using other technologies that now exist or are developed in the future, including, but not limited to, mechanical, optical, fluidic, and quantum technologies. In addition, embodiments of the application can be practiced within a general computer system or in any other circuits or systems.
[0035] According to one aspect, the computing device 100 can also have one or more input device(s) 112 such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. Output device(s) 114 such as a display, speakers, a printer, etc. can also be included. The aforementioned devices are examples and others can be used. The computing device 100 can include one or more communication connections 116 allowing communications with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver, and / or transceiver circuitry; universal serial bus (USB), parallel, and / or serial ports.
[0036] The term computer readable media as used herein includes computer storage media. Computer storage media can include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, or program modules. The system memory 160, the removable storage device 109, and the non-removable storage device 110 are all computer storage media examples (i.e., memory storage.) Computer storage media can include Random Access Memory (RAM), Read Only Memory (ROM), Electronically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store information and which can be accessed by computing device 100. According to one aspect, any such computer storage media can be part of the computing device 100. Computer storage media does not include a modulated data signal or other propagated data signal.
[0037] According to an aspect, a communication medium is embodied by a computer readable instruction, a data structure, a program module, or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and includes any information delivery media. According to an aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.
[0038] In an embodiment according to the present application, the computing device 100 is configured to perform the method 300 of acquiring a call stack when running an application according to the present application. The computing device 100 comprises one or more processors, and one or more readable storage media storing program instructions which, when configured to be executed by the one or more processors, cause the computing device to perform the method 300 of acquiring a call stack when running an application according to the present application.
[0039] According to an embodiment of the present application, the computing device 100 comprises a plurality of program instructions for performing the method 300 of acquiring a call stack when running an application according to the present application, which can instruct the processor to perform the method 300 of acquiring a call stack when running an application according to the present application.
[0040] Figure 2 A schematic diagram of the computing device 100 running a first operating system according to an embodiment of the present application is shown. As shown, the computing device 100 comprises a first architecture processor 210, and runs a first operating system 220, on which an application layer is arranged. Figure 2 The first architecture processor 210 can support the running of the first operating system 220, and the first architecture processor 210 and the first operating system 220 can support the running of a first application program.
[0041] In an embodiment, the application layer can comprise one or more application programs, such as a first application program which can run directly on the first operating system 220. The first architecture processor 210 can support the running of the first operating system 220, and the first architecture processor 210 and the first operating system 220 can support the running of the first application program.
[0042] In an embodiment of the present application, the application layer on the first operating system 220 further comprises an emulator 230, a compatibility layer 240 of a second operating system, and one or more second application programs 250. Here, the second application program 250 can be an application program of the second operating system, and specifically can be an application program running based on the second architecture processor and the second operating system. The second application program 250 running on the first operating system 220 based on the emulator 230 and the compatibility layer 240 can be implemented.
[0043] It should be noted that the compatibility layer 240 can run on the second architecture processor, but cannot run directly on the first architecture processor 210, and therefore cannot run directly on the first operating system 220 on the first architecture processor 210. The emulator 230 can run on the first operating system 220 on the first architecture processor 210, and through the emulator 230, the compatibility layer 240 (of the second operating system) can be simulated and run on the first operating system 220 on the first architecture processor 210. In this way, the second application 250 of the second operating system can be run based on the compatibility layer 240.
[0044] In an embodiment of the present invention, a debugging tool 260 is also arranged in the application layer. The debugging tool 260 can run directly on the first operating system 220 and is used to debug the simulator 230.
[0045] In one embodiment of the present invention, the first architecture can be an ARM architecture, and the second architecture can be an x86 architecture (including x86_64 architecture), etc. Accordingly, the first architecture processor 210 can be an ARM processor.
[0046] The first operating system 220 is, for example, a Linux operating system, and the second operating system is, for example, a Windows operating system.
[0047] In one implementation, the compatibility layer 240 of the second operating system can be implemented as Wine (Wine is not an emulator, a compatibility layer 240 that enables Windows applications to run normally on the x86 architecture Linux operating system by implementing Windows system functions on the x86 architecture Linux operating system).
[0048] In one implementation, the emulator 230 can be implemented as a box86, which is a user-level x86 emulator on a Linux system, enabling the running of x86 architecture Linux programs on non-x86 architecture Linux systems. Figure 3 A flowchart of a method 300 for obtaining the call stack when simulating and running an application according to an embodiment of the present invention is shown. Method 300 is adapted to be executed in a computing device (the aforementioned computing device 100).
[0049] like Figure 3 As shown, method 300 may include steps 310 to 340.
[0050] In step 310, the second architecture instruction of the compatibility layer 240 and the second application 250 is converted into the first architecture instruction and executed by the emulator 230. Here, the converted first architecture instruction can be stored in the heap of the memory or simulated into c code and executed.
[0051] It should be noted that when the first architecture instruction converted from the second architecture instruction via the emulator 230 has errors or other abnormal problems, the first architecture processor 210 will be interrupted. Since the interrupt site of the first architecture processor 210 is in the converted first architecture instruction, when the emulator 230 is debugged according to the prior art, only the first architecture register, the call stack of the emulator 230 (presenting the function call chain of the emulator 230 in the interrupt site under the first architecture) can be obtained from the interrupt site, and the call stack of the second architecture instruction of the compatibility layer 240 or the second application 250 cannot be obtained from the interrupt site, which results in that the errors of the second architecture instruction of the compatibility layer 240 or the second application 250 cannot be directly observed.
[0052] According to the method 300 of the present application, in step 320, in response to the interrupt of the first architecture processor 210, the emulator 230 is debugged, and the extended command input by the user is obtained.
[0053] In one embodiment, the emulator 230 can be debugged by the debugging tool 260 on the first operating system. That is, when the emulator 230 is debugged by the debugging tool, the extended command input by the user can also be obtained, so as to add the extended command in the debugging tool. In one implementation, the debugging tool 260 can be implemented as gdb (debugging tool under UNIX and UNIX-like) for example.
[0054] Subsequently, in step 330, by executing the extended command, the current second architecture register in the second architecture site can be obtained from the interrupt site of the first architecture processor 210.
[0055] It should be noted that when the emulator 230 is used to simulate the running of the compatibility layer 240 and the second application 250, the second architecture site can be saved, which contains the second architecture register (such as X86 register) and other information.
[0056] Specifically, by executing the extended command, the second-architecture frame structure pointer of the interrupt site can be automatically detected, and the second-architecture frame structure pointer of the interrupt site (saved by the emulator 230 when emulating the compatible layer 240 and the second application 250) can be obtained. Then, based on the second-architecture frame structure pointer, the current second-architecture register of the second-architecture frame can be obtained, so as to obtain the information stored in the second-architecture register. Here, the current second-architecture register stores the stack frame of the current function.
[0057] In one embodiment of the present application, when the emulator 230 converts the second-architecture instructions of the compatible layer 240 and the second application 250 into first-architecture instructions and executes them, the interrupt site of the first-architecture processor 210 contains a first-architecture register, and the first-architecture register points to a second-architecture frame structure.
[0058] That is, the first-architecture register can be obtained from the interrupt site of the first-architecture processor 210, and based on the first-architecture register, the second-architecture frame structure pointer can be obtained. Further, based on the second-architecture frame structure pointer, the current second-architecture register of the second-architecture frame can be obtained, so as to obtain the stack frame of the current function stored in the second-architecture register.
[0059] In one embodiment, the second-architecture register is, for example, an ebp register. The second-architecture frame structure can be implemented as an x86emu_t structure.
[0060] In one embodiment, the first-architecture register can be implemented as an r0 register.
[0061] Finally, in step 340, based on the current second-architecture register, the call stack of the second-architecture instructions of the compatible layer 240 or the application is obtained. Here, each stack frame in the call stack corresponds to a function.
[0062] In one embodiment, based on the current second-architecture register, stack backtracking can be performed, so as to obtain the call stack of the second-architecture instructions of the compatible layer 240 or the second application 250.
[0063] Figure 4 A distribution diagram of a call stack according to one embodiment of the present application is shown.
[0064] It should be noted that when a function call occurs during program execution, a call stack is generated. As shown in Figure 4 The call stack stores the parameters (e.g., parameter 1, parameter 2, …, parameter N) of the caller function, the return address of the caller function, the value of the register ebp, local variables, etc. Whenever a function call occurs, the function is automatically added to the call stack and executed, and after the execution of the function is completed, the call stack automatically removes the function.
[0065] The pointer in the second architecture register ebp points to the topmost stack frame on the call stack. The current second architecture register holds the stack frame of the current function.
[0066] Figure 5 A flowchart of step 340 according to an embodiment of the present invention is shown.
[0067] like Figure 5 As shown, step 340 may include steps 341 to 342.
[0068] First, in step 341, the return address can be obtained from the previous stack frame (top) of the previous function based on the current second architecture register. That is, the return address of the previous function can be obtained, which is also the caller function of the current function.
[0069] Next, in step 342, the return address of the previous function can be used to trace back to the previous function (the caller function of the current function), and the upper-level second architecture register corresponding to the previous function can be obtained. Here, the upper-level second architecture register stores the previous stack frame corresponding to the previous function.
[0070] Next, we can determine whether the complete call stack has been obtained, that is, whether there are more stack frames before the previous stack frame. If the complete call stack has not been obtained (and there are more stack frames), then the previous function can be regarded as the new current function, and the upper-level second architecture register can be regarded as the new current second architecture register. Then, we continue to execute the aforementioned steps 341-342.
[0071] Specifically, based on the upper-level second architecture registers, the new return address (of the function preceding the new current function) is obtained. Based on the new return address, it is possible to continue backtracking to the function preceding the new current function (the new preceding function), and obtain the new upper-level second architecture registers corresponding to the new preceding function. Here, the new upper-level second architecture registers store the new preceding stack frame corresponding to the new preceding function.
[0072] If the complete call stack is not obtained, continue to repeat the above steps until the complete call stack is obtained.
[0073] According to the method for obtaining a call stack when an application is simulated to run according to the application, when an application of a second operating system is simulated to run by a compatible layer based on a simulator arranged with a first architecture processor and a first operating system, if a running interruption occurs due to a second architecture instruction error, when the simulator is debugged by using a debugging tool, the current second architecture register of a second architecture site can be obtained from the interruption site of the first architecture processor by inputting an extended command and executing the extended command, and the call stack of the second architecture instruction of the compatible layer or the second application can be obtained based on the stack backtracking of the current second architecture register. In this way, during the debugging of the simulator, the call stack of the second architecture instruction of the compatible layer or the application can be directly obtained at the interruption site, so that the error site of the second architecture instruction can be intuitively viewed.
[0074] The various techniques described herein can be implemented in connection with hardware or software, or a combination of both. Thus, the methods and apparatus of the application, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard disks, USB flash drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the subject application.
[0075] Where the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a memory that is readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code, and the processor is configured to execute instructions in the program code stored in the memory to perform the method for obtaining a call stack when an application is simulated to run according to the application.
[0076] In the interest of conciseness, the specification has not described all possible types of computer-readable media for storing data. It will be appreciated that both computer-readable storage media and communication media generally can be any available physical and / or logical media accessible by a general purpose or special-purpose computer. The computer-readable media disclosed herein includes both computer-readable storage media and communication media regardless of whether the computer-readable storage media is tangible or a communication medium such as carrier waves. The computer-readable media disclosed herein excludes propagated signals per se.
[0077] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.
[0078] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.
[0079] Similarly, it is to be understood that the mechanical details of the inventive features sometimes are grouped into a single embodiment, figure or description of related embodiments in the above description of example embodiments of the application for clarity purpose. There is no intention to be bound by the same features in each claim. The claims are thus to be understood in their broadest reasonable manner within the scope of the appended claims. Hence, the summary of the detailed description is expressly incorporated hereinto by reference, wherein each of the individual claims is hereby expressly incorporated by reference as a separate embodiment of the application.
[0080] Those skilled in the art will understand that the modules, or units, or components of the devices in the examples disclosed herein can be arranged in the devices as described in the examples, or alternatively can be located in one or more devices different from the devices in the examples. The modules in the foregoing examples can be combined into one module or further divided into multiple sub-modules.
[0081] Those skilled in the art will understand that the modules in the devices in the examples can be adaptively changed and disposed in one or more devices different from the examples. The modules or units or components in the examples can be combined into one module or unit or component, and further can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, all combinations of all features disclosed in this specification (including the accompanying claims, abstract and drawings) and all processes or units of any methods or apparatuses so disclosed can be used. Unless explicitly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) can be replaced by alternative features providing the same, equivalent or similar functionality.
[0082] Furthermore, to the extent that the terms "comprises", "comprising", "includes", "including" and "has" or any variation thereof are used in the following description and claims, these terms are intended to cover a non-exclusive inclusion. For any particular feature, structure or characteristic, an embodiment can include that feature, structure or characteristic alone or in a combination with other features, structures or characteristics.
[0083] Furthermore, some of the embodiments described herein are of a "method" or a "process" that can be embodied in software, firmware or hardware, and when embodied in software, can be implemented with computer- executable instructions (computer- readable code). When implemented in software, the instructions can be executable by a processor of a computer system, a processor of multiple computer systems, or by one or more processors of an electronic device. The instructions can be stored in any applicable non-transitory computer-readable medium, including storage devices and memories such as hard drives, floppy diskettes, optical storage, CD-ROMs, RAM memories, EPROMs, EEPROMs, processor registers, etc. The order in which the
[0084] As used herein, the terms "first", "second", "third", etc. are used merely as labels, and are not intended to impose numerical requirements on their objects.
[0085] While the application has been described in connection with limited number of embodiments, it will be evident that many modifications and variations of the present application are possible in light of the above teachings. It is, therefore, to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described. It is therefore understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described. With respect to the references numerals in the figures, it should be understood that each reference numeral uniquely identifies a physical component, while reference numerals with the same last two digits signify either component similar function(s) or similar structure(s).
Claims
1. A method of simulating acquisition of a call stack while running an application, performed in a computing device, wherein, The computing device includes a first architecture processor and runs a first operating system; An emulator and a compatibility layer of a second operating system are arranged on the first operating system, so as to run the compatibility layer through the emulator and run a second application of the second operating system based on the compatibility layer; The method comprises: Converting and executing, by the emulator, second architecture instructions of the compatibility layer and the second application into first architecture instructions; In response to the first architecture processor running an interrupt, debugging the emulator by using a debugging tool, and obtaining an input extended command so as to add the extended command in the debugging tool; Executing the extended command to obtain first architecture registers from an interrupt site of the first architecture processor, obtain a second architecture site structure pointer based on the first architecture registers, and obtain current second architecture registers of a second architecture site based on the second architecture site structure pointer; Performing stack backtracking based on the current second architecture registers so as to obtain a call stack of second architecture instructions of the compatibility layer or the second application.
2. The method of claim 1, wherein, The stack backtracking based on the current second architecture registers comprises: Obtaining a return address based on the current second architecture registers; Backtracking to a previous function based on the return address and obtaining upper second architecture registers corresponding to the previous function, the upper second architecture registers saving a previous stack frame.
3. The method of claim 2, wherein, The stack backtracking based on the current second architecture registers further comprises: Obtaining a new return address based on the upper second architecture registers; Backtracking to a new previous function based on the new return address and obtaining new upper second architecture registers corresponding to the new previous function, until a complete call stack is obtained, wherein the new upper architecture registers save a new previous stack frame.
4. The method of any one of claims 1-3, wherein The first architecture is an ARM architecture, and the second architecture is an X86 architecture.
5. A computing device comprising: at least one processor; and a memory storing program instructions configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any one of claims 1-4.
6. A readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to perform the method of any one of claims 1-4.
Citation Information
Patent Citations
Error tracking method of embedded system and device thereof
CN101539883A
Application control method and device, equipment, medium and program product
CN114416295A
Method of Debugging an Executable Computer Program Having Instructions for Different Computer Architectures
US20080270107A1