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