A visual gateway debugging system and method based on a honk operating system

By using a visual gateway debugging system based on the HarmonyOS operating system, the problems of low device identification accuracy, fragmented links, coarse status acquisition, poor graph interactivity, and fragmented cross-device debugging in IoT device debugging are solved. It realizes an efficient and visual debugging process and improves the automation and intelligence of IoT system debugging.

CN120785786BActive Publication Date: 2026-06-05NANJING SHENDA ENG TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING SHENDA ENG TECH CO LTD
Filing Date
2025-08-11
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing IoT device debugging suffers from problems such as low device identification accuracy, fragmented debugging command links, coarse granularity of runtime status acquisition, bloated graph structure, insufficient support for distributed debugging, and weak graph interactivity, making it difficult to achieve efficient, visualized, and cross-device collaborative debugging.

Method used

The system employs a visual gateway debugging system based on the HarmonyOS operating system. Through a device fingerprint recognition module, a debugging control center module, a lightweight debugging agent module, a state graph modeling module, and a distributed migration module, it achieves device identification, debugging command control, runtime state acquisition, graph modeling and compression, and breakpoint state migration. Combined with a visual debugging front-end module, it provides graphical display and interaction.

Benefits of technology

It significantly improves the automation, visualization, and intelligence of IoT device debugging, enabling efficient identification of device identity, fine modeling of runtime status, unified transmission of debugging commands, and graphical display of abnormal behavior, thereby enhancing the continuity and observability of the debugging process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120785786B_ABST
    Figure CN120785786B_ABST
Patent Text Reader

Abstract

The application provides a visual gateway debugging system and method based on a Hongmeng operating system, and relates to the technical field of Internet of Things (IoT) debugging. The system comprises the following steps: constructing a domain name forest structure based on DNS, TLS and HTTP traffic and identifying device identity; generating a debugging activation instruction and transmitting a cross-device command through WebSocket and DSoftBus; collecting a program counter, a stack and a variable state with microsecond-level precision; constructing a state quadruple graph and performing compression processing; migrating a breakpoint context among multiple devices and reconstructing an execution environment; graphically presenting a state graph, a variable trajectory and a call stack, and supporting path playback and debugging control linkage. The application realizes a full-process closed loop from device identification to debugging control and from state modeling to path playback, improves debugging efficiency, automation level and system visualization capability, and is suitable for debugging and abnormal diagnosis scenarios of distributed intelligent terminals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Internet of Things (IoT) debugging technology, and in particular to a visual gateway debugging system and method based on the HarmonyOS operating system. Background Technology

[0002] Currently, with the widespread deployment of Internet of Things (IoT) devices in smart homes, industrial control, and edge computing, debugging the behavior of these devices during deployment, operation, and updates has become a core technical aspect of ensuring system stability and security. However, existing technologies for debugging IoT devices still have many shortcomings: Weak device identification capabilities: Traditional IoT gateways mainly rely on MAC addresses or basic protocol fields for device identification, lacking in-depth analysis of device behavioral characteristics. This makes it difficult to accurately identify device types in passive environments, especially posing a risk of confusion in complex networks. Fragmented debugging command links: Most debugging systems lack a unified command issuance format, resulting in inconsistent cross-device link protocols and low efficiency in command encapsulation and transmission, making it difficult for debugging commands to be executed stably on the target device. Coarse-grained runtime state acquisition: Current debugging methods mostly focus on breakpoint events, lacking synchronous and fine-grained acquisition of program counters, call stacks, and variable snapshots, making it difficult to reconstruct the complete state at the time of the problem. Lack of structural expression and visualization support for debugging behavior: Current log-based debugging methods only provide event stream records, making it difficult to construct a debugging spectrum with temporal evolution and dependency paths, preventing debuggers from systematically understanding the problem evolution process. The graphical graph structure is bloated and lacks optimization mechanisms: As debugging data accumulates, the graph grows exponentially, and most nodes have high repetition rates. Existing methods lack effective graph compression and node folding mechanisms, leading to high subsequent analysis costs. Distributed debugging support is insufficient: In multi-device collaborative operation scenarios, the debugging context cannot be migrated across devices, and breakpoint states and variable information cannot be restored on new devices, severely impacting debugging continuity. The graph has weak interactivity and lacks root cause tracing mechanisms: Current graphical debugging interfaces are mostly static displays, lacking interactive capabilities such as path expansion, node highlighting, root cause feedback, and dynamic animations, failing to effectively assist debugging operations.

[0003] Therefore, there is an urgent need for a full-link debugging system for the HarmonyOS operating system environment that supports everything from device identification and debugging command control to runtime status acquisition and graph modeling and compression, and from context migration recovery to graphical anomaly path playback, in order to improve the automation, visualization and cross-device collaboration capabilities of debugging and meet the debugging needs of future distributed Internet of Things systems. Summary of the Invention

[0004] The purpose of this invention is to provide a visual gateway debugging system and method based on the HarmonyOS operating system to solve the limitations of existing IoT device debugging, such as low identification accuracy, coarse granularity of status acquisition, fragmented debugging links, difficulty in tracing abnormal paths, and inability to migrate debugging contexts across devices. It achieves efficient identification of device identity, fine modeling of runtime status, unified transmission of debugging commands, graphical display and playback of abnormal behavior, and distributed migration and recovery of breakpoint status, thereby significantly improving the automation, visualization, and intelligence of the debugging process.

[0005] To achieve the above objectives, the present invention employs the following technical solution:

[0006] On one hand, this invention provides a visual gateway debugging system based on the HarmonyOS operating system, comprising:

