Processor Single Step Diagnostic Exception Handling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Diagnostic systems face challenges when single stepping through code that involves instructions whose execution path changes due to exceptions, leading to infinite loops, particularly when exclusive monitors are involved, as existing solutions require scanning all code and have high overhead, especially in remote diagnostics.
Innovation Solution
A method that controls the processor to execute in single step mode, determines if an instruction is of a predetermined type that changes the execution path, and either continues or exits single step mode based on this determination, using type indicators and diagnostic exceptions to manage the execution flow and set breakpoints as necessary.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If single stepping through code is performed to analyze processor execution, then diagnostic precision is improved, but infinite loops occur when exclusive monitor instructions are encountered
Solution Approach 1:
The patent applies preliminary action by checking whether the current instruction is an exclusive monitor instruction (LDREX or STREX) before taking a diagnostic exception. The type indicator is set in advance to indicate the instruction type, and based on this pre-determined type, the system decides whether to suppress the diagnostic exception. This prevents the infinite loop from occurring in the first place by anticipating the problem before it arises.
2Reliability
If code scanning is performed to identify blocks with execution path changes, then infinite loops are prevented, but diagnostic overhead increases significantly
Solution Approach 1:
The patent extracts only the critical information needed to prevent infinite loops - specifically, the type indicator of the current instruction - without performing comprehensive code scanning. By taking out just the essential instruction type information and using it to make a local decision about whether to suppress diagnostic exceptions, the system avoids the time-consuming overhead of scanning all code while still preventing infinite loops effectively.
Solution Approach 2:
The processor itself generates and maintains the type indicator information during normal instruction execution. This self-generated information is then used by the diagnostic system to make decisions about exception handling. The system serves itself by using its own execution state information rather than requiring external scanning or analysis of the code.
3Stability of the object's composition
If exception handler clears exclusive monitor on return from diagnostic exception, then execution path correctness is maintained, but single stepping through exclusive monitor instructions fails
Solution Approach 1:
The patent applies preliminary anti-action by preventing the diagnostic exception from being taken in the first place when an exclusive monitor instruction is detected. The type indicator is checked beforehand, and if it indicates an exclusive monitor instruction, the diagnostic exception is suppressed. This preemptive measure counteracts the harmful effect of clearing the exclusive monitor and causing infinite loops, allowing single-step debugging to proceed efficiently through such instructions without interruption.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A method and apparatus for diagnosing a processor processing a stream of instructions are disclosed. The method comprises the steps of: (i) controlling the processor to execute in a single step mode such that a single instruction from the instruction stream is executed, the processor determines if the single instruction is one of at least one predetermined type of instruction and stores a type indicator in a data storage location and a diagnostic exception is taken after the processor has processed the single instruction; (ii) performing diagnostic operations following the diagnostic exception including: accessing the type indicator stored in the data storage location; and (iiia) in response to the type indicator indicating the single instruction was not one of the predetemined type controlling the processor to continue executing instructions in the single step mode such that a next single instruction is executed on return form the exception; (iiib) in response to the type indicator indicating the single instruction was one of the at least one predetermined type controlling the processor to exit the single step mode and not execute the next instruction within the instruction stream as a single instruction followed by an exception.