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 - Scope.
20 
21   @param  CommandArg      - The argument for this command
22   @param  DebuggerPrivate - EBC Debugger private data structure
23   @param  ExceptionType   - Exception type.
24   @param  SystemContext   - EBC system context.
25 
26   @retval EFI_DEBUG_CONTINUE - formal return value
27 
28 **/
29 EFI_DEBUG_STATUS
DebuggerScope(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)30 DebuggerScope (
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   EFI_STATUS   Status;
38   UINTN        Address;
39 
40   if (CommandArg == NULL) {
41     EDBPrint (L"Scope: invalid Address\n");
42     return EFI_DEBUG_CONTINUE;
43   }
44 
45   //
46   // Load new scope
47   //
48   Status = Symboltoi (CommandArg, &Address);
49   if (EFI_ERROR (Status)) {
50     if (Status == EFI_NOT_FOUND) {
51       Address = Xtoi(CommandArg);
52     } else {
53       //
54       // Something wrong, let Symboltoi print error info.
55       //
56       EDBPrint (L"Command Argument error!\n");
57       return EFI_DEBUG_CONTINUE;
58     }
59   }
60   DebuggerPrivate->InstructionScope = Address;
61   EDBPrint (L"Scope: 0x%x\n", DebuggerPrivate->InstructionScope);
62   EdbShowDisasm (DebuggerPrivate, SystemContext);
63 
64   //
65   // Done
66   //
67   return EFI_DEBUG_CONTINUE;
68 }
69 
70 /**
71 
72   DebuggerCommand - List.
73 
74   @param  CommandArg      - The argument for this command
75   @param  DebuggerPrivate - EBC Debugger private data structure
76   @param  ExceptionType   - Exception type.
77   @param  SystemContext   - EBC system context.
78 
79   @retval EFI_DEBUG_CONTINUE - formal return value
80 
81 **/
82 EFI_DEBUG_STATUS
DebuggerList(IN CHAR16 * CommandArg,IN EFI_DEBUGGER_PRIVATE_DATA * DebuggerPrivate,IN EFI_EXCEPTION_TYPE ExceptionType,IN OUT EFI_SYSTEM_CONTEXT SystemContext)83 DebuggerList (
84   IN     CHAR16                    *CommandArg,
85   IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
86   IN     EFI_EXCEPTION_TYPE        ExceptionType,
87   IN OUT EFI_SYSTEM_CONTEXT        SystemContext
88   )
89 {
90   if (CommandArg == NULL) {
91     EdbShowDisasm (DebuggerPrivate, SystemContext);
92   } else {
93     //
94     // Load new list number
95     //
96     DebuggerPrivate->InstructionNumber = Atoi(CommandArg);
97     EDBPrint (L"List Number: %d\n", DebuggerPrivate->InstructionNumber);
98     EdbShowDisasm (DebuggerPrivate, SystemContext);
99   }
100 
101   //
102   // Done
103   //
104   return EFI_DEBUG_CONTINUE;
105 }
106