[0007] (1) Device fingerprint recognition module, set in the IoT gateway, is used to extract multi-level domain name features based on passively captured DNS traffic, TLS traffic and HTTP traffic, construct a domain name forest fingerprint structure, and output device identity and device type identifier through local sensitive hash matching algorithm;

[0008] (2) Debugging control center module, deployed on the IoT gateway, is used to send a debugging agent activation instruction to the target IoT device according to the device identity identifier, encapsulate the debugging command through a standardized debugging command encapsulation protocol, and transmit the debugging command through the HarmonyOS DSoftBus channel based on the WebSocket connection, while generating debugging operation events;

[0009] (3) A lightweight debugging agent module is embedded in the target IoT device to respond to the debugging agent activation command, collect the program counter status, stack status and variable table status with microsecond-level time synchronization accuracy, generate runtime status data, call stack structure and variable trajectory, and parse and execute the debugging command under the premise of continuously executing device tasks;

[0010] (4) State graph modeling module, logically connected to the IoT gateway, is used to receive the debugging operation event and the runtime state data, construct and output a debugging state graph with state quadruples as nodes and operation trigger conditions as edges, and perform graph compression and sensitive node marking.

[0011] (5) Distributed migration module, integrated into the distributed task framework of HarmonyOS, is used to serialize the debugging context into migration data packets, transmit them across devices through the HarmonyOS device network, and reconstruct the breakpoint state and restore the stack state to the lightweight debugging agent module on the target device.

[0012] (6) A visual debugging front-end module is deployed on the remote control terminal to receive and graphically display the debugging status map, the call stack structure and the variable trajectory, and at the same time provide a debugging patch submission interface and a debugging command input panel to the debugging control center module.

[0013] A further improvement of the present invention is that the device fingerprint recognition module includes:

[0014] The domain name structure building unit is used to construct a corresponding multi-level domain name tree structure based on the domain name fields extracted from the DNS traffic, TLS traffic and HTTP traffic passively collected by the IoT gateway. Each tree represents the domain name access path in a device session, nodes represent domain name levels and edges represent hierarchical relationships.

[0015] The feature optimization unit is used to calculate the weight value of each node based on the frequency of occurrence of each node in the device domain name tree structure and the node coverage in multiple device samples, and to perform node matrix dimensionality reduction based on the weight value, filter out subtrees with high structural redundancy, and generate a simplified tree structure feature vector for identification.

[0016] The similarity matching unit is used to map the tree structure feature vector to a preset device fingerprint space, perform similarity retrieval based on the locality sensitive hash algorithm and known device samples in the fingerprint vector library, and output the identity identifier and device type identifier of the target device.

[0017] A further improvement of the present invention is that the debugging control center module includes:

[0018] The instruction interception unit is used to insert instruction hooks for debugging agent activation instructions into the target device based on the Wasm runtime environment. It captures debugging-related instructions through the Hook mechanism, including but not limited to local variable acquisition instructions, function call instructions, or memory access offset instructions.

[0019] The state snapshot acquisition unit is used to construct the state node corresponding to the breakpoint event when the debugging instruction is triggered. The state node contains a four-tuple, which respectively represents the current instruction address, stack frame function identifier, variable mapping relationship and resource access permission.

[0020] The hot patch injection unit is used to dynamically generate replacement function bytecode fragments based on the target function specified in the debugging process, compile them into Wasm binary modules, and call the replacement function execution interface to replace the corresponding function implementation, thereby realizing function behavior injection and dynamic updates during the debugging process.

[0021] A further improvement of the present invention is that the lightweight debugging agent module includes:

[0022] The timing synchronization control unit is used to set the timing points for debugging acquisition with microsecond-level time accuracy based on a software and hardware collaboration mechanism after receiving the debugging agent activation command.

[0023] The runtime status acquisition unit is used to acquire the current program counter status, call stack information and variable mapping table of the target device at the time point, and construct runtime status data;

[0024] The stack structure parsing unit is used to reconstruct the function call path based on the call stack information and construct a call stack structure that includes stack frame boundary relationships.

[0025] The variable trajectory analysis unit is used to track the value change process of key variables based on the variable mapping table and historical instruction sequence, and generate variable trajectory data.

[0026] The debugging command execution unit is used to asynchronously parse and execute the debugging command while ensuring the continuous execution of the target device task, and output dynamic debugging feedback information.

[0027] A further improvement of the present invention is that the state graph modeling module includes:

[0028] The event-driven graphing unit is used to construct state nodes and record their associated events after each debug command is executed, based on the runtime state data, call stack structure and variable trajectory generated by the lightweight debug agent module.

[0029] The state transition modeling unit is used to generate weighted state transition edges based on the instruction execution order, variable change path, and stack switching between adjacent state nodes, thus forming a directed state graph.

[0030] The graph compression and extraction unit is used to perform path deduplication, edge weight fusion and node folding on the constructed state graph, and extract the smallest subgraph representing the key behavior pattern for loading and display by the visualization debugging front end.

[0031] A further improvement of the present invention is that the map compression and extraction unit includes the following steps:

[0032] Encode the debug context attributes of each state node into a state node vector:

[0033]

[0034] Among them: PC i This indicates the address of the program counter corresponding to this status node, used to identify the instruction execution location; f i This indicates the current function identifier, used to represent the function stack frame to which this node belongs; v i Indicates the variable mapping state; r iIndicates resource access permissions;

[0035] For any pair of state nodes (S) i ,S j Perform cosine similarity calculation on vectors between them:

[0036]

