]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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
1436aea4 28 { SCAN_F5, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 38 { SCAN_F8, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 48 { SCAN_F10, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 58 { SCAN_F11, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 68 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 83 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 95 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 107 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 119 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 131 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 143 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 153 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 164 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 175 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 186 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 197 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 213 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
6a0b4887 221 L" (No Argument) - Show current instruction branch\n"\r
748edcd5
PB
222 L" c - Clear current instruction branch\n",\r
223 L"",\r
1436aea4 224 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 236 { SCAN_F2, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 247 { SCAN_F4, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 258 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 270 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 282 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 294 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 306 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 318 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 330 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 342 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 354 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 370 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 381 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 391 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 402 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 413 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 426 { SCAN_F3, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 439 { SCAN_F6, CHAR_NULL },\r
748edcd5
PB
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
1436aea4 451 { SCAN_F1, CHAR_NULL },\r
748edcd5
PB
452 DebuggerHelp\r
453 },\r
1436aea4
MK
454\r
455 /*\r
456 //\r
457 // Extended\r
458 //\r
459 {\r
460 L"!IB",\r
461 L"![I|O][B|W|D] - display/modify IO\n",\r
462 L"",\r
463 L"!IB <Address>\n",\r
464 L"Extended:\n",\r
465 {SCAN_NULL, CHAR_NULL},\r
466 DebuggerExtIoIB\r
467 },\r
468 {\r
469 L"!IW",\r
470 L"",\r
471 L"",\r
472 L"!IW <Address>\n",\r
473 L"",\r
474 {SCAN_NULL, CHAR_NULL},\r
475 DebuggerExtIoIW\r
476 },\r
477 {\r
478 L"!ID",\r
479 L"",\r
480 L"",\r
481 L"!ID <Address>\n",\r
482 L"",\r
483 {SCAN_NULL, CHAR_NULL},\r
484 DebuggerExtIoID\r
485 },\r
486 {\r
487 L"!OB",\r
488 L"",\r
489 L"",\r
490 L"!OB <Address> <Value>\n",\r
491 L"",\r
492 {SCAN_NULL, CHAR_NULL},\r
493 DebuggerExtIoOB\r
494 },\r
495 {\r
496 L"!OW",\r
497 L"",\r
498 L"",\r
499 L"!OW <Address> <Value>\n",\r
500 L"",\r
501 {SCAN_NULL, CHAR_NULL},\r
502 DebuggerExtIoOW\r
503 },\r
504 {\r
505 L"!OD",\r
506 L"",\r
507 L"",\r
508 L"!OD <Address> <Value>\n",\r
509 L"",\r
510 {SCAN_NULL, CHAR_NULL},\r
511 DebuggerExtIoOD\r
512 },\r
513 {\r
514 L"!PCIL",\r
515 L"!PCIL - list PCI device, with BAR\n",\r
516 L"",\r
517 L"!PCIL [B]\n",\r
518 L"",\r
519 {SCAN_NULL, CHAR_NULL},\r
520 DebuggerExtPciPCIL\r
521 },\r
522 {\r
523 L"!PCID",\r
524 L"!PCID - show PCI space\n",\r
525 L"",\r
526 L"!PCID Bus Device Function [H|B|E]\n",\r
527 L"",\r
528 {SCAN_NULL, CHAR_NULL},\r
529 DebuggerExtPciPCID\r
530 },\r
531 {\r
532 L"!CFGB",\r
533 L"!CFG[B|W|D] - show/modify PCI space",\r
534 L"",\r
535 L"!CFGB <Address> [<Value>]\n",\r
536 L"",\r
537 {SCAN_NULL, CHAR_NULL},\r
538 DebuggerExtPciCFGB\r
539 },\r
540 {\r
541 L"!CFGW",\r
542 L"",\r
543 L"",\r
544 L"!CFGW <Address> [<Value>]\n",\r
545 L"",\r
546 {SCAN_NULL, CHAR_NULL},\r
547 DebuggerExtPciCFGW\r
548 },\r
549 {\r
550 L"!CFGD",\r
551 L"",\r
552 L"",\r
553 L"!CFGD <Address> [<Value>]\n",\r
554 L"",\r
555 {SCAN_NULL, CHAR_NULL},\r
556 DebuggerExtPciCFGD\r
557 },\r
558 */\r
748edcd5
PB
559 {\r
560 NULL,\r
561 NULL,\r
562 NULL,\r
563 NULL,\r
564 NULL,\r
1436aea4 565 { SCAN_NULL, CHAR_NULL },\r
748edcd5
PB
566 NULL\r
567 },\r
568};\r
569\r
e8a5ac7c
DB
570/**\r
571\r
572 Find the command according to name.\r
573\r
574 @param CommandName - Command Name\r
575 @param CommandArg - Command Argument\r
576\r
577 @return Not NULL - The DebuggerCommand is found successfully\r
578 @return NULL - not found\r
579\r
580**/\r
748edcd5
PB
581EFI_DEBUGGER_COMMAND\r
582MatchDebuggerCommand (\r
1436aea4
MK
583 IN CHAR16 *CommandName,\r
584 IN CHAR16 **CommandArg\r
748edcd5 585 )\r
748edcd5 586{\r
1436aea4
MK
587 UINTN Index;\r
588 CHAR16 *Temp;\r
748edcd5
PB
589\r
590 //\r
591 // Get Command Name\r
592 //\r
1436aea4 593 Temp = StrGetNewTokenLine (CommandName, L" ");\r
748edcd5
PB
594 CommandName = Temp;\r
595 //\r
596 // Get Command Argument\r
597 //\r
1436aea4 598 Temp = StrGetNextTokenLine (L" ");\r
748edcd5
PB
599 *CommandArg = Temp;\r
600\r
601 if (CommandName == NULL) {\r
602 return NULL;\r
603 }\r
604\r
605 //\r
606 // Go through each command, check the CommandName\r
607 //\r
608 for (Index = 0; mDebuggerCommandSet[Index].CommandName != NULL; Index++) {\r
609 if (StriCmp (CommandName, mDebuggerCommandSet[Index].CommandName) == 0) {\r
610 //\r
611 // Found\r
612 //\r
613 return mDebuggerCommandSet[Index].CommandFunc;\r
614 }\r
615 }\r
616\r
617 //\r
618 // Not found\r
619 //\r
620 return NULL;\r
621}\r
622\r
e8a5ac7c 623/**\r
748edcd5 624\r
e8a5ac7c 625 Find the command name according to the function key.\r
748edcd5 626\r
e8a5ac7c 627 @param CommandKey - Command Function Key\r
748edcd5 628\r
e8a5ac7c
DB
629 @return Not NULL - The DebuggerName is found successfully\r
630 @return NULL - not found\r
748edcd5 631\r
e8a5ac7c
DB
632**/\r
633CHAR16 *\r
634GetCommandNameByKey (\r
1436aea4 635 IN EFI_INPUT_KEY CommandKey\r
e8a5ac7c 636 )\r
748edcd5
PB
637{\r
638 UINTN Index;\r
639\r
640 //\r
641 // Go through each command, check the CommandKey\r
642 //\r
643 for (Index = 0; mDebuggerCommandSet[Index].CommandName != NULL; Index++) {\r
644 if ((mDebuggerCommandSet[Index].CommandKey.UnicodeChar == CommandKey.UnicodeChar) &&\r
1436aea4
MK
645 (mDebuggerCommandSet[Index].CommandKey.ScanCode == CommandKey.ScanCode))\r
646 {\r
748edcd5
PB
647 //\r
648 // Found\r
649 //\r
650 return mDebuggerCommandSet[Index].CommandName;\r
651 }\r
652 }\r
653\r
654 //\r
655 // Not found\r
656 //\r
657 return NULL;\r
658}\r