CN114265779A - Method and device for locating down position of program, electronic equipment and storage medium - Google Patents
Method and device for locating down position of program, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN114265779A CN114265779A CN202111598148.6A CN202111598148A CN114265779A CN 114265779 A CN114265779 A CN 114265779A CN 202111598148 A CN202111598148 A CN 202111598148A CN 114265779 A CN114265779 A CN 114265779A
- Authority
- CN
- China
- Prior art keywords
- program module
- unique identifier
- address
- downtime
- program
- 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
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The invention provides a method, a device, electronic equipment and a storage medium for positioning a program downtime position. The method comprises the following steps: when a system is crashed in the running process of a program, acquiring a global unique identifier of a current program module running during crash and an entry physical address corresponding to the global unique identifier of the current program module; reading a physical address of an instruction address register stored in an instruction address register in the system when the system is down; subtracting the entry physical address from the physical address of the instruction address register to obtain a first offset address; acquiring a first mapping file corresponding to the global unique identifier of the current program module; searching a first function name corresponding to the first offset address; searching an offset address of a function corresponding to the first function name according to the first mapping file; and taking the offset address of the function corresponding to the first function name as the downtime position, and outputting the address. The invention can position the downtime position of the program.
Description
Technical Field
The present invention relates to the field of computer system technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for locating a program downtime position.
Background
The basic components of a modern computer system include SOC system-on-chip, memory, firmware, input and output devices, storage devices, etc.
The modern computer BIOS (basic input output system) is implemented according to UEFI (unified extensible firmware interface) specification, also called UEFI BIOS, and its operation modes are divided into the following two types:
1. a Debug mode: the BIOS in the mode can output a start log and debugging information in a serial port mode and the like.
2. Release mode: the BIOS in the mode closes debugging information and logs output by the serial port and improves starting speed.
In the development process of a computer system (chip, personal computer, workstation, server and the like), when BIOS starts or Reboot aging test is restarted, a Release mode BIOS is selected for testing, so that the testing time is shortened, and the testing efficiency is improved. In the process, the downtime problem is often encountered, and some downtime problems do not occur when the Debug mode BIOS is used in the same environment, but occur when the Release mode BIOS is used.
The Release mode BIOS generally determines the execution stage of the BIOS by a post code (power on self test code) output from an 80 port to a carrier such as a nixie tube of a motherboard, and when the Release mode BIOS is down and the Debug mode BIOS is not down in the same environment, the shutdown position cannot be located by means of serial port debugging and the like.
Disclosure of Invention
The method, the device, the electronic equipment and the storage medium for positioning the downtime position of the program can position the downtime position of the program.
In a first aspect, the present invention provides a method for locating a program downtime position, including:
when a system is crashed in the running process of a program, acquiring a global unique identifier of a current program module running during crash and an entry physical address corresponding to the global unique identifier of the current program module;
reading a physical address of an instruction address register stored in an instruction address register in the system when the system is down;
subtracting the entry physical address from the physical address of the instruction address register to obtain a first offset address;
acquiring a first mapping file corresponding to the global unique identifier of the current program module according to the corresponding relation between the global unique identifier of the program module and the mapping file; the first mapping file records the corresponding relation between each function name and the offset address of the function in the program module;
searching a first function name corresponding to the first offset address according to the first mapping file;
searching an offset address of a function corresponding to the first function name according to the first mapping file;
and taking the offset address of the function corresponding to the first function name as the downtime position, and outputting the offset address.
Optionally, before the step of acquiring the global unique identifier of the current program module running in downtime and the entry physical address corresponding to the global unique identifier of the current program module when the system is down in the running process of the program, the method includes:
and generating a mapping file corresponding to each program module at the compiling stage of the program, wherein the mapping file records the corresponding relation between each function name and the offset address of each function in each program module.
Optionally, before the step of acquiring the global unique identifier of the current program module running in downtime and the entry physical address corresponding to the global unique identifier of the current program module when the system is down in the running process of the program, the method includes:
and in the running process of the program, sequentially storing the global unique identifier corresponding to the current program module being executed and the corresponding entry physical address as a record.
Optionally, in the running process of the program, the step of sequentially storing the globally unique identifier corresponding to the current program module being executed and the corresponding entry physical address as a record includes:
appointing a segment of storage area;
and in the running process of the program, sequentially storing the globally unique identifier of the current program module being executed and the corresponding entry physical address as a record in the storage area.
Optionally, when the system is down during the program running process, the step of acquiring the global unique identifier of the current program module running at the time of down and the entry physical address corresponding to the global unique identifier of the current program module specifically includes:
and acquiring a global unique identifier and an entry physical address corresponding to a current program module which is stored for the last time before the system is crashed.
Optionally, the step of acquiring the global unique identifier and the entry physical address corresponding to the current program module that is stored last time before the system crashes includes:
and acquiring the global unique identifier and the entry physical address corresponding to the program module which is stored for the last time before the downtime in the storage area.
Optionally, the program is a basic input/output system BIOS; and/or
The storage area is a memory.
In a second aspect, the present invention further provides an apparatus for locating a program downtime position, including:
the system comprises a first obtaining unit, a second obtaining unit and a third obtaining unit, wherein the first obtaining unit is used for obtaining a global unique identifier of a current program module running in downtime and an entry physical address corresponding to the global unique identifier of the current program module when the system is in downtime in the running process of a program;
the reading unit is used for reading the physical address of the instruction address register stored in the instruction address register in the system when the system is down;
the calculation unit is used for subtracting the entry physical address from the physical address of the instruction address register to obtain a first offset address;
the second acquisition unit is used for acquiring a first mapping file corresponding to the global unique identifier of the current program module according to the corresponding relation between the global unique identifier of the program module and the mapping file; the first mapping file records the corresponding relation between each function name and the offset address of the function in the program module;
the searching unit is used for searching a first function name corresponding to the first offset address according to the first mapping file; searching an offset address of a function corresponding to the first function name according to the first mapping file;
and the output unit is used for taking the offset address of the function corresponding to the first function name as the downtime position and outputting the address.
In a third aspect, the present invention further provides an electronic device, where the electronic device includes the apparatus for locating the downtime position.
In a fourth aspect, the present invention further provides an apparatus for locating a program downtime position, including:
a memory;
and a processor coupled to the memory, the processor configured to perform the method of locating the location of the program downtime based on the instructions stored in the memory.
In a fifth aspect, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer instructions, when executed by a processor, implement the method for locating the downtime position.
According to the method, the device, the electronic equipment and the storage medium for positioning the downtime of the program, when the system is crashed in the running process of the program, the current program module running in the downtime and the physical address of the inlet corresponding to the current program module are obtained; reading a physical address of an instruction address register stored by an instruction address register RIP in the system when the system is down; subtracting the entry physical address from the physical address of the instruction address register to obtain a first offset address; acquiring a first mapping file corresponding to the current program module according to the corresponding relation between the program module and the mapping file; the mapping file records each function and corresponding offset address in the program module; searching a function corresponding to the first offset address according to the first mapping file; and taking the offset address of the function corresponding to the function as the downtime position and outputting the offset address, so that the function position of the program during downtime can be positioned.
Drawings
FIG. 1 is a flowchart illustrating a method for locating a program downtime location according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for locating a program downtime location according to another embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an apparatus for locating a program downtime location according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus for locating a program downtime location according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a method for locating a program downtime position, as shown in fig. 1, the method includes:
and step 16, taking the offset address of the function corresponding to the first function name as the downtime position, and outputting the address.
In the above embodiment, when a system is down in the program running process, the current program module running in the down process and the entry physical address corresponding to the current program module are acquired; reading a physical address of an instruction address register stored by an instruction address register RIP in the system when the system is down; subtracting the entry physical address from the physical address of the instruction address register to obtain a first offset address; acquiring a first mapping file corresponding to the current program module according to the corresponding relation between the program module and the mapping file; the mapping file records each function and corresponding offset address in the program module; searching a function corresponding to the first offset address according to the first mapping file; and taking the offset address of the function corresponding to the function as the downtime position and outputting the offset address, so that the function position of the program during downtime can be positioned. The invention can also be used in the debugging scene of the BIOS in the Release mode or the debugging scene of other programs.
An embodiment of the present invention further provides another method for locating a program downtime position, and as shown in fig. 2, the method includes:
And step 11B, in the running process of the program, sequentially storing the global unique identifier corresponding to the current program module being executed and the corresponding entry physical address as a record. The method comprises the following steps: appointing a segment of storage area; and in the running process of the program, sequentially storing the globally unique identifier of the current program module being executed and the corresponding entry physical address as a record in the storage area. Wherein the program is a BIOS; and/or the storage area is a memory.
and step 16, taking the offset address of the function corresponding to the first function name as the downtime position, and outputting the address.
An embodiment of the present invention further provides a device for locating a program downtime position, as shown in fig. 3, the device includes:
a first obtaining unit 31, configured to, when a system is down in a program running process, obtain a global unique identifier of a current program module running in the down process and an entry physical address corresponding to the global unique identifier of the current program module;
a reading unit 32, configured to read a physical address of an instruction address register stored in an instruction address register in the system when the system is down;
a calculating unit 33, configured to subtract the entry physical address from the physical address of the instruction address register to obtain a first offset address;
a second obtaining unit 34, configured to obtain, according to a correspondence between a global unique identifier of a program module and a mapping file, a first mapping file corresponding to the global unique identifier of the current program module; the first mapping file records the corresponding relation between each function name and the offset address of the function in the program module;
the searching unit 35 is configured to search, according to the first mapping file, a first function name corresponding to the first offset address; searching an offset address of a function corresponding to the first function name according to the first mapping file;
and the output unit 36 is configured to take the offset address of the function corresponding to the first function name as the downtime position, and output the downtime position.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
The embodiment of the invention also provides electronic equipment which comprises the device for positioning the downtime position.
An embodiment of the present invention further provides a device for locating a program downtime position, and as shown in fig. 4, the device includes:
a memory 42;
and a processor 41 coupled to the memory 42, the processor 41 being configured to perform the above-described method of locating a location of a program crash based on instructions stored in the memory 42.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer instructions, and the computer instructions, when executed by a processor, implement the method for locating the downtime position of a program.
The following describes an application scenario of the present invention. The application scenario takes BIOS as an example. Aiming at the current situation that the BIOS downtime problem in the Release mode cannot be debugged by relying on serial port output logs in the prior art, the method for accurately positioning the downtime position is provided, and the downtime problem analysis period is effectively shortened.
UEFI BIOS boot-up is divided into multiple phases, each consisting of multiple modules (e.g., efi format files), each bound with a unique globally unique identifier. In the initial stage of the BIOS starting, a suitable memory address P is first specified in the BIOS, and a section of memory area a is applied based on the address P. In the subsequent startup process, the globally unique identifier and Entry address (i.e., the Entry physical address described above) of each program module are stored as a record in a in the order of execution in sequence.
When the BIOS is down in the running process, the hardware debugging equipment is used for acquiring the data of the area A through the address P, the last record of the area A is checked, and the globally unique identifier and the Entry address corresponding to the down module can be found.
The BIOS generates, during the compile phase, a. efi file and a.map file (i.e., a map file) for each module of the program in the same directory (the same module is in one directory), where the name of all functions in the module and their offset addresses are recorded in the map.
The RIP address (i.e. the physical address of the instruction address register) is subtracted by the Entry address (Entry physical address) to obtain an offset address B, i.e. the first offset address mentioned above.
Comparing the offset address B with the address in the map file, the function name of the current downtime can be obtained, for example: addresses of F1 and F2 of two adjacent functions in the map file are M1 and M2, respectively, if B > is M1 and B < M2, the function to be found is F1, then an offset address of the function corresponding to F1 is searched, and the offset address is output, that is, the downtime position of the program can be located.
The method and the device can record the BIOS execution flow through the memory address space under the condition of not influencing the starting time of the computer, and can realize the quick positioning of the BIOS downtime position under the condition of not influencing the starting time of the computer.
It will be understood by those skilled in the art that all or part of the processes of the embodiments of the methods described above may be implemented by a computer program, which may be stored in a computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (11)
1. A method for locating a program downtime location, comprising:
when a system is crashed in the running process of a program, acquiring a global unique identifier of a current program module running during crash and an entry physical address corresponding to the global unique identifier of the current program module;
reading a physical address of an instruction address register stored in an instruction address register in the system when the system is down;
subtracting the entry physical address from the physical address of the instruction address register to obtain a first offset address;
acquiring a first mapping file corresponding to the global unique identifier of the current program module according to the corresponding relation between the global unique identifier of the program module and the mapping file; the first mapping file records the corresponding relation between each function name and the offset address of the function in the program module;
searching a first function name corresponding to the first offset address according to the first mapping file; searching the offset address of the function corresponding to the first function name according to the first mapping file;
and taking the offset address of the function corresponding to the first function name as the downtime position, and outputting the offset address.
2. The method according to claim 1, wherein before the step of acquiring the globally unique identifier of the current program module running at downtime and the entry physical address corresponding to the globally unique identifier of the current program module when the system is down during the running process of the program, the method comprises:
and generating a mapping file corresponding to each program module at the compiling stage of the program, wherein the mapping file records the corresponding relation between each function name and the offset address of each function in each program module.
3. The method according to claim 1, wherein before the step of acquiring the globally unique identifier of the current program module running at downtime and the entry physical address corresponding to the globally unique identifier of the current program module when the system is down during the running process of the program, the method comprises:
and in the running process of the program, sequentially storing the global unique identifier corresponding to the current program module being executed and the corresponding entry physical address as a record.
4. The method according to claim 3, wherein the step of sequentially storing the globally unique identifier corresponding to the current program module being executed and the corresponding entry physical address as a record during the running of the program comprises:
appointing a segment of storage area;
and in the running process of the program, sequentially storing the globally unique identifier of the current program module being executed and the corresponding entry physical address as a record in the storage area.
5. The method of claim 3,
the step of acquiring the global unique identifier of the current program module running in downtime and the entry physical address corresponding to the global unique identifier of the current program module when the system is down in the running process of the program specifically includes:
and acquiring a global unique identifier and an entry physical address corresponding to a current program module which is stored for the last time before the system is crashed.
6. The method of claim 5,
the step of acquiring the global unique identifier and the entry physical address corresponding to the current program module stored last time before the system crashes is specifically as follows:
and acquiring the global unique identifier and the entry physical address corresponding to the program module which is stored for the last time before the downtime in the storage area.
7. The method of claim 4,
the program is a basic input/output system (BIOS); and/or
The storage area is a memory.
8. An apparatus for locating a program downtime location, comprising:
the system comprises a first obtaining unit, a second obtaining unit and a third obtaining unit, wherein the first obtaining unit is used for obtaining a global unique identifier of a current program module running in downtime and an entry physical address corresponding to the global unique identifier of the current program module when the system is in downtime in the running process of a program;
the reading unit is used for reading the physical address of the instruction address register stored in the instruction address register in the system when the system is down;
the calculation unit is used for subtracting the entry physical address from the physical address of the instruction address register to obtain a first offset address;
the second acquisition unit is used for acquiring a first mapping file corresponding to the global unique identifier of the current program module according to the corresponding relation between the global unique identifier of the program module and the mapping file; the first mapping file records the corresponding relation between each function name and the offset address of the function in the program module;
the searching unit is used for searching a first function name corresponding to the first offset address according to the first mapping file; searching an offset address of a function corresponding to the first function name according to the first mapping file;
and the output unit is used for taking the offset address of the function corresponding to the first function name as the downtime position and outputting the address.
9. An electronic device comprising the apparatus for locating the location of the program downtime of claim 8.
10. An apparatus for locating a location of a program downtime, comprising:
a memory;
and a processor coupled to the memory, the processor configured to execute the method of locating a program downtime location of any one of claims 1 to 7 based on instructions stored in the memory.
11. A computer readable storage medium, wherein the computer readable storage medium stores computer instructions which, when executed by a processor, implement a method of locating a location of program downtime as claimed in any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111598148.6A CN114265779A (en) | 2021-12-27 | 2021-12-27 | Method and device for locating down position of program, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111598148.6A CN114265779A (en) | 2021-12-27 | 2021-12-27 | Method and device for locating down position of program, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114265779A true CN114265779A (en) | 2022-04-01 |
Family
ID=80829747
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111598148.6A Pending CN114265779A (en) | 2021-12-27 | 2021-12-27 | Method and device for locating down position of program, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114265779A (en) |
-
2021
- 2021-12-27 CN CN202111598148.6A patent/CN114265779A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9727436B2 (en) | Adding a profiling agent to a virtual machine to permit performance and memory consumption analysis within unit tests | |
CN114168222B (en) | Method and device for acquiring time consumption during starting, terminal equipment and storage medium | |
CN110851351A (en) | Deployment environment testing method and device, computer equipment and storage medium | |
CN115357515B (en) | Debugging method and device of multi-core system, computer equipment and storage medium | |
CN108572895B (en) | Stability test method for automatically checking software and hardware configuration under Linux | |
CN110955598A (en) | Breakpoint processing method and device of kernel mode program | |
CN115935631A (en) | Test system and method for vehicle equipment and storage medium | |
WO2013030612A1 (en) | Data race analysis with improved detection filtering | |
CN115686961A (en) | Processor testing method and device and electronic equipment | |
CN110245074B (en) | Log record generation method and device, storage medium and server | |
CN114385418A (en) | Protection method, device, equipment and storage medium for communication equipment | |
CN113315675A (en) | White box switch U-Boot automatic testing method, system and storage medium | |
CN112905378A (en) | Crash information analysis method and device, electronic equipment and readable storage medium | |
CN117112522A (en) | Concurrent process log management method, device, equipment and storage medium | |
CN116450398A (en) | Exception backtracking method, device, equipment and medium | |
CN114265779A (en) | Method and device for locating down position of program, electronic equipment and storage medium | |
CN113342431B (en) | Function call stack backtracking and program exception handling method, device, equipment and medium | |
CN115794259A (en) | Method for generating device tree through ACPI | |
CN113867810B (en) | Method, device, terminal and storage medium for checking server hard disk topology | |
CN110096888B (en) | Method and system for accelerating verification and analyzing SMM potential safety hazard | |
US20070168978A1 (en) | Computer program code debugging method and system | |
US9495278B2 (en) | Dynamic discovery of data segments within instrumented code | |
CN112527335A (en) | Method, system and computer device for automating npm dependent package installation | |
CN112181853A (en) | Program debugging method, device and system | |
CN110673974A (en) | System debugging method and device |
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 |