Debugging system and debugging method
By instrumenting debugging information into the program and dynamically setting statement status values, the inefficiency of existing breakpoint debugging and single-step debugging is solved, realizing a cross-platform debugging system suitable for high-real-time environments without an operating system, thus improving debugging efficiency and adaptability.
Patent Information
- Application Number
- CN202210402824.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2042-04-18
AI Technical Summary
In the field of industrial control, existing technologies require setting CPU exception instructions and flags for breakpoint debugging and single-step debugging, adapting to different hardware models and operating systems, and do not support strong real-time environments without an operating system, resulting in low debugging efficiency and lack of cross-platform versatility.
By instrumenting and embedding debugging information, including the first function identifier and communication unit, into the program to be debugged, and dynamically setting statement status values, it enables step-by-step debugging, step-in, and step-out debugging, and analyzes the function call stack. It is suitable for strong real-time environments without an operating system.
It enables cross-platform breakpoint debugging and single-step debugging, improving program debugging efficiency. It is suitable for real-time environments without an operating system and does not require redevelopment of the debugging module.
Smart Images

Figure CN114880212B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a debugging system for a programmable logic controller (PLC) and a method for debugging the PLC program. Background Technology
[0002] Languages conforming to the IEC 61131-3 standard are widely used in industrial control. With increasing program complexity, support for breakpoint debugging and single-step debugging is needed to improve problem localization and analysis efficiency. Breakpoint debugging pauses program execution at a breakpoint. StepIn involves entering each function call within the current line of code and stopping at the first line of that call. StepOver treats each function as an atomic unit, executing until the next line of code after the function call completes. StepOut executes when stepping into a sub-function, completing the remaining parts of the sub-function, and then returning to the previous function. Traditional breakpoint and single-step debugging require setting CPU exception instructions and flags, analyzing the target file context, and utilizing Windows operating system service interfaces or GDB debugging functions. Each change in hardware model and instructions necessitates redesign and adaptation, and it does not support highly real-time environments without an operating system. Step-in and step-out debugging can significantly improve the debugging efficiency of complex programs and facilitate the location and analysis of problems in sub-functions. It is necessary to study cross-platform universal debugging techniques. The IEC61131-3 standard for industrial control supports graphical and textual languages, so it is also necessary to support step-in debugging of different types of languages at the same time. Summary of the Invention
[0003] In view of at least one deficiency of the prior art, the present invention provides a debugging system, comprising:
[0004] The debugging unit is configured to add a first function identifier to each line of statement in the program to be debugged, and then compile it to generate an executable program.
[0005] A communication unit communicates with the debugging unit and is configured to set the statement status value of the first function according to the debugging command sent by the debugging unit;
[0006] The task unit communicates with the communication unit, is configured to run the executable program, and calls a first function based on the first function identifier, wherein the first function is configured to:
[0007] The corresponding statement line will be executed or stopped based on the statement status value.
[0008] According to one aspect of the invention, the first function is further configured to:
[0009] When the status value of the statement is "pass", the corresponding statement line is executed;
[0010] When the status value of the statement is blocked, the execution of the corresponding statement line will stop;
[0011] The communication unit is further configured to:
[0012] The line number of the currently stopped statement and the current values of each variable register are sent to the debugging unit.
[0013] According to one aspect of the invention, the communication unit is further configured to:
[0014] According to the step-by-step command sent by the debugging unit, when the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0015] When the current statement line contains a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the source code sub-function has completed execution is set to blocked.
[0016] According to one aspect of the invention, the communication unit is further configured to:
[0017] According to the step-in command sent by the debugging unit, when the current statement behavior has a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to blocked;
[0018] When the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0019] According to one aspect of the invention, the communication unit is further configured to:
[0020] According to the step-out command sent by the debugging unit, the statement status value of the first function inside the current sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the current sub-function has been executed is blocked.
[0021] According to one aspect of the invention, the communication unit is further configured to:
[0022] Based on the commands sent by the debugging unit to execute, add, or delete breakpoints, the breakpoint list is dynamically maintained. The statement status value of the first function corresponding to the statement line within the breakpoint list is set to blocked; the statement status value of the first function corresponding to the statement line not within the breakpoint list is set to pass.
[0023] According to one aspect of the invention, the debugging unit is further configured to:
[0024] Add a second function identifier before the function call statement of each subroutine of the program to be debugged, and add a third function identifier after the function call of each subroutine of the program to be debugged is completed;
[0025] The task unit is further configured as follows:
[0026] The second function is invoked based on the second function identifier, and the second function is configured as follows:
[0027] Push the corresponding function number and the total number of statements in the function into the function call stack;
[0028] The third function is invoked based on the aforementioned third function identifier, and the third function is configured as follows:
[0029] Pop the corresponding function number and the total number of statement lines of the function from the function call stack.
[0030] According to one aspect of the invention, the debugging unit is further configured to:
[0031] Add a fourth function identifier before the subroutine calls of each level of the task in the program to be debugged;
[0032] The task unit is further configured as follows:
[0033] The fourth function is invoked based on the fourth function identifier, and the fourth function is configured as follows:
[0034] Clear the function call stack corresponding to the task level.
[0035] According to one aspect of the invention, the communication unit is further configured to:
[0036] Analyze the stored data of the function call stack and set the statement state value of the first function.
[0037] According to one aspect of the invention, the debugging unit is further configured to:
[0038] Add a fifth function identifier to the initialization function call statement of each subroutine of the program to be debugged;
[0039] The task unit is further configured as follows:
[0040] The fifth function is invoked based on the fifth function identifier, and the fifth function is configured as follows:
[0041] Store the corresponding subroutine's function number and entry address into the function lookup table.
[0042] According to one aspect of the invention, the communication unit is further configured to:
[0043] The statement status value of the first function is set according to the debugging command sent by the debugging unit, and a statement status value update signal is sent.
[0044] The task unit is further configured as follows:
[0045] Receive the statement status value update signal and read the statement status value.
[0046] According to one aspect of the invention, the debugging unit is further configured to:
[0047] Add the first function identifier during the code generation or compilation stage of the program to be debugged.
[0048] According to one aspect of the invention, the debugging unit is further configured to:
[0049] The system receives debugging commands from the debugger through the UI interface and sends the debugging commands to the communication unit.
[0050] The system receives the line number of the currently stopped statement and the current values of each variable register sent by the communication unit, and displays them to the debugger through the UI interface.
[0051] According to one aspect of the invention, the debugging unit includes configuration software, the communication unit includes a communication thread of a programmable controller, and the task unit includes a task thread of a programmable controller.
[0052] The present invention also provides a method for debugging using the debugging system described above, comprising:
[0053] The debugging unit adds a first function identifier to each line of statement in the program to be debugged, and compiles it to generate an executable program.
[0054] The communication unit sets the statement status value of the first function according to the debugging command sent by the debugging unit;
[0055] The executable program is run through the task unit, and a first function is called based on the first function identifier, wherein the first function is configured to:
[0056] The corresponding statement line will be executed or stopped based on the statement status value.
[0057] According to one aspect of the present invention, the first function is further configured to: execute the corresponding statement line when the statement status value is pass; and stop executing the corresponding statement line when the statement status value is block; the method further includes:
[0058] The communication unit sends the line number of the currently stopped statement and the current values of each variable register to the debugging unit.
[0059] According to one aspect of the invention, setting the statement status value of the first function via the communication unit according to a debugging command sent by the debugging unit includes:
[0060] According to the step-by-step command sent by the debugging unit, when the current statement line is not a function call statement or a sub-function call statement without source code, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0061] When the current statement line contains a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the source code sub-function has completed execution is set to blocked.
[0062] According to one aspect of the invention, setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes:
[0063] According to the step-in command sent by the debugging unit, when the current statement action is a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to blocked.
[0064] When the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0065] According to one aspect of the invention, setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes:
[0066] According to the step-out command sent by the debugging unit, the communication unit sets the statement status value of the first function inside the current sub-function to pass, and sets the statement status value of the first function corresponding to the next statement line after the current sub-function has been executed to blocked.
[0067] According to one aspect of the invention, setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes:
[0068] The communication unit dynamically maintains the breakpoint list by executing, adding, or deleting breakpoints according to the commands sent by the debugging unit. The statement status value of the first function corresponding to the statement line within the breakpoint list is set to blocked; the statement status value of the first function corresponding to the statement line not within the breakpoint list is set to pass.
[0069] According to one aspect of the invention, the method further comprises:
[0070] The debugging unit adds a second function identifier before the function call statement of each subroutine of the program to be debugged, and adds a third function identifier after the function call of each subroutine of the program to be debugged is completed.
[0071] The task unit invokes a second function based on the second function identifier, and the second function is configured as follows:
[0072] Push the corresponding function number and the total number of statements in the function into the function call stack;
[0073] The third function is invoked based on the aforementioned third function identifier, and the third function is configured as follows:
[0074] Pop the corresponding function number and the total number of statement lines of the function from the function call stack.
[0075] According to one aspect of the invention, the method further comprises:
[0076] The debugging unit adds a fourth function identifier before the subroutine calls of each level of the task in the program to be debugged;
[0077] The task unit invokes the fourth function based on the fourth function identifier, and the fourth function is configured as follows:
[0078] Clear the function call stack corresponding to the task level.
[0079] According to one aspect of the invention, the method further comprises:
[0080] The debugging unit adds a fifth function identifier to the initialization function call statement of each subroutine of the program to be debugged.
[0081] The task unit invokes the fifth function based on the fifth function identifier, and the fifth function is configured as follows:
[0082] Store the corresponding subroutine's function number and entry address into the function lookup table.
[0083] According to one aspect of the invention, the method further comprises:
[0084] The communication unit sets the statement status value of the first function according to the debugging command sent by the debugging unit, and sends a statement status value update signal.
[0085] The task unit receives the statement status value update signal and reads the statement status value.
[0086] According to one aspect of the invention, the debugging unit adds a first function identifier to each statement line of the program to be debugged, comprising:
[0087] The debugging unit adds the first function identifier to the code generation or compilation stage of the program to be debugged.
[0088] According to one aspect of the invention, the method further comprises:
[0089] The debugging unit receives debugging commands from the debugger through a UI interface and sends the debugging commands to the communication unit.
[0090] The debugging unit receives the line number of the currently stopped statement and the current values of each variable register sent by the communication unit, and displays them to the debugger through the UI interface.
[0091] This invention provides a debugging system and method that, by instrumenting and embedding debugging information, enables breakpoint debugging and single-step debugging of programmable logic controller (PLC) programming languages. Based on debugging commands issued by the debugger, statement status values are set, the execution range of the program to be debugged is dynamically updated, and the function call stack is analyzed to locate the function level and structural relationship of the current statement. This allows for single-step debugging (stepping through, stepping into, and stepping out), without requiring an operating system or access to its service interfaces, making it suitable for high-real-time environments without an operating system. When a new processor model is added, no new debugging module needs to be developed, improving the efficiency of product upgrade development.
[0092] The debugging system and debugging method provided by this invention can realize breakpoint debugging and single-step debugging of graphical programs, structured text programs or instruction list programs. By stepping into, stepping out and stepping through, the implementation details of complex multi-level function calls can be analyzed in detail and flexibly to see if they are consistent with expectations, thereby improving the development and debugging efficiency of application programs. Attached Figure Description
[0093] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings, without exceeding the scope of protection claimed by this application.
[0094] Figure 1 A debugging system according to one embodiment of the present invention is shown;
[0095] Figure 2 A function call stack is shown in one embodiment of the present invention;
[0096] Figure 3 This invention illustrates a graphical program instrumentation method for embedding debugging information in one embodiment.
[0097] Figure 4 This invention illustrates an embodiment of the invention that uses structured text program instrumentation to embed debugging information.
[0098] Figure 5 A debugging method according to one embodiment of the present invention is shown. Detailed Implementation
[0099] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0100] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. Furthermore, any changes or modifications made by those skilled in the art based on the ideas of this application, and on the specific implementation methods and application scope of this application, are all within the scope of protection of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
[0101] This invention provides a debugging system and method that embeds debugging information through instrumentation, enabling breakpoint debugging and single-step debugging of the program to be debugged. Based on the debugging commands issued by the debugger, statement status values are set, the execution range of the statements in the program to be debugged is dynamically updated, and the function call stack is analyzed to locate the function level and structural relationship of the current statement. This achieves single-step debugging (stepping through, stepping into, and stepping out), without requiring an operating system or access to its service interfaces, thus improving the operability of the debugging system and the efficiency of program debugging.
[0102] According to one embodiment of the present invention, such as Figure 1 As shown, the present invention provides a debugging system 100, including a debugging unit 110, a communication unit 120, and a task unit 130. Wherein:
[0103] The debugging unit 110 is configured to add debugging information to the program to be debugged and compile it into an executable program. The debugging information includes a first function identifier. Specifically, the debugging unit 110 adds a first function identifier to each line of statement in the program to be debugged and compiles it into an executable program. For example, the following describes the execution function statements of a program organization unit:
[0104] POU()
[0105] {
[0106] TMP1:=AND(IN1,IN2);
[0107] TMP2:=NOT(IN3);
[0108] OUT1:=OR(TMP1,TMP2);
[0109] }
[0110] The execution function statement of the program organization unit, after being instrumented into the first function identifier, is as follows:
[0111] POU()
[0112] {
[0113] checkState(1,1);
[0114] TMP1:=AND(IN1,IN2);
[0115] checkState(2,1);
[0116] TMP2:=NOT(IN3);
[0117] checkState(3,1);
[0118] OUT1:=OR(TMP1,TMP2);
[0119] }
[0120] The `checkState` function is the first function, also known as the statement status judgment function. The formal parameters of the `checkState` function are the corresponding statement line number and statement type, where 0 represents a non-function call statement, 1 represents a statement with no source code sub-function call, and 2 represents a statement with source code sub-function call.
[0121] Optionally, during the code generation (editing) phase of the program to be debugged, the debugging unit 110 instrumentes and embeds a first function identifier in each statement line of the program to be debugged, and compiles the program to be debugged after the instrumentation of the first function identifier to generate an executable program. Alternatively, during the compilation phase of the program to be debugged, the debugging unit 110 adds the first function identifier to the corresponding location in the executable program.
[0122] Optionally, the debugging unit 110 sends the executable program with added debugging information to the task unit 130.
[0123] Communication unit 120 communicates with debugging unit 110 and is configured to set the statement status value of the first function according to debugging commands sent by debugging unit 110. Optionally, as follows: Figure 1 As shown, the debugging unit 110 receives debugging commands from the debugger through a UI interface and sends the commands to the communication unit 120. The debugging commands issued by the debugger include: step-through debugging, step-in debugging, step-out debugging, breakpoint debugging, adding a breakpoint, deleting a breakpoint, clearing breakpoints, and ending debugging. The communication unit 120 dynamically sets the execution scope of the executable program based on the debugging commands, that is, sets the statement status value of the first function corresponding to the current statement line and related statement lines.
[0124] Task unit 130 communicates with communication unit 120 and is configured to run the executable program with added debugging information, and call the first function, i.e., the statement status judgment function, based on the first function identifier. The first function is configured to:
[0125] The corresponding statement line will be executed or stopped based on the statement status value.
[0126] According to one embodiment of the present invention, the communication unit 120 sets the statement status value of the first function corresponding to the current statement line and related statement lines to include pass / block. When the statement status value is pass, the first function enables branch code and runs the corresponding statement line, that is, runs the statement line under the first function; when the statement status value is block, the first function enables another branch code and stops running the corresponding statement line, that is, stops running the statement line under the first function.
[0127] According to one embodiment of the present invention, such as Figure 1 As shown, the communication unit 120 is further configured as follows:
[0128] The debugging results, including the line number of the currently stopped statement and the current values of each variable register, are sent to the debugging unit 110. Optionally, the debugging unit 110 displays the line number of the currently stopped statement and the current values of each variable register to the debugger through a UI interface.
[0129] According to one embodiment of the present invention, the communication unit 120 sets the statement status value of the first function according to the debugging command sent by the debugging unit 110, including:
[0130] According to the single-step debugging command sent by the debugging unit 110, when the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0131] When the current statement line contains a source code sub-function call statement, the statement status of the first function inside that source code sub-function is set to pass, and the statement status of the first function corresponding to the next statement line after the source code sub-function has completed execution is set to blocked.
[0132] The current statement line has no impact on the debugging process. Once the function call statement or non-function call statement is executed in one go, it jumps directly to the next line.
[0133] According to one embodiment of the present invention, the communication unit 120 sets the statement status value of the first function according to the debugging command sent by the debugging unit 110, including:
[0134] According to the step-in debugging command sent by the debugging unit 110, when the current statement behavior has a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to blocked;
[0135] When the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0136] That is, if the current statement is not a function call statement or a statement without source code sub-functions, it is skipped directly (equivalent to single-stepping). If the current statement is a statement with source code sub-function calls, it enters the interior of that source code sub-function. Optionally, the debugger issues a single-step debugging command through the debugging unit 110. After the executable program stops running inside the source code sub-function, the debugger issues a single-step debugging command through the debugging unit 110 to check the execution of statements inside the source code sub-function line by line.
[0137] According to one embodiment of the present invention, the communication unit 120 sets the statement status value of the first function according to the debugging command sent by the debugging unit 110, including:
[0138] According to the step-out debugging command sent by the debugging unit 110, the statement status value of the first function inside the current sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the current sub-function has been executed is blocked.
[0139] This means that the statements inside the current sub-function have no effect on debugging, and there is no need to execute step by step. The sub-function with source code can be executed in one go, and then jump to the parent function.
[0140] According to one embodiment of the present invention, the communication unit 120 further includes setting the statement status value of the first function according to the debugging command sent by the debugging unit 110:
[0141] Based on the breakpoint debugging command sent by the debugging unit 110, a breakpoint list is matched. Optionally, this breakpoint list is input through the debugging unit 110 during the code generation (editing) or compilation phase of the program to be debugged, or during program debugging. Optionally, the breakpoint list includes one or more of the following: the name of the subroutine / function that needs to be stopped, the subroutine / function number or graphical symbol number, and the line number of the statement that needs to be stopped. Based on one or more of the following: the name of each subroutine / function currently running until the end of the executable program, the subroutine / function number or graphical symbol number, and the line number of each statement currently running until the end of the executable program (the formal parameter of the first function checkState), after matching, the statement status value of the first function corresponding to the statement line within the breakpoint list is set to blocked; the statement status value of the first function corresponding to the statement line not within the breakpoint list is set to pass.
[0142] The executable program stops running at a line of code within the breakpoint list until it receives a command to cancel or clear the breakpoint, or a command to continue debugging (run to the next breakpoint). The communication unit 120 dynamically maintains the breakpoint list based on the command sent by the debugging unit 110, and resets the statement status values of each first function, setting the statement status value of the first function corresponding to the currently stopped line of code to "pass".
[0143] According to one embodiment of the present invention, the communication unit 120 further includes setting the statement status value of the first function according to the debugging command sent by the debugging unit 110:
[0144] Based on the new breakpoint command sent by the debugging unit 110, the breakpoint list is dynamically maintained. Optionally, the breakpoint list includes one or more of the following: the name of the subroutine / function that needs to be stopped, the subroutine / function number or graphical symbol number, and the line number of the statement that needs to be stopped. Based on one or more of the following: the name of each subroutine / function currently running until the end of the executable program, the subroutine / function number or graphical symbol number, and the line number of each statement currently running until the end of the executable program (the formal parameter of the first function checkState), after matching, the statement status value of the first function corresponding to the statement line within the breakpoint list is set to blocked; the statement status value of the first function corresponding to the statement line not within the breakpoint list is set to pass.
[0145] According to one embodiment of the present invention, the communication unit 120 further includes setting the statement status value of the first function according to the debugging command sent by the debugging unit 110:
[0146] Based on the breakpoint deletion command sent by the debugging unit 110, the breakpoint list is dynamically maintained. Optionally, the breakpoint list includes one or more of the following: the name of the subroutine / function that needs to be stopped, the subroutine / function number or graphic symbol number, and the line number of the statement that needs to be stopped. Based on one or more of the following: the name of each subroutine / function that has run to the end of the executable program, the subroutine / function number or graphic symbol number, and the line number of each statement that has run to the end of the executable program (formal parameter of the first function checkState), after matching, the statement status value of the first function corresponding to the statement line within the breakpoint list is set to blocked; the statement status value of the first function corresponding to the statement line not within the breakpoint list is set to pass.
[0147] Optionally, according to the breakpoint deletion command sent by the debugging unit 110, if the number of breakpoints in the breakpoint list is 0 after deleting the breakpoint, the system switches to full-speed execution mode / end debugging mode, and the communication unit 120 sets the statement status value of the first function corresponding to each statement line of the executable program to pass.
[0148] According to one embodiment of the present invention, the communication unit 120 further includes setting the statement status value of the first function according to the debugging command sent by the debugging unit 110:
[0149] Based on the breakpoint clear / full speed execution / end debugging commands sent by the debugging unit 110, the statement status value of the first function corresponding to each statement line of the executable program is set to pass.
[0150] According to one embodiment of the present invention, such as Figure 1 As shown, the communication unit 120 is further configured to: set the statement status value of the first function according to the debugging command sent by the debugging unit 110, and send a statement status value update signal;
[0151] Task unit 130 is further configured to receive the statement status value update signal and read the updated statement status value.
[0152] According to one embodiment of the present invention, the task unit 130 is further configured to: read the statement status value according to the clock cycle, that is, the first function corresponding to each statement line checks whether the statement status value is updated according to the clock cycle.
[0153] The debugging system 100 provided in the above embodiments of the present invention enables step-by-step debugging of programmable logic controller (PLC) programming languages by instrumenting and embedding debugging information during the code generation or compilation phase. It requires no operating system or access to operating system service interfaces, making it suitable for high-real-time environments without an operating system. When a new processor model is added, there is no need to develop a new debugging module, improving the efficiency of product upgrade development.
[0154] According to an embodiment of the present invention, the debugging unit 110 is further configured to: add a second function identifier before the function call statement of each subroutine of the program to be debugged, and add a third function identifier after the function call of each subroutine of the program to be debugged is completed;
[0155] Task unit 130 is further configured as follows:
[0156] The second function is called based on the second function identifier, and the second function is configured as follows:
[0157] Push the corresponding subroutine's function number and total number of statement lines onto the function call stack;
[0158] A third function is invoked based on a third function identifier, wherein the third function is configured as follows:
[0159] Pop the corresponding subroutine's function number and total number of statement lines from the function call stack.
[0160] For example, the following is an example of an execution function statement for a program organization unit:
[0161] POU()
[0162] {
[0163] TMP1:=AND(IN1,IN2);
[0164] TMP2:=NOT(IN3);
[0165] OUT1:=OR(TMP1,TMP2);
[0166] }
[0167] After the execution function statements of the program organization unit are instrumented with the second function identifier, the third function identifier, and the first function identifier mentioned above, the result is as follows:
[0168] POU()
[0169] {
[0170] push(1,1,3);
[0171] checkState(1,1);
[0172] TMP1:=AND(IN1,IN2);
[0173] checkState(2,1);
[0174] TMP2:=NOT(IN3);
[0175] checkState(3,1);
[0176] OUT1:=OR(TMP1,TMP2);
[0177] pop(1);
[0178] }
[0179] The `push` function is the second function, also known as the preamble function. It runs before the function call statements of the subroutine and fills the function number and the total number of statements of the subroutine onto the function call stack. The `pop` function is the third function, also known as the tail function. It runs after the function call statements of the subroutine are completed and pops the function number and the total number of statements of the subroutine from the function call stack.
[0180] The communication unit 120 can obtain the sub-function to which the current statement line belongs and its call relationship with the parent function by reading the stored data of the function call stack, as well as the total number of statement lines in the sub-function to which the current statement line belongs and the number of statement lines that have not been executed. Then, based on the sub-function to which the current statement line belongs and its call relationship with the parent function, the total number of statement lines in the sub-function to which the current statement line belongs and the number of statement lines that have not been executed, the communication unit 120 sets the statement status value of the first function corresponding to the current statement line and related statement lines.
[0181] According to one embodiment of the present invention, the debugging unit 110 is further configured to add a fourth function identifier before the subroutine execution function call of each level of the task to be debugged;
[0182] Task unit 130 is further configured to call a fourth function based on a fourth function identifier, wherein the fourth function is configured to clear the function call stack corresponding to the task level.
[0183] The program to be debugged has a task chain, which includes multi-level tasks. Each level of task includes one or more subroutines (corresponding to multiple execution functions). Before the execution function calls of the subroutines in each level of the program to be debugged, a fourth function is instrumented. This fourth function is configured to clear the function call stack corresponding to each level of task. That is, a function call stack is allocated for each level of task, and the function call stack is cleared before the execution function calls of the subroutines in each level of task. When the program is run in debug mode, the execution function numbers and the total number of statement lines are pushed onto and popped from the function call stack according to the calling order of the one or more subroutines. For example, the fourth function is instrumented before the execution function calls of each program organization unit in task level 1 (task_level=1), as shown below:
[0184] void runTask1()
[0185] {
[0186] / / In debug mode, before each cycle execution, clear the function call stack corresponding to the task level.
[0187] clearStack(1); / / task_level=1
[0188] POU1(); / / Function call executed in program organization unit 1
[0189] …
[0190] }
[0191] void POU1(){
[0192] …
[0193] POU2(); / / Function call executed in program organization unit 2
[0194] …
[0195] }
[0196] void POU2(){
[0197] …
[0198] POU3(); / / Function call executed in program organization unit 3
[0199] …
[0200] }
[0201] void POU3(){
[0202] …
[0203] SUBPOU1();
[0204] …
[0205] }
[0206] ClearStack is the fourth function. Program organization unit POU3 calls program organization unit SUBPOU1; that is, the execution function of program organization unit SUBPOU1 is a sub-function, and the execution function of program organization unit POU3 is the parent function.
[0207] like Figure 2 The function call stack shown is cleared by calling the fourth function `clearStack` before each program organization unit executes its function call. During program execution, the second function (prelude function) is called before each function call statement in each program organization unit, pushing the function numbers and total number of statement lines of program organization units POU1, POU2, and POU3 onto the function call stack in sequence. Specifically, program organization unit POU3 calls program organization unit SUBPOU1. Before the function call statement of program organization unit SUBPOU1, the second function (prelude function) is called, pushing the function number and total number of statement lines of program organization unit SUBPOU1 onto the function call stack. After the function call of program organization unit SUBPOU1 is completed, the third function (tail-end function) is called, popping the function number and total number of statement lines of program organization unit SUBPOU1 from the function call stack.
[0208] Optionally, when the debugger reaches the program organization unit SUBPOU1, the debugger issues a step-out debugging command. The communication unit 120, based on the stored data in the function call stack (i.e., the top element of the stack is the execution function number of SUBPOU1 and the total number of statement lines), sets the statement status of the first function corresponding to the current statement line up to the point where the SUBPOU1 execution function call is completed to "pass," and sets the statement status of the first function corresponding to the statement line from which SUBPOU1 exits and returns to the execution function POU3 to "blocked." That is, after the program organization unit SUBPOU1 completes execution and exits, returning to the previous program organization unit POU3, the top element of the function call stack becomes the execution function number of POU3 and the total number of statement lines.
[0209] According to one embodiment of the present invention, the debugging unit 110 is further configured to add a fifth function identifier at the initialization function call statement of each subroutine of the program to be debugged;
[0210] Task unit 130 is further configured to call a fifth function based on the fifth function identifier, wherein the fifth function is configured to store the execution function number and entry address of the corresponding subroutine into a function lookup table.
[0211] Instrumenting a fifth function during the initialization phase of each subroutine in the program to be debugged involves adding a fifth function call statement before the initialization function call statement of each subroutine. The fifth function is configured to fill the relevant information of the execution function number and execution function pointer corresponding to the subroutine into a function lookup table. The program statements that form the function lookup table are shown below:
[0212]
[0213] As described in the above embodiments, the preamble and tail function work together to push the subroutine's execution function number onto the function call stack. During the program's execution in debug mode, the debugger can read the stored data in the function call stack to obtain the execution function number at the current stopping point and its call relationship with the upper-level function. Then, by searching the function lookup table, the debugger can locate the entry address of the subroutine's execution function.
[0214] According to one embodiment of the present invention, during the code generation stage (editing stage) of the program to be debugged, the debugging unit 110 adds a second function identifier before the function call statement of each subroutine of the program to be debugged, adds a third function identifier after the function call of each subroutine of the program to be debugged is completed, adds a fourth function identifier before the subroutine call of each level of task of the program to be debugged, and adds a fifth function identifier at the initialization function call statement of each subroutine of the program to be debugged; and compiles the program to be debugged after instrumentation and embedding of debugging information to generate an executable program. Alternatively, during the compilation stage of the program to be debugged, the debugging unit 110 adds debugging information to the corresponding location of the executable program, the debugging information including the aforementioned second function identifier, third function identifier, fourth function identifier, and fifth function identifier.
[0215] Optionally, the debugging unit 110 sends the executable program with added debugging information to the task unit 130.
[0216] According to an embodiment of the present invention, in the debugging system 100 described above, the debugging unit 110 includes configuration software, the communication unit 120 includes a communication thread of a programmable controller, the task unit 130 includes a task thread of a programmable controller, and the subroutines include program organization units written in a language conforming to the IEC 61131-3 standard.
[0217] According to one embodiment of the present invention, the program to be debugged includes a graphical program, optionally including program organization units developed using function block diagrams, sequential function charts, or ladder diagrams of the IEC 61131-3 standard. During the graphical program code generation stage, the program organization units developed using function block diagrams, sequential function charts, or ladder diagrams of the IEC 61131-3 standard are analyzed and processed. A first function call statement, i.e., a statement status judgment function call statement, is inserted before the library function call statement corresponding to the graphical symbol; a second function call statement, i.e., a prologue function call statement, is inserted at the beginning of the execution function corresponding to the program organization unit, used to fill the execution function number of the program organization unit and the total number of statement lines of the execution function into the function call stack; a third function call statement, i.e., a tail function call statement, is inserted before the end of the execution function corresponding to the program organization unit, used to pop the execution function number of the program organization unit from the function call stack. Figure 3 As shown, taking a function block diagram as an example, in debug mode, the execution functions of the program organization unit are instrumented in sequence with the second function, namely the preamble function push, several first functions, namely the statement state judgment function checkState, and the third function, namely the tail function pop.
[0218] According to one embodiment of the present invention, the communication unit 120 sends the debugging results, including the line number of the currently stopped statement line and the current values of each variable register, to the debugging unit 110 for display. Optionally, the debugging unit 110 displays the debugging results to the debugger through a UI interface. In the case where the program to be debugged includes a graphical program, the communication unit 120 sends the execution function number to the debugging unit 110 to which the currently stopped statement line belongs. The debugging unit 110 opens the corresponding program organization unit according to the execution function number, searches for the graphical symbol corresponding to the currently stopped statement line number in the graphical program view, and highlights the currently stopped graphical symbol. Optionally, an arrow symbol can be used to identify the currently stopped graphical symbol. Optionally, after completing step-in and step-out debugging, the task unit 130 sends the line number of the currently stopped statement line and the execution function number to which the currently stopped statement line belongs to the debugging unit 110 through the communication unit 120. The debugging unit 110 searches for and opens the corresponding program file according to the execution function number, and synchronously updates the view corresponding to the current sub-function and the parent function.
[0219] According to one embodiment of the present invention, the program to be debugged includes a structured text language program or an instruction list program, optionally including program organization units developed using a structured text language or instruction list according to the IEC 61131-3 standard. During the front-end compilation stage of the text-based program, lexical analysis, syntax analysis, and semantic analysis are performed on the program organization units developed using a structured text language or instruction list according to the IEC 61131-3 standard. Instrumentation is performed on the syntax tree; a first function, i.e., a subtree of the statement state judgment function, is inserted before each statement line call; a second function, i.e., a prologue function subtree, is inserted at the beginning of the execution function corresponding to the program organization unit, used to fill the execution function number of the program organization unit and the total number of statement lines of the execution function into the function call stack; a third function, i.e., a tail function subtree, is inserted before the end of the execution function corresponding to the program organization unit, used to pop the execution function number of the program organization unit from the function call stack. Figure 4 As shown, taking structured text as an example, in debug mode, during the front-end compilation stage of the program organization unit, the syntax tree sequentially inserts the second function, namely the preamble function push subtree, several first functions, namely the statement state judgment function checkState subtree, and the third function, namely the end function pop subtree.
[0220] The debugging system 100 provided in the above embodiments of the present invention can realize breakpoint debugging and single-step debugging of graphical programs, structured text programs or instruction list programs. By stepping into, stepping out and stepping through, it can analyze in detail whether the implementation details of complex multi-level calling functions are consistent with expectations, thereby improving the development and debugging efficiency of application programs.
[0221] According to one embodiment of the present invention, such as Figure 5 As shown, the present invention also provides a method 10 for debugging using the debugging system 100 described above, including steps S101-S103. Wherein:
[0222] In step S101, the debugging unit adds a first function identifier to each statement line of the program to be debugged, and compiles it to generate an executable program;
[0223] In step S102, the statement status value of the first function is set by the communication unit according to the debugging command sent by the debugging unit;
[0224] In step S103, the executable program is run through the task unit, and a first function is called based on the first function identifier. The first function is configured to:
[0225] The corresponding statement line will be executed or stopped based on the statement status value.
[0226] According to an embodiment of the present invention, the first function is further configured to: execute the corresponding statement line when the statement status value is passed; and stop executing the corresponding statement line when the statement status value is blocked; method 10 further includes:
[0227] The communication unit sends the line number of the currently stopped statement and the current values of each variable register to the debugging unit.
[0228] According to one embodiment of the present invention, setting the statement status value of the first function by the communication unit according to the debugging command sent by the debugging unit includes:
[0229] According to the step-by-step command sent by the debugging unit, when the current statement line is not a function call statement or a sub-function call statement without source code, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0230] When the current statement line contains a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the source code sub-function has completed execution is set to blocked.
[0231] According to an embodiment of the present invention, setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes:
[0232] According to the step-in command sent by the debugging unit, when the current statement action is a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to blocked.
[0233] When the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
[0234] According to an embodiment of the present invention, setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes:
[0235] According to the step-out command sent by the debugging unit, the communication unit sets the statement status value of the first function inside the current sub-function to pass, and sets the statement status value of the first function corresponding to the next statement line after the current sub-function has been executed to blocked.
[0236] According to an embodiment of the present invention, setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes:
[0237] The communication unit dynamically maintains the breakpoint list by executing, adding, or deleting breakpoints according to the commands sent by the debugging unit. The statement status value of the first function corresponding to the statement line within the breakpoint list is set to blocked; the statement status value of the first function corresponding to the statement line not within the breakpoint list is set to pass.
[0238] According to one embodiment of the present invention, method 10 further includes:
[0239] The debugging unit adds a second function identifier before the function call statement of each subroutine of the program to be debugged, and adds a third function identifier after the function call of each subroutine of the program to be debugged is completed.
[0240] The task unit invokes a second function based on the second function identifier, and the second function is configured as follows:
[0241] Push the corresponding function number and the total number of lines of statements in the function function onto the function call stack;
[0242] The third function is invoked based on the aforementioned third function identifier, and the third function is configured as follows:
[0243] Pop the corresponding function number and the total number of lines of function statements from the function call stack.
[0244] According to one embodiment of the present invention, method 10 further includes:
[0245] The debugging unit adds a fourth function identifier before the subroutine calls of each level of the task in the program to be debugged;
[0246] The task unit invokes the fourth function based on the fourth function identifier, and the fourth function is configured as follows:
[0247] Clear the function call stack corresponding to the task level.
[0248] According to one embodiment of the present invention, method 10 further includes:
[0249] The debugging unit adds a fifth function identifier to the initialization function call statement of each subroutine of the program to be debugged.
[0250] The task unit invokes the fifth function based on the fifth function identifier, and the fifth function is configured as follows:
[0251] Store the corresponding subroutine's function number and entry address into the function lookup table.
[0252] According to one embodiment of the present invention, method 10 further includes:
[0253] The communication unit sets the statement status value of the first function according to the debugging command sent by the debugging unit, and sends a statement status value update signal.
[0254] The task unit receives the statement status value update signal and reads the statement status value.
[0255] According to one embodiment of the present invention, the debugging unit adds a first function identifier to each statement line of the program to be debugged, including:
[0256] The debugging unit adds the first function identifier to the code generation or compilation stage of the program to be debugged.
[0257] According to one embodiment of the present invention, method 10 further includes:
[0258] The debugging unit receives debugging commands from the debugger through a UI interface and sends the debugging commands to the communication unit.
[0259] The debugging unit receives the line number of the currently stopped statement and the current values of each variable register sent by the communication unit, and displays them to the debugger through the UI interface.
[0260] The debugging method 10 provided in the above embodiments of the present invention achieves breakpoint debugging and single-step debugging of programmable logic controller (PLC) programming languages by instrumenting and embedding debugging information. Based on the debugging commands issued by the debugger, statement status values are set, the execution range of the statements in the program to be debugged is dynamically updated, and the function call stack is analyzed to locate the function level and structural relationship of the current statement. This enables single-step debugging (stepping through, stepping into, and stepping out) of the program to be debugged, without requiring an operating system or access to its service interfaces, making it suitable for high-real-time environments without an operating system. When a new processor model is added, there is no need to develop a new debugging module, improving the efficiency of product upgrade development.
Claims
1. A debugging system, characterized in that, The debugging system is suitable for high-real-time environments without an operating system, and the debugging system includes: The debugging unit is configured to add a first function identifier to each line of statement in the program to be debugged, and then compile it to generate an executable program. A communication unit communicates with the debugging unit and is configured to set the statement status value of the first function according to the debugging command sent by the debugging unit; The task unit communicates with the communication unit, is configured to run the executable program, and calls a first function based on the first function identifier, wherein the first function is configured to: The corresponding statement line will be executed or stopped based on the statement status value. The debugging commands include step-through command, step-in command, step-out command, add breakpoint command, delete breakpoint command, clear breakpoint command, full-speed execution command and / or end debugging command; The communication unit includes a communication thread of the programmable controller, and the task unit includes a task thread of the programmable controller.
2. The debugging system as described in claim 1, wherein the first function is further configured to: When the status value of the statement is "pass", the corresponding statement line is executed; When the status value of the statement is blocked, the execution of the corresponding statement line will stop; The communication unit is further configured to: The line number of the currently stopped statement and the current values of each variable register are sent to the debugging unit.
3. The debugging system as described in claim 1 or 2, wherein the communication unit is further configured to: According to the step-by-step command sent by the debugging unit, when the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked. When the current statement line contains a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the source code sub-function has completed execution is set to blocked.
4. The debugging system as described in claim 1 or 2, wherein the communication unit is further configured to: According to the step-in command sent by the debugging unit, when the current statement behavior has a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to blocked; When the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
5. The debugging system as described in claim 1 or 2, wherein the communication unit is further configured to: According to the step-out command sent by the debugging unit, the statement status value of the first function inside the current sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the current sub-function has been executed is blocked.
6. The debugging system as claimed in claim 1 or 2, wherein the communication unit is further configured to: Based on the commands sent by the debugging unit to execute, add, or delete breakpoints, the breakpoint list is dynamically maintained. The statement status value of the first function corresponding to the statement line within the breakpoint list is set to blocked; the statement status value of the first function corresponding to the statement line not within the breakpoint list is set to pass.
7. The debugging system as described in claim 1 or 2, wherein the debugging unit is further configured to: Add a second function identifier before the function call statement of each subroutine of the program to be debugged, and add a third function identifier after the function call of each subroutine of the program to be debugged is completed; The task unit is further configured as follows: The second function is invoked based on the second function identifier, and the second function is configured as follows: Push the corresponding function number and the total number of statements in the function into the function call stack; The third function is invoked based on the aforementioned third function identifier, and the third function is configured as follows: Pop the corresponding function number and the total number of statement lines of the function from the function call stack.
8. The debugging system of claim 7, wherein the debugging unit is further configured to: Add a fourth function identifier before the subroutine calls of each level of the task in the program to be debugged; The task unit is further configured as follows: The fourth function is invoked based on the fourth function identifier, and the fourth function is configured as follows: Clear the function call stack corresponding to the task level.
9. The debugging system of claim 7, wherein the communication unit is further configured to: Analyze the stored data of the function call stack and set the statement state value of the first function.
10. The debugging system of claim 1 or 2, wherein the debugging unit is further configured to: Add a fifth function identifier to the initialization function call statement of each subroutine of the program to be debugged; The task unit is further configured as follows: The fifth function is invoked based on the fifth function identifier, and the fifth function is configured as follows: Store the corresponding subroutine's function number and entry address into the function lookup table.
11. The debugging system of claim 1 or 2, wherein the communication unit is further configured to: The statement status value of the first function is set according to the debugging command sent by the debugging unit, and a statement status value update signal is sent. The task unit is further configured as follows: Receive the statement status value update signal and read the statement status value.
12. The debugging system of claim 1 or 2, wherein the debugging unit is further configured to: Add the first function identifier during the code generation or compilation stage of the program to be debugged.
13. The debugging system of claim 2, wherein the debugging unit is further configured to: The system receives debugging commands from the debugger through the UI interface and sends the debugging commands to the communication unit. The system receives the line number of the currently stopped statement and the current values of each variable register sent by the communication unit, and displays them to the debugger through the UI interface.
14. A method for debugging using the debugging system as described in any one of claims 1-13, characterized in that, The debugging system is suitable for high-real-time environments without an operating system, and the method includes: The debugging unit adds a first function identifier to each line of statement in the program to be debugged, and compiles it to generate an executable program. The communication unit sets the statement status value of the first function according to the debugging command sent by the debugging unit; The executable program is run through the task unit, and a first function is called based on the first function identifier, wherein the first function is configured to: The corresponding statement line will be executed or stopped based on the statement status value. The debugging commands include step-through command, step-in command, step-out command, add breakpoint command, delete breakpoint command, clear breakpoint command, full-speed execution command, and / or end debugging command.
15. The method of claim 14, wherein the first function is further configured to: execute the corresponding statement line when the statement status value is pass; and stop executing the corresponding statement line when the statement status value is block; the method further includes: The communication unit sends the line number of the currently stopped statement and the current values of each variable register to the debugging unit.
16. The method of claim 14 or 15, wherein setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit includes: According to the step-by-step command sent by the debugging unit, when the current statement line is not a function call statement or a sub-function call statement without source code, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked. When the current statement line contains a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to pass, and the statement status value of the first function corresponding to the next statement line after the source code sub-function has completed execution is set to blocked.
17. The method of claim 14 or 15, wherein setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes: According to the step-in command sent by the debugging unit, when the current statement action is a source code sub-function call statement, the statement status value of the first function inside the source code sub-function is set to blocked. When the current statement line is not a function call statement or a statement without source code sub-function call statement, the statement status value of the first function corresponding to the current statement line is set to pass, and the statement status value of the first function corresponding to the next statement line is set to blocked.
18. The method of claim 14 or 15, wherein setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes: According to the step-out command sent by the debugging unit, the communication unit sets the statement status value of the first function inside the current sub-function to pass, and sets the statement status value of the first function corresponding to the next statement line after the current sub-function has been executed to blocked.
19. The method of claim 14 or 15, wherein setting the statement status value of the first function via the communication unit according to the debugging command sent by the debugging unit further includes: The communication unit executes, adds, or deletes breakpoints according to the commands sent by the debugging unit, dynamically maintains the breakpoint list, and sets the statement status value of the first function corresponding to the statement line within the breakpoint list to blocked. Set the statement status of the first function corresponding to a statement line that is not in the breakpoint list to "pass".
20. The method of claim 14 or 15, further comprising: The debugging unit adds a second function identifier before the function call statement of each subroutine of the program to be debugged, and adds a third function identifier after the function call of each subroutine of the program to be debugged is completed. The task unit invokes a second function based on the second function identifier, and the second function is configured as follows: Push the corresponding function number and the total number of statements in the function into the function call stack; The third function is invoked based on the aforementioned third function identifier, and the third function is configured as follows: Pop the corresponding function number and the total number of statement lines of the function from the function call stack.
21. The method of claim 20, further comprising: The debugging unit adds a fourth function identifier before the subroutine calls of each level of the task in the program to be debugged; The task unit invokes the fourth function based on the fourth function identifier, and the fourth function is configured as follows: Clear the function call stack corresponding to the task level.
22. The method of claim 14 or 15, further comprising: The debugging unit adds a fifth function identifier to the initialization function call statement of each subroutine of the program to be debugged. The task unit invokes the fifth function based on the fifth function identifier, and the fifth function is configured as follows: Store the corresponding subroutine's function number and entry address into the function lookup table.
23. The method of claim 14 or 15, further comprising: The communication unit sets the statement status value of the first function according to the debugging command sent by the debugging unit, and sends a statement status value update signal. The task unit receives the statement status value update signal and reads the statement status value.
24. The method of claim 14 or 15, wherein adding a first function identifier to each statement line of the program to be debugged by the debugging unit includes: The debugging unit adds the first function identifier to the code generation or compilation stage of the program to be debugged.
25. The method of claim 15, further comprising: The debugging unit receives debugging commands from the debugger through a UI interface and sends the debugging commands to the communication unit. The debugging unit receives the line number of the currently stopped statement and the current values of each variable register sent by the communication unit, and displays them to the debugger through the UI interface.
Citation Information
Patent Citations
Debugging method and debugging system for configuration program of PLC
CN111142469A
