[go: up one dir, main page]

CN103218294B - A kind of adjustment method of embedded system, debugging conversion equipment and system - Google Patents

A kind of adjustment method of embedded system, debugging conversion equipment and system Download PDF

Info

Publication number
CN103218294B
CN103218294B CN201310130926.8A CN201310130926A CN103218294B CN 103218294 B CN103218294 B CN 103218294B CN 201310130926 A CN201310130926 A CN 201310130926A CN 103218294 B CN103218294 B CN 103218294B
Authority
CN
China
Prior art keywords
debugging
command
source code
offline
online
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.)
Active
Application number
CN201310130926.8A
Other languages
Chinese (zh)
Other versions
CN103218294A (en
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.)
Nantong Hangda Electronic Technology Co ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201310130926.8A priority Critical patent/CN103218294B/en
Publication of CN103218294A publication Critical patent/CN103218294A/en
Application granted granted Critical
Publication of CN103218294B publication Critical patent/CN103218294B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a kind of adjustment method of embedded system, debugging conversion equipment and system, wherein the realization of method comprises: the transformation rule of on-line debugging order to off-line debug command obtaining customization; After the source code receiving on-line debugging order, according to described transformation rule, the source code of described on-line debugging order is converted to the code supporting off-line debugging; The code of described support off-line debugging is sent to Target Board.By the conversion of code that on-line debugging order is carried out debugging from the source code of on-line debugging order to off-line, realize the off-line debugging of on-line debugging order, the on-line debugging of built-in system software and the overlapping development problem of off-line debugging can be solved, avoid realizing off-line debugging to different platforms, or when identical platform being realized to the off-line debugging of different editions, all need to revise the problem of debugger client, therefore, the usable range of online debugging acid can be increased, shorten the development time of off-line debugging acid, reduce cost of development.

Description

