CN115185638A - Method for acquiring call stack during simulation running of application program and computing equipment - Google Patents

Method for acquiring call stack during simulation running of application program and computing equipment Download PDF

Info

Publication number
CN115185638A
CN115185638A CN202210768798.9A CN202210768798A CN115185638A CN 115185638 A CN115185638 A CN 115185638A CN 202210768798 A CN202210768798 A CN 202210768798A CN 115185638 A CN115185638 A CN 115185638A
Authority
CN
China
Prior art keywords
architecture
register
operating system
current
processor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210768798.9A
Other languages
Chinese (zh)
Inventor
叶业顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202210768798.9A priority Critical patent/CN115185638A/en
Publication of CN115185638A publication Critical patent/CN115185638A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45537Provision of facilities of other operating environments, e.g. WINE
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • G06F9/4552Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM

Abstract

The invention discloses a method and computing equipment for acquiring a call stack when an application program is simulated and run, wherein the computing equipment comprises a first architecture processor, runs a first operating system, and simulates and runs a compatible layer and a second application program of a second operating system through a simulator; the method comprises the following steps: converting a second architecture instruction of the compatible layer and a second application program into a first architecture instruction through the simulator and executing the first architecture instruction; responding to the running interruption of the first architecture processor, debugging the simulator and acquiring an input extended command; executing the extended command to obtain a current second architecture register of a second architecture field from an interrupt field of the first architecture processor; based on the current second architecture register, a call stack of a second architecture instruction of the compatible layer or the second application is obtained. According to the technical scheme of the invention, the error site of the second architecture instruction can be visually checked in the interrupt site in the debugging process of the simulator.

Description

