CN115809356A - Embedded operating system type detection method and device and storage medium - Google Patents

Embedded operating system type detection method and device and storage medium Download PDF

Info

Publication number
CN115809356A
CN115809356A CN202211430835.1A CN202211430835A CN115809356A CN 115809356 A CN115809356 A CN 115809356A CN 202211430835 A CN202211430835 A CN 202211430835A CN 115809356 A CN115809356 A CN 115809356A
Authority
CN
China
Prior art keywords
operating system
symbol
type
embedded operating
queried
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
CN202211430835.1A
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.)
Beijing Eswin Computing Technology Co Ltd
Original Assignee
Beijing Eswin Computing 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 Beijing Eswin Computing Technology Co Ltd filed Critical Beijing Eswin Computing Technology Co Ltd
Priority to CN202211430835.1A priority Critical patent/CN115809356A/en
Publication of CN115809356A publication Critical patent/CN115809356A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

A method, a device and a storage medium for detecting the type of an embedded operating system are provided, wherein the method for detecting the type of the embedded operating system is applied to a GDB server side and comprises the following steps: responding to a preset detection instruction sent by a GDB client, sending a symbolic symbol in a preset symbol table to be queried to the GDB client according to a preset detection sequence, so that the GDB client can query whether the type information of an embedded operating system contains the symbolic symbol according to the symbolic symbol, receiving a query result of the GDB client, and determining the type of the embedded operating system according to the query result of the GDB client, wherein the symbol table to be queried comprises a plurality of operating system types and the symbolic symbol corresponding to each operating system type.

Description