Debugging method, debugging conversion device and system of embedded system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a debugging method, a debugging conversion apparatus, and a debugging conversion system for an embedded system.
Background
Embedded systems are typically application specific and have very strict requirements on the execution order and execution time of the logic. The embedded system is suitable for a special system with strict requirements on functions, reliability, cost, volume and power consumption. The software development of the embedded system is also different from general application software, the former requires a developer to have enough knowledge of the hardware of the embedded system, and it is very difficult to develop a good software of the embedded system, so that a debugger suitable for the embedded system is very necessary.
The existing embedded debugging mode mainly has two modes: one is online debugging and the other is offline debugging.
The scheme for online debugging of embedded systems is generally as follows: the deployment debugger server is on the embedded single board (i.e. target board), the deployment debugger client is on the PC, the client and the server are connected through the channel such as network port or serial port. The server is responsible for accessing or controlling resources (such as a memory, a register and the like) of the embedded system, and the client on the PC is responsible for receiving command input of a user, performing command analysis, debugging information analysis, real-time/non-real-time analysis of a debugged program, outputting a debugging analysis result and the like.
The online debugging also comprises a non-real-time debugging mode (namely, a stop debugging mode) and a real-time debugging mode (namely, a non-stop debugging mode). The Stop debugging mode needs to Stop the debuggee program first and then analyze the information and the state of the program. The non-stop debugging mode can acquire the relevant state information of the program in real time and the like. Both of these two online debugging methods have drawbacks, which are as follows:
(1) and if the connection between the client of the debugger and the server of the target board is interrupted at a certain moment, the program is abnormal. At this time, the client of the debugger cannot acquire the real-time condition of the debugged program, and cannot control the state of the debugged program, so that the online debugging mode is invalid.
(2) And because the program abnormity usually has randomness and irreproducibility, the problem is difficult to reproduce, and the failure of online debugging causes the efficiency of problem positioning and analysis to be reduced.
In the off-line testing scheme, because the testing process is finished on the target board, the connection between the target board and the debugger does not exist; therefore, the technical defects can be avoided, and the scheme of off-line debugging is generally as follows: the target board comprises a backup dump file, wherein the backup dump file comprises register information, memory information, operating system information and the like; and the target board acquires debugging information and the backup dump file offline on a debugger, and then analyzes the causes of the program abnormality. However, the offline debugging also has the following defects:
because the variety of the platforms operated by the target board is wide, the backup dump file contains information related to the operating system and the target board platform, and therefore the backup dump file has a difference in format. In addition, in the development phase of the system software of the target board, the version upgrade of the system software is usually fast, however, the corresponding dump file formats of different versions of the system software are different. Therefore, when the debugger client implements dump files supporting different platforms, or dump files supporting different versions of the same platform, the debugger client needs to be modified greatly. Thus, in order to solve the contradiction between the debugger client and the platform in the file format support, the debugger client still needs to be modified, and a great amount of labor and time are needed for modifying the debugger.
In summary, offline debugging requires continuous modification of the debugger client to implement offline debugging, which results in greater difficulty, higher cost, and longer time for implementing offline analysis. In addition, debugging tools for online debugging and offline debugging need to be developed respectively, and the problem of repeated development exists.
Disclosure of Invention
The embodiment of the invention provides a debugging method, a debugging conversion device and a debugging conversion system of an embedded system, which are used for increasing the application range of an online debugging tool, shortening the development time of an offline debugging tool and reducing the development cost.
An embodiment of the present invention provides a method for debugging an embedded system, including:
acquiring a conversion rule from a customized online debugging command to an offline debugging command;
after receiving the source code of the online debugging command, converting the source code of the online debugging command into a code supporting offline debugging according to the conversion rule;
and sending the code supporting the offline debugging to a target board.
With reference to implementation manners of an aspect, in a first optional implementation manner, the converting the source code of the online debugging command into a code supporting offline debugging, and sending the code supporting offline debugging to a target board includes:
converting the source code of the online debugging command into the source code of the offline debugging command; performing secondary compiling on the obtained offline command source code and the current debugger client to generate a debugger client supporting offline debugging, and sending the debugger client supporting offline debugging to a target board; or,
and converting the source code of the online debugging command into a code of the offline debugging command, linking the code into a dynamic library, and sending the dynamic library to a target board.
With reference to the first optional implementation manner, in a second optional implementation manner, the converting the source code of the online debug command into the source code of the offline debug command includes:
converting the source code of the online debugging command into the source code of the offline command by using a compiler; or converting the source code of the online debugging command into the source code of the offline command through a client tool.
With reference to the second optional implementation manner, in a third optional implementation manner, the converting, by using a compiler, the source code of the online debug command into the source code of the offline command includes:
and reading in the source code of the online debugging command, performing rule matching of the character string according to the conversion rule, calling a conversion processing interface to generate a lexical or grammatical unit which can be identified by a compiler if the matching is successful, and then outputting the source code of the offline debugging command.
With reference to the first, second, or third optional implementation manners of an aspect, in a fourth optional implementation manner, the conversion rule includes:
at least one item of symbol table information conversion rules, register and call stack rules, debugging output interface conversion rules and memory distribution rules;
the symbol table information conversion rule is as follows: the address mapping information of the online debugging command service related symbol or the global symbol is converted into a rule of symbol information which can be identified by an online debugger;
the register and call stack rules are: the number of general registers, function return addresses, register configuration of stack pointers or Personal Computer (PC) pointers, and function call stack information;
the conversion rule of the debugging output interface is as follows: a rule that an online debugging command interface is converted into an offline debugging command interface;
the memory distribution rule is as follows: and determining the size and distribution rule of the private memory or the shared memory.
In a second aspect, an embodiment of the present invention provides a debugging conversion apparatus for an embedded system, including:
the rule obtaining unit is used for obtaining a conversion rule from a customized online debugging command to an offline debugging command;
the source code receiving unit is used for receiving the source code of the online debugging command;
the conversion unit is used for converting the source code of the online debugging command into a code supporting offline debugging according to the conversion rule acquired by the rule acquisition unit after the source code receiving unit receives the source code of the online debugging command;
and the sending unit is used for sending the codes supporting the off-line debugging obtained by the conversion unit to the target board.
With reference to the implementation manner of the second aspect, in a first optional implementation manner, the conversion unit is specifically configured to convert a source code of the online debug command into a source code of an offline debug command; performing secondary compiling on the obtained offline command source code and the current debugger client to generate a debugger client supporting offline debugging; or, converting the source code of the online debugging command into the code of the offline debugging command and linking the code into a dynamic library;
the sending unit is specifically configured to send the debugger client supporting offline debugging obtained by the conversion unit to a target board; or sending the dynamic library obtained by the conversion unit to a target board.
With reference to the implementation manner of the second aspect, in a second optional implementation manner, the conversion unit is specifically configured to convert a source code of the online debugging command into a source code of an offline command by using a compiler; or converting the source code of the online debugging command into the source code of the offline command through a client tool.
With reference to the second implementation manner, in a third optional implementation manner, the conversion unit includes:
the reading unit is used for reading the source code of the online debugging command received by the source code receiving unit;
the matching unit is used for matching the rules of the character strings according to the conversion rules acquired by the rule acquisition unit;
and the source code generating unit is used for calling the conversion processing interface to generate a lexical or grammatical unit which can be identified by the compiler if the matching unit is successfully matched, and then outputting the source code of the offline debugging command.
With reference to the one aspect, the first optional implementation manner, the second optional implementation manner, or the third optional implementation manner, in a fourth optional implementation manner, the rule obtaining unit obtains the conversion rule including: at least one item of symbol table information conversion rules, register and call stack rules, debugging output interface conversion rules and memory distribution rules;
the symbol table information conversion rule is as follows: the address mapping information of the online debugging command service related symbol or the global symbol is converted into a rule of symbol information which can be identified by an online debugger;
the register and call stack rules are: the number of general registers, function return addresses, register configuration of stack pointers or Personal Computer (PC) pointers, and function call stack information;
the conversion rule of the debugging output interface is as follows: a rule that an online debugging command interface is converted into an offline debugging command interface;
the memory distribution rule is as follows: and determining the size and distribution rule of the private memory or the shared memory.
The embodiment of the invention provides a debugging system of an embedded system in three aspects, which comprises a debugger and a target board, and also comprises: the debugging conversion device provided by the embodiment of the invention is any one;
and the debugging conversion device receives a source code of an online debugging command from a client of the debugger and outputs a code supporting offline debugging to a server of the target board.
According to the technical scheme, the embodiment of the invention has the following advantages: the online debugging command is converted from the source code of the online debugging command to the code of the offline debugging command, so that the offline debugging of the online debugging command is realized, the repeated development problems of online debugging and offline debugging of embedded system software can be solved, the problem that the client of a debugger needs to be modified when the offline debugging of different platforms is realized or the offline debugging of different versions is realized on the same platform is avoided, the application range of an online debugging tool can be enlarged, the development time of the offline debugging tool is shortened, and the development cost is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic flow chart of a method according to an embodiment of the present invention;
FIG. 2 is a block diagram of an embodiment of an offline command generation module;
FIG. 3 is a diagram illustrating an exemplary debugger networking, according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a process of converting an online command into an offline command according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an example source-to-source conversion process according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a debug conversion apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a debug conversion apparatus according to an embodiment of the present invention;
fig. 8 is a schematic system structure according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, 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 debugging an embedded system, as shown in fig. 1, including:
101: acquiring a conversion rule from a customized online debugging command to an offline debugging command;
the conversion rule from the online debugging command to the offline debugging command may be any rule that can establish a corresponding relationship from the online debugging command to the offline debugging command, and the conversion rule may be increased or decreased according to actual needs, and the specific form of the embodiment of the present invention provides the following examples: optionally, the conversion rule includes: at least one item of symbol table information conversion rules, register and call stack rules, debugging output interface conversion rules and memory distribution rules; the symbol table information conversion rule is as follows: the address mapping information of the online debugging command service related symbol or the global symbol is converted into a rule of symbol information which can be identified by an online debugger; the register and call stack rules are: the number of general registers, function return addresses, register configuration of stack pointers or Personal Computer (PC) pointers, and function call stack information; the conversion rule of the debugging output interface is as follows: a rule that an online debugging command interface is converted into an offline debugging command interface; the memory distribution rule is as follows: and determining the size and distribution rule of the private memory or the shared memory. It should be noted that the transcoding rules may be of many kinds, and the above examples should not be construed as limiting the embodiments of the present invention.
102: after receiving the source code of the online debugging command, converting the source code of the online debugging command into a code supporting offline debugging according to the conversion rule;
optionally, the embodiment of the present invention provides two optional schemes for supporting offline debugging of a code, which are as follows: the converting the source code of the online debugging command into the code supporting the offline debugging comprises: converting the source code of the online debugging command into the source code of the offline debugging command; performing secondary compiling on the obtained offline command source code and the current debugger client to generate a debugger client supporting offline debugging; or converting the source code of the online debugging command into the code of the offline debugging command and linking the code into a dynamic library.
Optionally, the embodiment of the present invention further provides two implementation schemes for converting a source code into a source code of an online debugging command into an offline debugging command, specifically: the converting the source code of the online debugging command into the source code of the offline debugging command includes: using a compiler to convert the source code of the online debugging command into the source code of the offline command; or, the source code of the online debugging command is converted into the source code of the offline command through the client tool.
Optionally, an embodiment of the present invention further provides a specific implementation manner for implementing conversion from a source code to a source code by using a compiler, where the specific implementation manner is as follows: the converting the source code of the online debugging command into the source code of the offline command by using the compiler comprises: and reading in the source code of the online debugging command, performing rule matching of the character string according to the conversion rule, calling a conversion processing interface to generate a lexical or grammatical unit which can be identified by a compiler if the matching is successful, and outputting the source code of the offline debugging command.
103: and sending the codes supporting the offline debugging to a target board.
According to the scheme, the online debugging command is converted from the source code of the online debugging command to the code of the offline debugging command, the offline debugging of the online debugging command is realized, the repeated development problems of the online debugging and the offline debugging of the embedded system software can be solved, the problem that the debugging client side needs to be modified when the offline debugging of different platforms or different versions of the same platform are realized is avoided, therefore, the application range of the online debugging tool can be enlarged, the development time of the offline debugging tool is shortened, and the development cost is reduced.
Optionally, corresponding to the two optional schemes of the code supporting offline debugging in the foregoing embodiment, the sending the code supporting offline debugging to the target board includes: sending the debugger client supporting the offline debugging to a target board; or sending the dynamic library to the target board.
The following embodiments illustrate the solutions of the above embodiments in more detail in terms of structural composition, debug networking, source code translation, and examples, respectively.
One, the structure is composed
Please refer to fig. 2, which shows: and generating a module structure schematic diagram of the offline command through source-to-source conversion, wherein the arrow direction is a data flow direction.
Both online and offline debuggers developed for embedded systems in this example may use C as the programming language. The online debug command source code (primarily. c and. h files) serves as the input source for the offline command translator.
The offline command converter has three main parts: the device comprises a symbol analysis module, a dump file analysis module and a source-to-source conversion module.
The symbol analysis module obtains the definition of the global symbol, the address mapping table and the symbol description information related to the service from the input source, analyzes and processes the symbol and outputs the symbol to the source-to-source conversion module.
The other input of the source-to-source conversion module comes from a dump file parsing module, and the dump file parsing module mainly completes analysis and processing of offline file registers and call stack rules, which are usually strongly related to the ISA (industry standard architecture bus) of the embedded system.
After the source-to-source conversion module obtains the required information, the output of the final off-line debugging command source code (mainly, the files of.c and.h) can be completed through the internally defined rules. At this time, the off-line debugger already has the service-related symbol table information and address information owned by the on-line debugger module, and the product service-related information can be acquired by using the printing interface of the off-line debugger.
Second, debugging networking
A typical debugger networking diagram as shown in figure 3,
in an online debugging scenario, a debugger client located at a PC (personal computer) end and a debugging server located on a target Board (Board) communicate through channels such as an ETH (Ethernet, internet access) or a serial port. The PC side also includes an Integrated Development Environment (IDE), and the Board side also includes an application program, a system, and a memory/register.
In an offline debugging scenario, a debugger client obtains required register/memory information, operating system information or product service information from a dump file (CoreFileonPC) of a personal computer through file I/O.
Three, source code conversion
Please refer to fig. 4: the flow diagram of converting an online command into an offline command.
401: formulating a conversion rule from the online debugging command to the offline debugging command;
there is a complete set of rules for the conversion of online debug commands to offline commands. The customization of the rules may mainly include the following parts: the symbol table information conversion rule mainly sets up a rule for converting address mapping information of online debugging command service related symbols or global symbols into symbol information which can be identified by an online debugger. The register and call stack rules comprise the number of general registers, the register configuration of function return addresses, stack pointers, PC pointers and the like, and function call stack information and the like. And debugging the conversion rule of the output interface, and making a command interface for online debugging converted into an offline debugging command interface. Memory distribution rules, determining the size and distribution of private memory or shared memory, etc. Certain rules may be added or subtracted depending on the requirements of the actual service.
402: converting the source code of the online debugging command into the source code of the offline debugging command by using a source code conversion compiler;
the basic principle of the conversion of this step may be: and reading in a source code of the online debugging command, and performing rule matching of the character string according to the established conversion rule. If the matching is successful, a conversion processing interface is called to generate a lexical or grammatical unit which can be identified by the compiler, and then the compiler outputs the source code of the final offline debugging command.
403: the source code of the offline debug command generated in 402 is compiled together with the source code of the offline debug that is not architecture and translation related, so that a new offline debugger client can be generated.
Steps 402 and 403 of the above scheme can be replaced in other ways, specifically as follows:
402 in the above flowchart of fig. 4 is a source code conversion compiler used to convert the source code of the online debug command into the source code of the offline debug command. The alternative may be to implement a translation client tool that translates the source code of the online debug command into the source code of the offline debug command separately, without relying on a compiler. That is, the conversion tool can be separated from the compiler, and the client tool has a function of analyzing the flow chart rule to generate the final source code.
Another alternative to 402 in the flow diagram of fig. 4 is to link the code of the converted offline commands (mainly. c and. h files) into a dynamic library (. dll or. so format) by a compiler. Then the second compilation in 403 may be omitted and the off-line debugger client only needs to dynamically load the dynamic library generated in 402 to complete the corresponding debugging function.
Fourth, example
The following is an implementation scenario:
referring to fig. 5, which is a source-to-source conversion process example, taking a CPU (central processing unit) load rate of a current system as an example, fig. 5 is written in C language, and may refer to a relevant specification written in C language, where a left column is a source code of an online debug command, and a right arrow points to a source code of an offline debug command corresponding to the online debug command, and the example converts the source code of the online debug command into the source code of the offline debug command. The method mainly comprises the following three steps:
1. global variables in the command implementation are identified. This is a traffic-related global variable, which is first to have a conversion rule that identifies this traffic symbol. The rules are simple to identify strings within quotation marks (i.e. the bold text in the top dashed box in the upper large box in fig. 5).
The offline command converter continuously reads the input file (i.e. the left code in fig. 5), and when the key word of DSP _ LkAddr is recognized (this is a call interface of the service query symbolic address, and this interface call is configured in the rule for matching the character string at the time of rule making), the offline command converter matches the character string following the key word, which is enclosed by a double quotation mark, in this case gstpu load. The implicit conversion rule is to convert the member call of the original structure into a member call of the recognized character string, such as strucpload. uwcurload- - - - > gstucpload. uload. uwcurload, and the conversion result is used as the input of the following function call conversion interface. The conversion correspondence is shown by the arrows shown in fig. 5.
2. And acquiring the function call of the global variable value, and replacing the function call with the function call in the off-line debugging client.
As shown in fig. 5, the call interface DSP _ CommRead for online query of the service variable address is converted into the corresponding offline call interface getSymAddrSize, and the above strucpuloload.
3. And replacing the function call output by the command return result with the function call of the off-line debugging client.
After the global symbol and the interface conversion for acquiring the global quantity are completed, the conversion of the platform printing output interface in the last step can be realized, and the conversion realizes the function of the output switching of the final debugging result. Such as the online debug interface LBB _ DSP _ Printf in this example, to the offline print interface Printf.
By adopting the scheme, the online debugging and the offline debugging of the embedded system software are applied to different scenes and are indispensable debugging modes. The embodiment of the invention realizes the off-line debugging of the on-line debugging command, can solve the problem of repeated development of the on-line debugging and the off-line debugging of embedded system software, converts the on-line debugging command from a source code of the on-line debugging command to a code of the off-line debugging command which can be used on a PC (personal computer), converts product service information related to the command into an address and a length by using a symbol analysis function, and can acquire system related information by inquiring a corresponding memory address interval by the off-line command. The off-line debugging of the on-line debugging command can avoid the problem that the debugger client needs to be modified when the off-line debugging of different platforms is realized or the off-line debugging of different versions is realized on the same platform, so the method can increase the application range of the on-line debugging tool, shorten the development time of the off-line debugging tool and reduce the development cost.
An embodiment of the present invention further provides a debug conversion apparatus for an embedded system, as shown in fig. 6, including:
a rule obtaining unit 601, configured to obtain a conversion rule from a customized online debugging command to an offline debugging command;
a source code receiving unit 602, configured to receive a source code of an online debugging command;
a conversion unit 603, configured to, after the source code receiving unit 602 receives the source code of the online debugging command, convert the source code of the online debugging command into a code supporting offline debugging according to the conversion rule obtained by the rule obtaining unit 601;
a sending unit 604, configured to send the code supporting offline debugging obtained by the converting unit 603 to a target board.
According to the scheme, the online debugging command is converted from the source code of the online debugging command to the code of the offline debugging command, the offline debugging of the online debugging command is realized, the repeated development problems of the online debugging and the offline debugging of the embedded system software can be solved, the problem that the debugging client side needs to be modified when the offline debugging of different platforms or different versions of the same platform are realized is avoided, therefore, the application range of the online debugging tool can be enlarged, the development time of the offline debugging tool is shortened, and the development cost is reduced.
Optionally, the converting unit 603 is specifically configured to convert the source code of the online debug command into a source code of an offline debug command; performing secondary compiling on the obtained offline command source code and the current debugger client to generate a debugger client supporting offline debugging; or, the source code of the online debugging command is converted into the code of the offline debugging command and linked into a dynamic library;
the sending unit 604 is specifically configured to send the debugger client supporting offline debugging obtained by the converting unit 603 to a target board; or the dynamic library obtained by the conversion unit 603 is sent to the target board.
Optionally, the converting unit 603 is specifically configured to convert the source code of the online debug command into the source code of the offline command by using a compiler; or, the source code of the online debugging command is converted into the source code of the offline command through the client tool.
Alternatively, as shown in fig. 7, the converting unit 603 includes:
a reading unit 701, configured to read in a source code of the online debug command received by the source code receiving unit 602;
a matching unit 702, configured to perform rule matching on the character string according to the conversion rule acquired by the rule acquisition unit 601;
and a source code generating unit 704, configured to, if the matching unit 702 succeeds in matching, invoke a conversion processing interface to generate a lexical or syntactic unit that can be recognized by a compiler, and then output a source code of the offline debugging command.
Optionally, the rule obtaining unit 601 obtains the conversion rule including: at least one item of symbol table information conversion rules, register and call stack rules, debugging output interface conversion rules and memory distribution rules;
the symbol table information conversion rule is as follows: the address mapping information of the online debugging command service related symbol or the global symbol is converted into a rule of symbol information which can be identified by an online debugger;
the register and call stack rules are: the number of general registers, function return addresses, register configuration of stack pointers or Personal Computer (PC) pointers, and function call stack information;
the conversion rule of the debugging output interface is as follows: a rule that an online debugging command interface is converted into an offline debugging command interface;
the memory distribution rule is as follows: and determining the size and distribution rule of the private memory or the shared memory.
An embodiment of the present invention further provides a debugging system of an embedded system, as shown in fig. 8, including a debugger 801 and a target board 803, further including: any one of the debugging conversion devices 802 provided in the embodiments of the present invention; the debug conversion apparatus 802 receives a source code of an online debug command from the client of the debugger 801, and outputs a code supporting offline debug to the server of the target board 803.
It should be noted that, in the embodiment of the debug conversion apparatus, each unit included in the embodiment is only divided according to functional logic, but is not limited to the above division as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
In addition, it is understood by those skilled in the art that all or part of the steps in the above method embodiments may be implemented by related hardware, and the corresponding program may be stored in a computer readable storage medium, where the above mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk.
The above description is only for the preferred 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 embodiment 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 (9)

