PLC Source Code Compilation With User-Mode Breakpoint Control
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing solutions for implementing breakpoints in programmable logic controllers (PLCs) executing in user mode are inadequate, particularly due to the need for processor exception mode access, which is restricted for cybersecurity reasons.
Innovation Solution
A method for compiling source code that inserts calls to a breakpoint control function during the first compilation step, allowing breakpoint management through a software solution by using unique identifiers and semaphores to manage execution pauses during debugging.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If hardware breakpoint or software breakpoint solutions are used in kernel mode, then breakpoint functionality is achieved, but system security is compromised due to kernel mode access requirements
Solution Approach 1:
The patent introduces an intermediary mechanism by inserting calls to a breakpoint control function in the intermediate code, which acts as a mediator between the user-mode executable and the breakpoint management system. This allows breakpoint functionality to be achieved without direct kernel mode access, thus maintaining security while enabling debugging capabilities.
Solution Approach 2:
The patent replaces the traditional mechanical approach of using processor exception modes (hardware or software breakpoints requiring kernel access) with a software-based control function call mechanism. This substitution allows breakpoint functionality to be implemented through standard user-mode function calls, eliminating the need for privileged mode access and thereby maintaining system security.
2Object-affected harmful factors
If user mode execution is used for firmware, then system security is improved, but breakpoint implementation becomes impossible with traditional methods
Solution Approach 1:
The patent applies preliminary action by inserting calls to the breakpoint control function during the compilation process (in the first compilation step transforming source code to intermediate code). This advance preparation ensures that breakpoint functionality is built into the executable structure before runtime, making breakpoint implementation feasible in user mode without requiring complex runtime modifications or kernel access.
3Ease of operation
If breakpoint control function calls are inserted in intermediate code, then breakpoint management is enabled in user mode, but code complexity increases
Solution Approach 1:
The patent implements self-service by having the compilation process automatically insert the necessary breakpoint control function calls during the transformation from source code to intermediate code. The system serves itself by integrating the breakpoint functionality insertion into the existing compilation workflow, eliminating the need for separate manual intervention or complex post-processing steps.
Data Source
Figure 1~2
Figure 3
Figure 4
AI summary
The disclosure relates to a method for compiling a source code (CS) intended to produce an executable program (FW) to be executed on a programmable controller (CP), said method being implemented by an electronic device comprising at least one processor and a storage space. The method comprises: - a first compilation step (CS01) in which the lines of code of the source code (CS) are transformed into a plurality of lines of code in an intermediate code (LCI) and in which at least one intermediate line of code of call to a breakpoint control function (FBP) is added, delivering a set of intermediate lines of code called intermediate program (ICP), - a second compilation step (CS02) in which the intermediate program (ICP) is compiled into a language executable by the programmable controller to produce the executable program (FW).