Embedded operating system type detection method and device and storage medium
Technical Field
The embodiment of the disclosure relates to, but not limited to, the technical field of embedded operating systems, and in particular, to a method and an apparatus for detecting a type of an embedded operating system, and a storage medium.
Background
In the field of embedded systems, in order to meet the Real-Time and multi-task requirements of a target scene, a specific function is usually implemented based on a Real Time Operating System (RTOS) core (Kernel). Currently, the mainstream real-time operating systems in the industry include: threadX, freeRTOS, eCos, etc.
In each stage of development, debugging, use, etc. of an embedded system, embedded software often needs to be debugged or configured, and at this time, the type of a specific real-time operating system core used by the embedded system needs to be determined. But for various reasons (lack of documentation, unknown software source, inability to obtain source code, etc.), the type of real-time operating system is often not known quickly. At this point, much extra effort (contact developer, manual acquisition and analysis of logs, etc.) is required to get the type of real-time operating system.
Disclosure of Invention
The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
The embodiment of the disclosure provides a method for detecting the type of an embedded operating system, which is applied to a GDB server side and comprises the following steps:
responding to a preset detection instruction sent by a GDB client, sending a symbolic symbol in a preset symbol table to be queried to the GDB client according to a preset detection sequence, so that the GDB client queries whether a backup program of an embedded operating system contains the symbolic symbol or not according to the symbolic symbol, receiving a query result of the GDB client, and determining the type of the embedded operating system according to the query result of the GDB client, wherein the symbol table to be queried comprises a plurality of operating system types and the symbolic symbol corresponding to each operating system type.
Optionally, the determining the type of the embedded operating system according to the query result of the GDB client includes: and when the query result of the GDB client is that all the symbolic symbols corresponding to the operating system type are contained in the backup program of the embedded operating system, determining that the type of the embedded operating system is the operating system type corresponding to all the symbolic symbols contained in the embedded operating system.
Optionally, the symbol table to be queried includes N rows, where N is a total number of types of the operating systems to be queried, and N is a natural number greater than or equal to 1, where an ith row includes j i A symbolic symbol to be queried, i being between 1 and N, j i ≥1。
Optionally, the symbol table to be queried includes N +1 rows, where N is a total number of types of the operating system to be queried, and N is a natural number greater than or equal to 1, where an ith row includes j i A symbolic symbol to be queried and 1 end symbolic symbol, i is between 1 and N, j i And ≧ 1, line (N + 1) includes 1 ending glyph.
Optionally, the preset detection sequence is: sequentially detecting from the first row to the (N + 1) th row of the symbol table to be inquired, and detecting from the first column of the ith row to the (j) th row of the ith row when detecting the ith row i + 1) columns are sequentially tested.
Optionally, determining the type of the embedded operating system according to the query result of the GDB client includes:
when the current symbol to be detected is the ending sign symbol of the (N + 1) th row, determining that the type of the embedded operating system is not found;
and when the current symbol to be detected is the ending mark symbol of the ith row, determining the type of the embedded operating system as the operating system type corresponding to all the symbolic symbols of the ith row.
Optionally, when a preset detection instruction sent by the GDB client is received, the detection method further includes:
checking whether an operating system type detection switch is started;
when the operating system type detection switch is started, triggering and executing the step of sending the symbolic symbols in the preset symbol table to be inquired to the GDB client according to the preset detection sequence;
and when the operating system type detection switch is closed, outputting a preset reply instruction to the GDB client.
Optionally, the detection method is used in a starting process of the GDB client remote debugging, and the preset detection instruction is qSymbol instruction.
The embodiment of the present disclosure further provides an embedded operating system type detection apparatus, including a memory; and a processor coupled to the memory, the memory for storing instructions, the processor configured to perform the steps of the embedded operating system type detection method of any embodiment of the present disclosure based on the instructions stored in the memory.
The embodiment of the disclosure also provides a storage medium, on which a computer program is stored, and when the program is executed by a processor, the embedded operating system type detection method according to any embodiment of the disclosure is implemented.
Other aspects will become apparent upon reading the attached drawings and detailed description.
Drawings
The accompanying drawings are included to provide a further understanding of the disclosed embodiments and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the example serve to explain the principles of the disclosure and not to limit the disclosure. The shapes and sizes of the various elements in the drawings are not to scale and are merely illustrative of the present disclosure.
Fig. 1A is a schematic structural diagram of a detection system provided in an exemplary embodiment of the present disclosure;
fig. 1B is a schematic flowchart of a method for detecting a type of an embedded operating system according to an exemplary embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating another embedded operating system type detection method according to an exemplary embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an embedded operating system type detection apparatus according to an exemplary embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. It should be noted that, in the present disclosure, the embodiments and the features of the embodiments may be arbitrarily combined with each other without conflict.
Unless otherwise defined, technical or scientific terms used in the disclosure of the embodiments of the present disclosure should have the ordinary meaning as understood by those having ordinary skill in the art to which the present disclosure belongs. The use of "first," "second," and similar terms in the embodiments of the disclosure is not intended to indicate any order, quantity, or importance, but rather is used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item preceding the word covers the element or item listed after the word and its equivalents, but does not exclude other elements or items.
For debugging of embedded software, GDB (GNU Project debug) is the most mature and widely used debugging tool. The GDB comprises a client and a Server, wherein the GDB client runs at a Host (Host) end and communicates with a GDB Server (GDB Server) running at a Remote (Remote) end to realize Remote debugging.
The disclosed embodiment provides a method for detecting embedded operating system type, which is implemented based on a detection system, as shown in fig. 1A, the detection system includes: the GDB server is a software program which runs on the target hardware to realize the functions of the server. The backup program of the embedded operating system is located on the Host computer, as shown in fig. 1B, the detection method includes the following steps:
step 101, in response to receiving a preset detection instruction sent by a GDB client, sending a symbolic symbol in a preset symbol table to be queried to the GDB client according to a preset detection sequence so that the GDB client can query whether a backup program of an embedded operating system contains the symbolic symbol or not according to the symbolic symbol, wherein the symbol table to be queried comprises a plurality of operating system types and symbolic symbols corresponding to each operating system type;
and 102, receiving a query result of the GDB client, and determining the type of the embedded operating system according to the query result of the GDB client.
In the embedded operating system type detection method of the embodiment of the disclosure, the symbolic symbols in the preset symbol table to be queried are sent to the GDB client according to the preset detection order by responding to the received preset detection instruction sent by the GDB client, the query result of the GDB client is received, and the type of the embedded operating system is determined according to the query result, so that the automatic acquisition of the type of the embedded operating system can be realized by using the existing interfaces and flows of the GDB client and the GDB server, thereby facilitating the further debugging and configuration of the embedded operating system, obtaining the type of the operating system without the need of consuming any extra energy by a user, and improving the use experience of the user.
The GDB debugging environment of the embedded operating system consists of a Host computer and target hardware (namely a target computer, such as a development board), wherein a GDB client is installed and operated on the Host computer, and a GDB server is installed and operated on the target hardware, wherein the GDB server copies a generated binary executable file onto the target hardware after the Host computer is successfully compiled.
In the embodiment of the disclosure, a backup program of the target program is stored on the Host, the GDB client queries whether the symbolic symbol is included in the backup program of the target program on the Host, and sends the query result to the GDB server, so that the GDB server can determine the type of the operating embedded operating system according to the query result. Specifically, the backup program of the target program may be an Executable and Linkable Format (ELF) file, the ELF file includes a backup program of the embedded operating system, and the GDB client may determine whether the symbolic symbol is included in the backup program of the target program by detecting whether the symbolic symbol is included in the backup program of the embedded operating system.
In some exemplary embodiments, the detection method further comprises, before:
and presetting a symbol table to be inquired in the GDB server.
In some exemplary embodiments, in step 101, the symbol table to be queried includes N rows, where N is the total number of types of operating systems to be queried, and N is a natural number greater than or equal to 1, where the ith row includes j i A symbolic symbol to be queried, i being between 1 and N, j i ≥1。
In other exemplary embodiments, in step 101, the symbol table to be queried may include N +1 rows, where N is a total number of types of operating systems to be queried, and N is a natural number greater than or equal to 1, where the ith row includes j i A symbolic symbol to be queried and 1 end symbolic symbol, i is between 1 and N, j i And ≧ 1, line (N + 1) includes 1 ending glyph.
The detection method disclosed by the embodiment of the disclosure is equivalent to adding an automatic table look-up function on the GDB server. First, a table containing a two-dimensional string array as shown in table 1 (for example, N =4,j in table 1) is added in the GDB server 1 =3,j 2 =4,j 3 =2,j 4 = 3), each element RTOS _ N _ Symbol _ N in the table may be a string, representing the nth Symbol of the nth RTOS type. The symbolic names corresponding to a plurality of mainstream RTOS types to be queried may be preset in a table, for example, RTOS _1 may be ThreadX, RTOS _2 may be FreeRTOS, RTOS _3 may be eCos, and so on. Each row corresponds to an RTOS type, and each row may contain one or more symbols, with NULL (0) being the final indicator. Taking table 1 as an example, four RTOS types may be detected.
Figure BDA0003945049450000061
TABLE 1
Taking FreeRTOS as an example, the "uxcurrent number of tasks" may be used as one of the symbolic symbols, it should be noted that, a person skilled in the art may set different types of operating systems to be queried and the symbolic symbol corresponding to each type of operating system according to needs, and the embodiments of the present disclosure do not limit the types and the numbers of the operating systems to be queried and the names and the numbers of the symbolic symbols corresponding to each type of operating systems. In addition, table 1 only shows an exemplary structure of a symbol table to be queried, and those skilled in the art may set different structures of symbol tables to be queried as needed, which is not limited by the embodiment of the present disclosure.
In some exemplary embodiments, in step 102, determining the type of the embedded operating system according to the query result of the GDB client includes:
and when the query result of the GDB client is that all symbolic symbols corresponding to one type of the operating system are contained in the backup program of the embedded operating system, determining that the type of the embedded operating system is the operating system type corresponding to all the symbolic symbols contained in the embedded operating system.
For example, still taking table 1 as an example, when the query results of the GDB client are that RTOS _1_ symbol _1to RTOS _1_ symbol _3are all included in the backup program of the embedded operating system, the GDB server determines that the type of the embedded operating system is RTOS _1. When the query result of the GDB client is that any one or more symbolic symbols in RTOS _1_Symbol _1to RTOS _1_Symbol _3are not included in the backup program of the embedded operating system, the GDB server determines that the type of the embedded operating system is not RTOS _1, and continues to detect the symbolic symbol of the next line.
In some exemplary embodiments, in step 102, the preset detection order is: sequentially detecting from the first row to the (N + 1) th row of the symbol table to be inquired, and detecting from the first column of the ith row to the (j) th row of the ith row i + 1) columns were tested in sequence. However, the embodiment of the present disclosure does not limit this, and the user may also use any other detection order to perform the detection.
In some exemplary embodiments, the sending the symbolic symbols in the preset symbol table to be queried to the GDB client according to a preset detection order includes:
selecting a row of symbolic symbols from the symbol table to be queried and sending the symbolic symbols to the GDB client so that the GDB client can query whether the backup program of the embedded operating system contains the currently sent symbolic symbols or not;
when the query result of the GDB client side indicates that the currently sent symbolic symbol is not in the backup program of the embedded operating system, another symbolic symbol in a row different from the currently sent symbolic symbol is selected from the symbol table to be queried and sent to the GDB client side;
and when the query result of the GDB client is that the currently sent symbolic symbol is in a backup program of the embedded operating system, selecting another symbolic symbol in the same row as the currently sent symbolic symbol from the symbol table to be queried and sending the selected symbolic symbol to the GDB client.
In some exemplary embodiments, determining the type of the embedded operating system according to the query result of the GDB client includes:
when the current symbol to be detected is the ending sign symbol of the (N + 1) th row, determining that the type of the embedded operating system is not found;
and when the current symbol to be detected is the ending mark symbol of the ith row, determining that the type of the embedded operating system is the operating system type corresponding to all the symbolic symbols of the ith row, wherein i is between 1 and N.
In some exemplary embodiments, sending symbolic symbols in a preset symbol table to be queried to a GDB client according to a preset detection order, receiving a query result of the GDB client, and determining a type of an embedded operating system according to the query result of the GDB client includes:
initializing a first symbolic symbol of a first row in a symbol table to be queried to a symbol to be queried currently (namely, setting the row number m of the symbol to be queried currently to 1, and setting the column number n of the symbol to be queried currently to 1);
judging whether the symbol to be inquired currently is an end sign symbol, judging whether the line of the symbol to be inquired currently is the (N + 1) th line when the symbol to be inquired currently is the end sign symbol, and determining that the type of the embedded operating system is not found when the line of the symbol to be inquired currently is the (N + 1) th line; when the line where the symbol to be queried currently is not the (N + 1) th line, determining that the type of the embedded operating system is the operating system type corresponding to the symbol to be queried currently;
when the symbol to be queried currently is not the end marker symbol, the symbol to be queried currently is sent to the GDB client, so that the GDB client can query whether the backup program of the embedded operating system contains the symbol to be queried currently or not;
receiving a query result of the GDB client, determining that the type of the embedded operating system is not the type of the operating system corresponding to the symbol to be queried currently when the query result of the GDB client is that the symbol to be queried currently is not in a backup program of the embedded operating system, acquiring a first symbol of a next row of the symbol to be queried currently and updating the acquired symbol to the symbol to be queried currently, and returning to execute the step of judging whether the symbol to be queried currently is an end mark symbol or not; and when the query result of the GDB client is that the symbol to be queried currently is in the backup program of the embedded operating system, acquiring the next symbol of the row where the symbol to be queried currently is positioned, updating the acquired symbol to the symbol to be queried currently, and returning to the step of judging whether the symbol to be queried currently is the end marker symbol or not.
Since the embodiment of the present disclosure designs the symbol table to be queried as shown in table 1, where the (N + 1) th row includes only one column, the column is an end marker symbol, and any other row includes at least one symbolic symbol and an end marker symbol, when the symbol to be queried currently is the end marker symbol, it is determined whether the row where the symbol to be queried currently is the (N + 1) th row, and it may also be replaced by determining whether the column where the symbol to be queried currently is the first column.
In some exemplary embodiments, as shown in fig. 2, sending a symbolic symbol in a preset symbol table to be queried to a GDB client according to a preset detection order, receiving a query result of the GDB client, and determining a type of an embedded operating system according to the query result of the GDB client includes:
initializing a first symbolic symbol of a first row in a symbol table to be queried as a current symbol to be queried (namely, the row number m of the current symbol to be queried is set to be 1, and the column number n of the current symbol to be queried is set to be 1);
judging whether the symbol to be inquired currently is an end sign symbol, judging whether the column of the symbol to be inquired currently is a first column when the symbol to be inquired currently is the end sign symbol, and determining that the type of the embedded operating system is not found when the column of the symbol to be inquired currently is the first column; when the column of the symbol to be queried currently is not the first column, determining the type of the embedded operating system as the type of the operating system corresponding to the symbol to be queried currently;
when the symbol to be queried currently is not the end sign symbol, sending the symbol to be queried currently to the GDB client, so that the GDB client can query whether the backup program of the embedded operating system contains the symbol to be queried currently;
receiving a query result of the GDB client, determining that the type of the embedded operating system is not the type of the operating system corresponding to the symbol to be queried currently when the query result of the GDB client is that the symbol to be queried currently is not in a backup program of the embedded operating system, acquiring a first symbol of a next row of the symbol to be queried currently and updating the acquired symbol to the symbol to be queried currently, and returning to execute the step of judging whether the symbol to be queried currently is an end mark symbol or not; and when the query result of the GDB client is that the current symbol to be queried is in the backup program of the embedded operating system, acquiring the next symbol of the row where the current symbol to be queried is positioned, updating the acquired symbol to the current symbol to be queried, and returning to execute the step of judging whether the current symbol to be queried is the end mark symbol.
In some exemplary embodiments, the predetermined detection instruction in step 102 may be a qSymbol:: instruction.
According to the detection method, the GDB server is modified to process the 'qSymbol:' instruction, and the symbol name string in the symbol table to be inquired is sent to the GDB client side to be inquired in sequence so as to judge whether the backup program of the embedded operating system contains the symbol.
In the detection method of the embodiment of the present disclosure, an operating system type detection switch may be set on the GDB server to control whether to enable the automatic detection function of the embodiment of the present disclosure.
In some exemplary embodiments, in step 102, when a preset detection instruction sent by the GDB client is received, the detection method further includes:
checking whether an operating system type detection switch is started;
when the operating system type detection switch is started, triggering and executing a step of sending the symbolic symbols in the preset symbol table to be inquired to the GDB client according to a preset detection sequence;
when the operating system type detection switch is turned off, a preset reply instruction is output to the GDB client.
In some exemplary embodiments, the preset reply command may be in a normal state (e.g., "OK").
In some exemplary embodiments, the detection method may be used during the start-up process of GDB client remote debugging.
In the starting process of remote debugging, the GDB client inquires whether the GDB Server needs to carry out symbol inquiry or not by sending a message packet with the content of 'qSymbol:'. At this time, the GDB Server modifies the processing flow of 'qSymbol:', sends the symbol name string in the table to the GDB client in sequence for query, and judges whether the backup program of the embedded operating system contains the symbol.
In other exemplary embodiments, the detection method may also be used during the debugging process of the GDB client to the GDB server.
The embedded operating system type detection method of the embodiment of the disclosure realizes automatic acquisition of the type of the embedded operating system by using the existing interfaces and starting processes of the GDB client and the GDB server. The embodiment of the disclosure mainly uses a table look-up mode to poll the symbolic symbols of each main stream RTOS, and if the corresponding symbols are inquired in the backup program of the embedded operating system, the acquisition is considered to be successful, and the inquiry result is output. Furthermore, an operating system type detection switch can be additionally arranged, and whether the detection function is started or not can be flexibly controlled.
The embodiment of the present disclosure further provides an embedded operating system type detection apparatus, including a memory; and a processor coupled to the memory, the memory for storing instructions, the processor configured to perform the steps of the embedded operating system type detection method according to any embodiment of the present disclosure based on the instructions stored in the memory.
As shown in fig. 3, in one example, the embedded operating system type detecting device may include: the system comprises a processor 310, a memory 320, a bus system 330 and a transceiver 340, wherein the processor 310, the memory 320 and the transceiver 340 are connected through the bus system 330, the memory 320 is used for storing instructions, a symbol table to be queried is further stored in the memory 320, the symbol table to be queried comprises a plurality of operating system types and symbolic symbols corresponding to each operating system type, and the processor 310 is used for executing the instructions stored in the memory 320 to control the transceiver 340 to transmit and receive signals. Specifically, the transceiver 340 may receive a preset detection instruction sent by the GDB client under the control of the processor 310, and the processor 310 sends a symbolic symbol in a preset symbol table to be queried to the GDB client according to a preset detection sequence, so that the GDB client queries whether a backup program of the embedded operating system includes the symbolic symbol according to the symbolic symbol, receives a query result of the GDB client, determines the type of the embedded operating system according to the query result of the GDB client, and outputs the determined type of the embedded operating system to the GDB client through the transceiver 340.
It should be understood that processor 310 may be a Central Processing Unit (CPU), and that processor 310 may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Memory 320 may include both read-only memory and random access memory and provides instructions and data to processor 310. A portion of memory 320 may also include non-volatile random access memory. For example, the memory 320 may also store device type information.
The bus system 330 may include a power bus, a control bus, a status signal bus, and the like, in addition to the data bus. For clarity of illustration, however, the various buses are labeled as bus system 330 in fig. 3.
In implementation, the processing performed by the processing device may be performed by instructions in the form of hardware, integrated logic circuits, or software in the processor 310. That is, the method steps of the embodiments of the present disclosure may be implemented by a hardware processor, or implemented by a combination of hardware and software modules in a processor. The software module may be located in a storage medium such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 320, and the processor 310 reads the information in the memory 320, and completes the steps of the method in combination with the hardware. To avoid repetition, it is not described in detail here.
The embodiments of the present disclosure further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for detecting the type of an embedded operating system according to any embodiment of the present disclosure. The method for driving the embedded operating system type detection by executing the executable instruction is basically the same as the method for detecting the embedded operating system type provided by the above embodiment of the present disclosure, and is not described herein again.
In some possible embodiments, various aspects of the embedded operating system type detection method provided by the present application may also be implemented in the form of a program product, which includes program code for causing a computer device to perform the steps of the embedded operating system type detection method according to various exemplary embodiments of the present application described above in this specification when the program product runs on the computer device, for example, the computer device may perform the embedded operating system type detection method described in the embodiments of the present application.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It will be understood by those of ordinary skill in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes 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, program modules or other data, as is well known to those skilled in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, 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 as known to those skilled in the art.
Although the embodiments disclosed in the present disclosure are described above, the descriptions are only for the purpose of understanding the present disclosure, and are not intended to limit the present disclosure. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the disclosure, and that the scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (10)

