]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdScope.c
MdeModulePkg/EbcDxe: add EBC Debugger
[mirror_edk2.git] / MdeModulePkg / Universal / EbcDxe / EbcDebugger / EdbCmdScope.c
1 /*++
2
3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. 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 Module Name:
13
14 EdbCmdScope.c
15
16 Abstract:
17
18
19 --*/
20
21 #include "Edb.h"
22
23 EFI_DEBUG_STATUS
24 DebuggerScope (
25 IN CHAR16 *CommandArg,
26 IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
27 IN EFI_EXCEPTION_TYPE ExceptionType,
28 IN OUT EFI_SYSTEM_CONTEXT SystemContext
29 )
30 /*++
31
32 Routine Description:
33
34 DebuggerCommand - Scope
35
36 Arguments:
37
38 CommandArg - The argument for this command
39 DebuggerPrivate - EBC Debugger private data structure
40 InterruptType - Interrupt type.
41 SystemContext - EBC system context.
42
43 Returns:
44
45 EFI_DEBUG_CONTINUE - formal return value
46
47 --*/
48 {
49 EFI_STATUS Status;
50 UINTN Address;
51
52 if (CommandArg == NULL) {
53 EDBPrint (L"Scope: invalid Address\n");
54 return EFI_DEBUG_CONTINUE;
55 }
56
57 //
58 // Load new scope
59 //
60 Status = Symboltoi (CommandArg, &Address);
61 if (EFI_ERROR (Status)) {
62 if (Status == EFI_NOT_FOUND) {
63 Address = Xtoi(CommandArg);
64 } else {
65 //
66 // Something wrong, let Symboltoi print error info.
67 //
68 EDBPrint (L"Command Argument error!\n");
69 return EFI_DEBUG_CONTINUE;
70 }
71 }
72 DebuggerPrivate->InstructionScope = Address;
73 EDBPrint (L"Scope: 0x%x\n", DebuggerPrivate->InstructionScope);
74 EdbShowDisasm (DebuggerPrivate, SystemContext);
75
76 //
77 // Done
78 //
79 return EFI_DEBUG_CONTINUE;
80 }
81
82 EFI_DEBUG_STATUS
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
91 Routine Description:
92
93 DebuggerCommand - List
94
95 Arguments:
96
97 CommandArg - The argument for this command
98 DebuggerPrivate - EBC Debugger private data structure
99 InterruptType - Interrupt type.
100 SystemContext - EBC system context.
101
102 Returns:
103
104 EFI_DEBUG_CONTINUE - formal return value
105
106 --*/
107 {
108 if (CommandArg == NULL) {
109 EdbShowDisasm (DebuggerPrivate, SystemContext);
110 } else {
111 //
112 // Load new list number
113 //
114 DebuggerPrivate->InstructionNumber = Atoi(CommandArg);
115 EDBPrint (L"List Number: %d\n", DebuggerPrivate->InstructionNumber);
116 EdbShowDisasm (DebuggerPrivate, SystemContext);
117 }
118
119 //
120 // Done
121 //
122 return EFI_DEBUG_CONTINUE;
123 }