Method for acquiring call stack during simulation running of application program and computing equipment
Technical Field
The invention relates to the technical field of computers, in particular to a method and computing equipment for acquiring a call stack when an application program is simulated and run.
Background
With the continuous update of computers, operating systems are also continuously upgraded. The Windows operating system has occupied most of the market of the computer operating system, and the software ecology on the Windows operating system is also extremely rich. In recent years, with the rise of the Linux operating system, more and more computers choose to use the Linux operating system. Because the hardware and the system interface are not supported, the software of the Windows operating system cannot run on the Linux operating system.
According to the difference of the CPU architecture, on the Linux system with the X86 and X86_64 architecture, software for operating the Windows operating system can be compatibly run through Wine (a compatible layer for enabling a Windows program to normally run on the Linux system with the X86 architecture by implementing a system function of Windows on the Linux system with the X86 architecture). But Wine only provides support for the X86 and X86_64 architectures, and the ARM architecture cannot directly run Wine.
On the ARM-based Linux system, box86 is required to emulate and run the Wine compatible layer. The principle of the box86 is to parse and translate the X86 instruction into an ARM instruction to execute, or to use c code to simulate the function of the X86 instruction to realize the behavior. However, the box86 still has some problems of instruction untranslated or instruction translation imperfection, and the robustness is insufficient, so that on the Linux system with the ARM architecture, when the box86 emulates and runs Wine to compatibly execute Windows software, a running error often occurs. The error manifestations include, for example: the software execution result is not in accordance with the expectation, the software crashes in the execution process, the card is stuck in the execution process and the like.
In order to solve the problem of operation errors when the box86 emulates and runs Wine to compatibly execute Windows software, gdb is needed to debug the box86. In the process of debugging the box86, because the X86 instruction is translated into the ARM instruction and stored in the heap for execution or is simulated into the c code for execution, the fault interrupt site is in the converted ARM instruction, and only ARM interrupt site information such as a call stack of the box86 (a function call chain of the box86 in the interrupt site under the ARM) and an ARM register can be observed, but the fault site of the X86 instruction of the compatible layer or the Windows software cannot be intuitively observed.
Therefore, a method for acquiring a call stack when an application program is simulated and run is needed, and the problems in the scheme are solved.
Disclosure of Invention
To this end, the present invention provides a method of obtaining a call stack while emulating a running application, which solves or at least alleviates the above-presented problems.
According to one aspect of the invention, a method for acquiring a call stack when an application program is simulated and run is provided and executed in a computing device, wherein the computing device comprises a first architecture processor and runs a first operating system; a simulator and a compatible layer of a second operating system are arranged on the first operating system, so that the simulator simulates and runs the compatible layer and runs a second application program of the second operating system based on the compatible layer; the method comprises the following steps: converting, by the emulator, the compatible layer and a second architecture instruction of a second application into a first architecture instruction and executing; responding to the running interruption of the first architecture processor, debugging the simulator, and acquiring an input extended command; executing the extended command to obtain a current second architecture register of a second architecture field from an interrupt field of the first architecture processor; based on the current second architecture register, a call stack of a second architecture instruction of the compatible layer or a second application is obtained.
Optionally, in the method for obtaining a call stack when an application is run in a simulation mode according to the present invention, obtaining a current second architecture register of a second architecture field from an interrupt field of the first architecture processor includes: acquiring a second framework field structure body pointer of the interrupt field; and acquiring a current second architecture register of the second architecture field based on the second architecture field structure body pointer.
Optionally, in the method for acquiring a call stack when an application is run in a simulation mode according to the present invention, acquiring the pointer of the second architecture field structure of the interrupt field includes: obtaining a first architecture register from an interrupt site of the first architecture processor; and acquiring a second architecture field structure body pointer based on the first architecture register.
Optionally, in the method for obtaining a call stack when an application is run in a simulation mode according to the present invention, obtaining, based on the current second architecture register, a call stack of a second architecture instruction of the compatible layer or the second application includes: stack trace back is performed based on the current second architectural register to obtain a call stack of a second architectural instruction of the compatible layer or a second application.
Optionally, in the method for obtaining a call stack when an application is run in a simulation mode according to the present invention, the stack tracing based on the current second architecture register includes: obtaining a return address based on the current second architectural register; and backtracking to a previous function based on the return address, and acquiring an upper layer second architecture register corresponding to the previous function, wherein the upper layer second architecture register stores a previous stack frame.
Optionally, in the method for obtaining a call stack when an application is run in a simulation manner according to the present invention, the stack tracing back based on the current second architecture register further includes: acquiring a new return address based on the upper layer second architecture register; and 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.
Optionally, in the method for obtaining a call stack when an application is run in simulation according to the present invention, debugging the simulator includes: and debugging the simulator by using a debugging tool.
Optionally, in the method for acquiring a call stack when an application is run in a simulation manner according to the present invention, 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.
Optionally, in the method for acquiring a call stack when an application is run in simulation according to the present invention, the compatible layer is Wine, and the simulator is box86.
According to an aspect of the invention, there is provided a computing device comprising: at least one processor; a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method of emulating a call stack when running an application as described above.
According to one aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to execute a method of retrieving a call stack when emulating a running application as described above.
According to the technical scheme of the invention, when a compatible layer is operated based on simulator simulation to execute an application program of a second operating system in a computing device provided with a first architecture processor and a first operating system, if operation interruption occurs due to an error of a second architecture instruction, when a debugging tool is used for debugging the simulator, a current second architecture register of the second architecture field can be acquired from an interruption field of the first architecture processor by inputting an extension command and executing the extension command, and stack backtracking is performed based on the current second architecture register so that a call stack of the second architecture instruction of the compatible layer or the second application program can be acquired. Therefore, in the debugging process of the simulator, the call stack of the second architecture instruction of the compatible layer or the application program can be directly acquired in the interrupt field, so that the error field of the second architecture instruction can be visually checked.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
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, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 shows a schematic diagram of a computing device 100, according to one embodiment of the invention;
FIG. 2 illustrates a schematic diagram of a computing device 100 having a first operating system running therein, according to one embodiment of the invention;
FIG. 3 illustrates a flow diagram of a method 300 for obtaining a call stack while emulating a running application, according to one embodiment of the invention;
FIG. 4 illustrates a distribution diagram of a call stack, according to one embodiment of the invention;
FIG. 5 shows a flowchart of step 340, according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to 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 disclosure to those skilled in the art.
According to the method for acquiring the call stack when the application program is simulated to run, the technical problem that when the compatible layer is simulated to run based on the simulator to execute the application program of the second operating system in the computing equipment provided with the first architecture processor and the first operating system, the running is interrupted, but the error site of the second architecture instruction of the application program of the compatible layer or the second operating system cannot be visually checked is solved.
FIG. 1 shows a schematic diagram of a computing device 100, according to one embodiment of the invention. As shown in FIG. 1, in a basic configuration, computing device 100 includes at least one processing unit 102 and system memory 160. According to one aspect, the processing unit 102 may be implemented as a processor depending on the configuration and type of computing device. In embodiments of the invention, the processing unit 102 may be implemented as a first architecture processor. In one embodiment, the first architecture processor may be, for example, an ARM processor. The system memory 160 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, operating system 150 is included in system memory 160.
According to one embodiment of the invention, the operating system 150 may be implemented as a first operating system adapted to run applications of the first operating system.
According to one aspect, the operating system 150 is, for example, adapted to control the operation of the computing device 100. Further, the examples are practiced in conjunction with a graphics library, other operating systems, or any other application program, and are not limited to any particular application or system. This basic configuration is illustrated in fig. 1 by those components within the dashed line. According to one aspect, the computing device 100 has additional features or functionality. For example, according to one 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 FIG. 1 by removable storage device 109 and non-removable storage device 110.
As stated hereinabove, according to one aspect, program modules 140 are stored in system memory 160. According to one aspect, program modules 140 may include one or more application programs, which may include application programs that run directly on a first operating system and may also include application programs that are adapted to a second operating system. Here, the present invention is not limited to the type of application, and for example, the application may include: email and contacts applications, word processing applications, spreadsheet applications, database applications, slide show applications, drawing or computer-aided applications, web browser applications, and the like.
In an embodiment according to the present invention, the program module 140 may further include an emulator 230, a compatibility layer 240 of the second operating system, the emulator 230 may run on the first operating system, and the emulation of the running of the compatibility layer 240 on the first operating system on the first architecture processor may be implemented by the emulator 230 so as to run an application (the second application 250) of the second operating system based on the compatibility layer 240. It should be noted that in order to distinguish the application program of the second operating system from the application program of the first operating system, the application program of the second operating system may be referred to as "second application program" and the application program of the first operating system may be referred to as "first application program". In addition, program module 140 may also include a debugging tool 260, debugging tool 260 for debugging the emulator.
According to one aspect, examples may be practiced in a circuit comprising discrete electronic elements, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic elements or microprocessors. For example, an example may be practiced via a system on a chip (SOC) in which each or many of the components shown in fig. 1 may be integrated on a single integrated circuit. According to one aspect, such SOC devices may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all integrated (or "burned") onto a chip substrate as a single integrated circuit. When operating via an SOC, the functions described herein may be operated via application-specific logic integrated with other components of the computing device 100 on a single integrated circuit (chip). Embodiments of the invention may also be practiced using other technologies capable of performing logical operations (e.g., AND, OR, AND NOT), including but NOT limited to mechanical, optical, fluidic, AND quantum technologies. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuits or systems.
According to one aspect, computing device 100 may also have one or more input devices 112, such as a keyboard, mouse, pen, voice input device, touch input device, or the like. Output device(s) 114 such as a display, speakers, printer, etc. may also be included. The foregoing devices are examples and other devices may also be used. Computing device 100 may include one or more communication connections 116 that allow 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.
The term computer readable media as used herein includes computer storage media. Computer storage media may 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. System memory 160, removable storage 109, and non-removable storage 110 are all examples of computer storage media (i.e., memory storage). Computer storage media may include Random Access Memory (RAM), read-only memory (ROM), electrically erasable 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 article of manufacture that may be used to store information and that may be accessed by computing device 100. In accordance with one aspect, any such computer storage media may be part of computing device 100. Computer storage media does not include a carrier wave or other propagated data signal.
According to one aspect, communication media is embodied by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism) and includes any information delivery media. According to one 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.
In an embodiment in accordance with the invention, the computing device 100 is configured to execute a method 300 of obtaining a call stack while emulating running an application in accordance with the invention. The computing device 100 includes one or more processors, and one or more readable storage media storing program instructions that, when configured to be executed by the one or more processors, cause the computing device to perform the method 300 of retrieving a call stack when emulating a running application in an embodiment of the present invention.
According to one embodiment of the present invention, the computing device 100 includes a plurality of program instructions for performing the method 300 of obtaining a call stack when emulating a running application of the present invention, which may direct a processor to perform the method 300 of obtaining a call stack when emulating a running application according to the present invention.
FIG. 2 illustrates a schematic diagram of a computing device 100 having a first operating system running therein, according to one embodiment of the invention. As shown in fig. 2, the computing device 100 includes a first architecture processor 210 therein and runs a first operating system 220, and an application layer is disposed on the first operating system 220.
In one embodiment, the application layer may include one or more application programs, including for example a first application program that may run directly on the first operating system 220. The first architecture processor 210 may support the execution of a first operating system 220, and the first architecture processor 210 and the first operating system 220 may support the execution of a first application.
In the embodiment of the present invention, an emulator 230, a compatible layer 240 of a second operating system, and one or more second application programs 250 are also disposed in the application layer above the first operating system 220. Here, the second application 250 may be an application of the second operating system, and specifically may be an application that runs based on the second architecture processor and the second operating system. The emulator 230 and the compatibility layer 240 may implement a second application 250 running on the first operating system 220, based on the second architecture processor and the second operating system.
It should be noted that the compatible layer 240 may run based on the second architecture processor, cannot run directly based on the first architecture processor 210, and thus cannot run directly on the first operating system 220 on the first architecture processor 210. The emulator 230 may run on the first operating system 220 on the first architecture processor 210, and the emulator 230 may emulate running the compatible layer 240 (of the second operating system) on the first operating system 220 on the first architecture processor 210, so that the second application 250 of the second operating system may be run based on the compatible layer 240.
In the embodiment of the present invention, a debugging tool 260 is further disposed in the application layer, and the debugging tool 260 can run directly on the first operating system 220 for debugging the emulator 230.
In one embodiment of the present invention, the first architecture may be an ARM architecture, the second architecture may be an X86 architecture (including an X86_64 architecture), and so on. Accordingly, the first architecture processor 210 may be an ARM processor.
The first operating system 220 is, for example, a Linux operating system, and the second operating system is, for example, a Windows operating system.
In an implementation manner, the compatible layer 240 of the second operating system may be implemented as a Wine (Wine is not an observer, which is a compatible layer 240 that enables a Windows application to normally run on a Linux operating system of an X86 architecture by implementing a system function of Windows on the Linux operating system of the X86 architecture).
In one implementation, the emulator 230 may be implemented as a box86, the box86 is a user layer X86 emulator on a Linux system, and the X86-based Linux program may be implemented to run on a non-X86-based Linux system. FIG. 3 illustrates a flow diagram of a method 300 for obtaining a call stack while emulating a running application, according to one embodiment of the invention. The method 300 is suitable for execution in a computing device (computing device 100 described previously).
As shown in FIG. 3, method 300 may include steps 310-340.
In step 310, the second architecture instructions of the compatible layer 240 and the second application 250 are converted into the first architecture instructions and executed by the emulator 230. Here, the converted first-architecture instruction may be stored in a heap of a memory or may be simulated as c-code and executed.
It should be noted that, when an error or other exception occurs in the first architecture instruction obtained by converting the second architecture instruction through the emulator 230, the first architecture processor 210 is caused to run an interrupt. 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 and the call stack of the emulator 230 (which represents the function call chain of the emulator 230 in the interrupt site in the first architecture) can be obtained from the interrupt site, and the call stack of the second architecture instruction of the compatible layer 240 or the second application 250 cannot be obtained from the interrupt site, so that an error that the second architecture instruction of the compatible layer 240 or the second application 250 cannot be visually checked is caused.
According to the method 300 of the present invention, in step 320, the emulator 230 is debugged and the user-entered extension command is obtained in response to the first architecture processor 210 running an interrupt.
In one embodiment, emulator 230 may be debugged by debugging tool 260 on the first operating system. That is, when the simulator 230 is debugged by the debugging tool, the present invention may further obtain the extended command input by the user, so as to add the extended command to the debugging tool. In one implementation, the debugging tool 260 may be implemented, for example, as gdb (a debugging tool under UNIX and UNIX-like).
Subsequently, in step 330, the current second architecture register of the second architecture field may be obtained from the interrupt field of the first architecture processor 210 by executing the extended command.
It should be noted that, when the compatible layer 240 and the second application 250 are emulated and run by the emulator 230, a second architecture field may be saved, and the second architecture field includes information such as a second architecture register (for example, an X86 register).
Specifically, by executing the extended command, the pointer to the second architectural field structure of the interrupt site can be automatically detected, and the pointer to the second architectural field structure of the interrupt site (saved by the simulator 230 when the simulator runs the compatible layer 240 and the second application 250) can be obtained. Then, based on the second architectural field structure pointer, a current second architectural register of the second architectural field can be obtained, so as to obtain the information stored in the second architectural register. Here, the current second architecture register holds the stack frame of the current function.
In one embodiment of the present invention, when the emulator 230 converts the second architecture instructions of the compatible layer 240 and the second application 250 into the first architecture instructions and executes them, the interrupt field of the first architecture processor 210 includes the first architecture register, and the first architecture register points to the second architecture field structure.
That is, the first architectural register may be obtained from the interrupt site of the first architectural processor 210, and the second architectural field structure pointer may be obtained based on the first architectural register. Furthermore, a current second architectural register of the second architectural site may be obtained based on the second architectural site structure pointer, so as to obtain a stack frame of the current function stored in the second architectural register.
In one embodiment, the second architectural register is, for example, an ebp register. The second architectural field structure may be implemented as an x86emu _ t structure.
In one embodiment, the first architectural register may be implemented as an r0 register.
Finally, in step 340, based on the current second architecture register, a call stack of the second architecture instruction of the compatible layer 240 or application is obtained. Here, each stack frame in the call stack corresponds to a function.
In one embodiment, a stack trace back may be performed based on the current second architecture register to obtain a call stack of the second architecture instruction of the compatible layer 240 or the second application 250.
FIG. 4 shows a distribution diagram of a call stack, according to one embodiment of the invention.
It should be noted that, when a function call occurs during the program running process, a call stack is generated. As shown in fig. 4, the call stack stores data such as parameters (for example, parameter 1 and parameter 2 \8230; parameter N) of the caller function, the return address of the caller function, the value of the register ebp, and the local variable. Whenever a function call occurs, a function is automatically added to the call stack and executed, and after execution completes the function, the call stack automatically removes the function.
The pointer of the second architectural register ebp points to the top stack frame in the call stack. The current second architecture register stores the stack frame of the current function.
FIG. 5 shows a flowchart of step 340 according to one embodiment of the invention.
As shown in fig. 5, step 340 may include steps 341-342.
First, in step 341, based on the current second architecture register, a return address may be obtained from a previous stack frame (top) of a previous function, that is, a return address of the previous function, that is, a caller function of the current function.
Next, in step 342, a previous function (the caller function of the current function) may be traced back based on the return address of the previous function, and an upper layer second architecture register corresponding to the previous function may be obtained, where the previous stack frame corresponding to the previous function is stored in the upper layer second architecture register.
Next, it may be determined whether a complete call stack is obtained, that is, whether more stack frames are included before the previous stack frame. If a complete call stack (including more stack frames) is not obtained, at this time, the previous function may be regarded as a new current function, and the upper layer second architecture register may be regarded as a new current second architecture register. And continues to perform the aforementioned steps 341 to 342.
Specifically, a new return address (of a function previous to the new current function) is obtained based on the upper-layer second architecture register, and based on the new return address, the previous function (new previous function) of the new current function can be traced back continuously, and a new upper-layer second architecture register corresponding to the new previous function can be obtained. Here, the new upper layer second architecture register stores a new previous stack frame corresponding to the new previous function.
And if the complete call stack is not obtained, continuously and repeatedly executing the steps until the complete call stack is obtained.
According to the method 300 for obtaining a call stack when an application program is simulated and run, if an operation interruption occurs due to an error of a second architecture instruction when a compatible layer is simulated and run based on a simulator in a computing device provided with a first architecture processor and a first operating system to execute the application program of a second operating system, when the simulator is debugged by using a debugging tool, a current second architecture register of the second architecture field can be obtained from the interruption field of the first architecture processor by inputting an extension command and executing the extension command, and a call stack of the second architecture instruction of the compatible layer or the second application program can be obtained by performing stack backtracking based on the current second architecture register. Therefore, in the debugging process of the simulator, the call stack of the second architecture instruction of the compatible layer or the application program can be directly acquired in the interrupt field, so that the error field of the second architecture instruction can be visually checked.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the mobile terminal generally includes a processor, a storage medium 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. Wherein the memory is configured to store program code; the processor is configured to execute the method of the present invention for obtaining a call stack while emulating a running application, according to instructions in said program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system is apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the device in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Moreover, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense with respect to the scope of the invention, as defined in the appended claims.

