File processing method, device, electronic device and storage medium
By obtaining and processing the entry address and address offset of the UEFI module, source code instructions with link information are generated, which solves the problem of difficulty in locating the module running address in the UEFI environment and achieves accurate location of the cause of the crash.
Patent Information
- Application Number
- CN202110542563.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-18
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-05-18
AI Technical Summary
In the UEFI environment, it is difficult to find the actual running address of each module's code, making it difficult to locate the cause of the crash. Existing debugging methods cannot fully simulate the real environment, especially hardware-related problems that cannot be checked through the simulator.
By obtaining the module file in the firmware interface system and its runtime entry address, compile and decompile the source code instructions in the assembly language, and add link information based on the entry address and address offset to generate a link information source code instructions to determine the actual running address of the module file.
Quickly and directly find the actual running address of the code of each module file, helping developers accurately locate the cause of the crash and avoiding the problem of being unable to fully simulate the real environment during virtual machine debugging.
Smart Images

Figure CN113377370B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a file processing method, a file processing device, an electronic device and a readable storage medium. Background Art
[0002] UEFI (Unified Extensible Firmware Interface) is a personal computer system specification that defines the software interface between the operating system and the system firmware as an alternative to BIOS (Basic Input Output System). The Extensible Firmware Interface is responsible for power-on self-test, contacting the operating system, and providing an interface between the operating system and hardware.
[0003] In UEFI, many programs are not complete executable files, they are divided into some relatively independent module files, such as DLL (Dynamic Link Library) files. The entry address of each module is dynamically loaded, so the address of each module is not fixed, so debugging is particularly inconvenient.
[0004] Currently, there are UEFI debuggers on the x86 (a series of CPU instruction set architectures based on Intel 8086 and backward compatible) platform, which are essentially UEFI virtual machines that simulate execution on real physical machines. However, RSIC architectures such as ARM (Advanced Reduced Instruction Set Computing Machines) and MIPS (Microprocessor without Interlocked Pipedline Stages architecture) do not have UEFI debuggers. Moreover, the effect of simulating program execution can only simulate specific software behaviors, and some behaviors related to hardware cannot be completed. This debugging method can only detect pure software errors, and some hardware-related driver problems cannot be checked through the simulator.
[0005] During the development and debugging process under UEFI, it is difficult to find the address where the code of each module actually runs, which makes it difficult to locate the cause of the crash. Summary of the invention
[0006] The technical problem to be solved by the embodiments of the present invention is to provide a file processing method, device, electronic device and readable storage medium to solve the problem that it is difficult to find the address where the code of each module is actually running, thereby making it difficult to locate the cause of the crash.
[0007] In order to solve the above problem, the present invention provides a file processing method, comprising:
[0008] Obtaining a module file in a firmware interface system and an entry address of the module file at runtime;
[0009] Compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets;
[0010] The source code instruction is processed into a source code instruction with link information according to the entry address and the address offset.
[0011] Optionally, compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file includes:
[0012] Compile the module file with a compiler to obtain a binary file corresponding to the module file;
[0013] The binary file is decompiled by a compiler to obtain a decompiled file in assembly language corresponding to the module file, wherein the decompiled file includes the source code instructions.
[0014] Optionally, before compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file, the method further includes:
[0015] The compiler corresponding to the processor platform is called.
[0016] Optionally, processing the source code instruction into a source code instruction with link information according to the entry address and the address offset includes:
[0017] Determine the actual running address corresponding to each of the source code instructions according to the entry address and the address offset;
[0018] The actual running address is added to the source code instruction to obtain the source code instruction with link information.
[0019] Optionally, obtaining the entry address of the module file at runtime includes:
[0020] The entry address of the module file at runtime is searched from the log information of the firmware interface system.
[0021] Accordingly, the present invention also provides a file processing device, comprising:
[0022] An acquisition module, used to acquire a module file in a firmware interface system and an entry address of the module file at runtime;
[0023] An instruction processing module, used for compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets;
[0024] The address processing module is used to process the source code instruction into a source code instruction with link information according to the entry address and the address offset.
[0025] Optionally, the instruction processing module includes:
[0026] A compiling submodule, used for compiling the module file through a compiler to obtain a binary file corresponding to the module file;
[0027] The decompilation submodule is used to decompile the binary file through a compiler to obtain a decompiled file corresponding to the module file in assembly language, wherein the decompiled file includes the source code instructions.
[0028] Optionally, the device further comprises:
[0029] The compiler calling module is used to call the compiler corresponding to the processor platform before compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file.
[0030] Optionally, the address processing module includes:
[0031] An address determination submodule, used for determining the actual running address corresponding to each of the source code instructions according to the entry address and the address offset;
[0032] The address adding submodule is used to add the actual running address to the source code instruction to obtain the source code instruction with link information.
[0033] Optionally, the acquisition module includes:
[0034] The address search submodule is used to search the entry address of the module file at runtime from the log information of the firmware interface system.
[0035] Accordingly, the present invention also provides an electronic device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations:
[0036] Obtaining a module file in a firmware interface system and an entry address of the module file at runtime;
[0037] Compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets;
[0038] The source code instruction is processed into a source code instruction with link information according to the entry address and the address offset.
[0039] Optionally, compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file includes:
[0040] Compile the module file with a compiler to obtain a binary file corresponding to the module file;
[0041] The binary file is decompiled by a compiler to obtain a decompiled file in assembly language corresponding to the module file, wherein the decompiled file includes the source code instructions.
[0042] Optionally, before compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file, the method further includes:
[0043] The compiler corresponding to the processor platform is called.
[0044] Optionally, processing the source code instruction into a source code instruction with link information according to the entry address and the address offset includes:
[0045] Determine the actual running address corresponding to each of the source code instructions according to the entry address and the address offset;
[0046] The actual running address is added to the source code instruction to obtain the source code instruction with link information.
[0047] Optionally, obtaining the entry address of the module file at runtime includes:
[0048] The entry address of the module file at runtime is searched from the log information of the firmware interface system.
[0049] Correspondingly, the present invention also provides a readable storage medium, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the above-mentioned file processing method.
[0050] According to an embodiment of the present invention, by obtaining a module file in a firmware interface system and an entry address of the module file at runtime, the module file is compiled and decompiled to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry a corresponding address offset, and according to the entry address and the address offset, the source code instructions are processed into source code instructions with link information, so that the module file is automatically processed to obtain source code instructions with link information, thereby avoiding the problem of being unable to fully simulate the real environment when debugging on a virtual machine, thereby helping developers to quickly and directly find the address where the code of each module file is actually running, so as to accurately locate problems such as freezing at a certain address. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A flowchart of a file processing method provided by an embodiment of the present invention is shown;
[0052] Figure 2 A schematic diagram showing the file processing flow is shown;
[0053] Figure 3 A flowchart showing a method for processing a file according to another embodiment of the present invention is shown;
[0054] Figure 4 A structural block diagram of a file processing device embodiment provided by another embodiment of the present invention is shown;
[0055] Figure 5 A structural block diagram of an electronic device for file processing according to an exemplary embodiment is shown. DETAILED DESCRIPTION
[0056] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0057] Reference Figure 1 , shows a flowchart of a file processing method provided by an embodiment of the present invention, which may specifically include the following steps:
[0058] Step 101, obtaining a module file in a firmware interface system and an entry address of the module file at runtime.
[0059] In the embodiment of the present invention, the firmware interface system includes UEFI, etc., or any other applicable firmware interface system, such as PMIN, BIOS, etc., which is not limited in the embodiment of the present invention. The module file includes DLL files, etc., or any other applicable files, which is not limited in the embodiment of the present invention. When the module file is running on a real physical machine, it will be dynamically loaded into a certain space in the memory, and the starting address of the space is recorded as the entry address of the module file at runtime.
[0060] For example, under UEFI, a script tool that applies the method of the present invention is run, and the name and entry address of the module file are passed to the script tool, thereby obtaining the module file and the corresponding entry address.
[0061] In the embodiment of the present invention, optionally, in an implementation manner of obtaining the entry address of the module file at runtime, it may include: searching the entry address of the module file at runtime from the log information of the firmware interface system.
[0062] The log information of the firmware interface system stores the entry address of the module file when it was running in the past. The entry address can be found by searching the log information.
[0063] Step 102, compile and decompile the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets.
[0064] In the embodiment of the present invention, the module file is processed to obtain source code instructions in assembly language corresponding to the module file, which can usually be achieved by using a compilation tool. The module file is compiled and decompiled to convert the module file into source code instructions in assembly language, and the source code instructions carry corresponding address offsets.
[0065] For example, Figure 2 The schematic diagram of the file processing flow shown is that the module file is a (*.dll) file, which is compiled and decompiled to obtain a (*.s) file, that is, a source code file in assembly language, which includes source code instructions and the address offset corresponding to each instruction.
[0066] In the embodiment of the present invention, optionally, before the module file is compiled and decompiled to obtain source code instructions in assembly language corresponding to the module file, the process may further include: calling the compiler corresponding to the processor platform.
[0067] Processor platforms include x86, ARM, MIPS, Loongarch, etc., or any other applicable platforms. Different processor platforms are adapted to different compilers. For example, the Loongarch platform can use the gcc (GNU Compiler Collection) compilation method. By determining the processor platform and calling the compiler corresponding to the processor platform, it is possible to achieve application to multiple processing platforms.
[0068] Step 103: Process the source code instruction into a source code instruction with link information according to the entry address and the address offset.
[0069] In the embodiment of the present invention, the main content of the link is to correctly connect the parts that reference each other between modules. Its work is to correct the references of some instructions to other symbol addresses. The link information mainly includes information related to address and space allocation, symbol resolution and redirection.
[0070] In the embodiment of the present invention, if the link information of the source code instruction lacks the address corresponding to each instruction, the first source code instruction can be found according to the entry address, and then the address corresponding to each source code instruction can be determined according to the address offset of each instruction. The link information can be obtained according to the source code instruction and the address of each instruction, and the link information is added to the corresponding source code instruction to obtain the source code instruction with the link information.
[0071] For example, Figure 2 As shown, the source code instructions included in the (*.s) file do not have linkage information. Based on the entry address and the address offset of each instruction, the address corresponding to each instruction can be determined, thereby generating the corresponding linkage information, and processing the source code instructions into source code instructions with linkage information, that is, obtaining the (*.ld) linkage script file.
[0072] According to an embodiment of the present invention, by obtaining a module file in a firmware interface system and an entry address of the module file at runtime, the module file is compiled and decompiled to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry a corresponding address offset, and according to the entry address and the address offset, the source code instructions are processed into source code instructions with link information, so that the module file is automatically processed to obtain source code instructions with link information, thereby avoiding the problem of being unable to fully simulate the real environment when debugging on a virtual machine, thereby helping developers to quickly and directly find the address where the code of each module file is actually running, so as to accurately locate problems such as freezing at a certain address.
[0073] Reference Figure 3, shows a flowchart of a file processing method provided by another embodiment of the present invention, which may specifically include the following steps:
[0074] Step 201, obtaining a module file in a firmware interface system and an entry address of the module file at runtime.
[0075] In the embodiment of the present invention, the specific implementation method of this step can refer to the description in the above embodiment and will not be repeated here.
[0076] Step 202: compile the module file through a compiler to obtain a binary file corresponding to the module file.
[0077] In the embodiment of the present invention, the module file is a program to be translated, which cannot be directly understood and executed by the computer. The computer can only understand binary. After the compiler compiles, the module file can be processed into a corresponding binary file. For example, the module file (.dll file) under UEFI is compiled by the gcc compiler to obtain a binary file (.bin file).
[0078] Step 203, decompiling the binary file by a compiler to obtain a decompiled file in assembly language corresponding to the module file, wherein the decompiled file includes the source code instructions.
[0079] In an embodiment of the present invention, a binary file is decompiled by a compiler to obtain a corresponding decompiled file in assembly language, the decompiled file includes source code instructions, and the decompiled file has no link information. For example, a binary file (.bin file) is processed by a gcc compiler into a disassembled file (.s file) without link information.
[0080] Step 204: Determine the actual execution address corresponding to each of the source code instructions according to the entry address and the address offset.
[0081] In the embodiment of the present invention, the actual running address corresponding to each source code instruction can be determined according to the entry address and the address offset of each source code instruction. For example, if the entry address is 0x0E647240 and the address offset of a source code instruction is 1, the address of the source code instruction is 0x0E647241.
[0082] Step 205: Add the actual execution address to the source code instruction to obtain the source code instruction with link information.
[0083] In an embodiment of the present invention, the actual running address is added to the corresponding source code instruction to obtain the source code instruction with link information. For example, a disassembled file without link information is processed into a link file (.ld file) with link information according to the actual running address corresponding to each instruction.
[0084] According to an embodiment of the present invention, by obtaining a module file in a firmware interface system and an entry address of the module file at runtime, the module file is compiled by a compiler to obtain a binary file corresponding to the module file, and the binary file is decompiled by a compiler to obtain a decompiled file using assembly language corresponding to the module file, wherein the decompiled file includes the source code instructions, and the actual running address corresponding to each source code instruction is determined according to the entry address and the address offset, and the actual running address is added to the source code instruction to obtain the source code instruction with link information, so that the module file is automatically processed to obtain the source code instruction with link information, avoiding the problem of not being able to fully simulate the real environment when debugging on a virtual machine, thereby helping developers to quickly and directly find the address where the code of each module file actually runs, so as to accurately locate problems such as freezing at a certain address.
[0085] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0086] Reference Figure 4 , shows a structural block diagram of a file processing device embodiment provided by another embodiment of the present invention, which may specifically include the following modules:
[0087] The acquisition module 301 is used to acquire the module file in the firmware interface system and the entry address of the module file at runtime;
[0088] The instruction processing module 302 is used to compile and decompile the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets;
[0089] The address processing module 303 is used to process the source code instruction into a source code instruction with link information according to the entry address and the address offset.
[0090] Optionally, the instruction processing module includes:
[0091] A compiling submodule, used for compiling the module file through a compiler to obtain a binary file corresponding to the module file;
[0092] The decompilation submodule is used to decompile the binary file through a compiler to obtain a decompiled file corresponding to the module file in assembly language, wherein the decompiled file includes the source code instructions.
[0093] Optionally, the device further comprises:
[0094] The compiler calling module is used to call the compiler corresponding to the processor platform before compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file.
[0095] Optionally, the address processing module includes:
[0096] An address determination submodule, used for determining the actual running address corresponding to each of the source code instructions according to the entry address and the address offset;
[0097] The address adding submodule is used to add the actual running address to the source code instruction to obtain the source code instruction with link information.
[0098] Optionally, the acquisition module includes:
[0099] The address search submodule is used to search the entry address of the module file at runtime from the log information of the firmware interface system.
[0100] According to an embodiment of the present invention, by obtaining a module file in a firmware interface system and an entry address of the module file at runtime, the module file is compiled and decompiled to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry a corresponding address offset, and according to the entry address and the address offset, the source code instructions are processed into source code instructions with link information, so that the module file is automatically processed to obtain source code instructions with link information, thereby avoiding the problem of being unable to fully simulate the real environment when debugging on a virtual machine, thereby helping developers to quickly and directly find the address where the code of each module file is actually running, so as to accurately locate problems such as freezing at a certain address.
[0101] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0102] Figure 5 1 is a block diagram of an electronic device 700 for file processing according to an exemplary embodiment. For example, the electronic device 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0103] Reference Figure 5 , the electronic device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .
[0104] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0105] The memory 704 is configured to store various types of data to support operations on the device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0106] The power component 704 provides power to various components of the electronic device 700. The power component 704 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 700.
[0107] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0108] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0109] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0110] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of contact between the user and the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0111] The communication component 716 is configured to facilitate wired or wireless communication between the electronic device 700 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 714 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 714 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0112] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0113] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0114] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a terminal, enables the terminal to perform a file processing method, the method comprising:
[0115] Obtaining a module file in a firmware interface system and an entry address of the module file at runtime;
[0116] Compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets;
[0117] The source code instruction is processed into a source code instruction with link information according to the entry address and the address offset.
[0118] Optionally, compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file includes:
[0119] Compile the module file with a compiler to obtain a binary file corresponding to the module file;
[0120] The binary file is decompiled by a compiler to obtain a decompiled file in assembly language corresponding to the module file, wherein the decompiled file includes the source code instructions.
[0121] Optionally, before compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file, the method further includes:
[0122] The compiler corresponding to the processor platform is called.
[0123] Optionally, processing the source code instruction into a source code instruction with link information according to the entry address and the address offset includes:
[0124] Determine the actual running address corresponding to each of the source code instructions according to the entry address and the address offset;
[0125] The actual running address is added to the source code instruction to obtain the source code instruction with link information.
[0126] Optionally, obtaining the entry address of the module file at runtime includes:
[0127] The entry address of the module file at runtime is searched from the log information of the firmware interface system.
[0128] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0129] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0130] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0131] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0133] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0134] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0135] The above is a detailed introduction to a file processing method and a file processing device provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A file processing method, It is characterized in that include: Obtaining a module file in a firmware interface system and an entry address of the module file at runtime; Compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets; Processing the source code instruction into a source code instruction with link information according to the entry address and the address offset; The step of processing the source code instructions into source code instructions with link information according to the entry address and the address offset includes: determining the actual running address corresponding to each source code instruction according to the entry address and the address offset; and adding the actual running address to the source code instruction to obtain the source code instruction with link information.
2. The method according to claim 1, It is characterized in that The compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file includes: Compile the module file with a compiler to obtain a binary file corresponding to the module file; The binary file is decompiled by a compiler to obtain a decompiled file in assembly language corresponding to the module file, wherein the decompiled file includes the source code instructions.
3. The method according to claim 2, It is characterized in that Before the module file is compiled and decompiled to obtain source code instructions in assembly language corresponding to the module file, the method further includes: The compiler corresponding to the processor platform is called.
4. The method according to any one of claims 1 to 3, It is characterized in that Obtaining the entry address of the module file at runtime, including: The entry address of the module file at runtime is searched from the log information of the firmware interface system.
5. A file processing device, It is characterized in that include: An acquisition module, used to acquire a module file in a firmware interface system and an entry address of the module file at runtime; An instruction processing module, used for compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets; An address processing module, used for processing the source code instruction into a source code instruction with link information according to the entry address and the address offset; The address processing module includes: an address determination submodule, used to determine the actual running address corresponding to each of the source code instructions according to the entry address and the address offset; an address addition submodule, used to add the actual running address to the source code instruction to obtain the source code instruction with link information.
6. The device according to claim 5, It is characterized in that The instruction processing module comprises: A compiling submodule, used for compiling the module file through a compiler to obtain a binary file corresponding to the module file; The decompilation submodule is used to decompile the binary file through a compiler to obtain a decompiled file corresponding to the module file in assembly language, wherein the decompiled file includes the source code instructions.
7. The device according to claim 6, It is characterized in that The device also includes: The compiler calling module is used to call the compiler corresponding to the processor platform before compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file.
8. The device according to claim 5, It is characterized in that The acquisition module comprises: The address search submodule is used to search the entry address of the module file at runtime from the log information of the firmware interface system.
9. An electronic device, It is characterized in that The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations: Obtaining a module file in a firmware interface system and an entry address of the module file at runtime; Compiling and decompiling the module file to obtain source code instructions in assembly language corresponding to the module file; wherein the source code instructions carry corresponding address offsets; Processing the source code instruction into a source code instruction with link information according to the entry address and the address offset; The step of processing the source code instructions into source code instructions with link information according to the entry address and the address offset includes: determining the actual running address corresponding to each source code instruction according to the entry address and the address offset; and adding the actual running address to the source code instruction to obtain the source code instruction with link information.
10. A readable storage medium, It is characterized in that When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the file processing method as described in one or more of method claims 1-4.