1. A method for detecting the type of an embedded operating system is applied to a GDB server side and comprises the following steps:
responding to a preset detection instruction sent by a GDB client, sending a symbolic symbol in a preset symbol table to be queried to the GDB client according to a preset detection sequence, so that the GDB client queries whether a backup program of an embedded operating system contains the symbolic symbol according to the symbolic symbol, receiving a query result of the GDB client, and determining the type of the embedded operating system according to the query result of the GDB client, wherein the symbol table to be queried comprises a plurality of operating system types and the symbolic symbol corresponding to each operating system type.
2. The detection method according to claim 1, wherein the determining the type of the embedded operating system according to the query result of the GDB client comprises:
and when the query result of the GDB client is that all the symbolic symbols corresponding to the type of the operating system are contained in the backup program of the embedded operating system, determining that the type of the embedded operating system is the type of the operating system corresponding to all the symbolic symbols contained in the embedded operating system.
3. The detection method according to claim 1, wherein the symbol table to be queried comprises N rows, N being the total number of operating system types to be queried, N being a natural number greater than or equal to 1, wherein the ith row comprises j i A symbolic symbol to be queried, i being between 1 and N, j i ≥1。
4. The detection method according to claim 1, wherein the symbol table to be queried comprises N +1 rows, N is the total number of the operating system types to be queried, N is a natural number greater than or equal to 1, wherein the ith row comprises j i A symbolic symbol to be queried and 1 end symbolic symbol, i is between 1 and N, j i ≧ 1, the (N + 1) th row includes 1 end-marker.
5. The detection method according to claim 4, wherein the preset detection sequence is: sequentially detecting from the first row to the (N + 1) th row of the symbol table to be inquired, and detecting from the first column of the ith row to the (j) th row of the ith row when detecting the ith row i + 1) columns are sequentially tested.
6. The detection method according to claim 5, wherein determining the type of the embedded operating system according to the query result of the GDB client comprises:
when the current symbol to be detected is the ending sign symbol of the (N + 1) th row, determining that the type of the embedded operating system is not found;
and when the current symbol to be detected is the ending mark symbol of the ith row, determining the type of the embedded operating system as the operating system type corresponding to all the symbolic symbols of the ith row.
7. The detection method according to claim 1, wherein when receiving a preset detection instruction sent by the GDB client, the detection method further comprises:
checking whether an operating system type detection switch is started;
when the operating system type detection switch is started, triggering and executing the step of sending the symbolic symbols in the preset symbol table to be inquired to the GDB client according to the preset detection sequence;
and when the operating system type detection switch is closed, outputting a preset reply instruction to the GDB client.
8. The detection method as claimed in claim 1, wherein the detection method is used in a start process of the GDB client remote debugging, and the preset detection instruction is qSymbol:: instruction.
9. The embedded operating system type detection device is characterized by comprising a memory; and a processor connected to the memory for storing instructions, the processor being configured to perform the steps of the embedded operating system type detection method of any one of claims 1 to 8 based on the instructions stored in the memory.
10. A storage medium on which a computer program is stored, which when executed by a processor implements the embedded operating system type detection method of any one of claims 1 to 8.
CN202211430835.1A 2022-11-15 2022-11-15 Embedded operating system type detection method and device and storage medium Pending CN115809356A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211430835.1A CN115809356A (en) 2022-11-15 2022-11-15 Embedded operating system type detection method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211430835.1A CN115809356A (en) 2022-11-15 2022-11-15 Embedded operating system type detection method and device and storage medium