1. A debugging method of an embedded system is characterized by comprising the following steps:
acquiring a conversion rule from a customized online debugging command to an offline debugging command;
after receiving the source code of the online debugging command, converting the source code of the online debugging command into a code supporting offline debugging according to the conversion rule;
sending the code supporting the offline debugging to a target board;
wherein, the converting the source code of the online debugging command into a code supporting offline debugging, and the sending the code supporting offline debugging to a target board comprises:
converting the source code of the online debugging command into the source code of the offline debugging command; performing secondary compiling on the obtained offline command source code and the current debugger client to generate a debugger client supporting offline debugging, and sending the debugger client supporting offline debugging to a target board; or,
and converting the source code of the online debugging command into a code of the offline debugging command, linking the code into a dynamic library, and sending the dynamic library to a target board.
2. The method of claim 1, wherein converting the source code of the online debug command to the source code of the offline debug command comprises:
converting the source code of the online debugging command into the source code of the offline command by using a compiler; or converting the source code of the online debugging command into the source code of the offline command through a client tool.
3. The method of claim 2, wherein converting the source code of the online debug command into the source code of the offline command using a compiler comprises:
and reading in the source code of the online debugging command, performing rule matching of the character string according to the conversion rule, calling a conversion processing interface to generate a lexical or grammatical unit which can be identified by a compiler if the matching is successful, and then outputting the source code of the offline debugging command.
4. The method according to any of claims 1 to 3, wherein the transformation rules comprise:
at least one item of symbol table information conversion rules, register and call stack rules, debugging output interface conversion rules and memory distribution rules;
the symbol table information conversion rule is as follows: the address mapping information of the online debugging command service related symbol or the global symbol is converted into a rule of symbol information which can be identified by an online debugger;
the register and call stack rules are: the number of general registers, function return addresses, register configuration of stack pointers or Personal Computer (PC) pointers, and function call stack information;
the conversion rule of the debugging output interface is as follows: a rule that an online debugging command interface is converted into an offline debugging command interface;
the memory distribution rule is as follows: and determining the size and distribution rule of the private memory or the shared memory.
5. A debug conversion apparatus of an embedded system, comprising:
the rule obtaining unit is used for obtaining a conversion rule from a customized online debugging command to an offline debugging command;
the source code receiving unit is used for receiving the source code of the online debugging command;
the conversion unit is used for converting the source code of the online debugging command into a code supporting offline debugging according to the conversion rule acquired by the rule acquisition unit after the source code receiving unit receives the source code of the online debugging command;
the transmitting unit is used for transmitting the codes supporting the off-line debugging obtained by the converting unit to a target board;
the conversion unit is specifically configured to convert a source code of the online debug command into a source code of an offline debug command; performing secondary compiling on the obtained offline command source code and the current debugger client to generate a debugger client supporting offline debugging; or, converting the source code of the online debugging command into the code of the offline debugging command and linking the code into a dynamic library;
the sending unit is specifically configured to send the debugger client supporting offline debugging obtained by the conversion unit to a target board; or sending the dynamic library obtained by the conversion unit to a target board.
6. The debug conversion apparatus of claim 5,
the conversion unit is specifically configured to convert the source code of the online debugging command into the source code of the offline command by using a compiler; or converting the source code of the online debugging command into the source code of the offline command through a client tool.
7. The debug conversion apparatus of claim 6, wherein said conversion unit comprises:
the reading unit is used for reading the source code of the online debugging command received by the source code receiving unit;
the matching unit is used for matching the rules of the character strings according to the conversion rules acquired by the rule acquisition unit;
and the source code generating unit is used for calling the conversion processing interface to generate a lexical or grammatical unit which can be identified by the compiler if the matching unit is successfully matched, and then outputting the source code of the offline debugging command.
8. The apparatus according to any one of claims 5 to 7,
the rule obtaining unit obtains the conversion rule including: at least one item of symbol table information conversion rules, register and call stack rules, debugging output interface conversion rules and memory distribution rules;
the symbol table information conversion rule is as follows: the address mapping information of the online debugging command service related symbol or the global symbol is converted into a rule of symbol information which can be identified by an online debugger;
the register and call stack rules are: the number of general registers, function return addresses, register configuration of stack pointers or Personal Computer (PC) pointers, and function call stack information;
the conversion rule of the debugging output interface is as follows: a rule that an online debugging command interface is converted into an offline debugging command interface;
the memory distribution rule is as follows: and determining the size and distribution rule of the private memory or the shared memory.
9. The debugging system of the embedded system comprises a debugger and a target board, and is characterized by further comprising: the debug conversion means of any one of claims 5 to 8;
and the debugging conversion device receives a source code of an online debugging command from a client of the debugger and outputs a code supporting offline debugging to a server of the target board.
CN201310130926.8A 2013-04-16 2013-04-16 A kind of adjustment method of embedded system, debugging conversion equipment and system Active CN103218294B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310130926.8A CN103218294B (en) 2013-04-16 2013-04-16 A kind of adjustment method of embedded system, debugging conversion equipment and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310130926.8A CN103218294B (en) 2013-04-16 2013-04-16 A kind of adjustment method of embedded system, debugging conversion equipment and system