Claims (10)

1. A method for acquiring a call stack when an application program is simulated and run is executed in computing equipment, wherein the computing equipment 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 that the emulator emulates and runs the compatible layer, and a second application program of the second operating system is run based on the compatible layer;
the method comprises the following steps:
converting, by the emulator, the compatible layer and a second architecture instruction of a second application into a first architecture instruction and executing;
responding to the running interruption of the first architecture processor, debugging the simulator and acquiring an input extended command;
executing the extended command to obtain a current second architecture register of a second architecture field from an interrupt field of the first architecture processor;
based on the current second architecture register, a call stack of a second architecture instruction of the compatible layer or a second application is obtained.
2. The method of claim 1, wherein obtaining, from an interrupt site of the first architecture processor, a current second architecture register of a second architecture site comprises:
acquiring a second framework field structure body pointer of the interrupt field;
and acquiring a current second architecture register of the second architecture field based on the second architecture field structure body pointer.
3. The method of claim 2, wherein obtaining a second architectural field structure pointer for the blackout field comprises:
obtaining a first architecture register from an interrupt site of the first architecture processor;
and acquiring a second architecture field structure body pointer based on the first architecture register.
4. The method of any of claims 1-3, wherein retrieving a call stack of a second architecture instruction of the compatible layer or a second application based on the current second architecture register comprises:
stack trace back is performed based on the current second architecture register to obtain a call stack of a second architecture instruction of the compatible layer or a second application.
5. The method of claim 4, wherein performing stack backtracking based on the current second architectural register comprises:
obtaining a return address based on the current second architecture register;
and backtracking to a previous function based on the return address, and acquiring an upper layer second architecture register corresponding to the previous function, wherein the upper layer second architecture register stores a previous stack frame.
6. The method of claim 5, wherein performing stack trace back based on the current second architectural register further comprises:
acquiring a new return address based on the upper layer second architecture register;
and 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.
7. The method of any of claims 1-6, wherein debugging the emulator comprises:
and debugging the simulator by using a debugging tool.
8. The method of any one of claims 1-7,
the first architecture is an ARM architecture, and the second architecture is an X86 architecture.
9. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-8.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-8.
CN202210768798.9A 2022-06-30 2022-06-30 Method for acquiring call stack during simulation running of application program and computing equipment Pending CN115185638A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210768798.9A CN115185638A (en) 2022-06-30 2022-06-30 Method for acquiring call stack during simulation running of application program and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210768798.9A CN115185638A (en) 2022-06-30 2022-06-30 Method for acquiring call stack during simulation running of application program and computing equipment