Publications (1)

Publication Number Publication Date
CN115809356A true CN115809356A (en) 2023-03-17

Family

ID=85483212

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211430835.1A Pending CN115809356A (en) 2022-11-15 2022-11-15 Embedded operating system type detection method and device and storage medium

Country Status (1)

Country Link
CN (1) CN115809356A (en)

Similar Documents

Publication Publication Date Title
CN109669873B (en) User interface automatic test method and device, electronic equipment and storage medium
US20120331449A1 (en) Device, method and computer program product for evaluating a debugger script
US9262283B2 (en) Method for reading kernel log upon kernel panic in operating system
US9753730B2 (en) Decoding instructions from multiple instructions sets
CN110866258B (en) Rapid vulnerability positioning method, electronic device and storage medium
CN110727597B (en) Method for checking invalid code completion case based on log
CN101377749B (en) Method, programmable logic device, system and apparatus for checking memory data
US7882395B2 (en) Debug device for embedded systems and method thereof
US4127768A (en) Data processing system self-test enabling technique
CN114168222B (en) Method and device for acquiring time consumption during starting, terminal equipment and storage medium
CN108255735B (en) Associated environment testing method, electronic device and computer readable storage medium
CN110245074B (en) Log record generation method and device, storage medium and server
CN110580220A (en) method for measuring execution time of code segment and terminal equipment
CN111694684A (en) Abnormal construction method and device of storage equipment, electronic equipment and storage medium
CN111338864B (en) Memory problem detection method, device, computer equipment and storage medium
CN115809356A (en) Embedded operating system type detection method and device and storage medium
CN107766228B (en) Multi-language-based automatic testing method and device
US7856622B2 (en) Computer program runtime bottleneck diagnostic method and system
CN112181853A (en) Program debugging method, device and system
CN109582347B (en) Method and device for acquiring front-end codes
CN109783718B (en) Repeat request judgment method and device
CN109144524B (en) Version release method of subject game on education platform and electronic equipment
CN111857785A (en) MCU starting method and device and terminal equipment
US20210335441A1 (en) In-system test of a memory device
CN112558982B (en) Code detection method and device and computer equipment

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