Publications (2)

Publication Number Publication Date
CN103218294A CN103218294A (en) 2013-07-24
CN103218294B true CN103218294B (en) 2015-12-02

Family

ID=48816112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310130926.8A Active CN103218294B (en) 2013-04-16 2013-04-16 A kind of adjustment method of embedded system, debugging conversion equipment and system

Country Status (1)

Country Link
CN (1) CN103218294B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631716B (en) * 2013-11-29 2017-06-06 华为技术有限公司 The conversion method and equipment of a kind of debug command
CN104461905A (en) * 2014-12-30 2015-03-25 东信和平科技股份有限公司 Method and system for debugging intelligent card virtual machine, API bank and upper layer application at same time
CN107632819B (en) * 2016-07-14 2021-02-09 南京南瑞继保电气有限公司 Symbol table-based programmable logic debugging method and system
CN106897633B (en) * 2017-05-02 2023-11-28 义乌中国小商品城大数据有限公司 Embedded online and offline function conversion equipment
CN109213676A (en) * 2018-07-06 2019-01-15 中国电力科学研究院有限公司 A kind of offline adjustment method and device for test script
CN109726213B (en) * 2018-12-10 2021-11-19 阿里巴巴(中国)有限公司 Program code conversion method, device, medium and computing equipment
CN109656535B (en) * 2018-12-24 2022-02-08 思必驰科技股份有限公司 Voice skill off-line development method based on browser
CN109507991B (en) * 2018-12-25 2020-08-11 中国兵器装备集团自动化研究所 Double-shaft servo control platform debugging system and method
CN110806976B (en) * 2019-10-24 2022-03-22 青岛英泰软件技术有限公司 Method for remotely pushing shell and CMD (command-to-command) commands
CN110853327B (en) * 2019-11-02 2021-04-02 杭州雅格纳科技有限公司 Ship cabin equipment data field debugging and collecting method and device based on single chip microcomputer
CN111143218B (en) * 2019-12-27 2024-03-26 深圳市共进电子股份有限公司 Log debugging method and device suitable for 5G embedded equipment and readable storage medium
CN112416790B (en) * 2020-11-30 2023-04-14 中国航空工业集团公司西安航空计算技术研究所 Embedded software offline replay debugging method and device
CN114020607B (en) * 2021-10-26 2024-02-13 苏州浪潮智能科技有限公司 BMC debugging method, device and computer equipment
CN114253837B (en) * 2021-11-22 2023-03-24 杭州加速科技有限公司 Multithreading debugging method and system for ATE (automatic test equipment) tester program and tester table

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7100086B1 (en) * 1998-03-31 2006-08-29 Seiko Epson Corporation Microcomputer, electronic equipment and debugging system
CN1862507A (en) * 2006-03-10 2006-11-15 华为技术有限公司 Single board fault positioning aid and positioning method
US7177791B1 (en) * 2003-12-05 2007-02-13 Unisys Corporation Offline emulated input/output processor debugger
CN101126989A (en) * 2006-08-15 2008-02-20 凌阳科技股份有限公司 Mobile phone emulation system and method
CN102662835A (en) * 2012-03-23 2012-09-12 凌阳科技股份有限公司 A program debugging method for an embedded system and the embedded system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7100086B1 (en) * 1998-03-31 2006-08-29 Seiko Epson Corporation Microcomputer, electronic equipment and debugging system
US7177791B1 (en) * 2003-12-05 2007-02-13 Unisys Corporation Offline emulated input/output processor debugger
CN1862507A (en) * 2006-03-10 2006-11-15 华为技术有限公司 Single board fault positioning aid and positioning method
CN101126989A (en) * 2006-08-15 2008-02-20 凌阳科技股份有限公司 Mobile phone emulation system and method
CN102662835A (en) * 2012-03-23 2012-09-12 凌阳科技股份有限公司 A program debugging method for an embedded system and the embedded system

