Multithread Debugging With Hook Injection and Local Breakpoint Control

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing debugging methods for industrial equipment, particularly multi-threaded industrial robots, are inefficient due to reliance on remote control platforms that lack real-time information and support only single-threaded operations.

Innovation Solution

A debugging method that determines whether a thread contains a breakpoint, injecting a hook function to execute in debug mode if a breakpoint is set, and allowing for real-time debug instruction execution and breakpoint updates.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If remote control platforms are used for debugging industrial equipment, then debugging can be performed, but real-time information cannot be obtained and debugging efficiency is low

Engineering Contradiction:
Improvedebugging efficiencyVSAvoidreal-time information
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The patent introduces a debug agent as an intermediary component that runs locally on the industrial equipment alongside the target program. This debug agent acts as a mediator between the remote debugging platform and the running program, enabling real-time information exchange. The agent receives debug instructions from the remote platform and sends back real-time execution information, resolving the information loss problem while maintaining remote debugging capability and improving efficiency.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of manufacture

If single-threaded script language like Lua is used for programming control, then code writing is simplified and user-friendly, but multi-threaded operations are not supported and debugging is limited

Engineering Contradiction:
Improvecode writing simplicityVSAvoidmulti-threaded operation support
Core Design Contradiction:
Ease of manufactureVSAdaptability or versatility

Solution Approach 1:

The patent segments the debugging system into independent thread handlers, each capable of managing a separate thread of execution. The debug agent creates and manages multiple thread contexts, allowing each thread to be debugged independently while maintaining the simplicity of script language programming. This segmentation enables multi-threaded operations without requiring complex multi-threaded programming constructs in the user's code.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The debug agent implements universal debugging functionality that works across multiple threads and programming languages. It provides a unified debugging interface that can handle Lua scripts and other languages, supporting both single-threaded and multi-threaded operations through the same mechanism. This multi-functionality allows the system to maintain code writing simplicity while gaining adaptability to multi-threaded scenarios.

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Reliability

If hook functions are injected into threads for debugging, then real-time breakpoint control is achieved, but system complexity increases

Engineering Contradiction:
Improvebreakpoint control accuracyVSAvoiddebugging system complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The debug agent implements self-service mechanisms by automatically managing its own lifecycle, thread creation, and hook function injection without requiring manual configuration. It autonomously monitors program execution, detects breakpoints, and controls thread suspension/resumption. This self-service approach reduces the apparent complexity for users while maintaining reliable breakpoint control, as the agent handles the complex interactions internally.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS20250060723A1Device debugging method, device, and storage medium
Publication Date: 2025.02.20 QKM TECH (DONG GUAN) CO LTD
  • US20250060723A1 patent drawing
  • US20250060723A1 patent drawing
  • US20250060723A1 patent drawing

AI summary

A device debugging method includes according to a first thread to be created and a breakpoint set, determining that the first thread contains a corresponding breakpoint; injecting a hook function into the first thread, and creating a first thread and executing in a debugging mode; if the hook function is invoked, determining whether a triggering condition of the breakpoint is satisfied; if not, directly exiting the hook function; if so, stopping the code running of the first thread, waiting, and executing a debug instruction. Therefore, the device is integrated with both functionalities of debugging and actual execution due to the breakpoint set for debugging configured on the device, the actual result of each debugging can be observed in real time, and the hook functions of different threads operate independently and do not interfere, thus multithread debugging can be achieved, and debugging efficiency is improved.