]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.c
MdeModulePkg/EbcDxe: Fix incorrect Copyright format
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcDebugger / EdbCommand.c
CommitLineData
e8a5ac7c 1/** @file\r
748edcd5 2\r
f42f22f5 3Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
e8a5ac7c 4This program and the accompanying materials\r
748edcd5
PB
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
748edcd5 12\r
e8a5ac7c 13**/\r
748edcd5
PB
14\r
15#include "Edb.h"\r
16\r
17//\r
18// Debugger Command Table\r
19//\r
20EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {\r
21 //\r
22 // Execution\r
23 //\r
24 {\r
25 L"G",\r
26 L"G/[F5] - continue to run the program\n",\r
27 L"The go command is used to cause the debugger to not interrupt execution of the EBC image. The debugger will only break execution of the interpreter if an exception is encountered (including an EBC breakpoint).\n\n",\r
28 L"G [til <Address|Symbol>]\n"\r
29 L" (No Argument) - It means continue run the program.\n"\r
30 L" til - It means continuing run the program till IP is the Address.\n"\r
31 L" <Address> - The hexical address user want to break at.\n"\r
32 L" <Symbol> - The symbol name for target address user want to break at. It has following format [MapFileName:]SymbolName\n",\r
33 L"Execution:\n",\r
34 {SCAN_F5, CHAR_NULL},\r
35 DebuggerGo\r
36 },\r
37 {\r
38 L"T",\r
39 L"T/[F8] - step into\n",\r
40 L"The step into command will cause the EBC debugger to step a single instruction. If the instruction is a call to internal code (CALL), then the debugger will break at the new function CALL.\n\n",\r
41 L"T\n"\r
42 L" (No Argument)\n",\r
43 L"",\r
44 {SCAN_F8, CHAR_NULL},\r
45 DebuggerStepInto\r
46 },\r
47 {\r
48 L"P",\r
49 L"P/[F10] - step over\n",\r
50 L"The step over command will cause the EBC debugger to step a single instruction. If the instruction is a call to internal code (CALL), then the external call will be made and the debugger will break at the instruction following the CALL.\n\n",\r
51 L"P\n"\r
52 L" (No Argument)\n",\r
53 L"",\r
54 {SCAN_F10, CHAR_NULL},\r
55 DebuggerStepOver\r
56 },\r
57 {\r
58 L"O",\r
59 L"O/[F11] - step out\n",\r
60 L"The step out command causes the EBC debugger to step out function calls. The function will be executed, but the debugger will stop after the called function returns.\n\n",\r
61 L"O\n"\r
62 L" (No Argument)\n",\r
63 L"",\r
64 {SCAN_F11, CHAR_NULL},\r
65 DebuggerStepOut\r
66 },\r
67 {\r
68 L"Q",\r
69 L"Q - reset the debugger to default value and go\n",\r
70 L"The quit command will reset the debugger to default value and go.\n\n",\r
71 L"Q\n"\r
72 L" (No Argument)\n",\r
73 L"",\r
74 {SCAN_NULL, CHAR_NULL},\r
75 DebuggerQuit\r
76 },\r
77 //\r
78 // Break\r
79 //\r
80 {\r
81 L"BOC",\r
82 L"BO[C|CX|R|E|T|K] - break on CALL/CALLEX/RET/Entrypoint/Native Thunk/Key\n",\r
83 L"Enabling break-on-call will cause the debugger to halt execution and display the debugger prompt prior to executing any EBC CALL (to EBC) instructions.\n\n",\r
84 L"BOC [on|off]\n"\r
85 L" (No Argument) - show current state\n"\r
86 L" on - enable break-on-call\n"\r
87 L" off - disable break-on-call\n",\r
88 L"Break:\n",\r
89 {SCAN_NULL, CHAR_NULL},\r
90 DebuggerBreakOnCALL\r
91 },\r
92 {\r
93 L"BOCX",\r
94 L"",\r
95 L"Enabling break-on-callex will cause the debugger to halt execution and display the debugger prompt prior to executing EBC CALLEX (thunk out) instructions.\n\n",\r
96 L"BOCX [on|off]\n"\r
97 L" (No Argument) - show current state\n"\r
98 L" on - enable break-on-callex\n"\r
99 L" off - disable break-on-callex\n",\r
100 L"",\r
101 {SCAN_NULL, CHAR_NULL},\r
102 DebuggerBreakOnCALLEX\r
103 },\r
104 {\r
105 L"BOR",\r
106 L"",\r
107 L"Enabling break-on-return will cause the debugger to halt execution and display the debugger prompt prior to executing EBC RET instructions.\n\n",\r
108 L"BOR [on|off]\n"\r
109 L" (No Argument) - show current state\n"\r
110 L" on - enable break-on-return\n"\r
111 L" off - disable break-on-return\n",\r
112 L"",\r
113 {SCAN_NULL, CHAR_NULL},\r
114 DebuggerBreakOnRET\r
115 },\r
116 {\r
117 L"BOE",\r
118 L"",\r
119 L"Enabling break-on-entrypoint will cause the debugger to halt execution and display the debugger prompt prior to start a driver entry point. (Default is on)\n\n",\r
120 L"BOE [on|off]\n"\r
121 L" (No Argument) - show current state\n"\r
122 L" on - enable break-on-entrypoint\n"\r
123 L" off - disable break-on-entrypoint\n",\r
124 L"",\r
125 {SCAN_NULL, CHAR_NULL},\r
126 DebuggerBreakOnEntrypoint\r
127 },\r
128 {\r
129 L"BOT",\r
130 L"",\r
131 L"Enabling break-on-thunk will cause the debugger to halt execution and display the debugger prompt prior to start native call EBC thunk. (Default is on)\n\n",\r
132 L"BOT [on|off]\n"\r
133 L" (No Argument) - show current state\n"\r
134 L" on - enable break-on-thunk\n"\r
135 L" off - disable break-on-thunk\n",\r
136 L"",\r
137 {SCAN_NULL, CHAR_NULL},\r
138 DebuggerBreakOnThunk\r
139 },\r
140 {\r
141 L"BOK",\r
142 L"",\r
143 L"Enabling break-on-key will cause the debugger to halt execution and display the debugger prompt after press any key.\n\n",\r
144 L"BOK [on|off]\n"\r
145 L" (No Argument) - show current state\n"\r
146 L" on - enable break-on-key\n"\r
147 L" off - disable break-on-key\n",\r
148 L"",\r
149 {SCAN_NULL, CHAR_NULL},\r
150 DebuggerBreakOnKey\r
151 },\r
152 {\r
153 L"BL",\r
154 L"B[L|P|C|D|E] - breakpoint list/set/clear/disable/enable\n",\r
155 L"List Breakpoint\n\n",\r
156 L"BL\n"\r
157 L" (No Argument) - show the state for current breakpoint\n",\r
158 L"",\r
159 {SCAN_NULL, CHAR_NULL},\r
160 DebuggerBreakpointList\r
161 },\r
162 {\r
163 L"BP",\r
164 L"",\r
165 L"Set Breakpoint\n\n",\r
166 L"BP <Address|Symbol>\n"\r
167 L" <Address> - Hexical breakpoint address\n"\r
168 L" <Symbol> - Symbol name for breakpoint address. It has following format [MapFileName:]SymbolName.\n",\r
169 L"",\r
170 {SCAN_NULL, CHAR_NULL},\r
171 DebuggerBreakpointSet\r
172 },\r
173 {\r
174 L"BC",\r
175 L"",\r
176 L"Clear Breakpoint\n\n",\r
177 L"BC <Index>|*\n"\r
178 L" <Index> - Decimal breakpoint index, which can be got from BL command\n"\r
179 L" * - For all the breakpoint\n",\r
180 L"",\r
181 {SCAN_NULL, CHAR_NULL},\r
182 DebuggerBreakpointClear\r
183 },\r
184 {\r
185 L"BD",\r
186 L"",\r
187 L"Disable Breakpoint\n\n",\r
188 L"BD <Index>|*\n"\r
189 L" <Index> - Decimal breakpoint index, which can be got from BL command\n"\r
190 L" * - For all the breakpoint\n",\r
191 L"",\r
192 {SCAN_NULL, CHAR_NULL},\r
193 DebuggerBreakpointDisable\r
194 },\r
195 {\r
196 L"BE",\r
197 L"",\r
198 L"Enable Breakpoint\n\n",\r
199 L"BE <Index>|*\n"\r
200 L" <Index> - Decimal breakpoint index, which can be got from BL command\n"\r
201 L" * - For all the breakpoint\n",\r
202 L"",\r
203 {SCAN_NULL, CHAR_NULL},\r
204 DebuggerBreakpointEnable\r
205 },\r
206 //\r
207 // Information\r
208 //\r
209 {\r
210 L"K",\r
211 L"K - show/clear call-stack\n",\r
212 L"The call-stack command will show or clear the current call-stack.\n\n",\r
213 L"K [p [<ParameterNum>]|c]\n"\r
214 L" (No Argument) - Show current call-stack\n"\r
215 L" p - Show current call-stack with parameters\n"\r
216 L" ParameterNum - Decimal call-stack parameters number, 8 by default, 16 as max\n"\r
217 L" c - Clear current call-stack\n",\r
218 L"Information:\n",\r
219 {SCAN_NULL, CHAR_NULL},\r
220 DebuggerCallStack\r
221 },\r
222 {\r
223 L"TRACE",\r
224 L"TRACE - show/clear trace instruction branch\n",\r
225 L"The trace command will show or clear the latest instruction branch.\n\n",\r
226 L"TRACE [c]\n"\r
227 L" (No Argument) - Show current instrcution branch\n"\r
228 L" c - Clear current instruction branch\n",\r
229 L"",\r
230 {SCAN_NULL, CHAR_NULL},\r
231 DebuggerInstructionBranch\r
232 },\r
233 {\r
234 L"R",\r
235 L"R/[F2] - display/modify register\n",\r
236 L"The register command is used to display or modify the contents of EBC VM registers. (R0~R7, Flags, IP)\n\n",\r
237 L"R [<Register> <Value>]\n"\r
238 L" (No Argument) - Display all registers\n"\r
239 L" <Register> - EBC VM register name (R0~R7, Flags, ControlFlags, and IP\n"\r
240 L" <Value> - The Hexical value of register\n",\r
241 L"",\r
242 {SCAN_F2, CHAR_NULL},\r
243 DebuggerRegister\r
244 },\r
245 {\r
246 L"L",\r
247 L"L/[F4] - show/load instruction assembly count\n",\r
248 L"The list assembly command will disassemble instructions starting with the current EBC VM instruction pointer. (by default 5 instructions)\n\n",\r
249 L"L [<Count>]\n"\r
250 L" (No Argument) - List current assembly code\n"\r
251 L" Count - The decimal instruction assembly count\n",\r
252 L"",\r
253 {SCAN_F4, CHAR_NULL},\r
254 DebuggerList\r
255 },\r
256 {\r
257 L"SCOPE",\r
258 L"SCOPE - load scope address\n",\r
259 L"The scope command will disassemble instructions starting with the Scope. (by default current EBC VM IP)\n\n",\r
260 L"SCOPE <Address|Symbol>\n"\r
261 L" <Address> - The Hexical address where user wants to see the assembly code\n"\r
262 L" <Symbol> - Symbol name for scope address. It has following format [MapFileName:]SymbolName.\n",\r
263 L"",\r
264 {SCAN_NULL, CHAR_NULL},\r
265 DebuggerScope\r
266 },\r
267 {\r
268 L"DB",\r
269 L"[D|E][B|W|D|Q] - display/modify memory\n",\r
270 L"Display BYTES Memory\n\n",\r
271 L"DB <Address|Symbol> [<Count>]\n"\r
272 L" <Address> - The hexical memory address\n"\r
273 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
274 L" <Count> - The hexical memory count (not set means 1)\n",\r
275 L"",\r
276 {SCAN_NULL, CHAR_NULL},\r
277 DebuggerMemoryDB\r
278 },\r
279 {\r
280 L"DW",\r
281 L"",\r
282 L"Display WORDS Memory\n\n",\r
283 L"DW <Address|Symbol> [<Count>]\n"\r
284 L" <Address> - The hexical memory address\n"\r
285 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
286 L" <Count> - The hexical memory count (not set means 1)\n",\r
287 L"",\r
288 {SCAN_NULL, CHAR_NULL},\r
289 DebuggerMemoryDW\r
290 },\r
291 {\r
292 L"DD",\r
293 L"",\r
294 L"Display DWORDS Memory\n\n",\r
295 L"DD <Address|Symbol> [<Count>]\n"\r
296 L" <Address> - The hexical memory address\n"\r
297 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
298 L" <Count> - The hexical memory count (not set means 1)\n",\r
299 L"",\r
300 {SCAN_NULL, CHAR_NULL},\r
301 DebuggerMemoryDD\r
302 },\r
303 {\r
304 L"DQ",\r
305 L"",\r
306 L"Display QWORDS Memory\n\n",\r
307 L"DQ <Address|Symbol> [<Count>]\n"\r
308 L" <Address> - The hexical memory address\n"\r
309 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
310 L" <Count> - The hexical memory count (not set means 1)\n",\r
311 L"",\r
312 {SCAN_NULL, CHAR_NULL},\r
313 DebuggerMemoryDQ\r
314 },\r
315 {\r
316 L"EB",\r
317 L"",\r
318 L"Enter BYTES Memory\n\n",\r
319 L"EB <Address|Symbol> <Value>\n"\r
320 L" <Address> - The hexical memory address\n"\r
321 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
322 L" <Value> - The hexical memory value\n",\r
323 L"",\r
324 {SCAN_NULL, CHAR_NULL},\r
325 DebuggerMemoryEB\r
326 },\r
327 {\r
328 L"EW",\r
329 L"",\r
330 L"Enter WORDS Memory\n\n",\r
331 L"EW <Address|Symbol> <Value>\n"\r
332 L" <Address> - The hexical memory address\n"\r
333 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
334 L" <Value> - The hexical memory value\n",\r
335 L"",\r
336 {SCAN_NULL, CHAR_NULL},\r
337 DebuggerMemoryEW\r
338 },\r
339 {\r
340 L"ED",\r
341 L"",\r
342 L"Enter DWORDS Memory\n\n",\r
343 L"ED <Address|Symbol> <Value>\n"\r
344 L" <Address> - The hexical memory address\n"\r
345 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
346 L" <Value> - The hexical memory value\n",\r
347 L"",\r
348 {SCAN_NULL, CHAR_NULL},\r
349 DebuggerMemoryED\r
350 },\r
351 {\r
352 L"EQ",\r
353 L"",\r
354 L"Enter QWORDS Memory\n\n",\r
355 L"EQ <Address|Symbol> <Value>\n"\r
356 L" <Address> - The hexical memory address\n"\r
357 L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"\r
358 L" <Value> - The hexical memory value\n",\r
359 L"",\r
360 {SCAN_NULL, CHAR_NULL},\r
361 DebuggerMemoryEQ\r
362 },\r
363 //\r
364 // Symbol\r
365 //\r
366 {\r
367 L"LN",\r
368 L"LN - list the symbol\n",\r
369 L"The show symbol command will list all the current symbol. It can list the symbol in one symbol file, or list the same symbol in all the files. It can also list the symbol according to nearest address.\n\n",\r
370 L"LN [[F <SymbolFile>] [S <Symbol>]] | <Address>\n"\r
371 L" (No Argument) - List all the symbol\n"\r
372 L" F <SymbolFile> - List the symbol in this symbol file only\n"\r
373 L" S <Symbol> - List this symbol only\n"\r
374 L" <Address> - The hexical memory address, which user want to find the symbol for.\n",\r
375 L"Symbol:\n",\r
376 {SCAN_NULL, CHAR_NULL},\r
377 DebuggerListSymbol\r
378 },\r
379 {\r
380 L"LOADSYMBOL",\r
381 L"[UN]LOADSYMBOL - load/unload the symbol file\n",\r
382 L"The load symbol command will load the ebc map file. Then it parses the function name and global variable, and the print real name when do the disassembly. (Symbol file name should be XXX.MAP)\n\n",\r
383 L"LOADSYMBOL <SymbolFile> [a]\n"\r
384 L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n"\r
385 L" a - Automatically load code files in the same dir\n",\r
386 L"",\r
387 {SCAN_NULL, CHAR_NULL},\r
388 DebuggerLoadSymbol\r
389 },\r
390 {\r
391 L"UNLOADSYMBOL",\r
392 L"",\r
393 L"The unload symbol command will unload the ebc map and cod file. After that the name will not be print.\n\n",\r
394 L"UNLOADSYMBOL <SymbolFile>\n"\r
395 L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n",\r
396 L"",\r
397 {SCAN_NULL, CHAR_NULL},\r
398 DebuggerUnloadSymbol\r
399 },\r
400 {\r
401 L"LOADCODE",\r
402 L"[UN]LOADCODE - load/unload the code file\n",\r
403 L"The load code command will load the ebc cod file. Then it parses the cod file, and the print source code when do the disassembly. (Code file name should be XXX.COD)\n\n",\r
404 L"LOADCODE <CodeFile> <SymbolFile>\n"\r
405 L" CodeFile - The EBC code file (Its name should be XXX.COD)\n"\r
406 L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n",\r
407 L"",\r
408 {SCAN_NULL, CHAR_NULL},\r
409 DebuggerLoadCode\r
410 },\r
411 {\r
412 L"UNLOADCODE",\r
413 L"",\r
414 L"The unload code command will unload the ebc cod file. After that the source code will not be print.\n\n",\r
415 L"UNLOADCODE <CodeFile> <SymbolFile>\n"\r
416 L" CodeFile - The EBC code file (Its name should be XXX.COD)\n"\r
417 L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n",\r
418 L"",\r
419 {SCAN_NULL, CHAR_NULL},\r
420 DebuggerUnloadCode\r
421 },\r
422 {\r
423 L"DISPLAYSYMBOL",\r
424 L"DISPLAYSYMBOL/[F3] - disable/enable the symbol output\n",\r
425 L"",\r
426 L"The display symbol command will configure the symbol show or not-show when disassembly.\n\n"\r
427 L"DISPLAYSYMBOL [on|off]\n"\r
428 L" (No Argument) - swtich symbol output state to another one\n"\r
429 L" on - enable symbol output\n"\r
430 L" off - disable symbol output\n",\r
431 L"",\r
432 {SCAN_F3, CHAR_NULL},\r
433 DebuggerDisplaySymbol\r
434 },\r
435 {\r
436 L"DISPLAYCODE",\r
437 L"DISPLAYCODE/[F6] - disable/enable the source code only output\n",\r
438 L"",\r
439 L"The display code command will configure the source code only show or misc source code with assembly.\n\n"\r
440 L"DISPLAYCODE [on|off]\n"\r
441 L" (No Argument) - swtich source only output state to another one\n"\r
442 L" on - enable source only output\n"\r
443 L" off - disable source only output\n",\r
444 L"",\r
445 {SCAN_F6, CHAR_NULL},\r
446 DebuggerDisplayCode\r
447 },\r
448 //\r
449 // Other\r
450 //\r
451 {\r
452 L"H",\r
453 L"",\r
454 L"The help command will print help information for each command\n\n",\r
455 L"H [<Command>]\n",\r
456 L"",\r
457 {SCAN_F1, CHAR_NULL},\r
458 DebuggerHelp\r
459 },\r
460/*\r
461 //\r
462 // Extended\r
463 //\r
464 {\r
465 L"!IB",\r
466 L"![I|O][B|W|D] - display/modify IO\n",\r
467 L"",\r
468 L"!IB <Address>\n",\r
469 L"Extended:\n",\r
470 {SCAN_NULL, CHAR_NULL},\r
471 DebuggerExtIoIB\r
472 },\r
473 {\r
474 L"!IW",\r
475 L"",\r
476 L"",\r
477 L"!IW <Address>\n",\r
478 L"",\r
479 {SCAN_NULL, CHAR_NULL},\r
480 DebuggerExtIoIW\r
481 },\r
482 {\r
483 L"!ID",\r
484 L"",\r
485 L"",\r
486 L"!ID <Address>\n",\r
487 L"",\r
488 {SCAN_NULL, CHAR_NULL},\r
489 DebuggerExtIoID\r
490 },\r
491 {\r
492 L"!OB",\r
493 L"",\r
494 L"",\r
495 L"!OB <Address> <Value>\n",\r
496 L"",\r
497 {SCAN_NULL, CHAR_NULL},\r
498 DebuggerExtIoOB\r
499 },\r
500 {\r
501 L"!OW",\r
502 L"",\r
503 L"",\r
504 L"!OW <Address> <Value>\n",\r
505 L"",\r
506 {SCAN_NULL, CHAR_NULL},\r
507 DebuggerExtIoOW\r
508 },\r
509 {\r
510 L"!OD",\r
511 L"",\r
512 L"",\r
513 L"!OD <Address> <Value>\n",\r
514 L"",\r
515 {SCAN_NULL, CHAR_NULL},\r
516 DebuggerExtIoOD\r
517 },\r
518 {\r
519 L"!PCIL",\r
520 L"!PCIL - list PCI device, with BAR\n",\r
521 L"",\r
522 L"!PCIL [B]\n",\r
523 L"",\r
524 {SCAN_NULL, CHAR_NULL},\r
525 DebuggerExtPciPCIL\r
526 },\r
527 {\r
528 L"!PCID",\r
529 L"!PCID - show PCI space\n",\r
530 L"",\r
531 L"!PCID Bus Device Function [H|B|E]\n",\r
532 L"",\r
533 {SCAN_NULL, CHAR_NULL},\r
534 DebuggerExtPciPCID\r
535 },\r
536 {\r
537 L"!CFGB",\r
538 L"!CFG[B|W|D] - show/modify PCI space",\r
539 L"",\r
540 L"!CFGB <Address> [<Value>]\n",\r
541 L"",\r
542 {SCAN_NULL, CHAR_NULL},\r
543 DebuggerExtPciCFGB\r
544 },\r
545 {\r
546 L"!CFGW",\r
547 L"",\r
548 L"",\r
549 L"!CFGW <Address> [<Value>]\n",\r
550 L"",\r
551 {SCAN_NULL, CHAR_NULL},\r
552 DebuggerExtPciCFGW\r
553 },\r
554 {\r
555 L"!CFGD",\r
556 L"",\r
557 L"",\r
558 L"!CFGD <Address> [<Value>]\n",\r
559 L"",\r
560 {SCAN_NULL, CHAR_NULL},\r
561 DebuggerExtPciCFGD\r
562 },\r
563*/\r
564 {\r
565 NULL,\r
566 NULL,\r
567 NULL,\r
568 NULL,\r
569 NULL,\r
570 {SCAN_NULL, CHAR_NULL},\r
571 NULL\r
572 },\r
573};\r
574\r
e8a5ac7c
DB
575/**\r
576\r
577 Find the command according to name.\r
578\r
579 @param CommandName - Command Name\r
580 @param CommandArg - Command Argument\r
581\r
582 @return Not NULL - The DebuggerCommand is found successfully\r
583 @return NULL - not found\r
584\r
585**/\r
748edcd5
PB
586EFI_DEBUGGER_COMMAND\r
587MatchDebuggerCommand (\r
588 IN CHAR16 *CommandName,\r
589 IN CHAR16 **CommandArg\r
590 )\r
748edcd5
PB
591{\r
592 UINTN Index;\r
593 CHAR16 *Temp;\r
594\r
595 //\r
596 // Get Command Name\r
597 //\r
598 Temp = StrGetNewTokenLine (CommandName, L" ");\r
599 CommandName = Temp;\r
600 //\r
601 // Get Command Argument\r
602 //\r
603 Temp = StrGetNextTokenLine (L" ");\r
604 *CommandArg = Temp;\r
605\r
606 if (CommandName == NULL) {\r
607 return NULL;\r
608 }\r
609\r
610 //\r
611 // Go through each command, check the CommandName\r
612 //\r
613 for (Index = 0; mDebuggerCommandSet[Index].CommandName != NULL; Index++) {\r
614 if (StriCmp (CommandName, mDebuggerCommandSet[Index].CommandName) == 0) {\r
615 //\r
616 // Found\r
617 //\r
618 return mDebuggerCommandSet[Index].CommandFunc;\r
619 }\r
620 }\r
621\r
622 //\r
623 // Not found\r
624 //\r
625 return NULL;\r
626}\r
627\r
e8a5ac7c 628/**\r
748edcd5 629\r
e8a5ac7c 630 Find the command name according to the function key.\r
748edcd5 631\r
e8a5ac7c 632 @param CommandKey - Command Function Key\r
748edcd5 633\r
e8a5ac7c
DB
634 @return Not NULL - The DebuggerName is found successfully\r
635 @return NULL - not found\r
748edcd5 636\r
e8a5ac7c
DB
637**/\r
638CHAR16 *\r
639GetCommandNameByKey (\r
640 IN EFI_INPUT_KEY CommandKey\r
641 )\r
748edcd5
PB
642{\r
643 UINTN Index;\r
644\r
645 //\r
646 // Go through each command, check the CommandKey\r
647 //\r
648 for (Index = 0; mDebuggerCommandSet[Index].CommandName != NULL; Index++) {\r
649 if ((mDebuggerCommandSet[Index].CommandKey.UnicodeChar == CommandKey.UnicodeChar) &&\r
650 (mDebuggerCommandSet[Index].CommandKey.ScanCode == CommandKey.ScanCode)) {\r
651 //\r
652 // Found\r
653 //\r
654 return mDebuggerCommandSet[Index].CommandName;\r
655 }\r
656 }\r
657\r
658 //\r
659 // Not found\r
660 //\r
661 return NULL;\r
662}\r