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