[0037] in: Represents the dot product of vectors; θ represents the Euclidean norm of each vector; i,j This represents the angle between two state nodes; when the calculation result satisfies cos(θ) i,j When the value is ≥0.95, the node pair is considered semantically redundant.

[0038] For node pairs that meet the similarity criteria, a merging process is performed. This process includes redirecting node identifiers, merging or transferring adjacent edges, and updating the graph structure to reduce the number of nodes and compress the overall complexity.

[0039] A further improvement of the present invention is that the distributed migration module includes:

[0040] The context serialization unit is used to encode the program counter value, function stack frame state, variable mapping information and breakpoint position in the current debug context data into a structured data packet. The context data comes from the runtime state data and breakpoint management information in the debug control center module.

[0041] The scheduling and transmission unit is used by the distributed task framework based on the HarmonyOS operating system to send structured data packets to the target device and complete cross-device transmission through the inter-device communication channel.

[0042] The state recovery unit is used to call the lightweight debugging agent module in the target device, parse the received data packets, and load the program counter, function stack frame state and variable mapping information to restore the corresponding debugging context on the target device side.

[0043] A further improvement of the present invention is that the visualization debugging front-end module includes:

[0044] The graph interaction interface unit is used to map the nodes and edge structures in the state graph into visual graphic elements, and supports abnormal path expansion based on user input events, abnormal node highlighting, state level color coding, and graph animation rendering.

[0045] The debugging control linkage unit is used to generate associated debugging control commands and call the debugging control central module to execute debugging instructions when the user selects a specific node or path segment.

[0046] The root cause feedback presentation unit is used to combine the weight evaluation results output by the root cause diagnosis module and highlight the abnormal starting nodes, path turning points or high-weight nodes in the graph interface. Users can also click on the nodes to view the abnormal causal chain path and triggering condition information.

[0047] A further improvement of the present invention is that the visualization debugging front-end module further includes:

[0048] The abnormal path reproduction module is used to drive the target device into the simulation execution mode based on the abnormal path data and variable trajectory information recorded in the state graph. It loads the corresponding program counter value, function stack frame state and variable snapshot step by step according to the abnormal path node sequence, and dynamically replays the abnormal triggering process.

[0049] The abnormal path reproduction module includes:

[0050] The path scheduling unit is used to schedule state switching instructions sequentially according to the ordered abnormal state nodes recorded in the graph.

[0051] The state loading unit is used to restore the program counter, call stack frame, and variable states according to the debugging context of each node;

[0052] The playback control unit is used to synchronously present each state transition and abnormal evolution process in the visualization front end, allowing users to reproduce, observe and analyze abnormal scenarios.

[0053] On the other hand, this invention provides a visual gateway debugging method based on the HarmonyOS operating system, including the following steps:

[0054] Step 1: Passively capture the DNS, TLS, and HTTP traffic of the IoT gateway, extract multi-level domain name features to construct a domain name forest fingerprint structure, and use the Locality Sensitive Hash (LSH) matching algorithm to generate device identity identifiers and device type identifiers;

[0055] Step 2: Send a debug agent activation command to the target IoT device based on the device identity identifier, encapsulate the debug command into a standardized debug command encapsulation protocol data packet, transmit it to the target device through a WebSocket connection and the HarmonyOS DSoftBus channel, and generate a debug operation event;

[0056] Step 3: In response to the debug agent activation command, collect the program counter status, stack status and variable table status of the target IoT device with microsecond-level time synchronization accuracy, generate runtime status data, call stack structure and variable trajectory, and parse and execute the transmitted debug commands while maintaining the continuous execution of device tasks.

[0057] Step 4: Receive the debugging operation events and runtime state data, construct a debugging state graph with state quadruples as nodes and operation triggering conditions as edges, perform compression processing on the graph and mark sensitive nodes;

[0058] Step 5: Serialize the debug context into migration data packets using the distributed task framework of the HarmonyOS operating system, transmit them across devices to the target IoT device, rebuild the breakpoint state on the target device and restore the stack state to the debug agent environment;

[0059] Step 6: Receive the debug status graph, call stack structure and variable trajectory, and display them graphically. At the same time, receive user instructions through the debug patch submission interface and debug command input panel, and feed back the debug patch or debug command submitted by the user to the debug control center for subsequent operations.

[0060] The beneficial effects of this invention are as follows: This invention achieves structured integration and technical improvements to key aspects of the entire debugging process in an IoT environment. By configuring a device fingerprint recognition module on the IoT gateway side, the system can extract multi-level domain name features based on passively captured DNS, TLS, and HTTP protocol traffic, construct a domain name forest fingerprint structure, and utilize locality-sensitive hashing (LSH) for efficient matching, achieving accurate identification of the target device's identity and type, significantly improving the accuracy and applicability of non-intrusive device identification. Furthermore, the system achieves standardized encapsulation and unified linking of debugging commands through a debugging control hub module, combining WebSocket connections with the HarmonyOS DSoftBus channel for transmission, solving the problems of link fragmentation and protocol incompatibility in existing debugging systems, and improving the stability and real-time performance of command issuance. The system embeds a lightweight debugging agent module in the target IoT device, enabling real-time acquisition of program counter status, stack status, and variable table status with microsecond-level synchronization accuracy without interrupting the execution of existing tasks, constructing runtime state data, call stack structure, and variable traces, achieving fine-grained observation of device behavior and immediate response to debugging commands. The collected debugging state data is processed by the state graph modeling module to construct a temporal state graph with state quadruples as nodes and operation trigger conditions as edges. Further graph compression and sensitive node marking are performed, compressing the graph structure while preserving the core evolution path, effectively reducing analysis complexity and improving the ability to identify critical debugging paths. To address multi-device collaborative operation scenarios, the system also integrates a distributed migration module. Relying on the distributed task framework of the HarmonyOS operating system, it structures and serializes the debugging context and constructs migration data packets for transmission between devices, enabling cross-device recovery of breakpoint states and stack states, effectively improving debugging continuity and system adaptability. Finally, through a visual debugging front-end module deployed on the remote control terminal, the system supports graphical display of the debugging state graph, call stack, and variable trajectory. Combined with debugging patch input and command linkage functions, it constructs a front-end environment with various interactive capabilities such as abnormal path expansion, root cause node highlighting, and animated evolution rendering, significantly improving the observability, operability, and interactivity of the debugging process. Attached Figure Description

[0061] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0062] in:

[0063] Figure 1 This is a modular diagram of the system of the present invention;

[0064] Figure 2 This is a flowchart of the method of the present invention. Detailed Implementation

[0065] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention 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 the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention are within the scope of protection of the present invention.

[0066] like Figure 1 As shown, this is an embodiment of the present invention, which provides a visual gateway debugging system based on the HarmonyOS operating system, including:

[0067] (1) Device fingerprint recognition module

[0068] Set in the IoT gateway, it is used to extract multi-level domain name features based on passively captured DNS traffic, TLS traffic and HTTP traffic, construct a domain name forest fingerprint structure, and output device identity and device type identifier through local sensitive hash matching algorithm;

[0069] In one embodiment, the device fingerprint recognition module includes:

[0070] The domain name structure building unit is used to construct a corresponding multi-level domain name tree structure based on the domain name fields extracted from the DNS traffic, TLS traffic and HTTP traffic passively collected by the IoT gateway. Each tree represents the domain name access path in a device session, nodes represent domain name levels and edges represent hierarchical relationships.

[0071] The feature optimization unit is used to calculate the weight value of each node based on the frequency of occurrence of each node in the device domain name tree structure and the node coverage in multiple device samples, and to perform node matrix dimensionality reduction based on the weight value, filter out subtrees with high structural redundancy, and generate a simplified tree structure feature vector for identification.

[0072] The similarity matching unit is used to map the tree structure feature vector to a preset device fingerprint space, perform similarity retrieval based on the locality sensitive hash algorithm and known device samples in the fingerprint vector library, and output the identity identifier and device type identifier of the target device.

[0073] In a further optimization scheme, the feature optimization unit in the device fingerprint recognition module employs a two-stage weighted strategy to significantly enhance the nodes of the domain name tree structure. In the first stage, node frequency analysis based on the TF-IDF model is used to calculate the weighted importance of nodes in a single device and the entire sample, thereby improving the discriminative contribution of rare nodes. In the second stage, principal component analysis (PCA) is used to perform dimensionality reduction on the node feature matrix, and similarity is determined by combining the cosine distance between nodes. A dynamic adaptive compression threshold is set to filter redundant subtree structures, thereby generating a tree-shaped fingerprint vector with high semantic discriminativeness and a simple structure.

[0074] Furthermore, during the similarity matching process, the similarity matching unit constructs a hash index space based on Locality Sensitive Hash (LSH) technology and combines it with a vector rotation perturbation mechanism to enhance recognition robustness. This supports quickly searching the feature library for candidate devices whose fingerprint vector similarity to the target device exceeds a set threshold, achieving high-precision device identity and type recognition under multi-source traffic. Compared to traditional MAC address or static field matching methods, this recognition mechanism has stronger anti-mutation capabilities and model generalization, making it particularly suitable for the passive identification and rapid classification of IoT devices in open network environments, improving the overall system recognition accuracy and debugging initialization efficiency.

[0075] (2) Debugging the control center module

[0076] Deployed on the IoT gateway, it is used to send a debug agent activation command to the target IoT device according to the device identity, encapsulate the debug command through a standardized debug command encapsulation protocol, and transmit the debug command through the HarmonyOS DSoftBus channel via WebSocket connection, while generating debug operation events;

[0077] In one embodiment, the debugging control center module includes:

[0078] The instruction interception unit is used to insert instruction hooks for debugging agent activation instructions into the target device based on the Wasm runtime environment. It captures debugging-related instructions through the Hook mechanism, including but not limited to local variable acquisition instructions, function call instructions, or memory access offset instructions.

[0079] The state snapshot acquisition unit is used to construct the state node corresponding to the breakpoint event when the debugging instruction is triggered. The state node contains a four-tuple, which respectively represents the current instruction address, stack frame function identifier, variable mapping relationship and resource access permission.

[0080] The hot patch injection unit is used to dynamically generate replacement function bytecode fragments based on the target function specified in the debugging process, compile them into Wasm binary modules, and call the replacement function execution interface to replace the corresponding function implementation, thereby realizing function behavior injection and dynamic updates during the debugging process.

[0081] In a further optimized implementation, the instruction interception unit in the debug control center module supports dynamic instruction selection and injection based on command priority and context matching strategies. Specifically, in the Wasm runtime environment, the debug control center can dynamically generate a command queue related to the current function scope during the debug session establishment phase based on the device identifier and debug state context, and set an instruction trigger threshold in the instruction interception unit to filter invalid instructions and redundant injection processes.

[0082] The state snapshot acquisition unit further supports the structured extraction of information such as register states, access permission masks, and function nesting levels from state nodes, and constructs node feature summaries through a state signature generator to facilitate node alignment and path reconstruction operations in the subsequent state graph module. After state acquisition is completed, the debugging control center can also generate a standardized debugging command encapsulation format based on the current command type, including instruction codes, trigger conditions, target function identifiers, and parameter structure descriptions, and uniformly transmit them through a WebSocket channel to ensure cross-platform debugging command structure consistency and reusability.

[0083] Furthermore, the hot patch injection unit supports dynamic type matching of the parameter signatures and return value structures of the replacement function, and automatically constructs a bridge function execution wrapper to adapt to the target function call stack frame, ensuring context integrity during function redirection. In a multi-module debugging environment, the hot patch injection unit can maintain a function mapping table and, in conjunction with an address relocation mechanism, achieve dynamic replacement and hot injection updates of the same function version across multiple debugging devices, thereby improving the inter-module portability of debugging command execution and the efficient response capability to local modifications.

[0084] (3) Lightweight debugging agent module

[0085] A lightweight debugging agent module is embedded in the target IoT device to respond to the debugging agent activation command, collect the program counter state, stack state and variable table state with microsecond-level time synchronization accuracy, generate runtime state data, call stack structure and variable trajectory, and parse and execute the debugging command while continuously executing device tasks;

[0086] In one embodiment, the lightweight debugging agent module includes:

[0087] The timing synchronization control unit is used to set the timing points for debugging acquisition with microsecond-level time accuracy based on a software and hardware collaboration mechanism after receiving the debugging agent activation command.

[0088] The runtime status acquisition unit is used to acquire the current program counter status, call stack information and variable mapping table of the target device at the time point, and construct runtime status data;

[0089] The stack structure parsing unit is used to reconstruct the function call path based on the call stack information and construct a call stack structure that includes stack frame boundary relationships.

[0090] The variable trajectory analysis unit is used to track the value change process of key variables based on the variable mapping table and historical instruction sequence, and generate variable trajectory data.

[0091] The debugging command execution unit is used to asynchronously parse and execute the debugging command while ensuring the continuous execution of the target device task, and output dynamic debugging feedback information.

[0092] (4) State Diagram Modeling Module

[0093] Logically connected to the IoT gateway, it is used to receive the debugging operation events and the runtime state data, construct and output a debugging state graph with state quadruples as nodes and operation triggering conditions as edges, and perform graph compression and sensitive node marking.

[0094] In one embodiment, the state graph modeling module includes:

[0095] The event-driven graphing unit is used to construct state nodes and record their associated events after each debug command is executed, based on the runtime state data, call stack structure and variable trajectory generated by the lightweight debug agent module.

[0096] The state transition modeling unit is used to generate weighted state transition edges based on the instruction execution order, variable change path, and stack switching between adjacent state nodes, thus forming a directed state graph.

[0097] The graph compression and extraction unit is used to perform path deduplication, edge weight fusion and node folding on the constructed state graph, and extract the smallest subgraph representing the key behavior pattern for loading and display by the visualization debugging front end.

[0098] In one specific embodiment, the map compression and extraction unit includes the following steps:

[0099] Encode the debug context attributes of each state node into a state node vector:

[0100]

[0101] Among them: PC i This indicates the address of the program counter corresponding to this status node, used to identify the instruction execution location; f i This indicates the current function identifier, used to represent the function stack frame to which this node belongs; v i Indicates the variable mapping state; r i Indicates resource access permissions;

[0102] For any pair of state nodes (S) i ,S j Perform cosine similarity calculation on vectors between them:

[0103]

[0104] in: Represents the dot product of vectors; θ represents the Euclidean norm of each vector; i,j This represents the angle between two state nodes; when the calculation result satisfies cos(θ) i,j When the value is ≥0.95, the node pair is considered semantically redundant.

[0105] For node pairs that meet the similarity criteria, a merging process is performed. This process includes redirecting node identifiers, merging or transferring adjacent edges, and updating the graph structure to reduce the number of nodes and compress the overall complexity.

[0106] In further optimization, to improve the compression quality and structural compactness of the state graph, the graph compression and extraction unit introduces a node semantic constraint mechanism and a dynamic path coverage adjustment strategy. Specifically, for each pair of state node vectors, in addition to satisfying the cosine similarity threshold, the system also calculates the Jaccard similarity of their corresponding context command sequences and sets a combined compression threshold. This ensures that both structural similarity and semantic proximity are satisfied before performing the node merging operation, avoiding the accidental merging of nodes with significantly different meanings due to structural compression, and guaranteeing the semantic consistency of the debugging path.

[0107] Furthermore, to reduce the impact of high-frequency similar paths on the map volume, the module maintains a path frequency histogram and performs statistical analysis on node in-degree and out-degree while constructing the directional state map. This identifies high-frequency but low-impact "path background noise segments" and automatically collapses them during the visualization front-end loading process. Collapsed paths retain their original link relationships and can be expanded when the user clicks for localized path tracing adjustments.

[0108] Furthermore, the state node encoding method supports the construction of state vectors based on multi-level feature fusion, where the program counter and function identifier constitute the main position vector, and the variable state is jointly represented as an auxiliary attribute group through hash digest and resource access permissions. The vector length and attribute encoding strategy can be dynamically adjusted according to the device type to adapt to the state alignment accuracy requirements under different operating environments.

[0109] By combining a structured compression strategy based on state vector representation, a semantic enhancement mechanism, and a path structure reduction method, the storage compression rate and key state highlighting capabilities of the graph are significantly improved, providing a high-quality graph foundation for subsequent graph-driven debugging analysis and path visual playback.

[0110] (5) Distributed migration module

[0111] A distributed task framework integrated into the HarmonyOS operating system is used to serialize the debugging context into migration data packets, transmit them across devices through the HarmonyOS device network, and reconstruct the breakpoint state and restore the stack state on the target device to the lightweight debugging agent module.

[0112] In one embodiment, the distributed migration module includes:

[0113] The context serialization unit is used to encode the program counter value, function stack frame state, variable mapping information and breakpoint position in the current debug context data into a structured data packet. The context data comes from the runtime state data and breakpoint management information in the debug control center module.

[0114] The scheduling and transmission unit is used by the distributed task framework based on the HarmonyOS operating system to send structured data packets to the target device and complete cross-device transmission through the inter-device communication channel.

[0115] The state recovery unit is used to call the lightweight debugging agent module in the target device, parse the received data packets, and load the program counter, function stack frame state and variable mapping information to restore the corresponding debugging context on the target device side.

[0116] (6) Visual debugging front-end module

[0117] Deployed at a remote control terminal, it is used to receive and graphically display the debug status graph, the call stack structure, and the variable trajectory, while providing a debug patch submission interface and a debug command input panel to the debug control center module.

[0118] In one embodiment, the visual debugging front-end module includes:

[0119] The graph interaction interface unit is used to map the nodes and edge structures in the state graph into visual graphic elements, and supports abnormal path expansion based on user input events, abnormal node highlighting, state level color coding, and graph animation rendering.

[0120] The debugging control linkage unit is used to generate associated debugging control commands and call the debugging control central module to execute debugging instructions when the user selects a specific node or path segment.

[0121] The root cause feedback presentation unit is used to combine the weight evaluation results output by the root cause diagnosis module and highlight the abnormal starting nodes, path turning points or high-weight nodes in the graph interface. Users can also click on the nodes to view the abnormal causal chain path and triggering condition information.

[0122] In one specific embodiment, the visual debugging front-end module further includes:

[0123] The abnormal path reproduction module is used to drive the target device into the simulation execution mode based on the abnormal path data and variable trajectory information recorded in the state graph. It loads the corresponding program counter value, function stack frame state and variable snapshot step by step according to the abnormal path node sequence, and dynamically replays the abnormal triggering process.

[0124] The abnormal path reproduction module includes:

[0125] The path scheduling unit is used to schedule state switching instructions sequentially according to the ordered abnormal state nodes recorded in the graph.

[0126] The state loading unit is used to restore the program counter, call stack frame, and variable states according to the debugging context of each node;

[0127] The playback control unit is used to synchronously present each state transition and abnormal evolution process in the visualization front end, allowing users to reproduce, observe and analyze abnormal scenarios.

[0128] In a further optimized implementation, the visual debugging front-end module also includes an abnormal behavior evolution control unit. This unit constructs a debugging evolution timeline based on the trigger timestamps of each state node in the playback path and the frequency of variable state changes. The state transitions, variable updates, and stack switching processes are then progressively replayed in an animated format within the visual interface, enhancing the perceptibility and interpretability of the abnormal evolution process. This unit supports playback at a user-defined rate, pause, or step-by-step progression of the path playback, assisting users in gradually analyzing the causes and key inflection points of the anomaly.

[0129] Furthermore, the path highlighting unit supports dynamically highlighting path segments based on user-selected path filtering conditions (such as variable name, function name, and exception level), and supports the overlay display of multiple paths, using a color overlay rendering method to distinguish the degree of path overlap, helping users focus on areas with dense exception states. Users can view the program counter, function identifier, variable snapshot summary, and trigger condition summary information of the current node through a floating tooltip, enabling a quick understanding of the exception behavior chain.

[0130] Furthermore, to support two-way debugging interaction, the front-end interface integrates a command input linkage panel, allowing users to pause any node during path playback and send patch commands or status query commands to the debugging control center module, forming a closed loop of debugging control: "path visualization - command linkage - status feedback". In addition, the front-end also supports quickly locating the status node with the highest root cause assessment score via the right-click menu of the graph, or expanding all causal paths corresponding to that node with one click, assisting users in anomaly root cause tracing analysis.

[0131] In summary, by integrating dynamic graph rendering, path playback control, and interactive command linkage mechanisms, the visual debugging front-end module can not only intuitively display the debugging state evolution process, but also has high human-computer interaction capabilities and feedback response capabilities, which greatly improves the debugging efficiency and user operation experience of IoT systems in complex scenarios.

[0132] like Figure 2 As shown, another embodiment of the present invention provides a visual gateway debugging method based on the HarmonyOS operating system, including the following steps:

[0133] Step 1: Passively capture the DNS, TLS, and HTTP traffic of the IoT gateway, extract multi-level domain name features to construct a domain name forest fingerprint structure, and use the Locality Sensitive Hash (LSH) matching algorithm to generate device identity identifiers and device type identifiers;

[0134] Step 2: Send a debug agent activation command to the target IoT device based on the device identity identifier, encapsulate the debug command into a standardized debug command encapsulation protocol data packet, transmit it to the target device through a WebSocket connection and the HarmonyOS DSoftBus channel, and generate a debug operation event;

[0135] Step 3: In response to the debug agent activation command, collect the program counter status, stack status and variable table status of the target IoT device with microsecond-level time synchronization accuracy, generate runtime status data, call stack structure and variable trajectory, and parse and execute the transmitted debug commands while maintaining the continuous execution of device tasks.

[0136] Step 4: Receive the debugging operation events and runtime state data, construct a debugging state graph with state quadruples as nodes and operation triggering conditions as edges, perform compression processing on the graph and mark sensitive nodes;

[0137] Step 5: Serialize the debug context into migration data packets using the distributed task framework of the HarmonyOS operating system, transmit them across devices to the target IoT device, rebuild the breakpoint state on the target device and restore the stack state to the debug agent environment;

[0138] Step 6: Receive the debug status graph, call stack structure and variable trajectory, and display them graphically. At the same time, receive user instructions through the debug patch submission interface and debug command input panel, and feed back the debug patch or debug command submitted by the user to the debug control center for subsequent operations.

[0139] In summary, this invention covers the entire debugging process, from passive device identification, debugging control linkage, and fine-grained acquisition of operational status, to state graph modeling and compression, distributed migration of debugging context, and front-end visual interactive playback. Through optimized design of the structural composition and collaborative mechanisms of each functional module, a system framework with a clear technical path, tight module connections, and well-defined functional boundaries is constructed. This solves problems existing in current technologies such as weak identification capabilities, coarse debugging granularity, fragmented link protocols, poor graph interactivity, and fragmented cross-device debugging. This system possesses significant engineering implementation potential and versatility, and can be widely applied to typical IoT environments such as smart homes, industrial control, and automotive edge nodes. It lays a solid foundation for subsequent multi-device collaborative debugging, automated anomaly tracking, and intelligent root cause diagnosis, and has broad prospects for industrial application and technological promotion value.

[0140] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.

[0141] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process. Furthermore, the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functionality involved.

[0142] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope disclosed in this application, and these should all be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A visual gateway debugging system based on the HarmonyOS operating system, characterized in that, Include: The device fingerprinting module is used to extract multi-level domain name features based on passively captured DNS traffic, TLS traffic, and HTTP traffic, construct a domain name forest fingerprint structure, and output device identity and device type identifiers through a locality-sensitive hash matching algorithm. The debugging control center module is used to issue a debugging agent activation command to the target IoT device according to the device identity identifier, encapsulate the debugging command through a standardized debugging command encapsulation protocol, and transmit the debugging command through the HarmonyOS DSoftBus channel based on the WebSocket connection, while generating debugging operation events. The lightweight debugging agent module is used to respond to the debugging agent activation command, collect the program counter status, stack status and variable table status of the target IoT device with microsecond-level time synchronization accuracy, generate runtime status data, call stack structure and variable trajectory, and parse and execute the debugging command while continuously executing device tasks; The state graph modeling module is used to receive the debugging operation event and the runtime state data, construct and output a debugging state graph with state quadruples as nodes and operation triggering conditions as edges, and perform graph compression and sensitive node marking. The distributed migration module is used to serialize the debug context into migration data packets, transmit them across devices through the HarmonyOS operating system device network, and reconstruct the breakpoint state and restore the stack state on the target IoT device to the lightweight debug agent module. The visual debugging front-end module is used to receive and graphically display the debugging status graph, the call stack structure and the variable trajectory, and at the same time provide a debugging patch submission interface and a debugging command input panel to the debugging control center module.

2. The visual gateway debugging system based on HarmonyOS according to claim 1, characterized in that, The device fingerprint recognition module includes: The domain name structure building unit is used to construct a corresponding multi-level domain name tree structure based on the domain name fields extracted from the DNS traffic, TLS traffic and HTTP traffic passively collected by the IoT gateway. Each tree represents the domain name access path in a device session, nodes represent domain name levels and edges represent hierarchical relationships. The feature optimization unit is used to calculate the weight value of each node based on the frequency of occurrence of each node in the multi-level domain name tree structure and the node coverage in multiple device samples, and to perform node matrix dimensionality reduction based on the weight value, filter out subtrees with high structural redundancy, and generate a simplified tree structure feature vector for identification. The similarity matching unit is used to map the simplified tree structure feature vector to a preset device fingerprint space, perform similarity retrieval based on the local sensitive hash matching algorithm and known device samples in the fingerprint vector library, and output the device identity identifier and device type identifier of the target IoT device.

3. The visual gateway debugging system based on HarmonyOS according to claim 1, characterized in that, The debugging control center module includes: The instruction interception unit is used to insert instruction hooks for debugging agent activation instructions into the target IoT device based on the Wasm runtime environment. It captures debugging-related instructions through the Hook mechanism, including but not limited to local variable acquisition instructions, function call instructions, or memory access offset instructions. The state snapshot acquisition unit is used to construct a state node corresponding to the breakpoint event when the debugging instruction is triggered. The state node contains a four-tuple, which respectively represents the current instruction address, stack frame function identifier, variable mapping relationship and resource access permission. The hot patch injection unit is used to dynamically generate replacement function bytecode fragments based on the target function specified in the debugging process, compile them into Wasm binary modules, and call the replacement function execution interface to replace the corresponding function implementation, thereby realizing function behavior injection and dynamic updates during the debugging process.

4. The visual gateway debugging system based on HarmonyOS according to claim 1, characterized in that, The lightweight debugging agent module includes: The timing synchronization control unit is used to set the timing points for debugging acquisition with microsecond-level time synchronization accuracy based on a software and hardware collaboration mechanism after receiving the debugging agent activation command. The runtime status acquisition unit is used to acquire the current program counter status, call stack information and variable mapping table of the target IoT device at the time point, and construct runtime status data. The stack structure parsing unit is used to reconstruct the function call path based on the call stack information and construct a call stack structure that includes stack frame boundary relationships. The variable trajectory analysis unit is used to track the value change process of key variables based on the variable mapping table and historical instruction sequence, and generate variable trajectory data. The debug command execution unit is used to asynchronously parse and execute the debug command while ensuring the continuous execution of the target IoT device task, and output dynamic debug feedback information.

5. A visual gateway debugging system based on the HarmonyOS operating system according to claim 1, characterized in that, The state graph modeling module includes: The event-driven graphing unit is used to construct state nodes and record their associated events after each debug command is executed, based on the runtime state data, call stack structure and variable trajectory generated by the lightweight debug agent module. The state transition modeling unit is used to generate weighted state transition edges based on the instruction execution order, variable change path and stack switching between adjacent state nodes, thus forming a debug state graph. The graph compression and extraction unit is used to perform path deduplication, edge weight fusion, and node folding on the constructed debug state graph, and extract the smallest subgraph representing key behavior patterns for loading and display by the visualization debug front end.

6. The visual gateway debugging system based on HarmonyOS according to claim 5, characterized in that, The map compression and extraction unit is used for: Encode the debug context attributes of each state node into a state node vector: ; in: This indicates the address of the program counter corresponding to the status node, used to identify the instruction execution location; This indicates the current function identifier, used to represent the function stack frame to which this node belongs; Indicates the variable mapping state; Indicates resource access permissions; For any pair of state nodes Perform cosine similarity calculation on the vectors between them: ; in: Represents the dot product of vectors; , Let Euclidean norm represent the vectors; This represents the angle between two state nodes; when the calculation result satisfies... When this happens, the node pair is determined to be semantically redundant; For node pairs that meet the similarity criteria, a merging process is performed. This process includes redirecting node identifiers, merging or transferring adjacent edges, and updating the graph structure to reduce the number of nodes and compress the overall complexity.

7. The visual gateway debugging system based on HarmonyOS according to claim 1, characterized in that, The distributed migration module includes: The context serialization unit is used to encode the program counter value, function stack frame state, variable mapping information and breakpoint position in the current debug context data into a structured data packet. The current debug context data comes from the runtime state data and breakpoint management information in the debug control center module. The scheduling and transmission unit is used by the distributed task framework based on the HarmonyOS operating system to send structured data packets to the target IoT device and complete cross-device transmission through the inter-device communication channel. The state recovery unit is used to call the lightweight debugging agent module in the target IoT device, parse the received data packets, and load the program counter, function stack frame state and variable mapping information to restore the corresponding debugging context on the target IoT device side.

8. The visual gateway debugging system based on HarmonyOS according to claim 1, characterized in that, The visual debugging front-end module includes: The graph interaction interface unit is used to map the nodes and edge structures in the debug status graph into visual graphic elements, and supports abnormal path expansion based on user input events, abnormal node highlighting, status level color coding, and graph animation rendering. The debugging control linkage unit is used to generate associated debugging control commands and call the debugging control central module to execute debugging instructions when the user selects a specific node or path segment. The root cause feedback presentation unit is used to highlight the abnormal starting node, path turning point or high weight node in the graph interface according to the weight evaluation results, and allows users to click on the node to view the abnormal causal chain path and triggering condition information.

9. A visual gateway debugging system based on HarmonyOS according to claim 8, characterized in that, The visual debugging front-end module also includes: The abnormal path reproduction module is used to drive the target IoT device into the simulation execution mode based on the abnormal path data and variable trajectory data recorded in the debug state graph. It loads the corresponding program counter value, function stack frame state and variable snapshot step by step according to the abnormal path node sequence, and dynamically replays the abnormal triggering process. The abnormal path reproduction module includes: The path scheduling unit is used to schedule state switching instructions sequentially according to the ordered abnormal state nodes recorded in the debugging state map. The state loading unit is used to restore the program counter, call stack frame, and variable states according to the debugging context of each node; The playback control unit is used to synchronously present each state transition and abnormal evolution process in the visualization front end, allowing users to reproduce, observe and analyze abnormal scenarios.

10. A debugging method for a visual gateway debugging system based on the HarmonyOS operating system according to any one of claims 1-9, characterized in that, Includes the following steps: Step 1: Passively capture the DNS, TLS, and HTTP traffic of the IoT gateway, extract multi-level domain name features to construct a domain name forest fingerprint structure, and use the Locality Sensitive Hash (LSH) matching algorithm to generate device identity identifiers and device type identifiers; Step 2: Send a debug agent activation command to the target IoT device based on the device identity identifier, encapsulate the debug command into a standardized debug command encapsulation protocol data packet, transmit it to the target IoT device through a WebSocket connection and the HarmonyOS DSoftBus channel, and generate a debug operation event; Step 3: In response to the debug agent activation command, collect the program counter status, stack status and variable table status of the target IoT device with microsecond-level time synchronization accuracy, generate runtime status data, call stack structure and variable trajectory, and parse and execute the transmitted debug commands while maintaining the continuous execution of device tasks. Step 4: Receive the debugging operation events and runtime state data, construct a debugging state graph with state quadruples as nodes and operation triggering conditions as edges, perform compression processing on the graph and mark sensitive nodes; Step 5: Serialize the debug context into migration data packets using the distributed task framework of the HarmonyOS operating system, transmit them across devices to the target IoT device, rebuild the breakpoint state on the target IoT device and restore the stack state to the debug agent environment; Step 6: Receive the debug status graph, call stack structure and variable trajectory, and display them graphically. At the same time, receive user instructions through the debug patch submission interface and debug command input panel, and feed back the debug patch or debug command submitted by the user to the debug control center for subsequent operations.

Citation Information

Patent Citations

  • CN120317626A