Also Published As

Publication number Publication date
CN103218294A (en) 2013-07-24

Similar Documents

Publication Publication Date Title
CN103218294B (en) A kind of adjustment method of embedded system, debugging conversion equipment and system
US20040194072A1 (en) Multi-language compilation
US9122540B2 (en) Transformation of computer programs and eliminating errors
US8776024B2 (en) Software application fine-tuning method, system, and corresponding computer program product
JP6479184B2 (en) Computer-executable model reverse engineering method and apparatus
JP2004295398A (en) Compiler, method for compiling and program developing tool
CN112269566B (en) Script generation processing method, device, equipment and system
CN111427583A (en) Component compiling method and device, electronic equipment and computer readable storage medium
CN112286784A (en) Test case generation method and device, server and storage medium
CN110737431B (en) Software development method, development platform, terminal device and storage medium
US20060009962A1 (en) Code conversion using parse trees
US20100306734A1 (en) Method and apparatus for multi-language software development
WO2022068559A1 (en) Code processing method and apparatus, and device
US10606569B2 (en) Declarative configuration elements
JP2008165342A (en) Source code generation method and apparatus, and program
KR100878044B1 (en) Application conversion method and apparatus for providing compatibility between brew and Wippy
CN114296705A (en) Application package generation method, apparatus, electronic device, and storage medium
CN110297768A (en) Method, apparatus, equipment and the storage medium of prototype SDK compatible analog device debug
KR101670726B1 (en) Method for code conversion using debugging information of intermediate language code, apparatus and computer-readable recording medium with program therefor
CN117075912B (en) Method for program language conversion, compiling method and related equipment
KR101277145B1 (en) Method For Transforming Intermediate Language by Using Common Representation, System And Computer-Readable Recording Medium with Program Therefor
KR101598819B1 (en) Method for code conversion using target-independent debugging information, apparatus and computer-readable recording medium with program therefor
CN117130677A (en) Script conversion method and related equipment
CN113900631A (en) Code generator design method based on antlr4
CN112988164A (en) Text conversion method, text conversion device, and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20191213

Address after: No.1, floor 3, No.319, zhanggongshan Road, Yuhui District, Bengbu City, Anhui Province

Patentee after: Bengbu guijiu Intellectual Property Service Co., Ltd

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: Huawei Technologies Co., Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201019

Address after: 226000 No. 998 Century Avenue, hi tech Zone, Jiangsu, Nantong

Patentee after: NANTONG HANGDA ELECTRONIC TECHNOLOGY Co.,Ltd.

Address before: No.1, floor 3, No.319, zhanggongshan Road, Yuhui District, Bengbu City, Anhui Province

Patentee before: Bengbu guijiu Intellectual Property Service Co.,Ltd.

TR01 Transfer of patent right