Home | History | Annotate | Download | only in EbcDebugger
      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   DebuggerCommand - Help.
     20 
     21   @param  CommandArg      - The argument for this command
     22   @param  DebuggerPrivate - EBC Debugger private data structure
     23   @param  ExceptionType   - Interrupt type.
     24   @param  SystemContext   - EBC system context.
     25 
     26   @retval EFI_DEBUG_CONTINUE - formal return value
     27 
     28 **/
     29 EFI_DEBUG_STATUS
     30 DebuggerHelp (
     31   IN     CHAR16                    *CommandArg,
     32   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
     33   IN     EFI_EXCEPTION_TYPE        ExceptionType,
     34   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
     35   )
     36 {
     37   UINTN Index;
     38 
     39   //
     40   // if no argument, print all the command title
     41   //
     42   if (CommandArg == NULL) {
     43     for (Index = 0; DebuggerPrivate->DebuggerCommandSet[Index].CommandName != NULL; Index++) {
     44       EDBPrint (DebuggerPrivate->DebuggerCommandSet[Index].ClassName);
     45       if (StrCmp (DebuggerPrivate->DebuggerCommandSet[Index].CommandTitle, L"") != 0) {
     46         EDBPrint (L"  ");
     47         EDBPrint (DebuggerPrivate->DebuggerCommandSet[Index].CommandTitle);
     48       }
     49     }
     50     return EFI_DEBUG_CONTINUE;
     51   }
     52 
     53   //
     54   // If there is argument, the argument should be command name.
     55   // Find the command and print the detail information.
     56   //
     57   for (Index = 0; DebuggerPrivate->DebuggerCommandSet[Index].CommandName != NULL; Index++) {
     58     if (StriCmp (CommandArg, DebuggerPrivate->DebuggerCommandSet[Index].CommandName) == 0) {
     59       EDBPrint (DebuggerPrivate->DebuggerCommandSet[Index].CommandHelp);
     60       EDBPrint (DebuggerPrivate->DebuggerCommandSet[Index].CommandSyntax);
     61       return EFI_DEBUG_CONTINUE;
     62     }
     63   }
     64 
     65   //
     66   // Command not found.
     67   //
     68   EDBPrint (L"No help info for this command\n");
     69 
     70   //
     71   // Done
     72   //
     73   return EFI_DEBUG_CONTINUE;
     74 }
     75