PLC Code Compilation With User-Space Breakpoint Insertion
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 cybersecurity concerns that prevent the use of processor exceptions, necessitating a new approach for debugging in user space.
Innovation Solution
A method involving two compilation steps transforms source code into intermediate code with breakpoint control function calls, followed by compilation into executable code for PLCs, enabling software breakpoints through a breakpoint verification function and semaphore mechanism to manage breakpoints during execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If processor exception mode is used to implement breakpoints, then breakpoint functionality is achieved, but security requirements are violated due to kernel mode access
Solution Approach 1:
The patent introduces an intermediary breakpoint management function that operates in user mode to handle breakpoint operations. Instead of directly using processor exception mode which requires kernel access, the patent creates a mediator function that can be called from user mode to achieve breakpoint functionality through software-based mechanisms, thus eliminating the security risk while maintaining the desired functionality.
Solution Approach 2:
The patent replaces the hardware-based processor exception mechanism with a software-based breakpoint management system. Instead of relying on the mechanical/hardware exception mode that requires kernel access, the patent substitutes it with software functions that can operate entirely in user mode, achieving the same breakpoint functionality without the security implications of kernel mode access.
2Reliability
If software breakpoint is implemented by substituting source opcode, then breakpoint is achieved, but code modification is required which increases complexity
Solution Approach 1:
The patent performs preliminary action by pre-defining breakpoint management functions and their interfaces during the compilation or code generation phase. Instead of modifying source opcodes at runtime or requiring manual code substitution, the breakpoint functionality is prepared in advance through systematic function insertion, reducing the complexity of code modification while ensuring reliable breakpoint operation.
3Adaptability or versatility
If breakpoint control function is added during compilation, then user mode execution is enabled, but compilation process complexity increases
Solution Approach 1:
The patent segments the compilation process into distinct phases: standard compilation to generate initial code, followed by a separate breakpoint instrumentation phase that inserts breakpoint management function calls. This segmentation allows the core compilation process to remain simple while adding the necessary user mode breakpoint capabilities in a systematic, modular manner, reducing overall compilation complexity.
Data Source
AI summary
A method for compiling a source code intended to produce an executable program to be executed on a programmable controller, the method being implemented by an electronic device including at least one processor and a storage space. The method includes: a first compilation step in which the lines of code of the source code are transformed into a plurality of lines of code in an intermediate code and in which at least one intermediate line of code of call to a breakpoint control function is added, delivering a set of intermediate lines of code called intermediate program, and a second compilation step in which the intermediate program is compiled into a language executable by the programmable controller to produce the executable program.


