1 /** @file
2 
3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5 
6 
7 **/
8 
9 #include "Edb.h"
10 
11 
12 /**
13 
14   DebuggerCommand - BreakOnCALL.
15 
16   @param  CommandArg          The argument for this command
17   @param  DebuggerPrivate     EBC Debugger private data structure
18   @param  ExceptionType       Exception type.
19   @param  SystemContext       EBC system context.
20 
21   @retval EFI_DEBUG_CONTINUE  formal return value
22 
23 **/
24 EFI_DEBUG_STATUS
DebuggerBreakOnCALL(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)25 DebuggerBreakOnCALL (
26   IN     CHAR16                    *CommandArg,
27   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
28   IN     EFI_EXCEPTION_TYPE        ExceptionType,
29   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
30   )
31 {
32   //
33   // Check argument
34   //
35   if (CommandArg == NULL) {
36     if ((DebuggerPrivate->FeatureFlags & EFI_DEBUG_FLAG_EBC_BOC) == EFI_DEBUG_FLAG_EBC_BOC) {
37       EDBPrint (L"BOC on\n");
38     } else {
39       EDBPrint (L"BOC off\n");
40     }
41   } else if (StriCmp (CommandArg, L"on") == 0) {
42     DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_BOC;
43     EDBPrint (L"BOC on\n");
44   } else if (StriCmp (CommandArg, L"off") == 0) {
45     DebuggerPrivate->FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_BOC;
46     EDBPrint (L"BOC off\n");
47   } else {
48     EDBPrint (L"BOC - argument error\n");
49   }
50 
51   //
52   // Done
53   //
54   return EFI_DEBUG_CONTINUE;
55 }
56 
57 /**
58 
59   DebuggerCommand    BreakOnCALLEX.
60 
61 
62   @param  CommandArg           The argument for this command
63   @param  DebuggerPrivate      EBC Debugger private data structure
64   @param  ExceptionType        Exceptiont type.
65   @param  SystemContext        EBC system context.
66 
67   @retval EFI_DEBUG_CONTINUE   formal return value
68 
69 **/
70 EFI_DEBUG_STATUS
DebuggerBreakOnCALLEX(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)71 DebuggerBreakOnCALLEX (
72   IN     CHAR16                    *CommandArg,
73   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
74   IN     EFI_EXCEPTION_TYPE        ExceptionType,
75   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
76   )
77 {
78   //
79   // Check argument
80   //
81   if (CommandArg == NULL) {
82     if ((DebuggerPrivate->FeatureFlags & EFI_DEBUG_FLAG_EBC_BOCX) == EFI_DEBUG_FLAG_EBC_BOCX) {
83       EDBPrint (L"BOCX on\n");
84     } else {
85       EDBPrint (L"BOCX off\n");
86     }
87   } else if (StriCmp (CommandArg, L"on") == 0) {
88     DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_BOCX;
89     EDBPrint (L"BOCX on\n");
90   } else if (StriCmp (CommandArg, L"off") == 0) {
91     DebuggerPrivate->FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_BOCX;
92     EDBPrint (L"BOCX off\n");
93   } else {
94     EDBPrint (L"BOCX - argument error\n");
95   }
96 
97   //
98   // Done
99   //
100   return EFI_DEBUG_CONTINUE;
101 }
102 
103 /**
104 
105   DebuggerCommand - BreakOnRET.
106 
107 
108   @param  CommandArg          The argument for this command
109   @param  DebuggerPrivate     EBC Debugger private data structure
110   @param  ExceptionType       Exception type.
111   @param  SystemContext       EBC system context.
112 
113   @retval EFI_DEBUG_CONTINUE  formal return value
114 
115 **/
116 EFI_DEBUG_STATUS
DebuggerBreakOnRET(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)117 DebuggerBreakOnRET (
118   IN     CHAR16                    *CommandArg,
119   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
120   IN     EFI_EXCEPTION_TYPE        ExceptionType,
121   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
122   )
123 {
124   //
125   // Check argument
126   //
127   if (CommandArg == NULL) {
128     if ((DebuggerPrivate->FeatureFlags & EFI_DEBUG_FLAG_EBC_BOR) == EFI_DEBUG_FLAG_EBC_BOR) {
129       EDBPrint (L"BOR on\n");
130     } else {
131       EDBPrint (L"BOR off\n");
132     }
133   } else if (StriCmp (CommandArg, L"on") == 0) {
134     DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_BOR;
135     EDBPrint (L"BOR on\n");
136   } else if (StriCmp (CommandArg, L"off") == 0) {
137     DebuggerPrivate->FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_BOR;
138     EDBPrint (L"BOR off\n");
139   } else {
140     EDBPrint (L"BOR - argument error\n");
141   }
142 
143   //
144   // Done
145   //
146   return EFI_DEBUG_CONTINUE;
147 }
148 
149 /**
150 
151   DebuggerCommand - BreakOnEntrypoint.
152 
153 
154   @param  CommandArg           The argument for this command
155   @param  DebuggerPrivate      EBC Debugger private data structure
156   @param  ExceptionType        Exception type.
157   @param  SystemContext        EBC system context.
158 
159   @retval EFI_DEBUG_CONTINUE   formal return value
160 
161 **/
162 EFI_DEBUG_STATUS
DebuggerBreakOnEntrypoint(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)163 DebuggerBreakOnEntrypoint (
164   IN     CHAR16                    *CommandArg,
165   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
166   IN     EFI_EXCEPTION_TYPE        ExceptionType,
167   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
168   )
169 {
170   //
171   // Check argument
172   //
173   if (CommandArg == NULL) {
174     if ((DebuggerPrivate->FeatureFlags & EFI_DEBUG_FLAG_EBC_BOE) == EFI_DEBUG_FLAG_EBC_BOE) {
175       EDBPrint (L"BOE on\n");
176     } else {
177       EDBPrint (L"BOE off\n");
178     }
179   } else if (StriCmp (CommandArg, L"on") == 0) {
180     DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_BOE;
181     EDBPrint (L"BOE on\n");
182   } else if (StriCmp (CommandArg, L"off") == 0) {
183     DebuggerPrivate->FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_BOE;
184     EDBPrint (L"BOE off\n");
185   } else {
186     EDBPrint (L"BOE - argument error\n");
187   }
188 
189   //
190   // Done
191   //
192   return EFI_DEBUG_CONTINUE;
193 }
194 
195 /**
196 
197 
198   DebuggerCommand - BreakOnThunk.
199 
200 
201   @param  CommandArg          The argument for this command
202   @param  DebuggerPrivate     EBC Debugger private data structure
203   @param  ExceptionType       Exception type.
204   @param  SystemContext       EBC system context.
205 
206 
207   @retval EFI_DEBUG_CONTINUE  formal return value
208 
209 **/
210 EFI_DEBUG_STATUS
DebuggerBreakOnThunk(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)211 DebuggerBreakOnThunk (
212   IN     CHAR16                    *CommandArg,
213   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
214   IN     EFI_EXCEPTION_TYPE        ExceptionType,
215   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
216   )
217 {
218   //
219   // Check argument
220   //
221   if (CommandArg == NULL) {
222     if ((DebuggerPrivate->FeatureFlags & EFI_DEBUG_FLAG_EBC_BOT) == EFI_DEBUG_FLAG_EBC_BOT) {
223       EDBPrint (L"BOT on\n");
224     } else {
225       EDBPrint (L"BOT off\n");
226     }
227   } else if (StriCmp (CommandArg, L"on") == 0) {
228     DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_BOT;
229     EDBPrint (L"BOT on\n");
230   } else if (StriCmp (CommandArg, L"off") == 0) {
231     DebuggerPrivate->FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_BOT;
232     EDBPrint (L"BOT off\n");
233   } else {
234     EDBPrint (L"BOT - argument error\n");
235   }
236 
237   //
238   // Done
239   //
240   return EFI_DEBUG_CONTINUE;
241 }
242 
243 /**
244 
245   DebuggerCommand - BreakOnKey.
246 
247 
248   @param  CommandArg           The argument for this command
249   @param  DebuggerPrivate      EBC Debugger private data structure
250   @param  ExceptionType        Exception type.
251   @param  SystemContext        EBC system context.
252 
253 
254   @retval EFI_DEBUG_CONTINUE   formal return value
255 
256 **/
257 EFI_DEBUG_STATUS
DebuggerBreakOnKey(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)258 DebuggerBreakOnKey (
259   IN     CHAR16                    *CommandArg,
260   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
261   IN     EFI_EXCEPTION_TYPE        ExceptionType,
262   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
263   )
264 {
265   //
266   // Check argument
267   //
268   if (CommandArg == NULL) {
269     if ((DebuggerPrivate->FeatureFlags & EFI_DEBUG_FLAG_EBC_BOK) == EFI_DEBUG_FLAG_EBC_BOK) {
270       EDBPrint (L"BOK on\n");
271     } else {
272       EDBPrint (L"BOK off\n");
273     }
274   } else if (StriCmp (CommandArg, L"on") == 0) {
275     DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_BOK;
276     EDBPrint (L"BOK on\n");
277   } else if (StriCmp (CommandArg, L"off") == 0) {
278     DebuggerPrivate->FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_BOK;
279     EDBPrint (L"BOK off\n");
280   } else {
281     EDBPrint (L"BOK - argument error\n");
282   }
283 
284   //
285   // Done
286   //
287   return EFI_DEBUG_CONTINUE;
288 }
289