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