Publications (1)

Publication Number Publication Date
CN115185638A true CN115185638A (en) 2022-10-14

Family

ID=83515613

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210768798.9A Pending CN115185638A (en) 2022-06-30 2022-06-30 Method for acquiring call stack during simulation running of application program and computing equipment

Country Status (1)

Country Link
CN (1) CN115185638A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115374017A (en) * 2022-10-26 2022-11-22 统信软件技术有限公司 Method for capturing site during simulation running of executable file and computing equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115374017A (en) * 2022-10-26 2022-11-22 统信软件技术有限公司 Method for capturing site during simulation running of executable file and computing equipment

Similar Documents

Publication Publication Date Title
JP2022036889A (en) Method of verifying chip, device, electronic device, computer readable storage medium, and computer program
CN107278297B (en) Computing device, method, and medium for software testing
US9047427B1 (en) Method and system for performing verification of an electronic design
JP7321839B2 (en) General Purpose Virtualization Platform for Systems Using Hardware Abstraction Software Layers
CN105320553A (en) Method and system for updating network card firmware on basis of domestic processor platform
US20200381071A1 (en) Systems and methods for simulated device testing using a memory-based communication protocol
CN104699523A (en) Debugging method and system used for application programs developed by hardware platform
CN110516447A (en) A kind of method and apparatus of identification terminal simulator
CN115185638A (en) Method for acquiring call stack during simulation running of application program and computing equipment
CN115374017A (en) Method for capturing site during simulation running of executable file and computing equipment
US20140298299A1 (en) Method for determining whether a machine code instruction of a machine code program is executed in the machine code program
CN109271231B (en) Method for testing physical hardware device and system for simulating physical hardware device
CN116306392A (en) Chip simulation device, method, electronic device and storage medium
US11544436B1 (en) Hardware-software interaction testing using formal verification
US20030025490A1 (en) Method for verifying hardware circuits through simulation
JP2013020425A (en) Hardware and software cooperative verification method using open source software
US11200126B2 (en) Utilizing translation tables for testing processors
JP7101709B2 (en) Methods, devices, devices and media for realizing simulators
CN112559336A (en) Method, device and system for adaptively debugging heterogeneous computing chip and mainboard chip
CN115145696B (en) Method, system and computing device for determining running difference of process virtual machine
CN114781294B (en) Signature comparison method and device in RISC-V CPU verification
EP3961389A1 (en) Virtual machine for developing and testing target code for hardware designs
KR100638476B1 (en) Virtual platform based system on chip development environment and development method for the same
CN117008972B (en) Instruction analysis method, device, computing equipment and storage medium
Posadas et al. Automatic HW/SW interface modeling for scratch-pad and memory mapped HW components in native source-code co-simulation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination