1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//! # JSON Interface
//!
//! Provides a JSON-based interface for interacting with the Coreminer debugger.
//!
//! This module implements the [`DebuggerUI`] trait to provide a programmatic
//! JSON interface suitable for integration with other tools or remote debugging
//! sessions. It communicates with clients by:
//!
//! - Reading JSON-formatted commands from stdin
//! - Writing JSON-formatted feedback to stdout
//! - Supporting the same debugging operations as the CLI interface
//!
//! This interface enables automation and integration with external tools
//! that can communicate via JSON.
use ;
use ;
use json;
use ;
use crateResult;
use crateFeedback;
use ;
/// Input command structure for JSON interface
///
/// This structure defines the format of commands sent to the debugger
/// via the JSON interface.
///
/// # Examples
///
/// ```
/// use coreminer::ui::json::Input;
/// use coreminer::feedback::Status;
/// use coreminer::addr::Addr;
/// use serde_json::json;
///
/// let json = json!({
/// "status": {
/// "SetBreakpoint": 21958295
/// }
/// });
///
/// let input: Input = serde_json::from_value(json).unwrap();
/// // Now input.status contains Status::SetBreakpoint(Addr::from(4194304usize))
/// ```
/// JSON-based interface for the debugger
///
/// Implements the [`DebuggerUI`] trait to provide a JSON-based interface
/// for the debugger suitable for programmatic or remote use.
///
/// # Examples
///
/// ```no_run
/// use coreminer::ui::json::JsonUI;
/// use coreminer::ui::DebuggerUI;
/// use coreminer::feedback::Feedback;
///
/// // Create a JSON UI
/// let mut ui = JsonUI::build().unwrap();
///
/// // Process feedback from the debugger with user input
/// let status = ui.process(Feedback::Ok).unwrap();
/// ```
;