summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/EbcDxe/EbcDebugger
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/EbcDxe/EbcDebugger')
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EbcDebuggerConfig.c48
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c164
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.h14
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBranch.c66
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreak.c49
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c139
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtIo.c51
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtPci.c41
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdGo.c19
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdHelp.c11
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c254
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdQuit.c8
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdRegister.c9
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdScope.c25
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdStep.c36
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c251
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.c302
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.h6
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommon.h204
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c1073
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.h8
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.c341
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.h86
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c253
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupport.h84
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportFile.c118
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c278
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportUI.c508
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c893
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.h72
30 files changed, 2797 insertions, 2614 deletions
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EbcDebuggerConfig.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EbcDebuggerConfig.c
index 966dfb7173..98ddf8c668 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EbcDebuggerConfig.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EbcDebuggerConfig.c
@@ -31,7 +31,7 @@ PrintUsage (
L"usage: EdbCfg <Command>\n"
L" CommandList:\n"
L" BO[C|CX|R|E|T|K] <ON|OFF> - Enable/Disable BOC/BOCX/BOR/BOE/BOT/BOK.\n"
-// L" SHOWINFO - Show Debugger Information.\n"
+ // L" SHOWINFO - Show Debugger Information.\n"
L"\n"
);
return;
@@ -46,11 +46,11 @@ PrintUsage (
**/
VOID
EdbShowInfo (
- EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration
+ EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration
)
{
Print (L"Not supported!\n");
- return ;
+ return;
}
/**
@@ -64,12 +64,12 @@ EdbShowInfo (
**/
VOID
EdbConfigBreak (
- EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration,
- CHAR16 *Command,
- CHAR16 *CommandArg
+ EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration,
+ CHAR16 *Command,
+ CHAR16 *CommandArg
)
{
- EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate;
+ EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate;
DebuggerPrivate = (EFI_DEBUGGER_PRIVATE_DATA *)DebuggerConfiguration->DebuggerPrivateData;
@@ -158,7 +158,8 @@ EdbConfigBreak (
Print (L"Invalid parameter\n");
}
}
- return ;
+
+ return;
}
/**
@@ -178,18 +179,18 @@ InitializeEbcDebuggerConfig (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- UINTN Argc;
- CHAR16 **Argv;
- EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
- EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration;
- EFI_STATUS Status;
+ UINTN Argc;
+ CHAR16 **Argv;
+ EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters;
+ EFI_DEBUGGER_CONFIGURATION_PROTOCOL *DebuggerConfiguration;
+ EFI_STATUS Status;
Status = gBS->HandleProtocol (
gImageHandle,
&gEfiShellParametersProtocolGuid,
- (VOID**)&ShellParameters
+ (VOID **)&ShellParameters
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
Print (L"Please use UEFI Shell to run this application.\n");
return EFI_INVALID_PARAMETER;
}
@@ -206,18 +207,19 @@ InitializeEbcDebuggerConfig (
if ((StrCmp (Argv[1], L"/?") == 0) ||
(StrCmp (Argv[1], L"-?") == 0) ||
(StrCmp (Argv[1], L"-h") == 0) ||
- (StrCmp (Argv[1], L"-H") == 0) ) {
+ (StrCmp (Argv[1], L"-H") == 0))
+ {
PrintUsage ();
return EFI_SUCCESS;
}
}
Status = gBS->LocateProtocol (
- &gEfiDebuggerConfigurationProtocolGuid,
- NULL,
- (VOID**)&DebuggerConfiguration
- );
- if (EFI_ERROR(Status)) {
+ &gEfiDebuggerConfigurationProtocolGuid,
+ NULL,
+ (VOID **)&DebuggerConfiguration
+ );
+ if (EFI_ERROR (Status)) {
Print (L"Error: DebuggerConfiguration protocol not found.\n");
return EFI_NOT_FOUND;
}
@@ -233,12 +235,14 @@ InitializeEbcDebuggerConfig (
(StriCmp (Argv[1], L"BOR") == 0) ||
(StriCmp (Argv[1], L"BOE") == 0) ||
(StriCmp (Argv[1], L"BOT") == 0) ||
- (StriCmp (Argv[1], L"BOK") == 0))) {
+ (StriCmp (Argv[1], L"BOK") == 0)))
+ {
if (Argc == 3) {
EdbConfigBreak (DebuggerConfiguration, Argv[1], Argv[2]);
} else {
EdbConfigBreak (DebuggerConfiguration, Argv[1], NULL);
}
+
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
index e417f4870f..c0d5485cbf 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
@@ -8,13 +8,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Uefi.h>
#include "Edb.h"
-EFI_DEBUGGER_PRIVATE_DATA mDebuggerPrivate = {
+EFI_DEBUGGER_PRIVATE_DATA mDebuggerPrivate = {
EFI_DEBUGGER_SIGNATURE, // Signature
IsaEbc, // Isa
(EBC_DEBUGGER_MAJOR_VERSION << 16) |
- EBC_DEBUGGER_MINOR_VERSION, // EfiDebuggerRevision
+ EBC_DEBUGGER_MINOR_VERSION, // EfiDebuggerRevision
(VM_MAJOR_VERSION << 16) |
- VM_MINOR_VERSION, // EbcVmRevision
+ VM_MINOR_VERSION, // EbcVmRevision
{
EFI_DEBUGGER_CONFIGURATION_VERSION,
&mDebuggerPrivate,
@@ -23,24 +23,30 @@ EFI_DEBUGGER_PRIVATE_DATA mDebuggerPrivate = {
NULL, // Vol
NULL, // PciRootBridgeIo
mDebuggerCommandSet, // DebuggerCommandSet
- {0}, // DebuggerSymbolContext
+ { 0 }, // DebuggerSymbolContext
0, // DebuggerBreakpointCount
- {{0}}, // DebuggerBreakpointContext
+ {
+ { 0 }
+ }, // DebuggerBreakpointContext
0, // CallStackEntryCount
- {{0}}, // CallStackEntry
+ {
+ { 0 }
+ }, // CallStackEntry
0, // TraceEntryCount
- {{0}}, // TraceEntry
- {0}, // StepContext
- {0}, // GoTilContext
- 0, // InstructionScope
- EFI_DEBUG_DEFAULT_INSTRUCTION_NUMBER, // InstructionNumber
+ {
+ { 0 }
+ }, // TraceEntry
+ { 0 }, // StepContext
+ { 0 }, // GoTilContext
+ 0, // InstructionScope
+ EFI_DEBUG_DEFAULT_INSTRUCTION_NUMBER, // InstructionNumber
EFI_DEBUG_FLAG_EBC_BOE | EFI_DEBUG_FLAG_EBC_BOT, // FeatureFlags
0, // StatusFlags
FALSE, // EnablePageBreak
NULL // BreakEvent
};
-CHAR16 *mExceptionStr[] = {
+CHAR16 *mExceptionStr[] = {
L"EXCEPT_EBC_UNDEFINED",
L"EXCEPT_EBC_DIVIDE_ERROR",
L"EXCEPT_EBC_DEBUG",
@@ -64,11 +70,11 @@ CHAR16 *mExceptionStr[] = {
**/
VOID
EdbClearAllBreakpoint (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN BOOLEAN NeedRemove
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN BOOLEAN NeedRemove
)
{
- UINTN Index;
+ UINTN Index;
//
// Patch all the breakpoint
@@ -78,7 +84,7 @@ EdbClearAllBreakpoint (
CopyMem (
(VOID *)(UINTN)DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress,
&DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction,
- sizeof(UINT16)
+ sizeof (UINT16)
);
}
}
@@ -88,13 +94,13 @@ EdbClearAllBreakpoint (
//
if (NeedRemove) {
DebuggerPrivate->DebuggerBreakpointCount = 0;
- ZeroMem (DebuggerPrivate->DebuggerBreakpointContext, sizeof(DebuggerPrivate->DebuggerBreakpointContext));
+ ZeroMem (DebuggerPrivate->DebuggerBreakpointContext, sizeof (DebuggerPrivate->DebuggerBreakpointContext));
}
//
// Done
//
- return ;
+ return;
}
/**
@@ -106,11 +112,11 @@ EdbClearAllBreakpoint (
**/
VOID
EdbSetAllBreakpoint (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
)
{
- UINTN Index;
- UINT16 Data16;
+ UINTN Index;
+ UINT16 Data16;
//
// Set all the breakpoint (BREAK(3) : 0x0300)
@@ -121,7 +127,7 @@ EdbSetAllBreakpoint (
CopyMem (
(VOID *)(UINTN)DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress,
&Data16,
- sizeof(UINT16)
+ sizeof (UINT16)
);
}
}
@@ -134,7 +140,7 @@ EdbSetAllBreakpoint (
CopyMem (
(VOID *)(UINTN)DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX].BreakpointAddress,
&DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX].OldInstruction,
- sizeof(UINT16)
+ sizeof (UINT16)
);
DebuggerPrivate->StatusFlags &= ~EFI_DEBUG_FLAG_EBC_B_BP;
}
@@ -142,7 +148,7 @@ EdbSetAllBreakpoint (
//
// Done
//
- return ;
+ return;
}
/**
@@ -156,8 +162,8 @@ EdbSetAllBreakpoint (
**/
VOID
EdbCheckBreakpoint (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
UINT64 Address;
@@ -167,7 +173,7 @@ EdbCheckBreakpoint (
//
// Roll back IP for breakpoint instruction (BREAK(3) : 0x0300)
//
- Address = SystemContext.SystemContextEbc->Ip - sizeof(UINT16);
+ Address = SystemContext.SystemContextEbc->Ip - sizeof (UINT16);
//
// Check if the breakpoint is hit
@@ -175,7 +181,8 @@ EdbCheckBreakpoint (
IsHitBreakpoint = FALSE;
for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {
if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&
- (DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {
+ (DebuggerPrivate->DebuggerBreakpointContext[Index].State))
+ {
IsHitBreakpoint = TRUE;
break;
}
@@ -185,7 +192,7 @@ EdbCheckBreakpoint (
//
// If hit, record current breakpoint
//
- DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX] = DebuggerPrivate->DebuggerBreakpointContext[Index];
+ DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX] = DebuggerPrivate->DebuggerBreakpointContext[Index];
DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX].State = TRUE;
//
// Update: IP and Instruction (NOTE: Since we not allow set breakpoint to BREAK 3, this update is safe)
@@ -209,7 +216,8 @@ EdbCheckBreakpoint (
IsHitBreakpoint = FALSE;
for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {
if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&
- (DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {
+ (DebuggerPrivate->DebuggerBreakpointContext[Index].State))
+ {
IsHitBreakpoint = TRUE;
break;
}
@@ -234,7 +242,7 @@ EdbCheckBreakpoint (
//
ZeroMem (
&DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX],
- sizeof(DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX])
+ sizeof (DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX])
);
}
}
@@ -242,7 +250,7 @@ EdbCheckBreakpoint (
//
// Done
//
- return ;
+ return;
}
/**
@@ -253,13 +261,13 @@ EdbCheckBreakpoint (
**/
VOID
EdbClearSymbol (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
)
{
- EFI_DEBUGGER_SYMBOL_CONTEXT *DebuggerSymbolContext;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- UINTN ObjectIndex;
- UINTN Index;
+ EFI_DEBUGGER_SYMBOL_CONTEXT *DebuggerSymbolContext;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ UINTN ObjectIndex;
+ UINTN Index;
//
// Go throuth each object
@@ -271,13 +279,14 @@ EdbClearSymbol (
// Go throuth each entry
//
for (Index = 0; Index < Object->EntryCount; Index++) {
- ZeroMem (&Object->Entry[Index], sizeof(Object->Entry[Index]));
+ ZeroMem (&Object->Entry[Index], sizeof (Object->Entry[Index]));
}
- ZeroMem (Object->Name, sizeof(Object->Name));
- Object->EntryCount = 0;
- Object->BaseAddress = 0;
+
+ ZeroMem (Object->Name, sizeof (Object->Name));
+ Object->EntryCount = 0;
+ Object->BaseAddress = 0;
Object->StartEntrypointRVA = 0;
- Object->MainEntrypointRVA = 0;
+ Object->MainEntrypointRVA = 0;
//
// Free source buffer
//
@@ -286,9 +295,10 @@ EdbClearSymbol (
Object->SourceBuffer[Index] = NULL;
}
}
+
DebuggerSymbolContext->ObjectCount = 0;
- return ;
+ return;
}
/**
@@ -303,17 +313,17 @@ EdbClearSymbol (
**/
EFI_STATUS
InitDebuggerPrivateData (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- IN BOOLEAN Initialized
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN BOOLEAN Initialized
)
{
//
// clear STEP flag in any condition.
//
- if (SystemContext.SystemContextEbc->Flags & ((UINT64) VMFLAGS_STEP)) {
- SystemContext.SystemContextEbc->Flags &= ~((UINT64) VMFLAGS_STEP);
+ if (SystemContext.SystemContextEbc->Flags & ((UINT64)VMFLAGS_STEP)) {
+ SystemContext.SystemContextEbc->Flags &= ~((UINT64)VMFLAGS_STEP);
}
if (!Initialized) {
@@ -323,13 +333,13 @@ InitDebuggerPrivateData (
DebuggerPrivate->InstructionNumber = EFI_DEBUG_DEFAULT_INSTRUCTION_NUMBER;
DebuggerPrivate->DebuggerBreakpointCount = 0;
- ZeroMem (DebuggerPrivate->DebuggerBreakpointContext, sizeof(DebuggerPrivate->DebuggerBreakpointContext));
+ ZeroMem (DebuggerPrivate->DebuggerBreakpointContext, sizeof (DebuggerPrivate->DebuggerBreakpointContext));
-// DebuggerPrivate->StatusFlags = 0;
+ // DebuggerPrivate->StatusFlags = 0;
- DebuggerPrivate->DebuggerSymbolContext.DisplaySymbol = TRUE;
+ DebuggerPrivate->DebuggerSymbolContext.DisplaySymbol = TRUE;
DebuggerPrivate->DebuggerSymbolContext.DisplayCodeOnly = FALSE;
- DebuggerPrivate->DebuggerSymbolContext.ObjectCount = 0;
+ DebuggerPrivate->DebuggerSymbolContext.ObjectCount = 0;
} else {
//
// Already initialized, just check Breakpoint here.
@@ -367,21 +377,21 @@ InitDebuggerPrivateData (
**/
EFI_STATUS
DeinitDebuggerPrivateData (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- IN BOOLEAN Initialized
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN BOOLEAN Initialized
)
{
if (!Initialized) {
//
// If it does not want initialized state, de-init everything
//
- DebuggerPrivate->FeatureFlags = EFI_DEBUG_FLAG_EBC_BOE | EFI_DEBUG_FLAG_EBC_BOT;
+ DebuggerPrivate->FeatureFlags = EFI_DEBUG_FLAG_EBC_BOE | EFI_DEBUG_FLAG_EBC_BOT;
DebuggerPrivate->CallStackEntryCount = 0;
- DebuggerPrivate->TraceEntryCount = 0;
- ZeroMem (DebuggerPrivate->CallStackEntry, sizeof(DebuggerPrivate->CallStackEntry));
- ZeroMem (DebuggerPrivate->TraceEntry, sizeof(DebuggerPrivate->TraceEntry));
+ DebuggerPrivate->TraceEntryCount = 0;
+ ZeroMem (DebuggerPrivate->CallStackEntry, sizeof (DebuggerPrivate->CallStackEntry));
+ ZeroMem (DebuggerPrivate->TraceEntry, sizeof (DebuggerPrivate->TraceEntry));
//
// Clear all breakpoint
@@ -402,7 +412,7 @@ DeinitDebuggerPrivateData (
//
// Clear Step context
//
- ZeroMem (&mDebuggerPrivate.StepContext, sizeof(mDebuggerPrivate.StepContext));
+ ZeroMem (&mDebuggerPrivate.StepContext, sizeof (mDebuggerPrivate.StepContext));
DebuggerPrivate->StatusFlags = 0;
//
@@ -423,10 +433,10 @@ DeinitDebuggerPrivateData (
**/
VOID
PrintExceptionReason (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- IN BOOLEAN Initialized
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN BOOLEAN Initialized
)
{
//
@@ -461,7 +471,7 @@ PrintExceptionReason (
}
}
- return ;
+ return;
}
/**
@@ -477,15 +487,15 @@ PrintExceptionReason (
VOID
EFIAPI
EdbExceptionHandler (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- CHAR16 InputBuffer[EFI_DEBUG_INPUS_BUFFER_SIZE];
- CHAR16 *CommandArg;
- EFI_DEBUGGER_COMMAND DebuggerCommand;
- EFI_DEBUG_STATUS DebugStatus;
- STATIC BOOLEAN mInitialized;
+ CHAR16 InputBuffer[EFI_DEBUG_INPUS_BUFFER_SIZE];
+ CHAR16 *CommandArg;
+ EFI_DEBUGGER_COMMAND DebuggerCommand;
+ EFI_DEBUG_STATUS DebugStatus;
+ STATIC BOOLEAN mInitialized;
mInitialized = FALSE;
@@ -506,6 +516,7 @@ EdbExceptionHandler (
(UINTN)EBC_DEBUGGER_MINOR_VERSION
);
}
+
//
// Init Private Data
//
@@ -526,6 +537,7 @@ EdbExceptionHandler (
EDBPrint (L"\nPlease enter command now, \'h\' for help.\n");
EDBPrint (L"(Using <Command> -b <...> to enable page break.)\n");
}
+
mInitialized = TRUE;
//
@@ -552,7 +564,7 @@ EdbExceptionHandler (
//
if (CommandArg != NULL) {
if (StriCmp (CommandArg, L"-b") == 0) {
- CommandArg = StrGetNextTokenLine (L" ");
+ CommandArg = StrGetNextTokenLine (L" ");
mDebuggerPrivate.EnablePageBreak = TRUE;
}
}
@@ -560,7 +572,7 @@ EdbExceptionHandler (
//
// Dispatch command
//
- DebugStatus = DebuggerCommand (CommandArg, &mDebuggerPrivate, ExceptionType, SystemContext);
+ DebugStatus = DebuggerCommand (CommandArg, &mDebuggerPrivate, ExceptionType, SystemContext);
mDebuggerPrivate.EnablePageBreak = FALSE;
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.h b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.h
index 34253b3a1d..66624221dd 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.h
@@ -11,8 +11,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "EdbCommon.h"
-#define EBC_DEBUGGER_MAJOR_VERSION 1
-#define EBC_DEBUGGER_MINOR_VERSION 0
+#define EBC_DEBUGGER_MAJOR_VERSION 1
+#define EBC_DEBUGGER_MINOR_VERSION 0
#define EFI_DEBUG_RETURN 1
#define EFI_DEBUG_BREAK 2
@@ -27,8 +27,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_STATUS
EfiDebuggerEntrypoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -44,11 +44,11 @@ EfiDebuggerEntrypoint (
VOID
EFIAPI
EdbExceptionHandler (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
);
-extern EFI_DEBUGGER_PRIVATE_DATA mDebuggerPrivate;
+extern EFI_DEBUGGER_PRIVATE_DATA mDebuggerPrivate;
#include "EdbSupport.h"
#include "EdbCommand.h"
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBranch.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBranch.c
index 500bb41da0..eb9f3db4f9 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBranch.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBranch.c
@@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Edb.h"
-CHAR16 *mBranchTypeStr[] = {
+CHAR16 *mBranchTypeStr[] = {
L"(CALL)",
L"(CALLEX)",
L"(RET)",
@@ -30,11 +30,11 @@ EdbBranchTypeToStr (
IN EFI_DEBUGGER_BRANCH_TYPE Type
)
{
- if (Type < 0 || Type >= EfiDebuggerBranchTypeEbcMax) {
+ if ((Type < 0) || (Type >= EfiDebuggerBranchTypeEbcMax)) {
return L"(Unknown Type)";
}
- return mBranchTypeStr [Type];
+ return mBranchTypeStr[Type];
}
/**
@@ -51,20 +51,20 @@ EdbBranchTypeToStr (
**/
EFI_DEBUG_STATUS
DebuggerCallStack (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- INTN Index;
- UINTN SubIndex;
- CHAR8 *FuncName;
- EFI_DEBUGGER_CALLSTACK_CONTEXT *CallStackEntry;
- BOOLEAN ShowParameter;
- UINTN ParameterNumber;
-
- ShowParameter = FALSE;
+ INTN Index;
+ UINTN SubIndex;
+ CHAR8 *FuncName;
+ EFI_DEBUGGER_CALLSTACK_CONTEXT *CallStackEntry;
+ BOOLEAN ShowParameter;
+ UINTN ParameterNumber;
+
+ ShowParameter = FALSE;
ParameterNumber = EFI_DEBUGGER_CALL_DEFAULT_PARAMETER;
//
@@ -76,7 +76,7 @@ DebuggerCallStack (
// Clear Call-Stack
//
DebuggerPrivate->CallStackEntryCount = 0;
- ZeroMem (DebuggerPrivate->CallStackEntry, sizeof(DebuggerPrivate->CallStackEntry));
+ ZeroMem (DebuggerPrivate->CallStackEntry, sizeof (DebuggerPrivate->CallStackEntry));
EDBPrint (L"Call-Stack is cleared\n");
return EFI_DEBUG_CONTINUE;
} else if (StriCmp (CommandArg, L"p") == 0) {
@@ -84,7 +84,7 @@ DebuggerCallStack (
// Print Call-Stack with parameter
//
ShowParameter = TRUE;
- CommandArg = StrGetNextTokenLine (L" ");
+ CommandArg = StrGetNextTokenLine (L" ");
if (CommandArg != NULL) {
//
// Try to get the parameter number
@@ -119,7 +119,7 @@ DebuggerCallStack (
EDBPrint (L"Call-Stack (TOP):\n");
EDBPrint (L" Caller Callee Name\n");
EDBPrint (L" ================== ================== ========\n");
-//EDBPrint (L" 0x00000000FFFFFFFF 0xFFFFFFFF00000000 EfiMain\n");
+ // EDBPrint (L" 0x00000000FFFFFFFF 0xFFFFFFFF00000000 EfiMain\n");
for (Index = (INTN)(DebuggerPrivate->CallStackEntryCount - 1); Index >= 0; Index--) {
//
// Get CallStack and print
@@ -134,13 +134,14 @@ DebuggerCallStack (
if (FuncName != NULL) {
EDBPrint (L" %a()", FuncName);
}
+
EDBPrint (L"\n");
if (ShowParameter) {
//
// Print parameter
//
- if (sizeof(UINTN) == sizeof(UINT64)) {
+ if (sizeof (UINTN) == sizeof (UINT64)) {
EDBPrint (
L" Parameter Address (0x%016lx) (\n",
CallStackEntry->ParameterAddr
@@ -149,6 +150,7 @@ DebuggerCallStack (
EDBPrint (L" )\n");
continue;
}
+
//
// Print each parameter
//
@@ -156,6 +158,7 @@ DebuggerCallStack (
if (SubIndex % 2 == 0) {
EDBPrint (L" ");
}
+
EDBPrint (
L"0x%016lx, ",
CallStackEntry->Parameter[SubIndex]
@@ -164,9 +167,11 @@ DebuggerCallStack (
EDBPrint (L"\n");
}
}
+
if (SubIndex % 2 == 0) {
EDBPrint (L" ");
}
+
EDBPrint (
L"0x%016lx\n",
CallStackEntry->Parameter[SubIndex]
@@ -176,7 +181,8 @@ DebuggerCallStack (
// break only for parameter
//
if ((((DebuggerPrivate->CallStackEntryCount - Index) % (16 / ParameterNumber)) == 0) &&
- (Index != 0)) {
+ (Index != 0))
+ {
if (SetPageBreak ()) {
break;
}
@@ -190,6 +196,7 @@ DebuggerCallStack (
EDBPrint (L" )\n");
continue;
}
+
//
// Print each parameter
//
@@ -197,6 +204,7 @@ DebuggerCallStack (
if (SubIndex % 4 == 0) {
EDBPrint (L" ");
}
+
EDBPrint (
L"0x%08x, ",
CallStackEntry->Parameter[SubIndex]
@@ -205,9 +213,11 @@ DebuggerCallStack (
EDBPrint (L"\n");
}
}
+
if (SubIndex % 4 == 0) {
EDBPrint (L" ");
}
+
EDBPrint (
L"0x%08x\n",
CallStackEntry->Parameter[SubIndex]
@@ -217,7 +227,8 @@ DebuggerCallStack (
// break only for parameter
//
if ((((DebuggerPrivate->CallStackEntryCount - Index) % (32 / ParameterNumber)) == 0) &&
- (Index != 0)) {
+ (Index != 0))
+ {
if (SetPageBreak ()) {
break;
}
@@ -246,10 +257,10 @@ DebuggerCallStack (
**/
EFI_DEBUG_STATUS
DebuggerInstructionBranch (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
UINTN Index;
@@ -263,11 +274,12 @@ DebuggerInstructionBranch (
// Clear Trace
//
DebuggerPrivate->TraceEntryCount = 0;
- ZeroMem (DebuggerPrivate->TraceEntry, sizeof(DebuggerPrivate->TraceEntry));
+ ZeroMem (DebuggerPrivate->TraceEntry, sizeof (DebuggerPrivate->TraceEntry));
EDBPrint (L"Instruction Trace is cleared\n");
} else {
EDBPrint (L"Trace argument Invalid\n");
}
+
return EFI_DEBUG_CONTINUE;
}
@@ -289,7 +301,7 @@ DebuggerInstructionBranch (
EDBPrint (L"Instruction Trace (->Latest):\n");
EDBPrint (L" Source Addr Destination Addr Type\n");
EDBPrint (L" ================== ================== ========\n");
-//EDBPrint (L" 0x00000000FFFFFFFF 0xFFFFFFFF00000000 (CALLEX)\n");
+ // EDBPrint (L" 0x00000000FFFFFFFF 0xFFFFFFFF00000000 (CALLEX)\n");
for (Index = 0; Index < DebuggerPrivate->TraceEntryCount; Index++) {
EDBPrint (
L" 0x%016lx 0x%016lx %s\n",
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreak.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreak.c
index 696703c4bb..7d0b6f1a82 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreak.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreak.c
@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Edb.h"
-
/**
DebuggerCommand - BreakOnCALL.
@@ -23,10 +22,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_DEBUG_STATUS
DebuggerBreakOnCALL (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
//
@@ -69,10 +68,10 @@ DebuggerBreakOnCALL (
**/
EFI_DEBUG_STATUS
DebuggerBreakOnCALLEX (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
//
@@ -115,10 +114,10 @@ DebuggerBreakOnCALLEX (
**/
EFI_DEBUG_STATUS
DebuggerBreakOnRET (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
//
@@ -161,10 +160,10 @@ DebuggerBreakOnRET (
**/
EFI_DEBUG_STATUS
DebuggerBreakOnEntrypoint (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
//
@@ -209,10 +208,10 @@ DebuggerBreakOnEntrypoint (
**/
EFI_DEBUG_STATUS
DebuggerBreakOnThunk (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
//
@@ -256,10 +255,10 @@ DebuggerBreakOnThunk (
**/
EFI_DEBUG_STATUS
DebuggerBreakOnKey (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
index 5d32c68406..791fd7d441 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
@@ -20,10 +20,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
BOOLEAN
IsEBCBREAK3 (
- IN UINTN Address
+ IN UINTN Address
)
{
- if (GET_OPCODE(Address) != OPCODE_BREAK) {
+ if (GET_OPCODE (Address) != OPCODE_BREAK) {
return FALSE;
}
@@ -47,8 +47,8 @@ IsEBCBREAK3 (
**/
BOOLEAN
DebuggerBreakpointIsDuplicated (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN UINTN Address
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN UINTN Address
)
{
UINTN Index;
@@ -85,8 +85,8 @@ DebuggerBreakpointIsDuplicated (
**/
EFI_STATUS
DebuggerBreakpointAdd (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN UINTN Address
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN UINTN Address
)
{
//
@@ -114,15 +114,15 @@ DebuggerBreakpointAdd (
// Set the breakpoint
//
DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].BreakpointAddress = Address;
- DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].State = TRUE;
- DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].OldInstruction = 0;
+ DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].State = TRUE;
+ DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].OldInstruction = 0;
CopyMem (
&DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].OldInstruction,
(VOID *)Address,
- sizeof(UINT16)
+ sizeof (UINT16)
);
- DebuggerPrivate->DebuggerBreakpointCount ++;
+ DebuggerPrivate->DebuggerBreakpointCount++;
//
// Done
@@ -143,14 +143,15 @@ DebuggerBreakpointAdd (
**/
EFI_STATUS
DebuggerBreakpointDel (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN UINTN Index
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN UINTN Index
)
{
- UINTN BpIndex;
+ UINTN BpIndex;
if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
- (Index >= DebuggerPrivate->DebuggerBreakpointCount)) {
+ (Index >= DebuggerPrivate->DebuggerBreakpointCount))
+ {
return EFI_NOT_FOUND;
}
@@ -164,12 +165,13 @@ DebuggerBreakpointDel (
sizeof (DebuggerPrivate->DebuggerBreakpointContext[BpIndex])
);
}
+
ZeroMem (
&DebuggerPrivate->DebuggerBreakpointContext[BpIndex],
- sizeof(DebuggerPrivate->DebuggerBreakpointContext[BpIndex])
+ sizeof (DebuggerPrivate->DebuggerBreakpointContext[BpIndex])
);
- DebuggerPrivate->DebuggerBreakpointCount --;
+ DebuggerPrivate->DebuggerBreakpointCount--;
//
// Done
@@ -190,12 +192,13 @@ DebuggerBreakpointDel (
**/
EFI_STATUS
DebuggerBreakpointDis (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN UINTN Index
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN UINTN Index
)
{
if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
- (Index >= DebuggerPrivate->DebuggerBreakpointCount)) {
+ (Index >= DebuggerPrivate->DebuggerBreakpointCount))
+ {
return EFI_NOT_FOUND;
}
@@ -220,12 +223,13 @@ DebuggerBreakpointDis (
**/
EFI_STATUS
DebuggerBreakpointEn (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN UINTN Index
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN UINTN Index
)
{
if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
- (Index >= DebuggerPrivate->DebuggerBreakpointCount)) {
+ (Index >= DebuggerPrivate->DebuggerBreakpointCount))
+ {
return EFI_NOT_FOUND;
}
@@ -251,13 +255,13 @@ DebuggerBreakpointEn (
**/
EFI_DEBUG_STATUS
DebuggerBreakpointList (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN Index;
+ UINTN Index;
//
// Check breakpoint cound
@@ -277,8 +281,8 @@ DebuggerBreakpointList (
EDBPrint (L"Breakpoint :\n");
EDBPrint (L" Index Address Status\n");
EDBPrint (L"======= ================== ========\n");
-//EDBPrint (L" 1 0xFFFFFFFF00000000 *\n");
-//EDBPrint (L" 12 0x00000000FFFFFFFF\n");
+ // EDBPrint (L" 1 0xFFFFFFFF00000000 *\n");
+ // EDBPrint (L" 12 0x00000000FFFFFFFF\n");
for (Index = 0; Index < DebuggerPrivate->DebuggerBreakpointCount; Index++) {
//
// Print the breakpoint
@@ -311,14 +315,14 @@ DebuggerBreakpointList (
**/
EFI_DEBUG_STATUS
DebuggerBreakpointSet (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN Address;
- EFI_STATUS Status;
+ UINTN Address;
+ EFI_STATUS Status;
if (CommandArg == NULL) {
EDBPrint (L"BreakpointSet Argument error!\n");
@@ -331,7 +335,7 @@ DebuggerBreakpointSet (
Status = Symboltoi (CommandArg, &Address);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND) {
- Address = Xtoi(CommandArg);
+ Address = Xtoi (CommandArg);
} else {
//
// Something wrong, let Symboltoi print error info.
@@ -345,7 +349,7 @@ DebuggerBreakpointSet (
// Add breakpoint
//
Status = DebuggerBreakpointAdd (DebuggerPrivate, Address);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"BreakpointSet error!\n");
}
@@ -369,14 +373,14 @@ DebuggerBreakpointSet (
**/
EFI_DEBUG_STATUS
DebuggerBreakpointClear (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN Index;
- EFI_STATUS Status;
+ UINTN Index;
+ EFI_STATUS Status;
if (CommandArg == NULL) {
EDBPrint (L"BreakpointClear Argument error!\n");
@@ -388,7 +392,7 @@ DebuggerBreakpointClear (
// delete all breakpoint
//
DebuggerPrivate->DebuggerBreakpointCount = 0;
- ZeroMem (DebuggerPrivate->DebuggerBreakpointContext, sizeof(DebuggerPrivate->DebuggerBreakpointContext));
+ ZeroMem (DebuggerPrivate->DebuggerBreakpointContext, sizeof (DebuggerPrivate->DebuggerBreakpointContext));
EDBPrint (L"All the Breakpoint is cleared\n");
return EFI_DEBUG_CONTINUE;
}
@@ -396,14 +400,15 @@ DebuggerBreakpointClear (
//
// Get breakpoint index
//
- Index = Atoi(CommandArg);
- if (Index == (UINTN) -1) {
+ Index = Atoi (CommandArg);
+ if (Index == (UINTN)-1) {
EDBPrint (L"BreakpointClear Argument error!\n");
return EFI_DEBUG_CONTINUE;
}
if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
- (Index >= DebuggerPrivate->DebuggerBreakpointCount)) {
+ (Index >= DebuggerPrivate->DebuggerBreakpointCount))
+ {
EDBPrint (L"BreakpointClear error!\n");
return EFI_DEBUG_CONTINUE;
}
@@ -412,7 +417,7 @@ DebuggerBreakpointClear (
// Delete breakpoint
//
Status = DebuggerBreakpointDel (DebuggerPrivate, Index);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"BreakpointClear error!\n");
}
@@ -436,14 +441,14 @@ DebuggerBreakpointClear (
**/
EFI_DEBUG_STATUS
DebuggerBreakpointDisable (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN Index;
- EFI_STATUS Status;
+ UINTN Index;
+ EFI_STATUS Status;
if (CommandArg == NULL) {
EDBPrint (L"BreakpointDisable Argument error!\n");
@@ -457,6 +462,7 @@ DebuggerBreakpointDisable (
for (Index = 0; Index < DebuggerPrivate->DebuggerBreakpointCount; Index++) {
Status = DebuggerBreakpointDis (DebuggerPrivate, Index);
}
+
EDBPrint (L"All the Breakpoint is disabled\n");
return EFI_DEBUG_CONTINUE;
}
@@ -464,8 +470,8 @@ DebuggerBreakpointDisable (
//
// Get breakpoint index
//
- Index = Atoi(CommandArg);
- if (Index == (UINTN) -1) {
+ Index = Atoi (CommandArg);
+ if (Index == (UINTN)-1) {
EDBPrint (L"BreakpointDisable Argument error!\n");
return EFI_DEBUG_CONTINUE;
}
@@ -474,7 +480,7 @@ DebuggerBreakpointDisable (
// Disable breakpoint
//
Status = DebuggerBreakpointDis (DebuggerPrivate, Index);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"BreakpointDisable error!\n");
}
@@ -497,14 +503,14 @@ DebuggerBreakpointDisable (
**/
EFI_DEBUG_STATUS
DebuggerBreakpointEnable (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN Index;
- EFI_STATUS Status;
+ UINTN Index;
+ EFI_STATUS Status;
if (CommandArg == NULL) {
EDBPrint (L"BreakpointEnable Argument error!\n");
@@ -518,6 +524,7 @@ DebuggerBreakpointEnable (
for (Index = 0; Index < DebuggerPrivate->DebuggerBreakpointCount; Index++) {
Status = DebuggerBreakpointEn (DebuggerPrivate, Index);
}
+
EDBPrint (L"All the Breakpoint is enabled\n");
return EFI_DEBUG_CONTINUE;
}
@@ -525,8 +532,8 @@ DebuggerBreakpointEnable (
//
// Get breakpoint index
//
- Index = Atoi(CommandArg);
- if (Index == (UINTN) -1) {
+ Index = Atoi (CommandArg);
+ if (Index == (UINTN)-1) {
EDBPrint (L"BreakpointEnable Argument error!\n");
return EFI_DEBUG_CONTINUE;
}
@@ -535,7 +542,7 @@ DebuggerBreakpointEnable (
// Enable breakpoint
//
Status = DebuggerBreakpointEn (DebuggerPrivate, Index);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"BreakpointEnable error!\n");
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtIo.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtIo.c
index d5390d13aa..6540f301cb 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtIo.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtIo.c
@@ -22,10 +22,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_DEBUG_STATUS
DebuggerExtIoIB (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -35,7 +35,6 @@ DebuggerExtIoIB (
return EFI_DEBUG_CONTINUE;
}
-
/**
DebuggerCommand - IW.
@@ -51,10 +50,10 @@ DebuggerExtIoIB (
**/
EFI_DEBUG_STATUS
DebuggerExtIoIW (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -79,10 +78,10 @@ DebuggerExtIoIW (
**/
EFI_DEBUG_STATUS
DebuggerExtIoID (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -106,10 +105,10 @@ DebuggerExtIoID (
**/
EFI_DEBUG_STATUS
DebuggerExtIoOB (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -119,7 +118,6 @@ DebuggerExtIoOB (
return EFI_DEBUG_CONTINUE;
}
-
/**
DebuggerCommand - OW.
@@ -134,10 +132,10 @@ DebuggerExtIoOB (
**/
EFI_DEBUG_STATUS
DebuggerExtIoOW (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -147,7 +145,6 @@ DebuggerExtIoOW (
return EFI_DEBUG_CONTINUE;
}
-
/**
DebuggerCommand - OD.
@@ -162,10 +159,10 @@ DebuggerExtIoOW (
**/
EFI_DEBUG_STATUS
DebuggerExtIoOD (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtPci.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtPci.c
index 93e8b503e3..49c57f66a4 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtPci.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdExtPci.c
@@ -22,10 +22,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_DEBUG_STATUS
DebuggerExtPciPCIL (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -49,10 +49,10 @@ DebuggerExtPciPCIL (
**/
EFI_DEBUG_STATUS
DebuggerExtPciPCID (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -76,10 +76,10 @@ DebuggerExtPciPCID (
**/
EFI_DEBUG_STATUS
DebuggerExtPciCFGB (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -89,7 +89,6 @@ DebuggerExtPciCFGB (
return EFI_DEBUG_CONTINUE;
}
-
/**
DebuggerCommand - CFGW.
@@ -104,10 +103,10 @@ DebuggerExtPciCFGB (
**/
EFI_DEBUG_STATUS
DebuggerExtPciCFGW (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
@@ -131,10 +130,10 @@ DebuggerExtPciCFGW (
**/
EFI_DEBUG_STATUS
DebuggerExtPciCFGD (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
EDBPrint (L"Unsupported\n");
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdGo.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdGo.c
index e5cf857a2a..d51e627865 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdGo.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdGo.c
@@ -24,15 +24,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_DEBUG_STATUS
DebuggerGo (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN Address;
- CHAR16 *CommandStr;
- EFI_STATUS Status;
+ UINTN Address;
+ CHAR16 *CommandStr;
+ EFI_STATUS Status;
//
// Check argument
@@ -48,7 +48,7 @@ DebuggerGo (
Status = Symboltoi (CommandStr, &Address);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND) {
- Address = Xtoi(CommandStr);
+ Address = Xtoi (CommandStr);
} else {
//
// Something wrong, let Symboltoi print error info.
@@ -57,8 +57,9 @@ DebuggerGo (
return EFI_DEBUG_CONTINUE;
}
}
+
DebuggerPrivate->GoTilContext.BreakAddress = Address;
- DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_GT;
+ DebuggerPrivate->FeatureFlags |= EFI_DEBUG_FLAG_EBC_GT;
} else {
EDBPrint (L"Command Argument error!\n");
return EFI_DEBUG_CONTINUE;
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdHelp.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdHelp.c
index 74e1befee5..655384c34f 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdHelp.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdHelp.c
@@ -22,13 +22,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_DEBUG_STATUS
DebuggerHelp (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN Index;
+ UINTN Index;
//
// if no argument, print all the command title
@@ -41,6 +41,7 @@ DebuggerHelp (
EDBPrint (DebuggerPrivate->DebuggerCommandSet[Index].CommandTitle);
}
}
+
return EFI_DEBUG_CONTINUE;
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c
index 42bd8093f8..f0e0d9802f 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdMemory.c
@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Edb.h"
-
/**
Display memory unit.
@@ -25,34 +24,34 @@ EdbDisplayMemoryUnit (
IN EDB_DATA_WIDTH Width
)
{
- UINT8 Data8;
- UINT16 Data16;
- UINT32 Data32;
- UINT64 Data64;
+ UINT8 Data8;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINT64 Data64;
//
// Print according to width
//
switch (Width) {
- case EdbWidthUint8:
- CopyMem (&Data8, (VOID *)Address, sizeof(UINT8));
- EDBPrint (L"%02x ", Data8);
- return sizeof(UINT8);
- case EdbWidthUint16:
- CopyMem (&Data16, (VOID *)Address, sizeof(UINT16));
- EDBPrint (L"%04x ", Data16);
- return sizeof(UINT16);
- case EdbWidthUint32:
- CopyMem (&Data32, (VOID *)Address, sizeof(UINT32));
- EDBPrint (L"%08x ", Data32);
- return sizeof(UINT32);
- case EdbWidthUint64:
- CopyMem (&Data64, (VOID *)Address, sizeof(UINT64));
- EDBPrint (L"%016lx ", Data64);
- return sizeof(UINT64);
- default:
- ASSERT (FALSE);
- break;
+ case EdbWidthUint8:
+ CopyMem (&Data8, (VOID *)Address, sizeof (UINT8));
+ EDBPrint (L"%02x ", Data8);
+ return sizeof (UINT8);
+ case EdbWidthUint16:
+ CopyMem (&Data16, (VOID *)Address, sizeof (UINT16));
+ EDBPrint (L"%04x ", Data16);
+ return sizeof (UINT16);
+ case EdbWidthUint32:
+ CopyMem (&Data32, (VOID *)Address, sizeof (UINT32));
+ EDBPrint (L"%08x ", Data32);
+ return sizeof (UINT32);
+ case EdbWidthUint64:
+ CopyMem (&Data64, (VOID *)Address, sizeof (UINT64));
+ EDBPrint (L"%016lx ", Data64);
+ return sizeof (UINT64);
+ default:
+ ASSERT (FALSE);
+ break;
}
//
@@ -72,9 +71,9 @@ EdbDisplayMemoryUnit (
**/
VOID
EdbDisplayMemory (
- IN UINTN Address,
- IN UINTN Count,
- IN EDB_DATA_WIDTH Width
+ IN UINTN Address,
+ IN UINTN Count,
+ IN EDB_DATA_WIDTH Width
)
{
UINTN LineNumber;
@@ -84,27 +83,27 @@ EdbDisplayMemory (
UINTN NumberInLine;
if (Count == 0) {
- return ;
+ return;
}
//
// Get line number and byte number
//
switch (Width) {
- case EdbWidthUint8:
- NumberInLine = 16;
- break;
- case EdbWidthUint16:
- NumberInLine = 8;
- break;
- case EdbWidthUint32:
- NumberInLine = 4;
- break;
- case EdbWidthUint64:
- NumberInLine = 2;
- break;
- default:
- return;
+ case EdbWidthUint8:
+ NumberInLine = 16;
+ break;
+ case EdbWidthUint16:
+ NumberInLine = 8;
+ break;
+ case EdbWidthUint32:
+ NumberInLine = 4;
+ break;
+ case EdbWidthUint64:
+ NumberInLine = 2;
+ break;
+ default:
+ return;
}
LineNumber = Count / NumberInLine;
@@ -118,12 +117,12 @@ EdbDisplayMemory (
// Print each line
//
for (LineIndex = 0; LineIndex < LineNumber; LineIndex++) {
-
//
// Break check
//
if (((LineIndex % EFI_DEBUGGER_LINE_NUMBER_IN_PAGE) == 0) &&
- (LineIndex != 0)) {
+ (LineIndex != 0))
+ {
if (SetPageBreak ()) {
break;
}
@@ -133,6 +132,7 @@ EdbDisplayMemory (
for (ByteIndex = 0; ByteIndex < NumberInLine; ByteIndex++) {
Address += EdbDisplayMemoryUnit (Address, Width);
}
+
EDBPrint (L"\n");
}
@@ -140,7 +140,8 @@ EdbDisplayMemory (
// Break check
//
if (((LineIndex % EFI_DEBUGGER_LINE_NUMBER_IN_PAGE) == 0) &&
- (LineIndex != 0)) {
+ (LineIndex != 0))
+ {
if (SetPageBreak ()) {
return;
}
@@ -154,7 +155,7 @@ EdbDisplayMemory (
Address += EdbDisplayMemoryUnit (Address, Width);
}
- return ;
+ return;
}
/**
@@ -168,29 +169,29 @@ EdbDisplayMemory (
**/
VOID
EdbEnterMemory (
- IN UINTN Address,
- IN VOID *Value,
- IN EDB_DATA_WIDTH Width
+ IN UINTN Address,
+ IN VOID *Value,
+ IN EDB_DATA_WIDTH Width
)
{
switch (Width) {
- case EdbWidthUint8:
- CopyMem ((VOID *)Address, Value, sizeof(UINT8));
- break;
- case EdbWidthUint16:
- CopyMem ((VOID *)Address, Value, sizeof(UINT16));
- break;
- case EdbWidthUint32:
- CopyMem ((VOID *)Address, Value, sizeof(UINT32));
- break;
- case EdbWidthUint64:
- CopyMem ((VOID *)Address, Value, sizeof(UINT64));
- break;
- default:
- break;
+ case EdbWidthUint8:
+ CopyMem ((VOID *)Address, Value, sizeof (UINT8));
+ break;
+ case EdbWidthUint16:
+ CopyMem ((VOID *)Address, Value, sizeof (UINT16));
+ break;
+ case EdbWidthUint32:
+ CopyMem ((VOID *)Address, Value, sizeof (UINT32));
+ break;
+ case EdbWidthUint64:
+ CopyMem ((VOID *)Address, Value, sizeof (UINT64));
+ break;
+ default:
+ break;
}
- return ;
+ return;
}
/**
@@ -207,14 +208,14 @@ EdbEnterMemory (
**/
EFI_STATUS
EdbGetMemoryAddressCount (
- IN CHAR16 *CommandArg,
- IN UINTN *Address,
- IN UINTN *Count
+ IN CHAR16 *CommandArg,
+ IN UINTN *Address,
+ IN UINTN *Count
)
{
- CHAR16 *CommandStr;
- UINTN MemAddress;
- EFI_STATUS Status;
+ CHAR16 *CommandStr;
+ UINTN MemAddress;
+ EFI_STATUS Status;
//
// Get Address
@@ -224,10 +225,11 @@ EdbGetMemoryAddressCount (
EDBPrint (L"Memory: Address error!\n");
return EFI_INVALID_PARAMETER;
}
+
Status = Symboltoi (CommandStr, &MemAddress);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND) {
- MemAddress = Xtoi(CommandStr);
+ MemAddress = Xtoi (CommandStr);
} else {
//
// Something wrong, let Symboltoi print error info.
@@ -236,6 +238,7 @@ EdbGetMemoryAddressCount (
return EFI_INVALID_PARAMETER;
}
}
+
*Address = MemAddress;
//
@@ -245,7 +248,7 @@ EdbGetMemoryAddressCount (
if (CommandStr == NULL) {
*Count = 1;
} else {
- *Count = Xtoi(CommandStr);
+ *Count = Xtoi (CommandStr);
}
//
@@ -268,14 +271,14 @@ EdbGetMemoryAddressCount (
**/
EFI_STATUS
EdbGetMemoryAddressValue (
- IN CHAR16 *CommandArg,
- IN UINTN *Address,
- IN UINT64 *Value
+ IN CHAR16 *CommandArg,
+ IN UINTN *Address,
+ IN UINT64 *Value
)
{
- CHAR16 *CommandStr;
- UINTN MemAddress;
- EFI_STATUS Status;
+ CHAR16 *CommandStr;
+ UINTN MemAddress;
+ EFI_STATUS Status;
//
// Get Address
@@ -285,10 +288,11 @@ EdbGetMemoryAddressValue (
EDBPrint (L"Memory: Address error!\n");
return EFI_INVALID_PARAMETER;
}
+
Status = Symboltoi (CommandStr, &MemAddress);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND) {
- MemAddress = Xtoi(CommandStr);
+ MemAddress = Xtoi (CommandStr);
} else {
//
// Something wrong, let Symboltoi print error info.
@@ -297,6 +301,7 @@ EdbGetMemoryAddressValue (
return EFI_INVALID_PARAMETER;
}
}
+
*Address = MemAddress;
//
@@ -307,7 +312,8 @@ EdbGetMemoryAddressValue (
EDBPrint (L"Memory: Value error!\n");
return EFI_INVALID_PARAMETER;
}
- *Value = LXtoi(CommandStr);
+
+ *Value = LXtoi (CommandStr);
//
// Done
@@ -327,19 +333,19 @@ EdbGetMemoryAddressValue (
**/
EFI_DEBUG_STATUS
DebuggerMemoryDisplay (
- IN CHAR16 *CommandArg,
- IN EDB_DATA_WIDTH Width
+ IN CHAR16 *CommandArg,
+ IN EDB_DATA_WIDTH Width
)
{
- EFI_STATUS Status;
- UINTN Address;
- UINTN Count;
+ EFI_STATUS Status;
+ UINTN Address;
+ UINTN Count;
//
// Get memory address and count
//
Status = EdbGetMemoryAddressCount (CommandArg, &Address, &Count);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return EFI_DEBUG_CONTINUE;
}
@@ -366,19 +372,19 @@ DebuggerMemoryDisplay (
**/
EFI_DEBUG_STATUS
DebuggerMemoryEnter (
- IN CHAR16 *CommandArg,
- IN EDB_DATA_WIDTH Width
+ IN CHAR16 *CommandArg,
+ IN EDB_DATA_WIDTH Width
)
{
- EFI_STATUS Status;
- UINTN Address;
- UINT64 Value;
+ EFI_STATUS Status;
+ UINTN Address;
+ UINT64 Value;
//
// Get memory address and value
//
Status = EdbGetMemoryAddressValue (CommandArg, &Address, &Value);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return EFI_DEBUG_CONTINUE;
}
@@ -407,10 +413,10 @@ DebuggerMemoryEnter (
**/
EFI_DEBUG_STATUS
DebuggerMemoryDB (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryDisplay (CommandArg, EdbWidthUint8);
@@ -430,10 +436,10 @@ DebuggerMemoryDB (
**/
EFI_DEBUG_STATUS
DebuggerMemoryDW (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryDisplay (CommandArg, EdbWidthUint16);
@@ -453,10 +459,10 @@ DebuggerMemoryDW (
**/
EFI_DEBUG_STATUS
DebuggerMemoryDD (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryDisplay (CommandArg, EdbWidthUint32);
@@ -476,10 +482,10 @@ DebuggerMemoryDD (
**/
EFI_DEBUG_STATUS
DebuggerMemoryDQ (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryDisplay (CommandArg, EdbWidthUint64);
@@ -499,10 +505,10 @@ DebuggerMemoryDQ (
**/
EFI_DEBUG_STATUS
DebuggerMemoryEB (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryEnter (CommandArg, EdbWidthUint8);
@@ -522,10 +528,10 @@ DebuggerMemoryEB (
**/
EFI_DEBUG_STATUS
DebuggerMemoryEW (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryEnter (CommandArg, EdbWidthUint16);
@@ -545,10 +551,10 @@ DebuggerMemoryEW (
**/
EFI_DEBUG_STATUS
DebuggerMemoryED (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryEnter (CommandArg, EdbWidthUint32);
@@ -568,10 +574,10 @@ DebuggerMemoryED (
**/
EFI_DEBUG_STATUS
DebuggerMemoryEQ (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return DebuggerMemoryEnter (CommandArg, EdbWidthUint64);
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdQuit.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdQuit.c
index 76daf85402..98ad31acdd 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdQuit.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdQuit.c
@@ -28,10 +28,10 @@ Abstract:
**/
EFI_DEBUG_STATUS
DebuggerQuit (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
return EFI_DEBUG_RETURN;
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdRegister.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdRegister.c
index 2ced0e4dd4..272e4556e5 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdRegister.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdRegister.c
@@ -22,10 +22,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_DEBUG_STATUS
DebuggerRegister (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
CHAR16 *RegName;
@@ -80,6 +80,7 @@ DebuggerRegister (
EDBPrint (L"Invalid Register Value\n");
return EFI_DEBUG_CONTINUE;
}
+
RegVal = LXtoi (RegValStr);
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdScope.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdScope.c
index 8240ab6242..d09bb8a781 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdScope.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdScope.c
@@ -22,14 +22,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
EFI_DEBUG_STATUS
DebuggerScope (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- EFI_STATUS Status;
- UINTN Address;
+ EFI_STATUS Status;
+ UINTN Address;
if (CommandArg == NULL) {
EDBPrint (L"Scope: invalid Address\n");
@@ -42,7 +42,7 @@ DebuggerScope (
Status = Symboltoi (CommandArg, &Address);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND) {
- Address = Xtoi(CommandArg);
+ Address = Xtoi (CommandArg);
} else {
//
// Something wrong, let Symboltoi print error info.
@@ -51,6 +51,7 @@ DebuggerScope (
return EFI_DEBUG_CONTINUE;
}
}
+
DebuggerPrivate->InstructionScope = Address;
EDBPrint (L"Scope: 0x%x\n", DebuggerPrivate->InstructionScope);
EdbShowDisasm (DebuggerPrivate, SystemContext);
@@ -75,10 +76,10 @@ DebuggerScope (
**/
EFI_DEBUG_STATUS
DebuggerList (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
if (CommandArg == NULL) {
@@ -87,7 +88,7 @@ DebuggerList (
//
// Load new list number
//
- DebuggerPrivate->InstructionNumber = Atoi(CommandArg);
+ DebuggerPrivate->InstructionNumber = Atoi (CommandArg);
EDBPrint (L"List Number: %d\n", DebuggerPrivate->InstructionNumber);
EdbShowDisasm (DebuggerPrivate, SystemContext);
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdStep.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdStep.c
index 441f536764..3c5ef84965 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdStep.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdStep.c
@@ -20,10 +20,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
BOOLEAN
IsEBCCALL (
- IN UINTN Address
+ IN UINTN Address
)
{
- if (GET_OPCODE(Address) != OPCODE_CALL) {
+ if (GET_OPCODE (Address) != OPCODE_CALL) {
return FALSE;
}
@@ -46,10 +46,10 @@ IsEBCCALL (
**/
BOOLEAN
IsEBCRET (
- IN UINTN Address
+ IN UINTN Address
)
{
- if (GET_OPCODE(Address) != OPCODE_RET) {
+ if (GET_OPCODE (Address) != OPCODE_RET) {
return FALSE;
}
@@ -74,10 +74,10 @@ IsEBCRET (
**/
EFI_DEBUG_STATUS
DebuggerStepInto (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
SystemContext.SystemContextEbc->Flags |= VMFLAGS_STEP;
@@ -99,13 +99,13 @@ DebuggerStepInto (
**/
EFI_DEBUG_STATUS
DebuggerStepOver (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- if (IsEBCCALL((UINTN)SystemContext.SystemContextEbc->Ip)) {
+ if (IsEBCCALL ((UINTN)SystemContext.SystemContextEbc->Ip)) {
//
// Check CALL (NOTE: CALLEX is exclusive)
//
@@ -134,13 +134,13 @@ DebuggerStepOver (
**/
EFI_DEBUG_STATUS
DebuggerStepOut (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- if (IsEBCRET((UINTN)SystemContext.SystemContextEbc->Ip)) {
+ if (IsEBCRET ((UINTN)SystemContext.SystemContextEbc->Ip)) {
//
// Check RET
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
index 7b453fa98c..1b30b917f1 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
@@ -19,17 +19,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
CHAR16 *
GetFileNameFromFullPath (
- IN CHAR16 *FullPath
+ IN CHAR16 *FullPath
)
{
- CHAR16 *FileName;
- CHAR16 *TempFileName;
+ CHAR16 *FileName;
+ CHAR16 *TempFileName;
- FileName = FullPath;
+ FileName = FullPath;
TempFileName = StrGetNewTokenLine (FullPath, L"\\");
while (TempFileName != NULL) {
- FileName = TempFileName;
+ FileName = TempFileName;
TempFileName = StrGetNextTokenLine (L"\\");
PatchForStrTokenBefore (TempFileName, L'\\');
}
@@ -48,10 +48,10 @@ GetFileNameFromFullPath (
**/
CHAR16 *
GetDirNameFromFullPath (
- IN CHAR16 *FullPath
+ IN CHAR16 *FullPath
)
{
- CHAR16 *FileName;
+ CHAR16 *FileName;
FileName = GetFileNameFromFullPath (FullPath);
if (FileName != FullPath) {
@@ -75,14 +75,14 @@ GetDirNameFromFullPath (
**/
CHAR16 *
ConstructFullPath (
- IN CHAR16 *DirPath,
- IN CHAR16 *FilePath,
- IN UINTN Size
+ IN CHAR16 *DirPath,
+ IN CHAR16 *FilePath,
+ IN UINTN Size
)
{
- UINTN DirPathSize;
+ UINTN DirPathSize;
- DirPathSize = StrLen(DirPath);
+ DirPathSize = StrLen (DirPath);
*(DirPath + DirPathSize) = L'\\';
StrnCatS (DirPath, DirPathSize + Size + 1, FilePath, Size);
@@ -91,7 +91,7 @@ ConstructFullPath (
return DirPath;
}
-CHAR16 *mSymbolTypeStr[] = {
+CHAR16 *mSymbolTypeStr[] = {
L"( F)",
L"(SF)",
L"(GV)",
@@ -112,11 +112,11 @@ EdbSymbolTypeToStr (
IN EFI_DEBUGGER_SYMBOL_TYPE Type
)
{
- if (Type < 0 || Type >= EfiDebuggerSymbolTypeMax) {
+ if ((Type < 0) || (Type >= EfiDebuggerSymbolTypeMax)) {
return L"(?)";
}
- return mSymbolTypeStr [Type];
+ return mSymbolTypeStr[Type];
}
/**
@@ -132,18 +132,18 @@ EdbSymbolTypeToStr (
EFI_DEBUG_STATUS
DebuggerDisplaySymbolAccrodingToAddress (
IN UINTN Address,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
)
{
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
- UINTN CandidateAddress;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
+ UINTN CandidateAddress;
//
// Find the nearest symbol address
//
CandidateAddress = EbdFindSymbolAddress (Address, EdbMatchSymbolTypeNearestAddress, &Object, &Entry);
- if (CandidateAddress == 0 || CandidateAddress == (UINTN) -1 || Entry == NULL) {
+ if ((CandidateAddress == 0) || (CandidateAddress == (UINTN)-1) || (Entry == NULL)) {
EDBPrint (L"Symbole at Address not found!\n");
return EFI_DEBUG_CONTINUE;
} else if (Address != CandidateAddress) {
@@ -154,10 +154,10 @@ DebuggerDisplaySymbolAccrodingToAddress (
// Display symbol
//
EDBPrint (L"Symbol File Name: %s\n", Object->Name);
- if (sizeof(UINTN) == sizeof(UINT64)) {
+ if (sizeof (UINTN) == sizeof (UINT64)) {
EDBPrint (L" Address Type Symbol\n");
EDBPrint (L" ================== ==== ========\n");
-// EDBPrint (L" 0xFFFFFFFF00000000 ( F) TestMain\n");
+ // EDBPrint (L" 0xFFFFFFFF00000000 ( F) TestMain\n");
EDBPrint (
L" 0x%016lx %s %a\n",
(UINT64)Entry->Rva + Object->BaseAddress,
@@ -167,7 +167,7 @@ DebuggerDisplaySymbolAccrodingToAddress (
} else {
EDBPrint (L" Address Type Symbol\n");
EDBPrint (L" ========== ==== ========\n");
-// EDBPrint (L" 0xFFFF0000 ( F) TestMain\n");
+ // EDBPrint (L" 0xFFFF0000 ( F) TestMain\n");
EDBPrint (
L" 0x%08x %s %a\n",
Entry->Rva + Object->BaseAddress,
@@ -197,13 +197,13 @@ EFI_DEBUG_STATUS
DebuggerDisplaySymbolAccrodingToName (
IN CHAR16 *SymbolFileName,
IN CHAR16 *SymbolName,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate
)
{
- UINTN Index;
- UINTN SubIndex;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
+ UINTN Index;
+ UINTN SubIndex;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
if (DebuggerPrivate->DebuggerSymbolContext.ObjectCount == 0) {
EDBPrint (L"No Symbol File!\n");
@@ -216,7 +216,8 @@ DebuggerDisplaySymbolAccrodingToName (
Object = DebuggerPrivate->DebuggerSymbolContext.Object;
for (Index = 0; Index < DebuggerPrivate->DebuggerSymbolContext.ObjectCount; Index++, Object++) {
if ((SymbolFileName != NULL) &&
- (StriCmp (SymbolFileName, Object->Name) != 0)) {
+ (StriCmp (SymbolFileName, Object->Name) != 0))
+ {
continue;
}
@@ -234,15 +235,16 @@ DebuggerDisplaySymbolAccrodingToName (
EDBPrint (L"No Symbol!\n");
continue;
}
+
Entry = Object->Entry;
- if (sizeof(UINTN) == sizeof(UINT64)) {
+ if (sizeof (UINTN) == sizeof (UINT64)) {
EDBPrint (L" Address Type Symbol\n");
EDBPrint (L" ================== ==== ========\n");
-// EDBPrint (L" 0xFFFFFFFF00000000 ( F) TestMain (EbcTest.obj)\n");
+ // EDBPrint (L" 0xFFFFFFFF00000000 ( F) TestMain (EbcTest.obj)\n");
} else {
EDBPrint (L" Address Type Symbol\n");
EDBPrint (L" ========== ==== ========\n");
-// EDBPrint (L" 0xFFFF0000 ( F) TestMain (EbcTest.obj)\n");
+ // EDBPrint (L" 0xFFFF0000 ( F) TestMain (EbcTest.obj)\n");
}
//
@@ -250,7 +252,8 @@ DebuggerDisplaySymbolAccrodingToName (
//
for (SubIndex = 0; SubIndex < Object->EntryCount; SubIndex++, Entry++) {
if ((SymbolName != NULL) &&
- (StrCmpUnicodeAndAscii (SymbolName, Entry->Name) != 0)) {
+ (StrCmpUnicodeAndAscii (SymbolName, Entry->Name) != 0))
+ {
continue;
}
@@ -258,13 +261,14 @@ DebuggerDisplaySymbolAccrodingToName (
// Break symbol
//
if (((SubIndex % EFI_DEBUGGER_LINE_NUMBER_IN_PAGE) == 0) &&
- (SubIndex != 0)) {
+ (SubIndex != 0))
+ {
if (SetPageBreak ()) {
break;
}
}
- if (sizeof(UINTN) == sizeof(UINT64)) {
+ if (sizeof (UINTN) == sizeof (UINT64)) {
EDBPrint (
L" 0x%016lx %s %a (%a)\n",
(UINT64)Entry->Rva + Object->BaseAddress,
@@ -304,27 +308,28 @@ DebuggerDisplaySymbolAccrodingToName (
**/
EFI_DEBUG_STATUS
DebuggerListSymbol (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- CHAR16 *SymbolFileName;
- CHAR16 *SymbolName;
- CHAR16 *CommandStr;
- UINTN Address;
+ CHAR16 *SymbolFileName;
+ CHAR16 *SymbolName;
+ CHAR16 *CommandStr;
+ UINTN Address;
SymbolFileName = NULL;
- SymbolName = NULL;
- CommandStr = CommandArg;
+ SymbolName = NULL;
+ CommandStr = CommandArg;
//
// display symbol according to address
//
if (CommandStr != NULL) {
if ((StriCmp (CommandStr, L"F") != 0) &&
- (StriCmp (CommandStr, L"S") != 0)) {
+ (StriCmp (CommandStr, L"S") != 0))
+ {
Address = Xtoi (CommandStr);
return DebuggerDisplaySymbolAccrodingToAddress (Address, DebuggerPrivate);
}
@@ -341,10 +346,11 @@ DebuggerListSymbol (
return EFI_DEBUG_CONTINUE;
} else {
SymbolFileName = CommandStr;
- CommandStr = StrGetNextTokenLine (L" ");
+ CommandStr = StrGetNextTokenLine (L" ");
}
}
}
+
//
// Get SymbolName
//
@@ -360,6 +366,7 @@ DebuggerListSymbol (
}
}
}
+
if (CommandStr != NULL) {
EDBPrint (L"Argument error!\n");
return EFI_DEBUG_CONTINUE;
@@ -385,22 +392,22 @@ DebuggerListSymbol (
**/
EFI_DEBUG_STATUS
DebuggerLoadSymbol (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN BufferSize;
- VOID *Buffer;
- EFI_STATUS Status;
- CHAR16 *FileName;
- CHAR16 *CommandArg2;
- BOOLEAN IsLoadCode;
- CHAR16 *DirName;
- CHAR16 CodFile[EFI_DEBUGGER_SYMBOL_NAME_MAX];
- CHAR16 *CodFileName;
- UINTN Index;
+ UINTN BufferSize;
+ VOID *Buffer;
+ EFI_STATUS Status;
+ CHAR16 *FileName;
+ CHAR16 *CommandArg2;
+ BOOLEAN IsLoadCode;
+ CHAR16 *DirName;
+ CHAR16 CodFile[EFI_DEBUGGER_SYMBOL_NAME_MAX];
+ CHAR16 *CodFileName;
+ UINTN Index;
//
// Check the argument
@@ -409,7 +416,8 @@ DebuggerLoadSymbol (
EDBPrint (L"SymbolFile not found!\n");
return EFI_DEBUG_CONTINUE;
}
- IsLoadCode = FALSE;
+
+ IsLoadCode = FALSE;
CommandArg2 = StrGetNextTokenLine (L" ");
if (CommandArg2 != NULL) {
if (StriCmp (CommandArg2, L"a") == 0) {
@@ -424,6 +432,7 @@ DebuggerLoadSymbol (
EDBPrint (L"SymbolFile name error!\n");
return EFI_DEBUG_CONTINUE;
}
+
if (StriCmp (CommandArg + (StrLen (CommandArg) - 4), L".map") != 0) {
EDBPrint (L"SymbolFile name error!\n");
return EFI_DEBUG_CONTINUE;
@@ -433,7 +442,7 @@ DebuggerLoadSymbol (
// Read MAP file to memory
//
Status = ReadFileToBuffer (DebuggerPrivate, CommandArg, &BufferSize, &Buffer, TRUE);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"SymbolFile read error!\n");
return EFI_DEBUG_CONTINUE;
}
@@ -443,18 +452,19 @@ DebuggerLoadSymbol (
// Load Symbol
//
Status = EdbLoadSymbol (DebuggerPrivate, FileName, BufferSize, Buffer);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"LoadSymbol error!\n");
gBS->FreePool (Buffer);
return EFI_DEBUG_CONTINUE;
}
+
gBS->FreePool (Buffer);
//
// Patch Symbol for RVA
//
Status = EdbPatchSymbolRVA (DebuggerPrivate, FileName, EdbEbcImageRvaSearchTypeLast);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"PatchSymbol RVA - %r! Using the RVA in symbol file.\n", Status);
} else {
DEBUG ((DEBUG_ERROR, "PatchSymbol RVA successfully!\n"));
@@ -468,9 +478,9 @@ DebuggerLoadSymbol (
// load each cod file
//
DirName = GetDirNameFromFullPath (CommandArg);
- ZeroMem (CodFile, sizeof(CodFile));
+ ZeroMem (CodFile, sizeof (CodFile));
if (StrCmp (DirName, L"") != 0) {
- StrCpyS (CodFile, sizeof(CodFile), DirName);
+ StrCpyS (CodFile, sizeof (CodFile), DirName);
} else {
DirName = L"\\";
}
@@ -478,19 +488,19 @@ DebuggerLoadSymbol (
//
// Go throuth each file under this dir
//
- Index = 0;
+ Index = 0;
CodFileName = GetFileNameUnderDir (DebuggerPrivate, DirName, L".cod", &Index);
while (CodFileName != NULL) {
- ZeroMem (CodFile, sizeof(CodFile));
+ ZeroMem (CodFile, sizeof (CodFile));
if (StrCmp (DirName, L"\\") != 0) {
- StrCpyS (CodFile, sizeof(CodFile), DirName);
+ StrCpyS (CodFile, sizeof (CodFile), DirName);
}
//
// read cod file to memory
//
Status = ReadFileToBuffer (DebuggerPrivate, ConstructFullPath (CodFile, CodFileName, EFI_DEBUGGER_SYMBOL_NAME_MAX - StrLen (CodFile) - 2), &BufferSize, &Buffer, FALSE);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"CodeFile read error!\n");
CodFileName = GetFileNameUnderDir (DebuggerPrivate, DirName, L".cod", &Index);
continue;
@@ -544,19 +554,19 @@ DebuggerLoadSymbol (
**/
EFI_DEBUG_STATUS
DebuggerUnloadSymbol (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- EFI_STATUS Status;
- CHAR16 *FileName;
- CHAR16 *DirName;
- CHAR16 CodFile[EFI_DEBUGGER_SYMBOL_NAME_MAX];
- CHAR16 *CodFileName;
- UINTN Index;
- VOID *BufferPtr;
+ EFI_STATUS Status;
+ CHAR16 *FileName;
+ CHAR16 *DirName;
+ CHAR16 CodFile[EFI_DEBUGGER_SYMBOL_NAME_MAX];
+ CHAR16 *CodFileName;
+ UINTN Index;
+ VOID *BufferPtr;
//
// Check the argument
@@ -572,9 +582,9 @@ DebuggerUnloadSymbol (
// Unload Code
//
DirName = GetDirNameFromFullPath (CommandArg);
- ZeroMem (CodFile, sizeof(CodFile));
+ ZeroMem (CodFile, sizeof (CodFile));
if (StrCmp (DirName, L"") != 0) {
- StrCpyS (CodFile, sizeof(CodFile), DirName);
+ StrCpyS (CodFile, sizeof (CodFile), DirName);
} else {
DirName = L"\\";
}
@@ -582,12 +592,12 @@ DebuggerUnloadSymbol (
//
// Go through each file under this dir
//
- Index = 0;
+ Index = 0;
CodFileName = GetFileNameUnderDir (DebuggerPrivate, DirName, L".cod", &Index);
while (CodFileName != NULL) {
- ZeroMem (CodFile, sizeof(CodFile));
+ ZeroMem (CodFile, sizeof (CodFile));
if (StrCmp (DirName, L"\\") != 0) {
- StrCpyS (CodFile, sizeof(CodFile), DirName);
+ StrCpyS (CodFile, sizeof (CodFile), DirName);
}
//
@@ -620,7 +630,7 @@ DebuggerUnloadSymbol (
// Unload Symbol
//
Status = EdbUnloadSymbol (DebuggerPrivate, FileName);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"UnloadSymbol error!\n");
}
@@ -644,10 +654,10 @@ DebuggerUnloadSymbol (
**/
EFI_DEBUG_STATUS
DebuggerDisplaySymbol (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
if (CommandArg == NULL) {
@@ -680,18 +690,18 @@ DebuggerDisplaySymbol (
**/
EFI_DEBUG_STATUS
DebuggerLoadCode (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- UINTN BufferSize;
- VOID *Buffer;
- EFI_STATUS Status;
- CHAR16 *CommandArg2;
- CHAR16 *FileName;
- CHAR16 *MapFileName;
+ UINTN BufferSize;
+ VOID *Buffer;
+ EFI_STATUS Status;
+ CHAR16 *CommandArg2;
+ CHAR16 *FileName;
+ CHAR16 *MapFileName;
//
// Check the argument
@@ -700,6 +710,7 @@ DebuggerLoadCode (
EDBPrint (L"CodeFile not found!\n");
return EFI_DEBUG_CONTINUE;
}
+
CommandArg2 = StrGetNextTokenLine (L" ");
if (CommandArg2 == NULL) {
EDBPrint (L"SymbolFile not found!\n");
@@ -710,14 +721,17 @@ DebuggerLoadCode (
EDBPrint (L"CodeFile name error!\n");
return EFI_DEBUG_CONTINUE;
}
+
if (StriCmp (CommandArg + (StrLen (CommandArg) - 4), L".cod") != 0) {
EDBPrint (L"CodeFile name error!\n");
return EFI_DEBUG_CONTINUE;
}
+
if (StrLen (CommandArg2) <= 4) {
EDBPrint (L"SymbolFile name error!\n");
return EFI_DEBUG_CONTINUE;
}
+
if (StriCmp (CommandArg2 + (StrLen (CommandArg2) - 4), L".map") != 0) {
EDBPrint (L"SymbolFile name error!\n");
return EFI_DEBUG_CONTINUE;
@@ -727,12 +741,12 @@ DebuggerLoadCode (
// read cod file to memory
//
Status = ReadFileToBuffer (DebuggerPrivate, CommandArg, &BufferSize, &Buffer, TRUE);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
EDBPrint (L"CodeFile read error!\n");
return EFI_DEBUG_CONTINUE;
}
- FileName = GetFileNameFromFullPath (CommandArg);
+ FileName = GetFileNameFromFullPath (CommandArg);
MapFileName = GetFileNameFromFullPath (CommandArg2);
//
// Load Code
@@ -774,17 +788,17 @@ DebuggerLoadCode (
**/
EFI_DEBUG_STATUS
DebuggerUnloadCode (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
- CHAR16 *CommandArg2;
- CHAR16 *FileName;
- CHAR16 *MapFileName;
- EFI_STATUS Status;
- VOID *BufferPtr;
+ CHAR16 *CommandArg2;
+ CHAR16 *FileName;
+ CHAR16 *MapFileName;
+ EFI_STATUS Status;
+ VOID *BufferPtr;
//
// Check the argument
@@ -793,13 +807,14 @@ DebuggerUnloadCode (
EDBPrint (L"CodeFile not found!\n");
return EFI_DEBUG_CONTINUE;
}
+
CommandArg2 = StrGetNextTokenLine (L" ");
if (CommandArg2 == NULL) {
EDBPrint (L"SymbolFile not found!\n");
return EFI_DEBUG_CONTINUE;
}
- FileName = GetFileNameFromFullPath (CommandArg);
+ FileName = GetFileNameFromFullPath (CommandArg);
MapFileName = GetFileNameFromFullPath (CommandArg2);
//
@@ -839,10 +854,10 @@ DebuggerUnloadCode (
**/
EFI_DEBUG_STATUS
DebuggerDisplayCode (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
)
{
if (CommandArg == NULL) {
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.c
index 5597a7e154..e099b16986 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.c
@@ -25,7 +25,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Address> - The hexical address user want to break at.\n"
L" <Symbol> - The symbol name for target address user want to break at. It has following format [MapFileName:]SymbolName\n",
L"Execution:\n",
- {SCAN_F5, CHAR_NULL},
+ { SCAN_F5, CHAR_NULL },
DebuggerGo
},
{
@@ -35,7 +35,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L"T\n"
L" (No Argument)\n",
L"",
- {SCAN_F8, CHAR_NULL},
+ { SCAN_F8, CHAR_NULL },
DebuggerStepInto
},
{
@@ -45,7 +45,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L"P\n"
L" (No Argument)\n",
L"",
- {SCAN_F10, CHAR_NULL},
+ { SCAN_F10, CHAR_NULL },
DebuggerStepOver
},
{
@@ -55,7 +55,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L"O\n"
L" (No Argument)\n",
L"",
- {SCAN_F11, CHAR_NULL},
+ { SCAN_F11, CHAR_NULL },
DebuggerStepOut
},
{
@@ -65,7 +65,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L"Q\n"
L" (No Argument)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerQuit
},
//
@@ -80,7 +80,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable break-on-call\n"
L" off - disable break-on-call\n",
L"Break:\n",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakOnCALL
},
{
@@ -92,7 +92,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable break-on-callex\n"
L" off - disable break-on-callex\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakOnCALLEX
},
{
@@ -104,7 +104,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable break-on-return\n"
L" off - disable break-on-return\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakOnRET
},
{
@@ -116,7 +116,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable break-on-entrypoint\n"
L" off - disable break-on-entrypoint\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakOnEntrypoint
},
{
@@ -128,7 +128,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable break-on-thunk\n"
L" off - disable break-on-thunk\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakOnThunk
},
{
@@ -140,7 +140,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable break-on-key\n"
L" off - disable break-on-key\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakOnKey
},
{
@@ -150,7 +150,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L"BL\n"
L" (No Argument) - show the state for current breakpoint\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakpointList
},
{
@@ -161,7 +161,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Address> - Hexical breakpoint address\n"
L" <Symbol> - Symbol name for breakpoint address. It has following format [MapFileName:]SymbolName.\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakpointSet
},
{
@@ -172,7 +172,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Index> - Decimal breakpoint index, which can be got from BL command\n"
L" * - For all the breakpoint\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakpointClear
},
{
@@ -183,7 +183,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Index> - Decimal breakpoint index, which can be got from BL command\n"
L" * - For all the breakpoint\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakpointDisable
},
{
@@ -194,7 +194,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Index> - Decimal breakpoint index, which can be got from BL command\n"
L" * - For all the breakpoint\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerBreakpointEnable
},
//
@@ -210,7 +210,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" ParameterNum - Decimal call-stack parameters number, 8 by default, 16 as max\n"
L" c - Clear current call-stack\n",
L"Information:\n",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerCallStack
},
{
@@ -221,7 +221,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" (No Argument) - Show current instruction branch\n"
L" c - Clear current instruction branch\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerInstructionBranch
},
{
@@ -233,7 +233,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Register> - EBC VM register name (R0~R7, Flags, ControlFlags, and IP\n"
L" <Value> - The Hexical value of register\n",
L"",
- {SCAN_F2, CHAR_NULL},
+ { SCAN_F2, CHAR_NULL },
DebuggerRegister
},
{
@@ -244,7 +244,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" (No Argument) - List current assembly code\n"
L" Count - The decimal instruction assembly count\n",
L"",
- {SCAN_F4, CHAR_NULL},
+ { SCAN_F4, CHAR_NULL },
DebuggerList
},
{
@@ -255,7 +255,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Address> - The Hexical address where user wants to see the assembly code\n"
L" <Symbol> - Symbol name for scope address. It has following format [MapFileName:]SymbolName.\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerScope
},
{
@@ -267,7 +267,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Count> - The hexical memory count (not set means 1)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryDB
},
{
@@ -279,7 +279,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Count> - The hexical memory count (not set means 1)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryDW
},
{
@@ -291,7 +291,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Count> - The hexical memory count (not set means 1)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryDD
},
{
@@ -303,7 +303,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Count> - The hexical memory count (not set means 1)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryDQ
},
{
@@ -315,7 +315,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Value> - The hexical memory value\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryEB
},
{
@@ -327,7 +327,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Value> - The hexical memory value\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryEW
},
{
@@ -339,7 +339,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Value> - The hexical memory value\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryED
},
{
@@ -351,7 +351,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" <Symbol> - Symbol name for memory address. It has following format [MapFileName:]SymbolName.\n"
L" <Value> - The hexical memory value\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerMemoryEQ
},
//
@@ -367,7 +367,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" S <Symbol> - List this symbol only\n"
L" <Address> - The hexical memory address, which user want to find the symbol for.\n",
L"Symbol:\n",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerListSymbol
},
{
@@ -378,7 +378,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n"
L" a - Automatically load code files in the same dir\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerLoadSymbol
},
{
@@ -388,7 +388,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L"UNLOADSYMBOL <SymbolFile>\n"
L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerUnloadSymbol
},
{
@@ -399,7 +399,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" CodeFile - The EBC code file (Its name should be XXX.COD)\n"
L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerLoadCode
},
{
@@ -410,7 +410,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" CodeFile - The EBC code file (Its name should be XXX.COD)\n"
L" SymbolFile - The EBC symbol file (Its name should be XXX.MAP)\n",
L"",
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
DebuggerUnloadCode
},
{
@@ -423,7 +423,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable symbol output\n"
L" off - disable symbol output\n",
L"",
- {SCAN_F3, CHAR_NULL},
+ { SCAN_F3, CHAR_NULL },
DebuggerDisplaySymbol
},
{
@@ -436,7 +436,7 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L" on - enable source only output\n"
L" off - disable source only output\n",
L"",
- {SCAN_F6, CHAR_NULL},
+ { SCAN_F6, CHAR_NULL },
DebuggerDisplayCode
},
//
@@ -448,120 +448,121 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
L"The help command will print help information for each command\n\n",
L"H [<Command>]\n",
L"",
- {SCAN_F1, CHAR_NULL},
+ { SCAN_F1, CHAR_NULL },
DebuggerHelp
},
-/*
- //
- // Extended
- //
- {
- L"!IB",
- L"![I|O][B|W|D] - display/modify IO\n",
- L"",
- L"!IB <Address>\n",
- L"Extended:\n",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtIoIB
- },
- {
- L"!IW",
- L"",
- L"",
- L"!IW <Address>\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtIoIW
- },
- {
- L"!ID",
- L"",
- L"",
- L"!ID <Address>\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtIoID
- },
- {
- L"!OB",
- L"",
- L"",
- L"!OB <Address> <Value>\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtIoOB
- },
- {
- L"!OW",
- L"",
- L"",
- L"!OW <Address> <Value>\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtIoOW
- },
- {
- L"!OD",
- L"",
- L"",
- L"!OD <Address> <Value>\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtIoOD
- },
- {
- L"!PCIL",
- L"!PCIL - list PCI device, with BAR\n",
- L"",
- L"!PCIL [B]\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtPciPCIL
- },
- {
- L"!PCID",
- L"!PCID - show PCI space\n",
- L"",
- L"!PCID Bus Device Function [H|B|E]\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtPciPCID
- },
- {
- L"!CFGB",
- L"!CFG[B|W|D] - show/modify PCI space",
- L"",
- L"!CFGB <Address> [<Value>]\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtPciCFGB
- },
- {
- L"!CFGW",
- L"",
- L"",
- L"!CFGW <Address> [<Value>]\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtPciCFGW
- },
- {
- L"!CFGD",
- L"",
- L"",
- L"!CFGD <Address> [<Value>]\n",
- L"",
- {SCAN_NULL, CHAR_NULL},
- DebuggerExtPciCFGD
- },
-*/
+
+ /*
+ //
+ // Extended
+ //
+ {
+ L"!IB",
+ L"![I|O][B|W|D] - display/modify IO\n",
+ L"",
+ L"!IB <Address>\n",
+ L"Extended:\n",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtIoIB
+ },
+ {
+ L"!IW",
+ L"",
+ L"",
+ L"!IW <Address>\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtIoIW
+ },
+ {
+ L"!ID",
+ L"",
+ L"",
+ L"!ID <Address>\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtIoID
+ },
+ {
+ L"!OB",
+ L"",
+ L"",
+ L"!OB <Address> <Value>\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtIoOB
+ },
+ {
+ L"!OW",
+ L"",
+ L"",
+ L"!OW <Address> <Value>\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtIoOW
+ },
+ {
+ L"!OD",
+ L"",
+ L"",
+ L"!OD <Address> <Value>\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtIoOD
+ },
+ {
+ L"!PCIL",
+ L"!PCIL - list PCI device, with BAR\n",
+ L"",
+ L"!PCIL [B]\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtPciPCIL
+ },
+ {
+ L"!PCID",
+ L"!PCID - show PCI space\n",
+ L"",
+ L"!PCID Bus Device Function [H|B|E]\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtPciPCID
+ },
+ {
+ L"!CFGB",
+ L"!CFG[B|W|D] - show/modify PCI space",
+ L"",
+ L"!CFGB <Address> [<Value>]\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtPciCFGB
+ },
+ {
+ L"!CFGW",
+ L"",
+ L"",
+ L"!CFGW <Address> [<Value>]\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtPciCFGW
+ },
+ {
+ L"!CFGD",
+ L"",
+ L"",
+ L"!CFGD <Address> [<Value>]\n",
+ L"",
+ {SCAN_NULL, CHAR_NULL},
+ DebuggerExtPciCFGD
+ },
+ */
{
NULL,
NULL,
NULL,
NULL,
NULL,
- {SCAN_NULL, CHAR_NULL},
+ { SCAN_NULL, CHAR_NULL },
NULL
},
};
@@ -579,22 +580,22 @@ EFI_DEBUGGER_COMMAND_SET mDebuggerCommandSet[] = {
**/
EFI_DEBUGGER_COMMAND
MatchDebuggerCommand (
- IN CHAR16 *CommandName,
- IN CHAR16 **CommandArg
+ IN CHAR16 *CommandName,
+ IN CHAR16 **CommandArg
)
{
- UINTN Index;
- CHAR16 *Temp;
+ UINTN Index;
+ CHAR16 *Temp;
//
// Get Command Name
//
- Temp = StrGetNewTokenLine (CommandName, L" ");
+ Temp = StrGetNewTokenLine (CommandName, L" ");
CommandName = Temp;
//
// Get Command Argument
//
- Temp = StrGetNextTokenLine (L" ");
+ Temp = StrGetNextTokenLine (L" ");
*CommandArg = Temp;
if (CommandName == NULL) {
@@ -631,7 +632,7 @@ MatchDebuggerCommand (
**/
CHAR16 *
GetCommandNameByKey (
- IN EFI_INPUT_KEY CommandKey
+ IN EFI_INPUT_KEY CommandKey
)
{
UINTN Index;
@@ -641,7 +642,8 @@ GetCommandNameByKey (
//
for (Index = 0; mDebuggerCommandSet[Index].CommandName != NULL; Index++) {
if ((mDebuggerCommandSet[Index].CommandKey.UnicodeChar == CommandKey.UnicodeChar) &&
- (mDebuggerCommandSet[Index].CommandKey.ScanCode == CommandKey.ScanCode)) {
+ (mDebuggerCommandSet[Index].CommandKey.ScanCode == CommandKey.ScanCode))
+ {
//
// Found
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.h b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.h
index ac8c23adfa..071d5c59b7 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommand.h
@@ -30,8 +30,8 @@ typedef enum {
**/
EFI_DEBUGGER_COMMAND
MatchDebuggerCommand (
- IN CHAR16 *CommandName,
- IN CHAR16 **CommandArg
+ IN CHAR16 *CommandName,
+ IN CHAR16 **CommandArg
);
/**
@@ -46,7 +46,7 @@ MatchDebuggerCommand (
**/
CHAR16 *
GetCommandNameByKey (
- IN EFI_INPUT_KEY CommandKey
+ IN EFI_INPUT_KEY CommandKey
);
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommon.h b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommon.h
index 924a2f7556..c5424948e3 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommon.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCommon.h
@@ -34,29 +34,29 @@ typedef struct _EFI_DEBUGGER_PRIVATE_DATA EFI_DEBUGGER_PRIVATE_DATA;
//
typedef
EFI_DEBUG_STATUS
-(* EFI_DEBUGGER_COMMAND) (
- IN CHAR16 *CommandArg,
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN OUT EFI_SYSTEM_CONTEXT SystemContext
-);
+(*EFI_DEBUGGER_COMMAND) (
+ IN CHAR16 *CommandArg,
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_EXCEPTION_TYPE ExceptionType,
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext
+ );
typedef struct {
- CHAR16 *CommandName;
- CHAR16 *CommandTitle;
- CHAR16 *CommandHelp;
- CHAR16 *CommandSyntax;
- CHAR16 *ClassName;
- EFI_INPUT_KEY CommandKey;
- EFI_DEBUGGER_COMMAND CommandFunc;
+ CHAR16 *CommandName;
+ CHAR16 *CommandTitle;
+ CHAR16 *CommandHelp;
+ CHAR16 *CommandSyntax;
+ CHAR16 *ClassName;
+ EFI_INPUT_KEY CommandKey;
+ EFI_DEBUGGER_COMMAND CommandFunc;
} EFI_DEBUGGER_COMMAND_SET;
//
// Definition for Debugger Symbol
//
-#define EFI_DEBUGGER_SYMBOL_NAME_MAX 256
-#define EFI_DEBUGGER_SYMBOL_ENTRY_MAX 512
-#define EFI_DEBUGGER_SYMBOL_OBJECT_MAX 32
+#define EFI_DEBUGGER_SYMBOL_NAME_MAX 256
+#define EFI_DEBUGGER_SYMBOL_ENTRY_MAX 512
+#define EFI_DEBUGGER_SYMBOL_OBJECT_MAX 32
//
// We have following SYMBOL data structure:
@@ -81,50 +81,50 @@ typedef enum {
} EFI_DEBUGGER_SYMBOL_TYPE;
typedef struct {
- CHAR8 Name[EFI_DEBUGGER_SYMBOL_NAME_MAX];
- UINTN Rva;
- EFI_DEBUGGER_SYMBOL_TYPE Type;
- CHAR8 ObjName[EFI_DEBUGGER_SYMBOL_NAME_MAX];
- CHAR8 *CodBuffer;
- UINTN CodBufferSize;
- UINTN FuncOffsetBase;
- CHAR8 *SourceBuffer;
+ CHAR8 Name[EFI_DEBUGGER_SYMBOL_NAME_MAX];
+ UINTN Rva;
+ EFI_DEBUGGER_SYMBOL_TYPE Type;
+ CHAR8 ObjName[EFI_DEBUGGER_SYMBOL_NAME_MAX];
+ CHAR8 *CodBuffer;
+ UINTN CodBufferSize;
+ UINTN FuncOffsetBase;
+ CHAR8 *SourceBuffer;
} EFI_DEBUGGER_SYMBOL_ENTRY;
typedef struct {
- CHAR16 Name[EFI_DEBUGGER_SYMBOL_NAME_MAX];
- UINTN EntryCount;
- UINTN MaxEntryCount;
- UINTN BaseAddress;
- UINTN StartEntrypointRVA;
- UINTN MainEntrypointRVA;
- EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
- VOID **SourceBuffer;
+ CHAR16 Name[EFI_DEBUGGER_SYMBOL_NAME_MAX];
+ UINTN EntryCount;
+ UINTN MaxEntryCount;
+ UINTN BaseAddress;
+ UINTN StartEntrypointRVA;
+ UINTN MainEntrypointRVA;
+ EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
+ VOID **SourceBuffer;
} EFI_DEBUGGER_SYMBOL_OBJECT;
typedef struct {
- UINTN ObjectCount;
- UINTN MaxObjectCount;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- BOOLEAN DisplaySymbol;
- BOOLEAN DisplayCodeOnly;
+ UINTN ObjectCount;
+ UINTN MaxObjectCount;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ BOOLEAN DisplaySymbol;
+ BOOLEAN DisplayCodeOnly;
} EFI_DEBUGGER_SYMBOL_CONTEXT;
//
// Definition for Debugger Breakpoint
//
-#define EFI_DEBUGGER_BREAKPOINT_MAX 0x10
+#define EFI_DEBUGGER_BREAKPOINT_MAX 0x10
typedef struct {
- EFI_PHYSICAL_ADDRESS BreakpointAddress;
- UINT64 OldInstruction; // UINT64 is enough for an instruction
- BOOLEAN State;
+ EFI_PHYSICAL_ADDRESS BreakpointAddress;
+ UINT64 OldInstruction; // UINT64 is enough for an instruction
+ BOOLEAN State;
} EFI_DEBUGGER_BREAKPOINT_CONTEXT;
//
// Definition for Debugger Call-Stack
//
-#define EFI_DEBUGGER_CALLSTACK_MAX 0x10
+#define EFI_DEBUGGER_CALLSTACK_MAX 0x10
typedef enum {
EfiDebuggerBranchTypeEbcCall,
@@ -139,101 +139,101 @@ typedef enum {
#define EFI_DEBUGGER_CALL_DEFAULT_PARAMETER 0x8
typedef struct {
- EFI_PHYSICAL_ADDRESS SourceAddress;
- EFI_PHYSICAL_ADDRESS DestAddress;
+ EFI_PHYSICAL_ADDRESS SourceAddress;
+ EFI_PHYSICAL_ADDRESS DestAddress;
//
// We save all parameter here, because code may update the parameter as local variable.
//
- UINTN ParameterAddr;
- UINTN Parameter[EFI_DEBUGGER_CALL_MAX_PARAMETER];
- EFI_DEBUGGER_BRANCH_TYPE Type;
+ UINTN ParameterAddr;
+ UINTN Parameter[EFI_DEBUGGER_CALL_MAX_PARAMETER];
+ EFI_DEBUGGER_BRANCH_TYPE Type;
} EFI_DEBUGGER_CALLSTACK_CONTEXT;
//
// Definition for Debugger Trace
//
-#define EFI_DEBUGGER_TRACE_MAX 0x10
+#define EFI_DEBUGGER_TRACE_MAX 0x10
typedef struct {
- EFI_PHYSICAL_ADDRESS SourceAddress;
- EFI_PHYSICAL_ADDRESS DestAddress;
- EFI_DEBUGGER_BRANCH_TYPE Type;
+ EFI_PHYSICAL_ADDRESS SourceAddress;
+ EFI_PHYSICAL_ADDRESS DestAddress;
+ EFI_DEBUGGER_BRANCH_TYPE Type;
} EFI_DEBUGGER_TRACE_CONTEXT;
//
// Definition for Debugger Step
//
typedef struct {
- EFI_PHYSICAL_ADDRESS BreakAddress;
- EFI_PHYSICAL_ADDRESS FramePointer;
+ EFI_PHYSICAL_ADDRESS BreakAddress;
+ EFI_PHYSICAL_ADDRESS FramePointer;
} EFI_DEBUGGER_STEP_CONTEXT;
//
// Definition for Debugger GoTil
//
typedef struct {
- EFI_PHYSICAL_ADDRESS BreakAddress;
+ EFI_PHYSICAL_ADDRESS BreakAddress;
} EFI_DEBUGGER_GOTIL_CONTEXT;
//
// Definition for Debugger private data structure
//
-#define EFI_DEBUGGER_SIGNATURE SIGNATURE_32 ('e', 'd', 'b', '!')
+#define EFI_DEBUGGER_SIGNATURE SIGNATURE_32 ('e', 'd', 'b', '!')
#define EFI_DEBUG_DEFAULT_INSTRUCTION_NUMBER 5
-#define EFI_DEBUG_BREAK_TIMER_INTERVAL 10000000 // 1 second
-
-#define EFI_DEBUG_FLAG_EBC 0x80000000
-#define EFI_DEBUG_FLAG_EBC_B_BOC 0x1
-#define EFI_DEBUG_FLAG_EBC_B_BOCX 0x2
-#define EFI_DEBUG_FLAG_EBC_B_BOR 0x4
-#define EFI_DEBUG_FLAG_EBC_B_BOE 0x8
-#define EFI_DEBUG_FLAG_EBC_B_BOT 0x10
-#define EFI_DEBUG_FLAG_EBC_B_STEPOVER 0x20
-#define EFI_DEBUG_FLAG_EBC_B_STEPOUT 0x40
-#define EFI_DEBUG_FLAG_EBC_B_BP 0x80
-#define EFI_DEBUG_FLAG_EBC_B_GT 0x100
-#define EFI_DEBUG_FLAG_EBC_B_BOK 0x200
-#define EFI_DEBUG_FLAG_EBC_BOC (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOC)
-#define EFI_DEBUG_FLAG_EBC_BOCX (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOCX)
-#define EFI_DEBUG_FLAG_EBC_BOR (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOR)
-#define EFI_DEBUG_FLAG_EBC_BOE (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOE)
-#define EFI_DEBUG_FLAG_EBC_BOT (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOT)
-#define EFI_DEBUG_FLAG_EBC_STEPOVER (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_STEPOVER)
-#define EFI_DEBUG_FLAG_EBC_STEPOUT (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_STEPOUT)
-#define EFI_DEBUG_FLAG_EBC_BP (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BP)
-#define EFI_DEBUG_FLAG_EBC_GT (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_GT)
-#define EFI_DEBUG_FLAG_EBC_BOK (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOK)
+#define EFI_DEBUG_BREAK_TIMER_INTERVAL 10000000 // 1 second
+
+#define EFI_DEBUG_FLAG_EBC 0x80000000
+#define EFI_DEBUG_FLAG_EBC_B_BOC 0x1
+#define EFI_DEBUG_FLAG_EBC_B_BOCX 0x2
+#define EFI_DEBUG_FLAG_EBC_B_BOR 0x4
+#define EFI_DEBUG_FLAG_EBC_B_BOE 0x8
+#define EFI_DEBUG_FLAG_EBC_B_BOT 0x10
+#define EFI_DEBUG_FLAG_EBC_B_STEPOVER 0x20
+#define EFI_DEBUG_FLAG_EBC_B_STEPOUT 0x40
+#define EFI_DEBUG_FLAG_EBC_B_BP 0x80
+#define EFI_DEBUG_FLAG_EBC_B_GT 0x100
+#define EFI_DEBUG_FLAG_EBC_B_BOK 0x200
+#define EFI_DEBUG_FLAG_EBC_BOC (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOC)
+#define EFI_DEBUG_FLAG_EBC_BOCX (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOCX)
+#define EFI_DEBUG_FLAG_EBC_BOR (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOR)
+#define EFI_DEBUG_FLAG_EBC_BOE (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOE)
+#define EFI_DEBUG_FLAG_EBC_BOT (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOT)
+#define EFI_DEBUG_FLAG_EBC_STEPOVER (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_STEPOVER)
+#define EFI_DEBUG_FLAG_EBC_STEPOUT (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_STEPOUT)
+#define EFI_DEBUG_FLAG_EBC_BP (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BP)
+#define EFI_DEBUG_FLAG_EBC_GT (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_GT)
+#define EFI_DEBUG_FLAG_EBC_BOK (EFI_DEBUG_FLAG_EBC | EFI_DEBUG_FLAG_EBC_B_BOK)
//
// Debugger private data structure
//
typedef struct _EFI_DEBUGGER_PRIVATE_DATA {
- UINT32 Signature;
- EFI_INSTRUCTION_SET_ARCHITECTURE Isa;
- UINT32 EfiDebuggerRevision;
- UINT32 EbcVmRevision;
- EFI_DEBUGGER_CONFIGURATION_PROTOCOL DebuggerConfiguration;
- EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *DebugImageInfoTableHeader;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_DEBUGGER_COMMAND_SET *DebuggerCommandSet;
- EFI_DEBUGGER_SYMBOL_CONTEXT DebuggerSymbolContext;
- UINTN DebuggerBreakpointCount;
- EFI_DEBUGGER_BREAKPOINT_CONTEXT DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX + 1];
- UINTN CallStackEntryCount;
- EFI_DEBUGGER_CALLSTACK_CONTEXT CallStackEntry[EFI_DEBUGGER_CALLSTACK_MAX + 1];
- UINTN TraceEntryCount;
- EFI_DEBUGGER_TRACE_CONTEXT TraceEntry[EFI_DEBUGGER_TRACE_MAX + 1];
- EFI_DEBUGGER_STEP_CONTEXT StepContext;
- EFI_DEBUGGER_GOTIL_CONTEXT GoTilContext;
- EFI_PHYSICAL_ADDRESS InstructionScope;
- UINTN InstructionNumber;
- UINT32 FeatureFlags;
- UINT32 StatusFlags;
- BOOLEAN EnablePageBreak;
- EFI_EVENT BreakEvent;
+ UINT32 Signature;
+ EFI_INSTRUCTION_SET_ARCHITECTURE Isa;
+ UINT32 EfiDebuggerRevision;
+ UINT32 EbcVmRevision;
+ EFI_DEBUGGER_CONFIGURATION_PROTOCOL DebuggerConfiguration;
+ EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *DebugImageInfoTableHeader;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
+ EFI_DEBUGGER_COMMAND_SET *DebuggerCommandSet;
+ EFI_DEBUGGER_SYMBOL_CONTEXT DebuggerSymbolContext;
+ UINTN DebuggerBreakpointCount;
+ EFI_DEBUGGER_BREAKPOINT_CONTEXT DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX + 1];
+ UINTN CallStackEntryCount;
+ EFI_DEBUGGER_CALLSTACK_CONTEXT CallStackEntry[EFI_DEBUGGER_CALLSTACK_MAX + 1];
+ UINTN TraceEntryCount;
+ EFI_DEBUGGER_TRACE_CONTEXT TraceEntry[EFI_DEBUGGER_TRACE_MAX + 1];
+ EFI_DEBUGGER_STEP_CONTEXT StepContext;
+ EFI_DEBUGGER_GOTIL_CONTEXT GoTilContext;
+ EFI_PHYSICAL_ADDRESS InstructionScope;
+ UINTN InstructionNumber;
+ UINT32 FeatureFlags;
+ UINT32 StatusFlags;
+ BOOLEAN EnablePageBreak;
+ EFI_EVENT BreakEvent;
} EFI_DEBUGGER_PRIVATE_DATA;
#endif
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c
index 7d933cae76..18f16d7329 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.c
@@ -44,7 +44,7 @@ EDB_DISASM_DEFINE (EdbDisasmMOVREL);
//
// Debugger Disasm Table
//
-EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable[] = {
+EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable[] = {
EdbDisasmBREAK, // opcode 0x00 BREAK
EdbDisasmJMP, // opcode 0x01 JMP
EdbDisasmJMP8, // opcode 0x02 JMP8
@@ -118,12 +118,12 @@ EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable[] = {
**/
UINTN
EdbDisasmBREAK (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_BREAK);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_BREAK);
if (*(UINT8 *)(UINTN)(InstructionAddress + 1) > 6) {
return 0;
@@ -144,7 +144,7 @@ EdbDisasmBREAK (
return 2;
}
-extern CONST UINT8 mJMPLen[];
+extern CONST UINT8 mJMPLen[];
/**
@@ -159,9 +159,9 @@ extern CONST UINT8 mJMPLen[];
**/
UINTN
EdbDisasmJMP (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
UINT8 Modifiers;
@@ -170,11 +170,11 @@ EdbDisasmJMP (
UINT32 Data32;
UINT64 Data64;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_JMP);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_JMP);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
- Size = (UINTN)mJMPLen[(Modifiers >> 6) & 0x03];
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Size = (UINTN)mJMPLen[(Modifiers >> 6) & 0x03];
//
// Construct Disasm String
@@ -183,11 +183,11 @@ EdbDisasmJMP (
*DisasmString = EdbPreInstructionString ();
EdbPrintInstructionName (L"JMP");
-// if (Modifiers & OPCODE_M_IMMDATA64) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+ // if (Modifiers & OPCODE_M_IMMDATA64) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
if ((Modifiers & CONDITION_M_CONDITIONAL) != 0) {
if ((Modifiers & JMP_M_CS) != 0) {
EdbPrintInstructionName (L"cs");
@@ -198,20 +198,21 @@ EdbDisasmJMP (
InstructionAddress += 2;
if ((Modifiers & OPCODE_M_IMMDATA64) != 0) {
- CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64));
+ CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT64));
if ((Modifiers & OPCODE_M_IMMDATA) != 0) {
EdbPrintData64 (Data64);
} else {
return 0;
}
} else {
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
EdbPrintRegister1 (Operands);
if ((Operands & OPERAND_M_INDIRECT1) == 0) {
if ((Modifiers & OPCODE_M_IMMDATA) == 0) {
Data32 = 0;
}
+
EdbPrintImmDatan (Data32);
} else {
EdbPrintRawIndexData32 (Data32);
@@ -237,15 +238,15 @@ EdbDisasmJMP (
**/
UINTN
EdbDisasmJMP8 (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
+ UINT8 Modifiers;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_JMP8);
- Modifiers = GET_MODIFIERS (InstructionAddress);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_JMP8);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
//
// Construct Disasm String
@@ -283,26 +284,26 @@ EdbDisasmJMP8 (
**/
UINTN
EdbDisasmCALL (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT32 Data32;
- UINT64 Data64;
- UINT64 Ip;
- UINTN Result;
- EFI_PHYSICAL_ADDRESS SavedInstructionAddress;
-
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_CALL);
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT32 Data32;
+ UINT64 Data64;
+ UINT64 Ip;
+ UINTN Result;
+ EFI_PHYSICAL_ADDRESS SavedInstructionAddress;
+
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_CALL);
SavedInstructionAddress = InstructionAddress;
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
- Size = (UINTN)mJMPLen[(Modifiers >> 6) & 0x03];
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Size = (UINTN)mJMPLen[(Modifiers >> 6) & 0x03];
//
// Construct Disasm String
@@ -311,21 +312,22 @@ EdbDisasmCALL (
*DisasmString = EdbPreInstructionString ();
EdbPrintInstructionName (L"CALL");
-// if (Modifiers & OPCODE_M_IMMDATA64) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+ // if (Modifiers & OPCODE_M_IMMDATA64) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
if ((Operands & OPERAND_M_NATIVE_CALL) != 0) {
EdbPrintInstructionName (L"EX");
}
-// if ((Operands & OPERAND_M_RELATIVE_ADDR) == 0) {
-// EdbPrintInstructionName (L"a");
-// }
+
+ // if ((Operands & OPERAND_M_RELATIVE_ADDR) == 0) {
+ // EdbPrintInstructionName (L"a");
+ // }
InstructionAddress += 2;
if ((Modifiers & OPCODE_M_IMMDATA64) != 0) {
- CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64));
+ CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT64));
Ip = Data64;
if ((Modifiers & OPCODE_M_IMMDATA) != 0) {
Result = EdbFindAndPrintSymbol ((UINTN)Ip);
@@ -337,7 +339,7 @@ EdbDisasmCALL (
}
} else {
if ((Modifiers & OPCODE_M_IMMDATA) != 0) {
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
} else {
Data32 = 0;
}
@@ -354,6 +356,7 @@ EdbDisasmCALL (
} else {
Result = EdbFindAndPrintSymbol ((UINTN)Ip);
}
+
if (Result == 0) {
EdbPrintRegister1 (Operands);
if ((Modifiers & OPCODE_M_IMMDATA) != 0) {
@@ -387,12 +390,12 @@ EdbDisasmCALL (
**/
UINTN
EdbDisasmRET (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_RET);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_RET);
if (*(UINT8 *)(UINTN)(InstructionAddress + 1) != 0) {
return 0;
@@ -425,28 +428,28 @@ EdbDisasmRET (
**/
UINTN
EdbDisasmCMP (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Opcode;
- UINT8 Modifiers;
- UINT8 Operands;
- UINT16 Data16;
- UINTN Size;
+ UINT8 Opcode;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINT16 Data16;
+ UINTN Size;
ASSERT (
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPEQ) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPLTE) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPGTE) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPULTE) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPUGTE)
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPEQ) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPLTE) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPGTE) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPULTE) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPUGTE)
);
- Opcode = GET_OPCODE (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
+ Opcode = GET_OPCODE (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
if ((Modifiers & OPCODE_M_IMMDATA) != 0) {
Size = 4;
} else {
@@ -460,27 +463,27 @@ EdbDisasmCMP (
*DisasmString = EdbPreInstructionString ();
EdbPrintInstructionName (L"CMP");
-// if (Modifiers & OPCODE_M_64BIT) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+ // if (Modifiers & OPCODE_M_64BIT) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
switch (Opcode) {
- case OPCODE_CMPEQ:
- EdbPrintInstructionName (L"eq");
- break;
- case OPCODE_CMPLTE:
- EdbPrintInstructionName (L"lte");
- break;
- case OPCODE_CMPGTE:
- EdbPrintInstructionName (L"gte");
- break;
- case OPCODE_CMPULTE:
- EdbPrintInstructionName (L"ulte");
- break;
- case OPCODE_CMPUGTE:
- EdbPrintInstructionName (L"ugte");
- break;
+ case OPCODE_CMPEQ:
+ EdbPrintInstructionName (L"eq");
+ break;
+ case OPCODE_CMPLTE:
+ EdbPrintInstructionName (L"lte");
+ break;
+ case OPCODE_CMPGTE:
+ EdbPrintInstructionName (L"gte");
+ break;
+ case OPCODE_CMPULTE:
+ EdbPrintInstructionName (L"ulte");
+ break;
+ case OPCODE_CMPUGTE:
+ EdbPrintInstructionName (L"ugte");
+ break;
}
EdbPrintRegister1 (Operands);
@@ -490,7 +493,7 @@ EdbDisasmCMP (
EdbPrintRegister2 (Operands);
if ((Modifiers & OPCODE_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT2) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -517,35 +520,35 @@ EdbDisasmCMP (
**/
UINTN
EdbDisasmUnsignedDataManip (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Opcode;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
+ UINT8 Modifiers;
+ UINT8 Opcode;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
ASSERT (
- (GET_OPCODE(InstructionAddress) == OPCODE_NOT) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MULU) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_DIVU) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MODU) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_AND) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_OR) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_XOR) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_SHL) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_SHR) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_EXTNDB) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_EXTNDW) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_EXTNDD)
+ (GET_OPCODE (InstructionAddress) == OPCODE_NOT) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MULU) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_DIVU) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MODU) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_AND) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_OR) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_XOR) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_SHL) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_SHR) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_EXTNDB) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_EXTNDW) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_EXTNDD)
);
- Opcode = GET_OPCODE (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
+ Opcode = GET_OPCODE (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) {
Size = 4;
} else {
@@ -559,48 +562,49 @@ EdbDisasmUnsignedDataManip (
*DisasmString = EdbPreInstructionString ();
switch (Opcode) {
- case OPCODE_NOT:
- EdbPrintInstructionName (L"NOT");
- break;
- case OPCODE_MULU:
- EdbPrintInstructionName (L"MULU");
- break;
- case OPCODE_DIVU:
- EdbPrintInstructionName (L"DIVU");
- break;
- case OPCODE_MODU:
- EdbPrintInstructionName (L"MODU");
- break;
- case OPCODE_AND:
- EdbPrintInstructionName (L"AND");
- break;
- case OPCODE_OR:
- EdbPrintInstructionName (L"OR");
- break;
- case OPCODE_XOR:
- EdbPrintInstructionName (L"XOR");
- break;
- case OPCODE_SHL:
- EdbPrintInstructionName (L"SHL");
- break;
- case OPCODE_SHR:
- EdbPrintInstructionName (L"SHR");
- break;
- case OPCODE_EXTNDB:
- EdbPrintInstructionName (L"EXTNDB");
- break;
- case OPCODE_EXTNDW:
- EdbPrintInstructionName (L"EXTNDW");
- break;
- case OPCODE_EXTNDD:
- EdbPrintInstructionName (L"EXTNDD");
- break;
+ case OPCODE_NOT:
+ EdbPrintInstructionName (L"NOT");
+ break;
+ case OPCODE_MULU:
+ EdbPrintInstructionName (L"MULU");
+ break;
+ case OPCODE_DIVU:
+ EdbPrintInstructionName (L"DIVU");
+ break;
+ case OPCODE_MODU:
+ EdbPrintInstructionName (L"MODU");
+ break;
+ case OPCODE_AND:
+ EdbPrintInstructionName (L"AND");
+ break;
+ case OPCODE_OR:
+ EdbPrintInstructionName (L"OR");
+ break;
+ case OPCODE_XOR:
+ EdbPrintInstructionName (L"XOR");
+ break;
+ case OPCODE_SHL:
+ EdbPrintInstructionName (L"SHL");
+ break;
+ case OPCODE_SHR:
+ EdbPrintInstructionName (L"SHR");
+ break;
+ case OPCODE_EXTNDB:
+ EdbPrintInstructionName (L"EXTNDB");
+ break;
+ case OPCODE_EXTNDW:
+ EdbPrintInstructionName (L"EXTNDW");
+ break;
+ case OPCODE_EXTNDD:
+ EdbPrintInstructionName (L"EXTNDD");
+ break;
}
-// if (Modifiers & DATAMANIP_M_64) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+
+ // if (Modifiers & DATAMANIP_M_64) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
EdbPrintRegister1 (Operands);
EdbPrintComma ();
@@ -608,7 +612,7 @@ EdbDisasmUnsignedDataManip (
InstructionAddress += 2;
if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT2) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -635,30 +639,30 @@ EdbDisasmUnsignedDataManip (
**/
UINTN
EdbDisasmSignedDataManip (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Opcode;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
+ UINT8 Modifiers;
+ UINT8 Opcode;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
ASSERT (
- (GET_OPCODE(InstructionAddress) == OPCODE_NEG) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_ADD) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_SUB) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MUL) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_DIV) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOD) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_ASHR)
+ (GET_OPCODE (InstructionAddress) == OPCODE_NEG) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_ADD) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_SUB) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MUL) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_DIV) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOD) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_ASHR)
);
- Opcode = GET_OPCODE (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
+ Opcode = GET_OPCODE (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) {
Size = 4;
} else {
@@ -672,33 +676,34 @@ EdbDisasmSignedDataManip (
*DisasmString = EdbPreInstructionString ();
switch (Opcode) {
- case OPCODE_NEG:
- EdbPrintInstructionName (L"NEG");
- break;
- case OPCODE_ADD:
- EdbPrintInstructionName (L"ADD");
- break;
- case OPCODE_SUB:
- EdbPrintInstructionName (L"SUB");
- break;
- case OPCODE_MUL:
- EdbPrintInstructionName (L"MUL");
- break;
- case OPCODE_DIV:
- EdbPrintInstructionName (L"DIV");
- break;
- case OPCODE_MOD:
- EdbPrintInstructionName (L"MOD");
- break;
- case OPCODE_ASHR:
- EdbPrintInstructionName (L"ASHR");
- break;
+ case OPCODE_NEG:
+ EdbPrintInstructionName (L"NEG");
+ break;
+ case OPCODE_ADD:
+ EdbPrintInstructionName (L"ADD");
+ break;
+ case OPCODE_SUB:
+ EdbPrintInstructionName (L"SUB");
+ break;
+ case OPCODE_MUL:
+ EdbPrintInstructionName (L"MUL");
+ break;
+ case OPCODE_DIV:
+ EdbPrintInstructionName (L"DIV");
+ break;
+ case OPCODE_MOD:
+ EdbPrintInstructionName (L"MOD");
+ break;
+ case OPCODE_ASHR:
+ EdbPrintInstructionName (L"ASHR");
+ break;
}
-// if (Modifiers & DATAMANIP_M_64) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+
+ // if (Modifiers & DATAMANIP_M_64) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
EdbPrintRegister1 (Operands);
EdbPrintComma ();
@@ -706,7 +711,7 @@ EdbDisasmSignedDataManip (
InstructionAddress += 2;
if ((Modifiers & DATAMANIP_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT2) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -733,9 +738,9 @@ EdbDisasmSignedDataManip (
**/
UINTN
EdbDisasmMOVxx (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
UINT8 Modifiers;
@@ -747,28 +752,29 @@ EdbDisasmMOVxx (
UINT64 Data64;
ASSERT (
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVBW) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVWW) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVDW) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVQW) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVBD) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVWD) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVDD) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVQD) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVQQ) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVNW) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_MOVND)
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVBW) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVWW) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVDW) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVQW) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVBD) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVWD) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVDD) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVQD) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVQQ) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVNW) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_MOVND)
);
- Opcode = GET_OPCODE (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
- Size = 2;
+ Opcode = GET_OPCODE (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Size = 2;
if ((Modifiers & (OPCODE_M_IMMED_OP1 | OPCODE_M_IMMED_OP2)) != 0) {
if ((Opcode <= OPCODE_MOVQW) || (Opcode == OPCODE_MOVNW)) {
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
Size += 2;
}
+
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
Size += 2;
}
@@ -776,6 +782,7 @@ EdbDisasmMOVxx (
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
Size += 4;
}
+
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
Size += 4;
}
@@ -783,6 +790,7 @@ EdbDisasmMOVxx (
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
Size += 8;
}
+
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
Size += 8;
}
@@ -797,39 +805,39 @@ EdbDisasmMOVxx (
EdbPrintInstructionName (L"MOV");
switch (Opcode) {
- case OPCODE_MOVBW:
- EdbPrintInstructionName (L"bw");
- break;
- case OPCODE_MOVWW:
- EdbPrintInstructionName (L"ww");
- break;
- case OPCODE_MOVDW:
- EdbPrintInstructionName (L"dw");
- break;
- case OPCODE_MOVQW:
- EdbPrintInstructionName (L"qw");
- break;
- case OPCODE_MOVBD:
- EdbPrintInstructionName (L"bd");
- break;
- case OPCODE_MOVWD:
- EdbPrintInstructionName (L"wd");
- break;
- case OPCODE_MOVDD:
- EdbPrintInstructionName (L"dd");
- break;
- case OPCODE_MOVQD:
- EdbPrintInstructionName (L"qd");
- break;
- case OPCODE_MOVQQ:
- EdbPrintInstructionName (L"qq");
- break;
- case OPCODE_MOVNW:
- EdbPrintInstructionName (L"nw");
- break;
- case OPCODE_MOVND:
- EdbPrintInstructionName (L"nd");
- break;
+ case OPCODE_MOVBW:
+ EdbPrintInstructionName (L"bw");
+ break;
+ case OPCODE_MOVWW:
+ EdbPrintInstructionName (L"ww");
+ break;
+ case OPCODE_MOVDW:
+ EdbPrintInstructionName (L"dw");
+ break;
+ case OPCODE_MOVQW:
+ EdbPrintInstructionName (L"qw");
+ break;
+ case OPCODE_MOVBD:
+ EdbPrintInstructionName (L"bd");
+ break;
+ case OPCODE_MOVWD:
+ EdbPrintInstructionName (L"wd");
+ break;
+ case OPCODE_MOVDD:
+ EdbPrintInstructionName (L"dd");
+ break;
+ case OPCODE_MOVQD:
+ EdbPrintInstructionName (L"qd");
+ break;
+ case OPCODE_MOVQQ:
+ EdbPrintInstructionName (L"qq");
+ break;
+ case OPCODE_MOVNW:
+ EdbPrintInstructionName (L"nw");
+ break;
+ case OPCODE_MOVND:
+ EdbPrintInstructionName (L"nd");
+ break;
}
EdbPrintRegister1 (Operands);
@@ -837,15 +845,15 @@ EdbDisasmMOVxx (
InstructionAddress += 2;
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
if ((Opcode <= OPCODE_MOVQW) || (Opcode == OPCODE_MOVNW)) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
InstructionAddress += 2;
EdbPrintRawIndexData16 (Data16);
} else if ((Opcode <= OPCODE_MOVQD) || (Opcode == OPCODE_MOVND)) {
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
InstructionAddress += 4;
EdbPrintRawIndexData32 (Data32);
} else if (Opcode == OPCODE_MOVQQ) {
- CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64));
+ CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT64));
InstructionAddress += 8;
EdbPrintRawIndexData64 (Data64);
}
@@ -856,13 +864,13 @@ EdbDisasmMOVxx (
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
if ((Opcode <= OPCODE_MOVQW) || (Opcode == OPCODE_MOVNW)) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
EdbPrintRawIndexData16 (Data16);
} else if ((Opcode <= OPCODE_MOVQD) || (Opcode == OPCODE_MOVND)) {
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
EdbPrintRawIndexData32 (Data32);
} else if (Opcode == OPCODE_MOVQQ) {
- CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64));
+ CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT64));
EdbPrintRawIndexData64 (Data64);
}
}
@@ -886,24 +894,25 @@ EdbDisasmMOVxx (
**/
UINTN
EdbDisasmMOVsnw (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_MOVSNW);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_MOVSNW);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
- Size = 2;
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Size = 2;
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
Size += 2;
}
+
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
Size += 2;
}
@@ -920,7 +929,7 @@ EdbDisasmMOVsnw (
InstructionAddress += 2;
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
InstructionAddress += 2;
EdbPrintRawIndexData16 (Data16);
}
@@ -929,7 +938,7 @@ EdbDisasmMOVsnw (
EdbPrintRegister2 (Operands);
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT2) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -956,24 +965,25 @@ EdbDisasmMOVsnw (
**/
UINTN
EdbDisasmMOVsnd (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT32 Data32;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT32 Data32;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_MOVSND);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_MOVSND);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
- Size = 2;
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Size = 2;
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
Size += 4;
}
+
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
Size += 4;
}
@@ -990,7 +1000,7 @@ EdbDisasmMOVsnd (
InstructionAddress += 2;
if ((Modifiers & OPCODE_M_IMMED_OP1) != 0) {
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
InstructionAddress += 4;
EdbPrintRawIndexData32 (Data32);
}
@@ -999,7 +1009,7 @@ EdbDisasmMOVsnd (
EdbPrintRegister2 (Operands);
if ((Modifiers & OPCODE_M_IMMED_OP2) != 0) {
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
if ((Operands & OPERAND_M_INDIRECT2) != 0) {
EdbPrintRawIndexData32 (Data32);
} else {
@@ -1026,16 +1036,16 @@ EdbDisasmMOVsnd (
**/
UINTN
EdbDisasmLOADSP (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
UINT8 Operands;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_LOADSP);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_LOADSP);
- Operands = GET_OPERANDS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
//
// Construct Disasm String
@@ -1068,16 +1078,16 @@ EdbDisasmLOADSP (
**/
UINTN
EdbDisasmSTORESP (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
UINT8 Operands;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_STORESP);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_STORESP);
- Operands = GET_OPERANDS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
//
// Construct Disasm String
@@ -1097,7 +1107,6 @@ EdbDisasmSTORESP (
return 2;
}
-
/**
Disasm instruction - PUSH.
@@ -1111,20 +1120,20 @@ EdbDisasmSTORESP (
**/
UINTN
EdbDisasmPUSH (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_PUSH);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_PUSH);
- Operands = GET_OPERANDS (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
Size = 4;
} else {
@@ -1138,17 +1147,17 @@ EdbDisasmPUSH (
*DisasmString = EdbPreInstructionString ();
EdbPrintInstructionName (L"PUSH");
-// if (Modifiers & PUSHPOP_M_64) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+ // if (Modifiers & PUSHPOP_M_64) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
EdbPrintRegister1 (Operands);
InstructionAddress += 2;
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT1) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -1175,20 +1184,20 @@ EdbDisasmPUSH (
**/
UINTN
EdbDisasmPOP (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_POP);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_POP);
- Operands = GET_OPERANDS (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
Size = 4;
} else {
@@ -1202,17 +1211,17 @@ EdbDisasmPOP (
*DisasmString = EdbPreInstructionString ();
EdbPrintInstructionName (L"POP");
-// if (Modifiers & PUSHPOP_M_64) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+ // if (Modifiers & PUSHPOP_M_64) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
EdbPrintRegister1 (Operands);
InstructionAddress += 2;
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT1) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -1239,29 +1248,29 @@ EdbDisasmPOP (
**/
UINTN
EdbDisasmCMPI (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Opcode;
- UINT8 Operands;
- UINT16 Data16;
- UINT32 Data32;
- UINTN Size;
+ UINT8 Modifiers;
+ UINT8 Opcode;
+ UINT8 Operands;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINTN Size;
ASSERT (
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPIEQ) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPILTE) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPIGTE) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPIULTE) ||
- (GET_OPCODE(InstructionAddress) == OPCODE_CMPIUGTE)
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPIEQ) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPILTE) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPIGTE) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPIULTE) ||
+ (GET_OPCODE (InstructionAddress) == OPCODE_CMPIUGTE)
);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Opcode = GET_OPCODE (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Opcode = GET_OPCODE (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
if ((Operands & 0xE0) != 0) {
return 0;
@@ -1271,6 +1280,7 @@ EdbDisasmCMPI (
if ((Operands & OPERAND_M_CMPI_INDEX) != 0) {
Size += 2;
}
+
if ((Modifiers & OPCODE_M_CMPI32_DATA) != 0) {
Size += 4;
} else {
@@ -1284,39 +1294,40 @@ EdbDisasmCMPI (
*DisasmString = EdbPreInstructionString ();
EdbPrintInstructionName (L"CMPI");
-// if (Modifiers & OPCODE_M_CMPI64) {
-// EdbPrintInstructionName (L"64");
-// } else {
-// EdbPrintInstructionName (L"32");
-// }
+ // if (Modifiers & OPCODE_M_CMPI64) {
+ // EdbPrintInstructionName (L"64");
+ // } else {
+ // EdbPrintInstructionName (L"32");
+ // }
if ((Modifiers & OPCODE_M_CMPI32_DATA) != 0) {
EdbPrintInstructionName (L"d");
} else {
EdbPrintInstructionName (L"w");
}
+
switch (Opcode) {
- case OPCODE_CMPIEQ:
- EdbPrintInstructionName (L"eq");
- break;
- case OPCODE_CMPILTE:
- EdbPrintInstructionName (L"lte");
- break;
- case OPCODE_CMPIGTE:
- EdbPrintInstructionName (L"gte");
- break;
- case OPCODE_CMPIULTE:
- EdbPrintInstructionName (L"ulte");
- break;
- case OPCODE_CMPIUGTE:
- EdbPrintInstructionName (L"ugte");
- break;
+ case OPCODE_CMPIEQ:
+ EdbPrintInstructionName (L"eq");
+ break;
+ case OPCODE_CMPILTE:
+ EdbPrintInstructionName (L"lte");
+ break;
+ case OPCODE_CMPIGTE:
+ EdbPrintInstructionName (L"gte");
+ break;
+ case OPCODE_CMPIULTE:
+ EdbPrintInstructionName (L"ulte");
+ break;
+ case OPCODE_CMPIUGTE:
+ EdbPrintInstructionName (L"ugte");
+ break;
}
EdbPrintRegister1 (Operands);
InstructionAddress += 2;
if ((Operands & OPERAND_M_CMPI_INDEX) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
InstructionAddress += 2;
EdbPrintRawIndexData16 (Data16);
}
@@ -1324,10 +1335,10 @@ EdbDisasmCMPI (
EdbPrintComma ();
if ((Modifiers & OPCODE_M_CMPI32_DATA) != 0) {
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
EdbPrintDatan (Data32);
} else {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
EdbPrintDatan (Data16);
}
@@ -1350,20 +1361,20 @@ EdbDisasmCMPI (
**/
UINTN
EdbDisasmPUSHn (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_PUSHN);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_PUSHN);
- Operands = GET_OPERANDS (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
Size = 4;
} else {
@@ -1382,7 +1393,7 @@ EdbDisasmPUSHn (
InstructionAddress += 2;
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT1) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -1409,20 +1420,20 @@ EdbDisasmPUSHn (
**/
UINTN
EdbDisasmPOPn (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_POPN);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_POPN);
- Operands = GET_OPERANDS (InstructionAddress);
- Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
Size = 4;
} else {
@@ -1441,7 +1452,7 @@ EdbDisasmPOPn (
InstructionAddress += 2;
if ((Modifiers & PUSHPOP_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
if ((Operands & OPERAND_M_INDIRECT1) != 0) {
EdbPrintRawIndexData16 (Data16);
} else {
@@ -1468,28 +1479,29 @@ EdbDisasmPOPn (
**/
UINTN
EdbDisasmMOVI (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
- UINT32 Data32;
- UINT64 Data64;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINT64 Data64;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_MOVI);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_MOVI);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
if ((Operands & MOVI_M_IMMDATA) != 0) {
- Size = 4;
+ Size = 4;
} else {
- Size = 2;
+ Size = 2;
}
+
if ((Modifiers & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH16) {
Size += 2;
} else if ((Modifiers & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH32) {
@@ -1506,36 +1518,37 @@ EdbDisasmMOVI (
EdbPrintInstructionName (L"MOVI");
switch (Operands & MOVI_M_MOVEWIDTH) {
- case MOVI_MOVEWIDTH8:
- EdbPrintInstructionName (L"b");
- break;
- case MOVI_MOVEWIDTH16:
- EdbPrintInstructionName (L"w");
- break;
- case MOVI_MOVEWIDTH32:
- EdbPrintInstructionName (L"d");
- break;
- case MOVI_MOVEWIDTH64:
- EdbPrintInstructionName (L"q");
- break;
+ case MOVI_MOVEWIDTH8:
+ EdbPrintInstructionName (L"b");
+ break;
+ case MOVI_MOVEWIDTH16:
+ EdbPrintInstructionName (L"w");
+ break;
+ case MOVI_MOVEWIDTH32:
+ EdbPrintInstructionName (L"d");
+ break;
+ case MOVI_MOVEWIDTH64:
+ EdbPrintInstructionName (L"q");
+ break;
}
+
switch (Modifiers & MOVI_M_DATAWIDTH) {
- case MOVI_DATAWIDTH16:
- EdbPrintInstructionName (L"w");
- break;
- case MOVI_DATAWIDTH32:
- EdbPrintInstructionName (L"d");
- break;
- case MOVI_DATAWIDTH64:
- EdbPrintInstructionName (L"q");
- break;
+ case MOVI_DATAWIDTH16:
+ EdbPrintInstructionName (L"w");
+ break;
+ case MOVI_DATAWIDTH32:
+ EdbPrintInstructionName (L"d");
+ break;
+ case MOVI_DATAWIDTH64:
+ EdbPrintInstructionName (L"q");
+ break;
}
EdbPrintRegister1 (Operands);
InstructionAddress += 2;
if ((Operands & MOVI_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
InstructionAddress += 2;
EdbPrintRawIndexData16 (Data16);
}
@@ -1543,18 +1556,18 @@ EdbDisasmMOVI (
EdbPrintComma ();
switch (Modifiers & MOVI_M_DATAWIDTH) {
- case MOVI_DATAWIDTH16:
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
- EdbPrintDatan (Data16);
- break;
- case MOVI_DATAWIDTH32:
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
- EdbPrintDatan (Data32);
- break;
- case MOVI_DATAWIDTH64:
- CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64));
- EdbPrintData64n (Data64);
- break;
+ case MOVI_DATAWIDTH16:
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
+ EdbPrintDatan (Data16);
+ break;
+ case MOVI_DATAWIDTH32:
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
+ EdbPrintDatan (Data32);
+ break;
+ case MOVI_DATAWIDTH64:
+ CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT64));
+ EdbPrintData64n (Data64);
+ break;
}
EdbPostInstructionString ();
@@ -1576,28 +1589,29 @@ EdbDisasmMOVI (
**/
UINTN
EdbDisasmMOVIn (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
- UINT32 Data32;
- UINT64 Data64;
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINT64 Data64;
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_MOVIN);
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_MOVIN);
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
if ((Operands & MOVI_M_IMMDATA) != 0) {
- Size = 4;
+ Size = 4;
} else {
- Size = 2;
+ Size = 2;
}
+
if ((Modifiers & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH16) {
Size += 2;
} else if ((Modifiers & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH32) {
@@ -1614,22 +1628,22 @@ EdbDisasmMOVIn (
EdbPrintInstructionName (L"MOVIn");
switch (Modifiers & MOVI_M_DATAWIDTH) {
- case MOVI_DATAWIDTH16:
- EdbPrintInstructionName (L"w");
- break;
- case MOVI_DATAWIDTH32:
- EdbPrintInstructionName (L"d");
- break;
- case MOVI_DATAWIDTH64:
- EdbPrintInstructionName (L"q");
- break;
+ case MOVI_DATAWIDTH16:
+ EdbPrintInstructionName (L"w");
+ break;
+ case MOVI_DATAWIDTH32:
+ EdbPrintInstructionName (L"d");
+ break;
+ case MOVI_DATAWIDTH64:
+ EdbPrintInstructionName (L"q");
+ break;
}
EdbPrintRegister1 (Operands);
InstructionAddress += 2;
if ((Operands & MOVI_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
InstructionAddress += 2;
EdbPrintRawIndexData16 (Data16);
}
@@ -1637,18 +1651,18 @@ EdbDisasmMOVIn (
EdbPrintComma ();
switch (Modifiers & MOVI_M_DATAWIDTH) {
- case MOVI_DATAWIDTH16:
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
- EdbPrintRawIndexData16 (Data16);
- break;
- case MOVI_DATAWIDTH32:
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
- EdbPrintRawIndexData32 (Data32);
- break;
- case MOVI_DATAWIDTH64:
- CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64));
- EdbPrintRawIndexData64 (Data64);
- break;
+ case MOVI_DATAWIDTH16:
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
+ EdbPrintRawIndexData16 (Data16);
+ break;
+ case MOVI_DATAWIDTH32:
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
+ EdbPrintRawIndexData32 (Data32);
+ break;
+ case MOVI_DATAWIDTH64:
+ CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT64));
+ EdbPrintRawIndexData64 (Data64);
+ break;
}
EdbPostInstructionString ();
@@ -1670,31 +1684,32 @@ EdbDisasmMOVIn (
**/
UINTN
EdbDisasmMOVREL (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisasmString
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisasmString
)
{
- UINT8 Modifiers;
- UINT8 Operands;
- UINTN Size;
- UINT16 Data16;
- UINT32 Data32;
- UINT64 Data64;
- UINTN Result;
- EFI_PHYSICAL_ADDRESS SavedInstructionAddress;
-
- ASSERT (GET_OPCODE(InstructionAddress) == OPCODE_MOVREL);
+ UINT8 Modifiers;
+ UINT8 Operands;
+ UINTN Size;
+ UINT16 Data16;
+ UINT32 Data32;
+ UINT64 Data64;
+ UINTN Result;
+ EFI_PHYSICAL_ADDRESS SavedInstructionAddress;
+
+ ASSERT (GET_OPCODE (InstructionAddress) == OPCODE_MOVREL);
SavedInstructionAddress = InstructionAddress;
- Modifiers = GET_MODIFIERS (InstructionAddress);
- Operands = GET_OPERANDS (InstructionAddress);
+ Modifiers = GET_MODIFIERS (InstructionAddress);
+ Operands = GET_OPERANDS (InstructionAddress);
if ((Operands & MOVI_M_IMMDATA) != 0) {
- Size = 4;
+ Size = 4;
} else {
- Size = 2;
+ Size = 2;
}
+
if ((Modifiers & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH16) {
Size += 2;
} else if ((Modifiers & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH32) {
@@ -1713,22 +1728,22 @@ EdbDisasmMOVREL (
EdbPrintInstructionName (L"MOVrel");
switch (Modifiers & MOVI_M_DATAWIDTH) {
- case MOVI_DATAWIDTH16:
- EdbPrintInstructionName (L"w");
- break;
- case MOVI_DATAWIDTH32:
- EdbPrintInstructionName (L"d");
- break;
- case MOVI_DATAWIDTH64:
- EdbPrintInstructionName (L"q");
- break;
+ case MOVI_DATAWIDTH16:
+ EdbPrintInstructionName (L"w");
+ break;
+ case MOVI_DATAWIDTH32:
+ EdbPrintInstructionName (L"d");
+ break;
+ case MOVI_DATAWIDTH64:
+ EdbPrintInstructionName (L"q");
+ break;
}
EdbPrintRegister1 (Operands);
InstructionAddress += 2;
if ((Operands & MOVI_M_IMMDATA) != 0) {
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
InstructionAddress += 2;
EdbPrintRawIndexData16 (Data16);
}
@@ -1736,31 +1751,35 @@ EdbDisasmMOVREL (
EdbPrintComma ();
switch (Modifiers & MOVI_M_DATAWIDTH) {
- case MOVI_DATAWIDTH16:
- CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT16));
- Result = EdbFindAndPrintSymbol ((UINTN)(SavedInstructionAddress + Size + (INT16)Data16));
- if (Result == 0) {
- EdbPrintData16 (Data16);
- }
- break;
- case MOVI_DATAWIDTH32:
- CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT32));
- Result = EdbFindAndPrintSymbol ((UINTN)(SavedInstructionAddress + Size + (INT32)Data32));
- if (Result == 0) {
- EdbPrintData32 (Data32);
- }
- break;
- case MOVI_DATAWIDTH64:
- CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof(UINT64));
- if (sizeof(UINTN) == sizeof(UINT64)) {
- Result = EdbFindAndPrintSymbol ((UINTN)(SavedInstructionAddress + Size + (INT64)Data64));
- } else {
- Result = 0;
- }
- if (Result == 0) {
- EdbPrintData64 (Data64);
- }
- break;
+ case MOVI_DATAWIDTH16:
+ CopyMem (&Data16, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT16));
+ Result = EdbFindAndPrintSymbol ((UINTN)(SavedInstructionAddress + Size + (INT16)Data16));
+ if (Result == 0) {
+ EdbPrintData16 (Data16);
+ }
+
+ break;
+ case MOVI_DATAWIDTH32:
+ CopyMem (&Data32, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT32));
+ Result = EdbFindAndPrintSymbol ((UINTN)(SavedInstructionAddress + Size + (INT32)Data32));
+ if (Result == 0) {
+ EdbPrintData32 (Data32);
+ }
+
+ break;
+ case MOVI_DATAWIDTH64:
+ CopyMem (&Data64, (VOID *)(UINTN)(InstructionAddress), sizeof (UINT64));
+ if (sizeof (UINTN) == sizeof (UINT64)) {
+ Result = EdbFindAndPrintSymbol ((UINTN)(SavedInstructionAddress + Size + (INT64)Data64));
+ } else {
+ Result = 0;
+ }
+
+ if (Result == 0) {
+ EdbPrintData64 (Data64);
+ }
+
+ break;
}
EdbPostInstructionString ();
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.h b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.h
index 43fa5f4b8b..e2617581fc 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasm.h
@@ -21,10 +21,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
typedef
UINTN
-(* EDB_DISASM_INSTRUCTION) (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN EFI_SYSTEM_CONTEXT SystemContext,
- OUT CHAR16 **DisAsmString
+(*EDB_DISASM_INSTRUCTION) (
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ OUT CHAR16 **DisAsmString
);
#endif
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.c
index feb3fb121c..f43b891e2e 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.c
@@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Edb.h"
-extern EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable[];
+extern EDB_DISASM_INSTRUCTION mEdbDisasmInstructionTable[];
typedef struct {
CHAR16 Name[EDB_INSTRUCTION_NAME_MAX_LENGTH];
@@ -16,9 +16,9 @@ typedef struct {
CHAR16 Tail;
} EDB_INSTRUCTION_STRING;
-EDB_INSTRUCTION_STRING mInstructionString;
-UINTN mInstructionNameOffset;
-UINTN mInstructionContentOffset;
+EDB_INSTRUCTION_STRING mInstructionString;
+UINTN mInstructionNameOffset;
+UINTN mInstructionContentOffset;
/**
@@ -30,14 +30,14 @@ UINTN mInstructionContentOffset;
**/
VOID
EdbSetOffset (
- IN UINTN InstructionNameOffset,
- IN UINTN InstructionContentOffset
+ IN UINTN InstructionNameOffset,
+ IN UINTN InstructionContentOffset
)
{
- mInstructionNameOffset = InstructionNameOffset;
+ mInstructionNameOffset = InstructionNameOffset;
mInstructionContentOffset = InstructionContentOffset;
- return ;
+ return;
}
/**
@@ -52,7 +52,7 @@ EdbPreInstructionString (
VOID
)
{
- ZeroMem (&mInstructionString, sizeof(mInstructionString));
+ ZeroMem (&mInstructionString, sizeof (mInstructionString));
mInstructionNameOffset = 0;
mInstructionContentOffset = 0;
@@ -71,13 +71,14 @@ EdbPostInstructionString (
VOID
)
{
- CHAR16 *Char;
+ CHAR16 *Char;
for (Char = (CHAR16 *)&mInstructionString; Char < &mInstructionString.Tail; Char++) {
if (*Char == 0) {
*Char = L' ';
}
}
+
mInstructionString.Tail = 0;
mInstructionNameOffset = 0;
@@ -104,15 +105,15 @@ EdbGetNaturalIndex16 (
OUT UINTN *ConstantUnits
)
{
- BOOLEAN Sign;
- UINTN NaturalUnitBit;
+ BOOLEAN Sign;
+ UINTN NaturalUnitBit;
- Sign = (BOOLEAN)(Data16 >> 15);
- NaturalUnitBit = (UINTN)((Data16 >> 12) & 0x7);
+ Sign = (BOOLEAN)(Data16 >> 15);
+ NaturalUnitBit = (UINTN)((Data16 >> 12) & 0x7);
NaturalUnitBit *= 2;
- Data16 = Data16 & 0xFFF;
- *NaturalUnits = (UINTN)(Data16 & ((1 << NaturalUnitBit) - 1));
- *ConstantUnits = (UINTN)((Data16 >> NaturalUnitBit) & ((1 << (12 - NaturalUnitBit)) - 1));
+ Data16 = Data16 & 0xFFF;
+ *NaturalUnits = (UINTN)(Data16 & ((1 << NaturalUnitBit) - 1));
+ *ConstantUnits = (UINTN)((Data16 >> NaturalUnitBit) & ((1 << (12 - NaturalUnitBit)) - 1));
return Sign;
}
@@ -135,15 +136,15 @@ EdbGetNaturalIndex32 (
OUT UINTN *ConstantUnits
)
{
- BOOLEAN Sign;
- UINTN NaturalUnitBit;
+ BOOLEAN Sign;
+ UINTN NaturalUnitBit;
- Sign = (BOOLEAN)(Data32 >> 31);
- NaturalUnitBit = (UINTN)((Data32 >> 28) & 0x7);
+ Sign = (BOOLEAN)(Data32 >> 31);
+ NaturalUnitBit = (UINTN)((Data32 >> 28) & 0x7);
NaturalUnitBit *= 4;
- Data32 = Data32 & 0xFFFFFFF;
- *NaturalUnits = (UINTN)(Data32 & ((1 << NaturalUnitBit) - 1));
- *ConstantUnits = (UINTN)((Data32 >> NaturalUnitBit) & ((1 << (28 - NaturalUnitBit)) - 1));
+ Data32 = Data32 & 0xFFFFFFF;
+ *NaturalUnits = (UINTN)(Data32 & ((1 << NaturalUnitBit) - 1));
+ *ConstantUnits = (UINTN)((Data32 >> NaturalUnitBit) & ((1 << (28 - NaturalUnitBit)) - 1));
return Sign;
}
@@ -166,15 +167,15 @@ EdbGetNaturalIndex64 (
OUT UINT64 *ConstantUnits
)
{
- BOOLEAN Sign;
- UINTN NaturalUnitBit;
+ BOOLEAN Sign;
+ UINTN NaturalUnitBit;
- Sign = (BOOLEAN)RShiftU64 (Data64, 63);
- NaturalUnitBit = (UINTN)(RShiftU64 (Data64, 60) & 0x7);
+ Sign = (BOOLEAN)RShiftU64 (Data64, 63);
+ NaturalUnitBit = (UINTN)(RShiftU64 (Data64, 60) & 0x7);
NaturalUnitBit *= 8;
- Data64 = RShiftU64 (LShiftU64 (Data64, 4), 4);
- *NaturalUnits = (UINT64)(Data64 & (LShiftU64 (1, NaturalUnitBit) - 1));
- *ConstantUnits = (UINT64)(RShiftU64 (Data64, NaturalUnitBit) & (LShiftU64 (1, (60 - NaturalUnitBit)) - 1));
+ Data64 = RShiftU64 (LShiftU64 (Data64, 4), 4);
+ *NaturalUnits = (UINT64)(Data64 & (LShiftU64 (1, NaturalUnitBit) - 1));
+ *ConstantUnits = (UINT64)(RShiftU64 (Data64, NaturalUnitBit) & (LShiftU64 (1, (60 - NaturalUnitBit)) - 1));
return Sign;
}
@@ -235,7 +236,7 @@ EdbGetBitWidth (
**/
UINTN
EdbPrintInstructionName (
- IN CHAR16 *Name
+ IN CHAR16 *Name
)
{
EDBSPrintWithOffset (
@@ -261,7 +262,7 @@ EdbPrintInstructionName (
**/
UINTN
EdbPrintRegister1 (
- IN UINT8 Operands
+ IN UINT8 Operands
)
{
if ((Operands & OPERAND_M_INDIRECT1) != 0) {
@@ -273,6 +274,7 @@ EdbPrintRegister1 (
);
mInstructionContentOffset += 1;
}
+
EDBSPrintWithOffset (
mInstructionString.Content,
EDB_INSTRUCTION_CONTENT_MAX_SIZE,
@@ -296,7 +298,7 @@ EdbPrintRegister1 (
**/
UINTN
EdbPrintRegister2 (
- IN UINT8 Operands
+ IN UINT8 Operands
)
{
if ((Operands & OPERAND_M_INDIRECT2) != 0) {
@@ -308,6 +310,7 @@ EdbPrintRegister2 (
);
mInstructionContentOffset += 1;
}
+
EDBSPrintWithOffset (
mInstructionString.Content,
EDB_INSTRUCTION_CONTENT_MAX_SIZE,
@@ -331,28 +334,28 @@ EdbPrintRegister2 (
**/
UINTN
EdbPrintDedicatedRegister1 (
- IN UINT8 Operands
+ IN UINT8 Operands
)
{
switch (Operands & OPERAND_M_OP1) {
- case 0:
- EDBSPrintWithOffset (
- mInstructionString.Content,
- EDB_INSTRUCTION_CONTENT_MAX_SIZE,
- mInstructionContentOffset,
- L"[FLAGS]"
- );
- mInstructionContentOffset += 7;
- break;
- case 1:
- EDBSPrintWithOffset (
- mInstructionString.Content,
- EDB_INSTRUCTION_CONTENT_MAX_SIZE,
- mInstructionContentOffset,
- L"[IP]"
- );
- mInstructionContentOffset += 4;
- break;
+ case 0:
+ EDBSPrintWithOffset (
+ mInstructionString.Content,
+ EDB_INSTRUCTION_CONTENT_MAX_SIZE,
+ mInstructionContentOffset,
+ L"[FLAGS]"
+ );
+ mInstructionContentOffset += 7;
+ break;
+ case 1:
+ EDBSPrintWithOffset (
+ mInstructionString.Content,
+ EDB_INSTRUCTION_CONTENT_MAX_SIZE,
+ mInstructionContentOffset,
+ L"[IP]"
+ );
+ mInstructionContentOffset += 4;
+ break;
}
return mInstructionContentOffset;
@@ -369,28 +372,28 @@ EdbPrintDedicatedRegister1 (
**/
UINTN
EdbPrintDedicatedRegister2 (
- IN UINT8 Operands
+ IN UINT8 Operands
)
{
switch ((Operands & OPERAND_M_OP2) >> 4) {
- case 0:
- EDBSPrintWithOffset (
- mInstructionString.Content,
- EDB_INSTRUCTION_CONTENT_MAX_SIZE,
- mInstructionContentOffset,
- L"[FLAGS]"
- );
- mInstructionContentOffset += 7;
- break;
- case 1:
- EDBSPrintWithOffset (
- mInstructionString.Content,
- EDB_INSTRUCTION_CONTENT_MAX_SIZE,
- mInstructionContentOffset,
- L"[IP]"
- );
- mInstructionContentOffset += 4;
- break;
+ case 0:
+ EDBSPrintWithOffset (
+ mInstructionString.Content,
+ EDB_INSTRUCTION_CONTENT_MAX_SIZE,
+ mInstructionContentOffset,
+ L"[FLAGS]"
+ );
+ mInstructionContentOffset += 7;
+ break;
+ case 1:
+ EDBSPrintWithOffset (
+ mInstructionString.Content,
+ EDB_INSTRUCTION_CONTENT_MAX_SIZE,
+ mInstructionContentOffset,
+ L"[IP]"
+ );
+ mInstructionContentOffset += 4;
+ break;
}
return mInstructionContentOffset;
@@ -409,9 +412,9 @@ EdbPrintDedicatedRegister2 (
**/
UINTN
EdbPrintIndexData (
- IN BOOLEAN Sign,
- IN UINTN NaturalUnits,
- IN UINTN ConstantUnits
+ IN BOOLEAN Sign,
+ IN UINTN NaturalUnits,
+ IN UINTN ConstantUnits
)
{
EDBSPrintWithOffset (
@@ -424,7 +427,7 @@ EdbPrintIndexData (
Sign ? L"-" : L"+",
ConstantUnits
);
- mInstructionContentOffset = mInstructionContentOffset + 5 + EdbGetBitWidth (NaturalUnits) + EdbGetBitWidth (ConstantUnits);
+ mInstructionContentOffset = mInstructionContentOffset + 5 + EdbGetBitWidth (NaturalUnits) + EdbGetBitWidth (ConstantUnits);
return mInstructionContentOffset;
}
@@ -442,9 +445,9 @@ EdbPrintIndexData (
**/
UINTN
EdbPrintIndexData64 (
- IN BOOLEAN Sign,
- IN UINT64 NaturalUnits,
- IN UINT64 ConstantUnits
+ IN BOOLEAN Sign,
+ IN UINT64 NaturalUnits,
+ IN UINT64 ConstantUnits
)
{
EDBSPrintWithOffset (
@@ -457,7 +460,7 @@ EdbPrintIndexData64 (
Sign ? L"-" : L"+",
ConstantUnits
);
- mInstructionContentOffset = mInstructionContentOffset + 5 + EdbGetBitWidth (NaturalUnits) + EdbGetBitWidth (ConstantUnits);
+ mInstructionContentOffset = mInstructionContentOffset + 5 + EdbGetBitWidth (NaturalUnits) + EdbGetBitWidth (ConstantUnits);
return mInstructionContentOffset;
}
@@ -473,15 +476,15 @@ EdbPrintIndexData64 (
**/
UINTN
EdbPrintRawIndexData16 (
- IN UINT16 Data16
+ IN UINT16 Data16
)
{
- BOOLEAN Sign;
- UINTN NaturalUnits;
- UINTN ConstantUnits;
- UINTN Offset;
+ BOOLEAN Sign;
+ UINTN NaturalUnits;
+ UINTN ConstantUnits;
+ UINTN Offset;
- Sign = EdbGetNaturalIndex16 (Data16, &NaturalUnits, &ConstantUnits);
+ Sign = EdbGetNaturalIndex16 (Data16, &NaturalUnits, &ConstantUnits);
Offset = EdbPrintIndexData (Sign, NaturalUnits, ConstantUnits);
return Offset;
@@ -498,15 +501,15 @@ EdbPrintRawIndexData16 (
**/
UINTN
EdbPrintRawIndexData32 (
- IN UINT32 Data32
+ IN UINT32 Data32
)
{
- BOOLEAN Sign;
- UINTN NaturalUnits;
- UINTN ConstantUnits;
- UINTN Offset;
+ BOOLEAN Sign;
+ UINTN NaturalUnits;
+ UINTN ConstantUnits;
+ UINTN Offset;
- Sign = EdbGetNaturalIndex32 (Data32, &NaturalUnits, &ConstantUnits);
+ Sign = EdbGetNaturalIndex32 (Data32, &NaturalUnits, &ConstantUnits);
Offset = EdbPrintIndexData (Sign, NaturalUnits, ConstantUnits);
return Offset;
@@ -523,15 +526,15 @@ EdbPrintRawIndexData32 (
**/
UINTN
EdbPrintRawIndexData64 (
- IN UINT64 Data64
+ IN UINT64 Data64
)
{
- BOOLEAN Sign;
- UINT64 NaturalUnits;
- UINT64 ConstantUnits;
- UINTN Offset;
+ BOOLEAN Sign;
+ UINT64 NaturalUnits;
+ UINT64 ConstantUnits;
+ UINTN Offset;
- Sign = EdbGetNaturalIndex64 (Data64, &NaturalUnits, &ConstantUnits);
+ Sign = EdbGetNaturalIndex64 (Data64, &NaturalUnits, &ConstantUnits);
Offset = EdbPrintIndexData64 (Sign, NaturalUnits, ConstantUnits);
return Offset;
@@ -548,7 +551,7 @@ EdbPrintRawIndexData64 (
**/
UINTN
EdbPrintImmData8 (
- IN UINT8 Data
+ IN UINT8 Data
)
{
EDBSPrintWithOffset (
@@ -558,7 +561,7 @@ EdbPrintImmData8 (
L"(0x%02x)",
(UINTN)Data
);
- mInstructionContentOffset += 6;
+ mInstructionContentOffset += 6;
return mInstructionContentOffset;
}
@@ -574,7 +577,7 @@ EdbPrintImmData8 (
**/
UINTN
EdbPrintImmData16 (
- IN UINT16 Data
+ IN UINT16 Data
)
{
EDBSPrintWithOffset (
@@ -584,7 +587,7 @@ EdbPrintImmData16 (
L"(0x%04x)",
(UINTN)Data
);
- mInstructionContentOffset += 8;
+ mInstructionContentOffset += 8;
return mInstructionContentOffset;
}
@@ -600,7 +603,7 @@ EdbPrintImmData16 (
**/
UINTN
EdbPrintImmData32 (
- IN UINT32 Data
+ IN UINT32 Data
)
{
EDBSPrintWithOffset (
@@ -610,7 +613,7 @@ EdbPrintImmData32 (
L"(0x%08x)",
(UINTN)Data
);
- mInstructionContentOffset += 12;
+ mInstructionContentOffset += 12;
return mInstructionContentOffset;
}
@@ -626,7 +629,7 @@ EdbPrintImmData32 (
**/
UINTN
EdbPrintImmData64 (
- IN UINT64 Data
+ IN UINT64 Data
)
{
EDBSPrintWithOffset (
@@ -636,7 +639,7 @@ EdbPrintImmData64 (
L"(0x%016lx)",
Data
);
- mInstructionContentOffset += 20;
+ mInstructionContentOffset += 20;
return mInstructionContentOffset;
}
@@ -652,7 +655,7 @@ EdbPrintImmData64 (
**/
UINTN
EdbPrintImmDatan (
- IN UINTN Data
+ IN UINTN Data
)
{
EDBSPrintWithOffset (
@@ -662,7 +665,7 @@ EdbPrintImmDatan (
L"(%d)",
(UINTN)Data
);
- mInstructionContentOffset = mInstructionContentOffset + 2 + EdbGetBitWidth (Data);
+ mInstructionContentOffset = mInstructionContentOffset + 2 + EdbGetBitWidth (Data);
return mInstructionContentOffset;
}
@@ -678,7 +681,7 @@ EdbPrintImmDatan (
**/
UINTN
EdbPrintImmData64n (
- IN UINT64 Data64
+ IN UINT64 Data64
)
{
EDBSPrintWithOffset (
@@ -688,7 +691,7 @@ EdbPrintImmData64n (
L"(%ld)",
Data64
);
- mInstructionContentOffset = mInstructionContentOffset + 2 + EdbGetBitWidth (Data64);
+ mInstructionContentOffset = mInstructionContentOffset + 2 + EdbGetBitWidth (Data64);
return mInstructionContentOffset;
}
@@ -704,7 +707,7 @@ EdbPrintImmData64n (
**/
UINTN
EdbPrintData8 (
- IN UINT8 Data8
+ IN UINT8 Data8
)
{
EDBSPrintWithOffset (
@@ -730,7 +733,7 @@ EdbPrintData8 (
**/
UINTN
EdbPrintData16 (
- IN UINT16 Data16
+ IN UINT16 Data16
)
{
EDBSPrintWithOffset (
@@ -756,7 +759,7 @@ EdbPrintData16 (
**/
UINTN
EdbPrintData32 (
- IN UINT32 Data32
+ IN UINT32 Data32
)
{
EDBSPrintWithOffset (
@@ -782,7 +785,7 @@ EdbPrintData32 (
**/
UINTN
EdbPrintData64 (
- IN UINT64 Data64
+ IN UINT64 Data64
)
{
EDBSPrintWithOffset (
@@ -808,7 +811,7 @@ EdbPrintData64 (
**/
UINTN
EdbPrintDatan (
- IN UINTN Data
+ IN UINTN Data
)
{
EDBSPrintWithOffset (
@@ -834,7 +837,7 @@ EdbPrintDatan (
**/
UINTN
EdbPrintData64n (
- IN UINT64 Data64
+ IN UINT64 Data64
)
{
EDBSPrintWithOffset (
@@ -860,10 +863,10 @@ EdbPrintData64n (
**/
UINTN
EdbPrintData8s (
- IN UINT8 Data8
+ IN UINT8 Data8
)
{
- BOOLEAN Sign;
+ BOOLEAN Sign;
Sign = (BOOLEAN)(Data8 >> 7);
@@ -891,10 +894,10 @@ EdbPrintData8s (
**/
UINTN
EdbPrintData16s (
- IN UINT16 Data16
+ IN UINT16 Data16
)
{
- BOOLEAN Sign;
+ BOOLEAN Sign;
Sign = (BOOLEAN)(Data16 >> 15);
@@ -922,10 +925,10 @@ EdbPrintData16s (
**/
UINTN
EdbPrintData32s (
- IN UINT32 Data32
+ IN UINT32 Data32
)
{
- BOOLEAN Sign;
+ BOOLEAN Sign;
Sign = (BOOLEAN)(Data32 >> 31);
@@ -953,13 +956,13 @@ EdbPrintData32s (
**/
UINTN
EdbPrintData64s (
- IN UINT64 Data64
+ IN UINT64 Data64
)
{
- BOOLEAN Sign;
- INT64 Data64s;
+ BOOLEAN Sign;
+ INT64 Data64s;
- Sign = (BOOLEAN)RShiftU64 (Data64, 63);
+ Sign = (BOOLEAN)RShiftU64 (Data64, 63);
Data64s = (INT64)RShiftU64 (LShiftU64 (Data64, 1), 1);
EDBSPrintWithOffset (
@@ -1010,10 +1013,10 @@ EdbPrintComma (
**/
UINTN
EdbFindAndPrintSymbol (
- IN UINTN Address
+ IN UINTN Address
)
{
- CHAR8 *SymbolStr;
+ CHAR8 *SymbolStr;
SymbolStr = FindSymbolStr (Address);
if (SymbolStr != NULL) {
@@ -1040,8 +1043,8 @@ EdbFindAndPrintSymbol (
**/
VOID
EdbPrintRaw (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN UINTN InstructionNumber
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN UINTN InstructionNumber
)
{
UINTN LineNumber;
@@ -1051,7 +1054,7 @@ EdbPrintRaw (
CHAR8 *SymbolStr;
if (InstructionNumber == 0) {
- return ;
+ return;
}
LineNumber = InstructionNumber / EDB_BYTECODE_NUMBER_IN_LINE;
@@ -1075,6 +1078,7 @@ EdbPrintRaw (
EDBPrint (L"%02x ", *(UINT8 *)(UINTN)InstructionAddress);
InstructionAddress += 1;
}
+
EDBPrint (L"\n");
}
@@ -1083,11 +1087,12 @@ EdbPrintRaw (
EDBPrint (L"%02x ", *(UINT8 *)(UINTN)InstructionAddress);
InstructionAddress += 1;
}
+
for (ByteIndex = 0; ByteIndex < EDB_BYTECODE_NUMBER_IN_LINE - ByteNumber; ByteIndex++) {
EDBPrint (L" ");
}
- return ;
+ return;
}
/**
@@ -1102,42 +1107,41 @@ EdbPrintRaw (
**/
EFI_STATUS
EdbShowDisasm (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
- EFI_PHYSICAL_ADDRESS InstructionAddress;
- UINTN InstructionNumber;
- UINTN InstructionLength;
- UINT8 Opcode;
- CHAR16 *InstructionString;
-// UINTN Result;
+ EFI_PHYSICAL_ADDRESS InstructionAddress;
+ UINTN InstructionNumber;
+ UINTN InstructionLength;
+ UINT8 Opcode;
+ CHAR16 *InstructionString;
+
+ // UINTN Result;
InstructionAddress = DebuggerPrivate->InstructionScope;
for (InstructionNumber = 0; InstructionNumber < DebuggerPrivate->InstructionNumber; InstructionNumber++) {
-
//
// Break each 0x10 instruction
//
if (((InstructionNumber % EFI_DEBUGGER_LINE_NUMBER_IN_PAGE) == 0) &&
- (InstructionNumber != 0)) {
+ (InstructionNumber != 0))
+ {
if (SetPageBreak ()) {
break;
}
}
- Opcode = GET_OPCODE(InstructionAddress);
+ Opcode = GET_OPCODE (InstructionAddress);
if ((Opcode < OPCODE_MAX) && (mEdbDisasmInstructionTable[Opcode] != NULL)) {
- InstructionLength = mEdbDisasmInstructionTable [Opcode] (InstructionAddress, SystemContext, &InstructionString);
+ InstructionLength = mEdbDisasmInstructionTable[Opcode](InstructionAddress, SystemContext, &InstructionString);
if (InstructionLength != 0) {
-
//
// Print Source
//
-// Result = EdbPrintSource ((UINTN)InstructionAddress, FALSE);
+ // Result = EdbPrintSource ((UINTN)InstructionAddress, FALSE);
if (!DebuggerPrivate->DebuggerSymbolContext.DisplayCodeOnly) {
-
EdbPrintRaw (InstructionAddress, InstructionLength);
if (InstructionString != NULL) {
EDBPrint (L"%s\n", InstructionString);
@@ -1182,30 +1186,31 @@ EdbShowDisasm (
**/
UINT64
GetRegisterValue (
- IN EFI_SYSTEM_CONTEXT SystemContext,
- IN UINT8 Index
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN UINT8 Index
)
{
switch (Index) {
- case 0:
- return SystemContext.SystemContextEbc->R0;
- case 1:
- return SystemContext.SystemContextEbc->R1;
- case 2:
- return SystemContext.SystemContextEbc->R2;
- case 3:
- return SystemContext.SystemContextEbc->R3;
- case 4:
- return SystemContext.SystemContextEbc->R4;
- case 5:
- return SystemContext.SystemContextEbc->R5;
- case 6:
- return SystemContext.SystemContextEbc->R6;
- case 7:
- return SystemContext.SystemContextEbc->R7;
- default:
- ASSERT (FALSE);
- break;
+ case 0:
+ return SystemContext.SystemContextEbc->R0;
+ case 1:
+ return SystemContext.SystemContextEbc->R1;
+ case 2:
+ return SystemContext.SystemContextEbc->R2;
+ case 3:
+ return SystemContext.SystemContextEbc->R3;
+ case 4:
+ return SystemContext.SystemContextEbc->R4;
+ case 5:
+ return SystemContext.SystemContextEbc->R5;
+ case 6:
+ return SystemContext.SystemContextEbc->R6;
+ case 7:
+ return SystemContext.SystemContextEbc->R7;
+ default:
+ ASSERT (FALSE);
+ break;
}
+
return 0;
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.h b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.h
index b1e7a468ee..7542b5c2c7 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbDisasmSupport.h
@@ -11,16 +11,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Uefi.h>
-#define EDB_BYTECODE_NUMBER_IN_LINE 5
+#define EDB_BYTECODE_NUMBER_IN_LINE 5
#ifdef EFI32
-#define EDB_PRINT_ADDRESS_FORMAT L"%08x: "
+#define EDB_PRINT_ADDRESS_FORMAT L"%08x: "
#else
// To use 012l instead of 016l because space is not enough
-#define EDB_PRINT_ADDRESS_FORMAT L"%012lx: "
+#define EDB_PRINT_ADDRESS_FORMAT L"%012lx: "
#endif
-#define OPCODE_MAX 0x40
+#define OPCODE_MAX 0x40
#define EDB_INSTRUCTION_NAME_MAX_LENGTH 10
#define EDB_INSTRUCTION_NAME_MAX_SIZE (EDB_INSTRUCTION_NAME_MAX_LENGTH * sizeof(CHAR16))
@@ -37,8 +37,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
EdbSetOffset (
- IN UINTN InstructionNameOffset,
- IN UINTN InstructionContentOffset
+ IN UINTN InstructionNameOffset,
+ IN UINTN InstructionContentOffset
);
/**
@@ -76,7 +76,7 @@ EdbPostInstructionString (
**/
UINTN
EdbPrintInstructionName (
- IN CHAR16 *Name
+ IN CHAR16 *Name
);
/**
@@ -144,7 +144,7 @@ EdbGetNaturalIndex64 (
**/
UINTN
EdbPrintRawIndexData16 (
- IN UINT16 Data16
+ IN UINT16 Data16
);
/**
@@ -158,7 +158,7 @@ EdbPrintRawIndexData16 (
**/
UINTN
EdbPrintRawIndexData32 (
- IN UINT32 Data32
+ IN UINT32 Data32
);
/**
@@ -172,7 +172,7 @@ EdbPrintRawIndexData32 (
**/
UINTN
EdbPrintRawIndexData64 (
- IN UINT64 Data64
+ IN UINT64 Data64
);
/**
@@ -186,7 +186,7 @@ EdbPrintRawIndexData64 (
**/
UINTN
EdbPrintRegister1 (
- IN UINT8 Operands
+ IN UINT8 Operands
);
/**
@@ -200,7 +200,7 @@ EdbPrintRegister1 (
**/
UINTN
EdbPrintRegister2 (
- IN UINT8 Operands
+ IN UINT8 Operands
);
/**
@@ -214,7 +214,7 @@ EdbPrintRegister2 (
**/
UINTN
EdbPrintDedicatedRegister1 (
- IN UINT8 Operands
+ IN UINT8 Operands
);
/**
@@ -228,7 +228,7 @@ EdbPrintDedicatedRegister1 (
**/
UINTN
EdbPrintDedicatedRegister2 (
- IN UINT8 Operands
+ IN UINT8 Operands
);
/**
@@ -244,9 +244,9 @@ EdbPrintDedicatedRegister2 (
**/
UINTN
EdbPrintIndexData (
- IN BOOLEAN Sign,
- IN UINTN NaturalUnits,
- IN UINTN ConstantUnits
+ IN BOOLEAN Sign,
+ IN UINTN NaturalUnits,
+ IN UINTN ConstantUnits
);
/**
@@ -262,9 +262,9 @@ EdbPrintIndexData (
**/
UINTN
EdbPrintIndexData64 (
- IN BOOLEAN Sign,
- IN UINT64 NaturalUnits,
- IN UINT64 ConstantUnits
+ IN BOOLEAN Sign,
+ IN UINT64 NaturalUnits,
+ IN UINT64 ConstantUnits
);
/**
@@ -278,7 +278,7 @@ EdbPrintIndexData64 (
**/
UINTN
EdbPrintImmData8 (
- IN UINT8 Data
+ IN UINT8 Data
);
/**
@@ -292,7 +292,7 @@ EdbPrintImmData8 (
**/
UINTN
EdbPrintImmData16 (
- IN UINT16 Data
+ IN UINT16 Data
);
/**
@@ -306,7 +306,7 @@ EdbPrintImmData16 (
**/
UINTN
EdbPrintImmData32 (
- IN UINT32 Data
+ IN UINT32 Data
);
/**
@@ -320,7 +320,7 @@ EdbPrintImmData32 (
**/
UINTN
EdbPrintImmData64 (
- IN UINT64 Data
+ IN UINT64 Data
);
/**
@@ -334,7 +334,7 @@ EdbPrintImmData64 (
**/
UINTN
EdbPrintImmDatan (
- IN UINTN Data
+ IN UINTN Data
);
/**
@@ -348,7 +348,7 @@ EdbPrintImmDatan (
**/
UINTN
EdbPrintImmData64n (
- IN UINT64 Data64
+ IN UINT64 Data64
);
/**
@@ -362,7 +362,7 @@ EdbPrintImmData64n (
**/
UINTN
EdbPrintData8 (
- IN UINT8 Data8
+ IN UINT8 Data8
);
/**
@@ -376,7 +376,7 @@ EdbPrintData8 (
**/
UINTN
EdbPrintData16 (
- IN UINT16 Data16
+ IN UINT16 Data16
);
/**
@@ -390,7 +390,7 @@ EdbPrintData16 (
**/
UINTN
EdbPrintData32 (
- IN UINT32 Data32
+ IN UINT32 Data32
);
/**
@@ -404,7 +404,7 @@ EdbPrintData32 (
**/
UINTN
EdbPrintData64 (
- IN UINT64 Data64
+ IN UINT64 Data64
);
/**
@@ -418,7 +418,7 @@ EdbPrintData64 (
**/
UINTN
EdbPrintDatan (
- IN UINTN Data
+ IN UINTN Data
);
/**
@@ -432,7 +432,7 @@ EdbPrintDatan (
**/
UINTN
EdbPrintData64n (
- IN UINT64 Data64
+ IN UINT64 Data64
);
/**
@@ -446,7 +446,7 @@ EdbPrintData64n (
**/
UINTN
EdbPrintData8s (
- IN UINT8 Data8
+ IN UINT8 Data8
);
/**
@@ -460,7 +460,7 @@ EdbPrintData8s (
**/
UINTN
EdbPrintData16s (
- IN UINT16 Data16
+ IN UINT16 Data16
);
/**
@@ -474,7 +474,7 @@ EdbPrintData16s (
**/
UINTN
EdbPrintData32s (
- IN UINT32 Data32
+ IN UINT32 Data32
);
/**
@@ -488,7 +488,7 @@ EdbPrintData32s (
**/
UINTN
EdbPrintData64s (
- IN UINT64 Data64
+ IN UINT64 Data64
);
/**
@@ -515,7 +515,7 @@ EdbPrintComma (
**/
UINTN
EdbFindAndPrintSymbol (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -528,8 +528,8 @@ EdbFindAndPrintSymbol (
**/
VOID
EdbPrintRaw (
- IN EFI_PHYSICAL_ADDRESS InstructionAddress,
- IN UINTN InstructionNumber
+ IN EFI_PHYSICAL_ADDRESS InstructionAddress,
+ IN UINTN InstructionNumber
);
/**
@@ -544,8 +544,8 @@ EdbPrintRaw (
**/
EFI_STATUS
EdbShowDisasm (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN EFI_SYSTEM_CONTEXT SystemContext
);
/**
@@ -560,8 +560,8 @@ EdbShowDisasm (
**/
UINT64
GetRegisterValue (
- IN EFI_SYSTEM_CONTEXT SystemContext,
- IN UINT8 Index
+ IN EFI_SYSTEM_CONTEXT SystemContext,
+ IN UINT8 Index
);
#endif
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
index 1bfe5240c7..4a04e902fb 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
@@ -18,8 +18,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
EbcDebuggerCheckHookFlag (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Flag
+ IN VM_CONTEXT *VmPtr,
+ IN UINT32 Flag
)
{
if ((mDebuggerPrivate.FeatureFlags & Flag) == Flag) {
@@ -30,7 +30,8 @@ EbcDebuggerCheckHookFlag (
VmPtr
);
}
- return ;
+
+ return;
}
/**
@@ -43,25 +44,26 @@ EbcDebuggerCheckHookFlag (
**/
VOID
EbcDebuggerPushCallstackSource (
- IN UINT64 SourceEntry,
- IN EFI_DEBUGGER_BRANCH_TYPE Type
+ IN UINT64 SourceEntry,
+ IN EFI_DEBUGGER_BRANCH_TYPE Type
)
{
if (mDebuggerPrivate.CallStackEntryCount > EFI_DEBUGGER_CALLSTACK_MAX) {
ASSERT (FALSE);
mDebuggerPrivate.CallStackEntryCount = EFI_DEBUGGER_CALLSTACK_MAX;
}
+
//
// Record the new callstack entry
//
mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].SourceAddress = SourceEntry;
- mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].Type = Type;
+ mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].Type = Type;
//
// Do not change CallStackEntryCount
//
- return ;
+ return;
}
/**
@@ -74,14 +76,15 @@ EbcDebuggerPushCallstackSource (
**/
VOID
EbcDebuggerPushCallstackParameter (
- IN UINT64 ParameterAddress,
- IN EFI_DEBUGGER_BRANCH_TYPE Type
+ IN UINT64 ParameterAddress,
+ IN EFI_DEBUGGER_BRANCH_TYPE Type
)
{
if (mDebuggerPrivate.CallStackEntryCount > EFI_DEBUGGER_CALLSTACK_MAX) {
ASSERT (FALSE);
mDebuggerPrivate.CallStackEntryCount = EFI_DEBUGGER_CALLSTACK_MAX;
}
+
//
// Record the new callstack parameter
//
@@ -89,14 +92,14 @@ EbcDebuggerPushCallstackParameter (
CopyMem (
mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].Parameter,
(VOID *)(UINTN)ParameterAddress,
- sizeof(mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].Parameter)
+ sizeof (mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].Parameter)
);
//
// Do not change CallStackEntryCount
//
- return ;
+ return;
}
/**
@@ -109,11 +112,11 @@ EbcDebuggerPushCallstackParameter (
**/
VOID
EbcDebuggerPushCallstackDest (
- IN UINT64 DestEntry,
- IN EFI_DEBUGGER_BRANCH_TYPE Type
+ IN UINT64 DestEntry,
+ IN EFI_DEBUGGER_BRANCH_TYPE Type
)
{
- UINTN Index;
+ UINTN Index;
if (mDebuggerPrivate.CallStackEntryCount < EFI_DEBUGGER_CALLSTACK_MAX) {
//
@@ -121,23 +124,25 @@ EbcDebuggerPushCallstackDest (
//
ASSERT (mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].Type == Type);
mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].DestAddress = DestEntry;
- mDebuggerPrivate.CallStackEntryCount ++;
+ mDebuggerPrivate.CallStackEntryCount++;
} else {
//
// If there is no empty entry for callstack, throw the oldest one
//
ASSERT (mDebuggerPrivate.CallStackEntry[EFI_DEBUGGER_TRACE_MAX].Type == Type);
for (Index = 0; Index < EFI_DEBUGGER_CALLSTACK_MAX; Index++) {
- CopyMem (&mDebuggerPrivate.CallStackEntry[Index],
- &mDebuggerPrivate.CallStackEntry[Index + 1],
- sizeof (mDebuggerPrivate.CallStackEntry[Index])
- );
+ CopyMem (
+ &mDebuggerPrivate.CallStackEntry[Index],
+ &mDebuggerPrivate.CallStackEntry[Index + 1],
+ sizeof (mDebuggerPrivate.CallStackEntry[Index])
+ );
}
+
mDebuggerPrivate.CallStackEntry[EFI_DEBUGGER_CALLSTACK_MAX - 1].DestAddress = DestEntry;
- mDebuggerPrivate.CallStackEntryCount = EFI_DEBUGGER_CALLSTACK_MAX;
+ mDebuggerPrivate.CallStackEntryCount = EFI_DEBUGGER_CALLSTACK_MAX;
}
- return ;
+ return;
}
/**
@@ -151,13 +156,14 @@ EbcDebuggerPopCallstack (
)
{
if ((mDebuggerPrivate.CallStackEntryCount > 0) &&
- (mDebuggerPrivate.CallStackEntryCount <= EFI_DEBUGGER_CALLSTACK_MAX)) {
+ (mDebuggerPrivate.CallStackEntryCount <= EFI_DEBUGGER_CALLSTACK_MAX))
+ {
//
// Throw the newest one
//
- mDebuggerPrivate.CallStackEntryCount --;
+ mDebuggerPrivate.CallStackEntryCount--;
mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].SourceAddress = 0;
- mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].DestAddress = 0;
+ mDebuggerPrivate.CallStackEntry[mDebuggerPrivate.CallStackEntryCount].DestAddress = 0;
} else if (mDebuggerPrivate.CallStackEntryCount == 0) {
//
// NOT assert here because it is reasonable, because when we start to build
@@ -167,7 +173,7 @@ EbcDebuggerPopCallstack (
ASSERT (FALSE);
}
- return ;
+ return;
}
/**
@@ -180,25 +186,26 @@ EbcDebuggerPopCallstack (
**/
VOID
EbcDebuggerPushTraceSourceEntry (
- IN UINT64 SourceEntry,
- IN EFI_DEBUGGER_BRANCH_TYPE Type
+ IN UINT64 SourceEntry,
+ IN EFI_DEBUGGER_BRANCH_TYPE Type
)
{
if (mDebuggerPrivate.TraceEntryCount > EFI_DEBUGGER_TRACE_MAX) {
ASSERT (FALSE);
mDebuggerPrivate.TraceEntryCount = EFI_DEBUGGER_TRACE_MAX;
}
+
//
// Record the new trace entry
//
mDebuggerPrivate.TraceEntry[mDebuggerPrivate.TraceEntryCount].SourceAddress = SourceEntry;
- mDebuggerPrivate.TraceEntry[mDebuggerPrivate.TraceEntryCount].Type = Type;
+ mDebuggerPrivate.TraceEntry[mDebuggerPrivate.TraceEntryCount].Type = Type;
//
// Do not change TraceEntryCount
//
- return ;
+ return;
}
/**
@@ -211,11 +218,11 @@ EbcDebuggerPushTraceSourceEntry (
**/
VOID
EbcDebuggerPushTraceDestEntry (
- IN UINT64 DestEntry,
- IN EFI_DEBUGGER_BRANCH_TYPE Type
+ IN UINT64 DestEntry,
+ IN EFI_DEBUGGER_BRANCH_TYPE Type
)
{
- UINTN Index;
+ UINTN Index;
if (mDebuggerPrivate.TraceEntryCount < EFI_DEBUGGER_TRACE_MAX) {
//
@@ -223,7 +230,7 @@ EbcDebuggerPushTraceDestEntry (
//
ASSERT (mDebuggerPrivate.TraceEntry[mDebuggerPrivate.TraceEntryCount].Type == Type);
mDebuggerPrivate.TraceEntry[mDebuggerPrivate.TraceEntryCount].DestAddress = DestEntry;
- mDebuggerPrivate.TraceEntryCount ++;
+ mDebuggerPrivate.TraceEntryCount++;
} else {
//
// If there is no empty entry for trace, throw the oldest one
@@ -236,11 +243,12 @@ EbcDebuggerPushTraceDestEntry (
sizeof (mDebuggerPrivate.TraceEntry[Index])
);
}
+
mDebuggerPrivate.TraceEntry[EFI_DEBUGGER_CALLSTACK_MAX - 1].DestAddress = DestEntry;
- mDebuggerPrivate.TraceEntryCount = EFI_DEBUGGER_TRACE_MAX;
+ mDebuggerPrivate.TraceEntryCount = EFI_DEBUGGER_TRACE_MAX;
}
- return ;
+ return;
}
/**
@@ -254,32 +262,34 @@ EbcDebuggerPushTraceDestEntry (
**/
VOID
EbcDebuggerPushStepEntry (
- IN UINT64 Entry,
- IN UINT64 FramePtr,
- IN UINT32 Flag
+ IN UINT64 Entry,
+ IN UINT64 FramePtr,
+ IN UINT32 Flag
)
{
//
// Check StepOver
//
if ((Flag == EFI_DEBUG_FLAG_EBC_STEPOVER) &&
- ((mDebuggerPrivate.FeatureFlags & EFI_DEBUG_FLAG_EBC_STEPOVER) == EFI_DEBUG_FLAG_EBC_STEPOVER)) {
+ ((mDebuggerPrivate.FeatureFlags & EFI_DEBUG_FLAG_EBC_STEPOVER) == EFI_DEBUG_FLAG_EBC_STEPOVER))
+ {
mDebuggerPrivate.StepContext.BreakAddress = Entry;
mDebuggerPrivate.StepContext.FramePointer = FramePtr;
- mDebuggerPrivate.FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_STEPOVER;
+ mDebuggerPrivate.FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_STEPOVER;
}
+
//
// Check StepOut
//
if ((Flag == EFI_DEBUG_FLAG_EBC_STEPOUT) &&
- ((mDebuggerPrivate.FeatureFlags & EFI_DEBUG_FLAG_EBC_STEPOUT) == EFI_DEBUG_FLAG_EBC_STEPOUT)) {
+ ((mDebuggerPrivate.FeatureFlags & EFI_DEBUG_FLAG_EBC_STEPOUT) == EFI_DEBUG_FLAG_EBC_STEPOUT))
+ {
mDebuggerPrivate.StepContext.BreakAddress = Entry;
mDebuggerPrivate.StepContext.FramePointer = FramePtr;
- mDebuggerPrivate.FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_STEPOUT;
+ mDebuggerPrivate.FeatureFlags &= ~EFI_DEBUG_FLAG_EBC_B_STEPOUT;
}
}
-
/**
Notify the callback function when an event is triggered.
@@ -290,14 +300,14 @@ EbcDebuggerPushStepEntry (
VOID
EFIAPI
EbcDebuggerBreakEventFunc (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
EFI_STATUS Status;
if ((mDebuggerPrivate.FeatureFlags & EFI_DEBUG_FLAG_EBC_BOK) != EFI_DEBUG_FLAG_EBC_BOK) {
- return ;
+ return;
}
Status = gBS->CheckEvent (gST->ConIn->WaitForKey);
@@ -321,44 +331,43 @@ EbcDebuggerHookInit (
IN EFI_DEBUG_SUPPORT_PROTOCOL *EbcDebugProtocol
)
{
- EFI_STATUS Status;
- UINTN Index;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
-
+ EFI_STATUS Status;
+ UINTN Index;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
//
// Register all exception handler
//
for (Index = EXCEPT_EBC_UNDEFINED; Index <= EXCEPT_EBC_STEP; Index++) {
EbcDebugProtocol->RegisterExceptionCallback (
- EbcDebugProtocol,
- 0,
- NULL,
- Index
- );
+ EbcDebugProtocol,
+ 0,
+ NULL,
+ Index
+ );
EbcDebugProtocol->RegisterExceptionCallback (
- EbcDebugProtocol,
- 0,
- EdbExceptionHandler,
- Index
- );
+ EbcDebugProtocol,
+ 0,
+ EdbExceptionHandler,
+ Index
+ );
}
//
// Init Symbol
//
- Object = AllocateZeroPool (sizeof(EFI_DEBUGGER_SYMBOL_OBJECT) * EFI_DEBUGGER_SYMBOL_OBJECT_MAX);
+ Object = AllocateZeroPool (sizeof (EFI_DEBUGGER_SYMBOL_OBJECT) * EFI_DEBUGGER_SYMBOL_OBJECT_MAX);
ASSERT (Object != NULL);
- mDebuggerPrivate.DebuggerSymbolContext.Object = Object;
- mDebuggerPrivate.DebuggerSymbolContext.ObjectCount = 0;
+ mDebuggerPrivate.DebuggerSymbolContext.Object = Object;
+ mDebuggerPrivate.DebuggerSymbolContext.ObjectCount = 0;
mDebuggerPrivate.DebuggerSymbolContext.MaxObjectCount = EFI_DEBUGGER_SYMBOL_OBJECT_MAX;
for (Index = 0; Index < EFI_DEBUGGER_SYMBOL_OBJECT_MAX; Index++) {
- Entry = AllocateZeroPool (sizeof(EFI_DEBUGGER_SYMBOL_ENTRY) * EFI_DEBUGGER_SYMBOL_ENTRY_MAX);
+ Entry = AllocateZeroPool (sizeof (EFI_DEBUGGER_SYMBOL_ENTRY) * EFI_DEBUGGER_SYMBOL_ENTRY_MAX);
ASSERT (Entry != NULL);
- Object[Index].Entry = Entry;
+ Object[Index].Entry = Entry;
Object[Index].MaxEntryCount = EFI_DEBUGGER_SYMBOL_ENTRY_MAX;
- Object[Index].SourceBuffer = AllocateZeroPool (sizeof(VOID *) * (EFI_DEBUGGER_SYMBOL_ENTRY_MAX + 1));
+ Object[Index].SourceBuffer = AllocateZeroPool (sizeof (VOID *) * (EFI_DEBUGGER_SYMBOL_ENTRY_MAX + 1));
ASSERT (Object[Index].SourceBuffer != NULL);
}
@@ -368,7 +377,7 @@ EbcDebuggerHookInit (
Status = gBS->LocateProtocol (
&gEfiPciRootBridgeIoProtocolGuid,
NULL,
- (VOID**) &mDebuggerPrivate.PciRootBridgeIo
+ (VOID **)&mDebuggerPrivate.PciRootBridgeIo
);
//
@@ -376,7 +385,7 @@ EbcDebuggerHookInit (
//
Status = EfiGetSystemConfigurationTable (
&gEfiDebugImageInfoTableGuid,
- (VOID**) &mDebuggerPrivate.DebugImageInfoTableHeader
+ (VOID **)&mDebuggerPrivate.DebugImageInfoTableHeader
);
//
@@ -408,7 +417,7 @@ EbcDebuggerHookInit (
);
}
- return ;
+ return;
}
/**
@@ -422,9 +431,9 @@ EbcDebuggerHookUnload (
VOID
)
{
- UINTN Index;
- UINTN SubIndex;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ UINTN Index;
+ UINTN SubIndex;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
//
// Close the break event
@@ -442,7 +451,7 @@ EbcDebuggerHookUnload (
// Clean up Entry
//
gBS->FreePool (Object[Index].Entry);
- Object[Index].Entry = NULL;
+ Object[Index].Entry = NULL;
Object[Index].EntryCount = 0;
//
// Clean up source buffer
@@ -451,6 +460,7 @@ EbcDebuggerHookUnload (
gBS->FreePool (Object[Index].SourceBuffer[SubIndex]);
Object[Index].SourceBuffer[SubIndex] = NULL;
}
+
gBS->FreePool (Object[Index].SourceBuffer);
Object[Index].SourceBuffer = NULL;
}
@@ -459,13 +469,13 @@ EbcDebuggerHookUnload (
// Clean up Object
//
gBS->FreePool (Object);
- mDebuggerPrivate.DebuggerSymbolContext.Object = NULL;
+ mDebuggerPrivate.DebuggerSymbolContext.Object = NULL;
mDebuggerPrivate.DebuggerSymbolContext.ObjectCount = 0;
//
// Done
//
- return ;
+ return;
}
/**
@@ -478,10 +488,10 @@ EbcDebuggerHookUnload (
**/
VOID
EbcDebuggerHookEbcUnloadImage (
- IN EFI_HANDLE Handle
+ IN EFI_HANDLE Handle
)
{
- return ;
+ return;
}
/**
@@ -496,14 +506,14 @@ EbcDebuggerHookEbcUnloadImage (
**/
VOID
EbcDebuggerHookExecuteEbcImageEntryPoint (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerPushCallstackSource ((UINT64)(UINTN)-1, EfiDebuggerBranchTypeEbcCall);
EbcDebuggerPushCallstackParameter ((UINT64)(UINTN)VmPtr->Gpr[0], EfiDebuggerBranchTypeEbcCall);
EbcDebuggerPushCallstackDest ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCall);
EbcDebuggerCheckHookFlag (VmPtr, EFI_DEBUG_FLAG_EBC_BOE);
- return ;
+ return;
}
/**
@@ -517,14 +527,14 @@ EbcDebuggerHookExecuteEbcImageEntryPoint (
**/
VOID
EbcDebuggerHookEbcInterpret (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerPushCallstackSource ((UINT64)(UINTN)-2, EfiDebuggerBranchTypeEbcCall);
EbcDebuggerPushCallstackParameter ((UINT64)(UINTN)VmPtr->Gpr[0], EfiDebuggerBranchTypeEbcCall);
EbcDebuggerPushCallstackDest ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCall);
EbcDebuggerCheckHookFlag (VmPtr, EFI_DEBUG_FLAG_EBC_BOT);
- return ;
+ return;
}
/**
@@ -537,16 +547,16 @@ EbcDebuggerHookEbcInterpret (
**/
VOID
EbcDebuggerHookExecuteStart (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
- EFI_TPL CurrentTpl;
+ EFI_TPL CurrentTpl;
//
// Check Ip for GoTil
//
if (mDebuggerPrivate.GoTilContext.BreakAddress == (UINT64)(UINTN)VmPtr->Ip) {
- mDebuggerPrivate.StatusFlags = EFI_DEBUG_FLAG_EBC_GT;
+ mDebuggerPrivate.StatusFlags = EFI_DEBUG_FLAG_EBC_GT;
mDebuggerPrivate.GoTilContext.BreakAddress = 0;
EbcDebugSignalException (
EXCEPT_EBC_BREAKPOINT,
@@ -554,14 +564,16 @@ EbcDebuggerHookExecuteStart (
VmPtr
);
mDebuggerPrivate.StatusFlags &= ~EFI_DEBUG_FLAG_EBC_B_GT;
- return ;
+ return;
}
+
//
// Check ReturnAddress for StepOver
//
if ((mDebuggerPrivate.StepContext.BreakAddress == (UINT64)(UINTN)VmPtr->Ip) &&
- (mDebuggerPrivate.StepContext.FramePointer == (UINT64)(UINTN)VmPtr->FramePtr)) {
- mDebuggerPrivate.StatusFlags = EFI_DEBUG_FLAG_EBC_STEPOVER;
+ (mDebuggerPrivate.StepContext.FramePointer == (UINT64)(UINTN)VmPtr->FramePtr))
+ {
+ mDebuggerPrivate.StatusFlags = EFI_DEBUG_FLAG_EBC_STEPOVER;
mDebuggerPrivate.StepContext.BreakAddress = 0;
mDebuggerPrivate.StepContext.FramePointer = 0;
EbcDebugSignalException (
@@ -571,11 +583,12 @@ EbcDebuggerHookExecuteStart (
);
mDebuggerPrivate.StatusFlags &= ~EFI_DEBUG_FLAG_EBC_B_STEPOVER;
}
+
//
// Check FramePtr for StepOut
//
if (mDebuggerPrivate.StepContext.BreakAddress == (UINT64)(UINTN)VmPtr->FramePtr) {
- mDebuggerPrivate.StatusFlags = EFI_DEBUG_FLAG_EBC_STEPOUT;
+ mDebuggerPrivate.StatusFlags = EFI_DEBUG_FLAG_EBC_STEPOUT;
mDebuggerPrivate.StepContext.BreakAddress = 0;
mDebuggerPrivate.StepContext.FramePointer = 0;
EbcDebugSignalException (
@@ -585,6 +598,7 @@ EbcDebuggerHookExecuteStart (
);
mDebuggerPrivate.StatusFlags &= ~EFI_DEBUG_FLAG_EBC_B_STEPOUT;
}
+
//
// Check Flags for BreakOnKey
//
@@ -603,7 +617,8 @@ EbcDebuggerHookExecuteStart (
mDebuggerPrivate.StatusFlags &= ~EFI_DEBUG_FLAG_EBC_B_BOK;
}
}
- return ;
+
+ return;
}
/**
@@ -616,7 +631,7 @@ EbcDebuggerHookExecuteStart (
**/
VOID
EbcDebuggerHookExecuteEnd (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
UINTN Address;
@@ -624,10 +639,10 @@ EbcDebuggerHookExecuteEnd (
//
// Use FramePtr as checkpoint for StepOut
//
- CopyMem (&Address, (VOID *)((UINTN)VmPtr->FramePtr), sizeof(Address));
+ CopyMem (&Address, (VOID *)((UINTN)VmPtr->FramePtr), sizeof (Address));
EbcDebuggerPushStepEntry (Address, (UINT64)(UINTN)VmPtr->FramePtr, EFI_DEBUG_FLAG_EBC_STEPOUT);
- return ;
+ return;
}
/**
@@ -641,14 +656,14 @@ EbcDebuggerHookExecuteEnd (
**/
VOID
EbcDebuggerHookCALLStart (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerCheckHookFlag (VmPtr, EFI_DEBUG_FLAG_EBC_BOC);
EbcDebuggerPushCallstackSource ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCall);
EbcDebuggerPushCallstackParameter ((UINT64)(UINTN)VmPtr->Gpr[0], EfiDebuggerBranchTypeEbcCall);
EbcDebuggerPushTraceSourceEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCall);
- return ;
+ return;
}
/**
@@ -662,7 +677,7 @@ EbcDebuggerHookCALLStart (
**/
VOID
EbcDebuggerHookCALLEnd (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
UINT64 Address;
@@ -674,22 +689,22 @@ EbcDebuggerHookCALLEnd (
//
// Get Old FramePtr
//
- CopyMem (&FramePtr, (VOID *)((UINTN)VmPtr->FramePtr), sizeof(FramePtr));
+ CopyMem (&FramePtr, (VOID *)((UINTN)VmPtr->FramePtr), sizeof (FramePtr));
//
// Use ReturnAddress as checkpoint for StepOver
//
- CopyMem (&Address, (VOID *)(UINTN)VmPtr->Gpr[0], sizeof(Address));
+ CopyMem (&Address, (VOID *)(UINTN)VmPtr->Gpr[0], sizeof (Address));
EbcDebuggerPushStepEntry (Address, FramePtr, EFI_DEBUG_FLAG_EBC_STEPOVER);
//
// Use FramePtr as checkpoint for StepOut
//
Address = 0;
- CopyMem (&Address, (VOID *)(FramePtr), sizeof(UINTN));
+ CopyMem (&Address, (VOID *)(FramePtr), sizeof (UINTN));
EbcDebuggerPushStepEntry (Address, FramePtr, EFI_DEBUG_FLAG_EBC_STEPOUT);
- return ;
+ return;
}
/**
@@ -703,14 +718,14 @@ EbcDebuggerHookCALLEnd (
**/
VOID
EbcDebuggerHookCALLEXStart (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerCheckHookFlag (VmPtr, EFI_DEBUG_FLAG_EBC_BOCX);
-// EbcDebuggerPushCallstackSource ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCallEx);
-// EbcDebuggerPushCallstackParameter ((UINT64)(UINTN)VmPtr->R[0], EfiDebuggerBranchTypeEbcCallEx);
+ // EbcDebuggerPushCallstackSource ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCallEx);
+ // EbcDebuggerPushCallstackParameter ((UINT64)(UINTN)VmPtr->R[0], EfiDebuggerBranchTypeEbcCallEx);
EbcDebuggerPushTraceSourceEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCallEx);
- return ;
+ return;
}
/**
@@ -723,12 +738,12 @@ EbcDebuggerHookCALLEXStart (
**/
VOID
EbcDebuggerHookCALLEXEnd (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
-// EbcDebuggerPushCallstackDest ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCallEx);
+ // EbcDebuggerPushCallstackDest ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCallEx);
EbcDebuggerPushTraceDestEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcCallEx);
- return ;
+ return;
}
/**
@@ -742,13 +757,13 @@ EbcDebuggerHookCALLEXEnd (
**/
VOID
EbcDebuggerHookRETStart (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerCheckHookFlag (VmPtr, EFI_DEBUG_FLAG_EBC_BOR);
EbcDebuggerPopCallstack ();
EbcDebuggerPushTraceSourceEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcRet);
- return ;
+ return;
}
/**
@@ -761,11 +776,11 @@ EbcDebuggerHookRETStart (
**/
VOID
EbcDebuggerHookRETEnd (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerPushTraceDestEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcRet);
- return ;
+ return;
}
/**
@@ -778,11 +793,11 @@ EbcDebuggerHookRETEnd (
**/
VOID
EbcDebuggerHookJMPStart (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerPushTraceSourceEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcJmp);
- return ;
+ return;
}
/**
@@ -795,11 +810,11 @@ EbcDebuggerHookJMPStart (
**/
VOID
EbcDebuggerHookJMPEnd (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerPushTraceDestEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcJmp);
- return ;
+ return;
}
/**
@@ -812,11 +827,11 @@ EbcDebuggerHookJMPEnd (
**/
VOID
EbcDebuggerHookJMP8Start (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerPushTraceSourceEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcJmp8);
- return ;
+ return;
}
/**
@@ -829,9 +844,9 @@ EbcDebuggerHookJMP8Start (
**/
VOID
EbcDebuggerHookJMP8End (
- IN VM_CONTEXT *VmPtr
+ IN VM_CONTEXT *VmPtr
)
{
EbcDebuggerPushTraceDestEntry ((UINT64)(UINTN)VmPtr->Ip, EfiDebuggerBranchTypeEbcJmp8);
- return ;
+ return;
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupport.h b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupport.h
index ba8b936b3a..43f750440f 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupport.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupport.h
@@ -17,7 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define EFI_DEBUGGER_LINE_NUMBER_IN_PAGE 0x10
-#define EFI_DEBUG_MAX_PRINT_BUFFER (80 * 4)
+#define EFI_DEBUG_MAX_PRINT_BUFFER (80 * 4)
/**
@@ -99,8 +99,8 @@ AsciiAtoi (
INTN
EFIAPI
StrCmpUnicodeAndAscii (
- IN CHAR16 *String,
- IN CHAR8 *String2
+ IN CHAR16 *String,
+ IN CHAR8 *String2
);
/**
@@ -118,8 +118,8 @@ StrCmpUnicodeAndAscii (
INTN
EFIAPI
StriCmp (
- IN CHAR16 *String,
- IN CHAR16 *String2
+ IN CHAR16 *String,
+ IN CHAR16 *String2
);
/**
@@ -137,8 +137,8 @@ StriCmp (
INTN
EFIAPI
StriCmpUnicodeAndAscii (
- IN CHAR16 *String,
- IN CHAR8 *String2
+ IN CHAR16 *String,
+ IN CHAR8 *String2
);
/**
@@ -152,8 +152,8 @@ StriCmpUnicodeAndAscii (
BOOLEAN
EFIAPI
StrEndWith (
- IN CHAR16 *Str,
- IN CHAR16 *SubStr
+ IN CHAR16 *Str,
+ IN CHAR16 *SubStr
);
/**
@@ -165,7 +165,7 @@ StrEndWith (
CHAR16 *
EFIAPI
StrDuplicate (
- IN CHAR16 *Src
+ IN CHAR16 *Src
);
/**
@@ -179,8 +179,8 @@ StrDuplicate (
CHAR16 *
EFIAPI
StrGetNewTokenLine (
- IN CHAR16 *String,
- IN CHAR16 *CharSet
+ IN CHAR16 *String,
+ IN CHAR16 *CharSet
);
/**
@@ -193,7 +193,7 @@ StrGetNewTokenLine (
CHAR16 *
EFIAPI
StrGetNextTokenLine (
- IN CHAR16 *CharSet
+ IN CHAR16 *CharSet
);
/**
@@ -207,8 +207,8 @@ StrGetNextTokenLine (
CHAR16 *
EFIAPI
StrGetNewTokenField (
- IN CHAR16 *String,
- IN CHAR16 *CharSet
+ IN CHAR16 *String,
+ IN CHAR16 *CharSet
);
/**
@@ -221,7 +221,7 @@ StrGetNewTokenField (
CHAR16 *
EFIAPI
StrGetNextTokenField (
- IN CHAR16 *CharSet
+ IN CHAR16 *CharSet
);
/**
@@ -235,8 +235,8 @@ StrGetNextTokenField (
VOID
EFIAPI
PatchForStrTokenAfter (
- IN CHAR16 *Buffer,
- IN CHAR16 Patch
+ IN CHAR16 *Buffer,
+ IN CHAR16 Patch
);
/**
@@ -249,8 +249,8 @@ PatchForStrTokenAfter (
VOID
EFIAPI
PatchForStrTokenBefore (
- IN CHAR16 *Buffer,
- IN CHAR16 Patch
+ IN CHAR16 *Buffer,
+ IN CHAR16 Patch
);
/**
@@ -264,8 +264,8 @@ PatchForStrTokenBefore (
CHAR8 *
EFIAPI
AsciiStrGetNewTokenLine (
- IN CHAR8 *String,
- IN CHAR8 *CharSet
+ IN CHAR8 *String,
+ IN CHAR8 *CharSet
);
/**
@@ -278,7 +278,7 @@ AsciiStrGetNewTokenLine (
CHAR8 *
EFIAPI
AsciiStrGetNextTokenLine (
- IN CHAR8 *CharSet
+ IN CHAR8 *CharSet
);
/**
@@ -292,8 +292,8 @@ AsciiStrGetNextTokenLine (
CHAR8 *
EFIAPI
AsciiStrGetNewTokenField (
- IN CHAR8 *String,
- IN CHAR8 *CharSet
+ IN CHAR8 *String,
+ IN CHAR8 *CharSet
);
/**
@@ -306,7 +306,7 @@ AsciiStrGetNewTokenField (
CHAR8 *
EFIAPI
AsciiStrGetNextTokenField (
- IN CHAR8 *CharSet
+ IN CHAR8 *CharSet
);
/**
@@ -320,8 +320,8 @@ AsciiStrGetNextTokenField (
VOID
EFIAPI
PatchForAsciiStrTokenAfter (
- IN CHAR8 *Buffer,
- IN CHAR8 Patch
+ IN CHAR8 *Buffer,
+ IN CHAR8 Patch
);
/**
@@ -334,8 +334,8 @@ PatchForAsciiStrTokenAfter (
VOID
EFIAPI
PatchForAsciiStrTokenBefore (
- IN CHAR8 *Buffer,
- IN CHAR8 Patch
+ IN CHAR8 *Buffer,
+ IN CHAR8 Patch
);
/**
@@ -351,9 +351,9 @@ PatchForAsciiStrTokenBefore (
VOID
EFIAPI
Input (
- IN CHAR16 *Prompt OPTIONAL,
- OUT CHAR16 *InStr,
- IN UINTN StrLen
+ IN CHAR16 *Prompt OPTIONAL,
+ OUT CHAR16 *InStr,
+ IN UINTN StrLen
);
/**
@@ -446,11 +446,11 @@ EDBSPrintWithOffset (
EFI_STATUS
EFIAPI
ReadFileToBuffer (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName,
- OUT UINTN *BufferSize,
- OUT VOID **Buffer,
- IN BOOLEAN ScanFs
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName,
+ OUT UINTN *BufferSize,
+ OUT VOID **Buffer,
+ IN BOOLEAN ScanFs
);
/**
@@ -468,10 +468,10 @@ ReadFileToBuffer (
CHAR16 *
EFIAPI
GetFileNameUnderDir (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *DirName,
- IN CHAR16 *FileName,
- IN OUT UINTN *Index
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *DirName,
+ IN CHAR16 *FileName,
+ IN OUT UINTN *Index
);
#endif
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportFile.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportFile.c
index ee2f8fc2f2..cef5141423 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportFile.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportFile.c
@@ -23,19 +23,19 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
ReadFileFromVol (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol,
- IN CHAR16 *FileName,
- OUT UINTN *BufferSize,
- OUT VOID **Buffer
+ IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol,
+ IN CHAR16 *FileName,
+ OUT UINTN *BufferSize,
+ OUT VOID **Buffer
)
{
- EFI_STATUS Status;
- EFI_FILE_HANDLE RootDir;
- EFI_FILE_HANDLE Handle;
- UINTN FileInfoSize;
- EFI_FILE_INFO *FileInfo;
- UINTN TempBufferSize;
- VOID *TempBuffer;
+ EFI_STATUS Status;
+ EFI_FILE_HANDLE RootDir;
+ EFI_FILE_HANDLE Handle;
+ UINTN FileInfoSize;
+ EFI_FILE_INFO *FileInfo;
+ UINTN TempBufferSize;
+ VOID *TempBuffer;
//
// Open the root directory
@@ -65,7 +65,7 @@ ReadFileFromVol (
//
// Get the file information
//
- FileInfoSize = sizeof(EFI_FILE_INFO) + 1024;
+ FileInfoSize = sizeof (EFI_FILE_INFO) + 1024;
FileInfo = AllocateZeroPool (FileInfoSize);
if (FileInfo == NULL) {
@@ -88,8 +88,8 @@ ReadFileFromVol (
//
// Allocate buffer for the file data. The last CHAR16 is for L'\0'
//
- TempBufferSize = (UINTN) FileInfo->FileSize + sizeof(CHAR16);
- TempBuffer = AllocateZeroPool (TempBufferSize);
+ TempBufferSize = (UINTN)FileInfo->FileSize + sizeof (CHAR16);
+ TempBuffer = AllocateZeroPool (TempBufferSize);
if (TempBuffer == NULL) {
Handle->Close (Handle);
gBS->FreePool (FileInfo);
@@ -141,20 +141,20 @@ ReadFileFromVol (
EFI_STATUS
EFIAPI
ReadFileToBuffer (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName,
- OUT UINTN *BufferSize,
- OUT VOID **Buffer,
- IN BOOLEAN ScanFs
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName,
+ OUT UINTN *BufferSize,
+ OUT VOID **Buffer,
+ IN BOOLEAN ScanFs
)
{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
- UINTN TempBufferSize;
- VOID *TempBuffer;
- UINTN NoHandles;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
+ EFI_STATUS Status;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
+ UINTN TempBufferSize;
+ VOID *TempBuffer;
+ UINTN NoHandles;
+ EFI_HANDLE *HandleBuffer;
+ UINTN Index;
//
// Check parameters
@@ -170,6 +170,7 @@ ReadFileToBuffer (
if (DebuggerPrivate->Vol == NULL) {
return EFI_INVALID_PARAMETER;
}
+
//
// Read file directly from Vol
//
@@ -184,12 +185,12 @@ ReadFileToBuffer (
// Get all Vol handle
//
Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &NoHandles,
- &HandleBuffer
- );
+ ByProtocol,
+ &gEfiSimpleFileSystemProtocolGuid,
+ NULL,
+ &NoHandles,
+ &HandleBuffer
+ );
if (EFI_ERROR (Status) && (NoHandles == 0)) {
return EFI_NOT_FOUND;
}
@@ -198,15 +199,15 @@ ReadFileToBuffer (
// Walk through each Vol
//
DebuggerPrivate->Vol = NULL;
- *BufferSize = 0;
- *Buffer = NULL;
+ *BufferSize = 0;
+ *Buffer = NULL;
for (Index = 0; Index < NoHandles; Index++) {
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiSimpleFileSystemProtocolGuid,
- (VOID**) &Vol
+ (VOID **)&Vol
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
continue;
}
@@ -228,8 +229,8 @@ ReadFileToBuffer (
// Record value
//
DebuggerPrivate->Vol = Vol;
- *BufferSize = TempBufferSize;
- *Buffer = TempBuffer;
+ *BufferSize = TempBufferSize;
+ *Buffer = TempBuffer;
}
}
}
@@ -262,31 +263,32 @@ ReadFileToBuffer (
CHAR16 *
EFIAPI
GetFileNameUnderDir (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *DirName,
- IN CHAR16 *FileName,
- IN OUT UINTN *Index
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *DirName,
+ IN CHAR16 *FileName,
+ IN OUT UINTN *Index
)
{
- EFI_STATUS Status;
- EFI_FILE_HANDLE RootDir;
- EFI_FILE_HANDLE Handle;
- UINTN FileInfoSize;
- EFI_FILE_INFO *FileInfo;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
- VOID *TempName;
- UINTN FileIndex;
+ EFI_STATUS Status;
+ EFI_FILE_HANDLE RootDir;
+ EFI_FILE_HANDLE Handle;
+ UINTN FileInfoSize;
+ EFI_FILE_INFO *FileInfo;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
+ VOID *TempName;
+ UINTN FileIndex;
if (DebuggerPrivate->Vol == NULL) {
Status = gBS->LocateProtocol (
&gEfiSimpleFileSystemProtocolGuid,
NULL,
- (VOID**) &DebuggerPrivate->Vol
+ (VOID **)&DebuggerPrivate->Vol
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return NULL;
}
}
+
Vol = DebuggerPrivate->Vol;
//
@@ -311,6 +313,7 @@ GetFileNameUnderDir (
RootDir->Close (RootDir);
return NULL;
}
+
RootDir->Close (RootDir);
//
@@ -325,7 +328,7 @@ GetFileNameUnderDir (
//
// Get the file information
//
- FileInfoSize = sizeof(EFI_FILE_INFO) + 1024;
+ FileInfoSize = sizeof (EFI_FILE_INFO) + 1024;
FileInfo = AllocateZeroPool (FileInfoSize);
if (FileInfo == NULL) {
@@ -337,12 +340,12 @@ GetFileNameUnderDir (
// Walk through each file in the directory
//
FileIndex = 0;
- TempName = NULL;
+ TempName = NULL;
while (TRUE) {
//
// Read a file entry
//
- FileInfoSize = sizeof(EFI_FILE_INFO) + 1024;
+ FileInfoSize = sizeof (EFI_FILE_INFO) + 1024;
Status = Handle->Read (
Handle,
@@ -367,10 +370,11 @@ GetFileNameUnderDir (
if (FileIndex == *Index) {
TempName = StrDuplicate (FileInfo->FileName);
- *Index = *Index + 1;
+ *Index = *Index + 1;
break;
}
- FileIndex ++;
+
+ FileIndex++;
}
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
index 9679a23002..e450e57662 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportString.c
@@ -27,38 +27,41 @@ Xtoi (
ASSERT (Str != NULL);
- MaxVal = (UINTN) -1 >> 4;
+ MaxVal = (UINTN)-1 >> 4;
//
// skip preceeding white space
//
while (*Str != '\0' && *Str == ' ') {
Str += 1;
}
+
//
// skip preceeding zeros
//
while (*Str != '\0' && *Str == '0') {
Str += 1;
}
+
//
// skip preceeding white space
//
- if (*Str != '\0' && (*Str == 'x' || *Str == 'X')) {
+ if ((*Str != '\0') && ((*Str == 'x') || (*Str == 'X'))) {
Str += 1;
}
+
//
// convert hex digits
//
- RetVal = 0;
+ RetVal = 0;
TempChar = *(Str++);
while (TempChar != '\0') {
- if (TempChar >= 'a' && TempChar <= 'f') {
+ if ((TempChar >= 'a') && (TempChar <= 'f')) {
TempChar -= 'a' - 'A';
}
- if ((TempChar >= '0' && TempChar <= '9') || (TempChar >= 'A' && TempChar <= 'F')) {
+ if (((TempChar >= '0') && (TempChar <= '9')) || ((TempChar >= 'A') && (TempChar <= 'F'))) {
if (RetVal > MaxVal) {
- return (UINTN) -1;
+ return (UINTN)-1;
}
RetVal = (RetVal << 4) | (TempChar - (TempChar >= 'A' ? 'A' - 10 : '0'));
@@ -91,38 +94,41 @@ LXtoi (
ASSERT (Str != NULL);
- MaxVal = RShiftU64 ((UINT64) -1, 4);
+ MaxVal = RShiftU64 ((UINT64)-1, 4);
//
// skip preceeding white space
//
while (*Str != '\0' && *Str == ' ') {
Str += 1;
}
+
//
// skip preceeding zeros
//
while (*Str != '\0' && *Str == '0') {
Str += 1;
}
+
//
// skip preceeding white space
//
- if (*Str != '\0' && (*Str == 'x' || *Str == 'X')) {
+ if ((*Str != '\0') && ((*Str == 'x') || (*Str == 'X'))) {
Str += 1;
}
+
//
// convert hex digits
//
- RetVal = 0;
+ RetVal = 0;
TempChar = *(Str++);
while (TempChar != '\0') {
- if (TempChar >= 'a' && TempChar <= 'f') {
+ if ((TempChar >= 'a') && (TempChar <= 'f')) {
TempChar -= 'a' - 'A';
}
- if ((TempChar >= '0' && TempChar <= '9') || (TempChar >= 'A' && TempChar <= 'F')) {
+ if (((TempChar >= '0') && (TempChar <= '9')) || ((TempChar >= 'A') && (TempChar <= 'F'))) {
if (RetVal > MaxVal) {
- return (UINT64) -1;
+ return (UINT64)-1;
}
RetVal = LShiftU64 (RetVal, 4);
@@ -157,23 +163,24 @@ Atoi (
ASSERT (Str != NULL);
- MaxVal = (UINTN) -1 / 10;
- ResteVal = (UINTN) -1 % 10;
+ MaxVal = (UINTN)-1 / 10;
+ ResteVal = (UINTN)-1 % 10;
//
// skip preceeding white space
//
while (*Str != '\0' && *Str == ' ') {
Str += 1;
}
+
//
// convert digits
//
- RetVal = 0;
+ RetVal = 0;
TempChar = *(Str++);
while (TempChar != '\0') {
- if (TempChar >= '0' && TempChar <= '9') {
- if (RetVal > MaxVal || (RetVal == MaxVal && TempChar - '0' > (INTN) ResteVal)) {
- return (UINTN) -1;
+ if ((TempChar >= '0') && (TempChar <= '9')) {
+ if ((RetVal > MaxVal) || ((RetVal == MaxVal) && (TempChar - '0' > (INTN)ResteVal))) {
+ return (UINTN)-1;
}
RetVal = (RetVal * 10) + TempChar - '0';
@@ -200,44 +207,47 @@ AsciiXtoi (
CHAR8 *Str
)
{
- UINTN RetVal;
- CHAR8 TempChar;
- UINTN MaxVal;
+ UINTN RetVal;
+ CHAR8 TempChar;
+ UINTN MaxVal;
ASSERT (Str != NULL);
- MaxVal = (UINTN) -1 >> 4;
+ MaxVal = (UINTN)-1 >> 4;
//
// skip preceeding white space
//
while (*Str != '\0' && *Str == ' ') {
Str += 1;
}
+
//
// skip preceeding zeros
//
while (*Str != '\0' && *Str == '0') {
Str += 1;
}
+
//
// skip preceeding white space
//
- if (*Str != '\0' && (*Str == 'x' || *Str == 'X')) {
+ if ((*Str != '\0') && ((*Str == 'x') || (*Str == 'X'))) {
Str += 1;
}
+
//
// convert hex digits
//
- RetVal = 0;
+ RetVal = 0;
TempChar = *(Str++);
while (TempChar != '\0') {
- if (TempChar >= 'a' && TempChar <= 'f') {
+ if ((TempChar >= 'a') && (TempChar <= 'f')) {
TempChar -= 'a' - 'A';
}
- if ((TempChar >= '0' && TempChar <= '9') || (TempChar >= 'A' && TempChar <= 'F')) {
+ if (((TempChar >= '0') && (TempChar <= '9')) || ((TempChar >= 'A') && (TempChar <= 'F'))) {
if (RetVal > MaxVal) {
- return (UINTN) -1;
+ return (UINTN)-1;
}
RetVal = (RetVal << 4) | (TempChar - (TempChar >= 'A' ? 'A' - 10 : '0'));
@@ -264,30 +274,31 @@ AsciiAtoi (
CHAR8 *Str
)
{
- UINTN RetVal;
- CHAR8 TempChar;
- UINTN MaxVal;
- UINTN ResteVal;
+ UINTN RetVal;
+ CHAR8 TempChar;
+ UINTN MaxVal;
+ UINTN ResteVal;
ASSERT (Str != NULL);
- MaxVal = (UINTN) -1 / 10;
- ResteVal = (UINTN) -1 % 10;
+ MaxVal = (UINTN)-1 / 10;
+ ResteVal = (UINTN)-1 % 10;
//
// skip preceeding white space
//
while (*Str != '\0' && *Str == ' ') {
Str += 1;
}
+
//
// convert digits
//
- RetVal = 0;
+ RetVal = 0;
TempChar = *(Str++);
while (TempChar != '\0') {
- if (TempChar >= '0' && TempChar <= '9') {
- if (RetVal > MaxVal || (RetVal == MaxVal && TempChar - '0' > (INTN) ResteVal)) {
- return (UINTN) -1;
+ if ((TempChar >= '0') && (TempChar <= '9')) {
+ if ((RetVal > MaxVal) || ((RetVal == MaxVal) && (TempChar - '0' > (INTN)ResteVal))) {
+ return (UINTN)-1;
}
RetVal = (RetVal * 10) + TempChar - '0';
@@ -301,7 +312,6 @@ AsciiAtoi (
return RetVal;
}
-
/**
Compare the Unicode and Ascii string pointed by String to the string pointed by String2.
@@ -317,8 +327,8 @@ AsciiAtoi (
INTN
EFIAPI
StrCmpUnicodeAndAscii (
- IN CHAR16 *String,
- IN CHAR8 *String2
+ IN CHAR16 *String,
+ IN CHAR8 *String2
)
{
while (*String != '\0') {
@@ -326,7 +336,7 @@ StrCmpUnicodeAndAscii (
break;
}
- String += 1;
+ String += 1;
String2 += 1;
}
@@ -348,12 +358,13 @@ StrCmpUnicodeAndAscii (
INTN
EFIAPI
StriCmp (
- IN CHAR16 *String,
- IN CHAR16 *String2
+ IN CHAR16 *String,
+ IN CHAR16 *String2
)
{
while ((*String != L'\0') &&
- (CharToUpper (*String) == CharToUpper (*String2))) {
+ (CharToUpper (*String) == CharToUpper (*String2)))
+ {
String++;
String2++;
}
@@ -376,12 +387,13 @@ StriCmp (
INTN
EFIAPI
StriCmpUnicodeAndAscii (
- IN CHAR16 *String,
- IN CHAR8 *String2
+ IN CHAR16 *String,
+ IN CHAR8 *String2
)
{
while ((*String != L'\0') &&
- (CharToUpper (*String) == (CHAR16)AsciiCharToUpper (*String2))) {
+ (CharToUpper (*String) == (CHAR16)AsciiCharToUpper (*String2)))
+ {
String++;
String2++;
}
@@ -400,17 +412,17 @@ StriCmpUnicodeAndAscii (
BOOLEAN
EFIAPI
StrEndWith (
- IN CHAR16 *Str,
- IN CHAR16 *SubStr
+ IN CHAR16 *Str,
+ IN CHAR16 *SubStr
)
{
CHAR16 *Temp;
- if ((Str == NULL) || (SubStr == NULL) || (StrLen(Str) < StrLen(SubStr))) {
+ if ((Str == NULL) || (SubStr == NULL) || (StrLen (Str) < StrLen (SubStr))) {
return FALSE;
}
- Temp = Str + StrLen(Str) - StrLen(SubStr);
+ Temp = Str + StrLen (Str) - StrLen (SubStr);
//
// Compare
@@ -431,23 +443,23 @@ StrEndWith (
CHAR16 *
EFIAPI
StrDuplicate (
- IN CHAR16 *Src
+ IN CHAR16 *Src
)
{
- CHAR16 *Dest;
- UINTN Size;
+ CHAR16 *Dest;
+ UINTN Size;
- Size = (StrLen(Src) + 1) * sizeof(CHAR16);
+ Size = (StrLen (Src) + 1) * sizeof (CHAR16);
Dest = AllocateZeroPool (Size);
if (Dest != NULL) {
CopyMem (Dest, Src, Size);
}
+
return Dest;
}
-
-CHAR16 *mLineBuffer = NULL;
-CHAR16 *mFieldBuffer = NULL;
+CHAR16 *mLineBuffer = NULL;
+CHAR16 *mFieldBuffer = NULL;
/**
@@ -460,8 +472,8 @@ CHAR16 *mFieldBuffer = NULL;
UINTN
EFIAPI
StrSpn (
- IN CHAR16 *String,
- IN CHAR16 *CharSet
+ IN CHAR16 *String,
+ IN CHAR16 *CharSet
)
{
UINTN Count;
@@ -470,8 +482,8 @@ StrSpn (
Count = 0;
- for (Str1 = String; *Str1 != L'\0'; Str1 ++) {
- for (Str2 = CharSet; *Str2 != L'\0'; Str2 ++) {
+ for (Str1 = String; *Str1 != L'\0'; Str1++) {
+ for (Str2 = CharSet; *Str2 != L'\0'; Str2++) {
if (*Str1 == *Str2) {
break;
}
@@ -481,7 +493,7 @@ StrSpn (
return Count;
}
- Count ++;
+ Count++;
}
return Count;
@@ -499,17 +511,17 @@ StrSpn (
CHAR16 *
EFIAPI
StrBrk (
- IN CHAR16 *String,
- IN CHAR16 *CharSet
+ IN CHAR16 *String,
+ IN CHAR16 *CharSet
)
{
CHAR16 *Str1;
CHAR16 *Str2;
- for (Str1 = String; *Str1 != L'\0'; Str1 ++) {
- for (Str2 = CharSet; *Str2 != L'\0'; Str2 ++) {
+ for (Str1 = String; *Str1 != L'\0'; Str1++) {
+ for (Str2 = CharSet; *Str2 != L'\0'; Str2++) {
if (*Str1 == *Str2) {
- return (CHAR16 *) Str1;
+ return (CHAR16 *)Str1;
}
}
}
@@ -528,8 +540,8 @@ StrBrk (
CHAR16 *
EFIAPI
StrTokenLine (
- IN CHAR16 *String OPTIONAL,
- IN CHAR16 *CharSet
+ IN CHAR16 *String OPTIONAL,
+ IN CHAR16 *CharSet
)
{
CHAR16 *Begin;
@@ -549,7 +561,7 @@ StrTokenLine (
End = StrBrk (Begin, CharSet);
if ((End != NULL) && (*End != L'\0')) {
*End = L'\0';
- End ++;
+ End++;
}
mLineBuffer = End;
@@ -567,14 +579,13 @@ StrTokenLine (
CHAR16 *
EFIAPI
StrTokenField (
- IN CHAR16 *String OPTIONAL,
- IN CHAR16 *CharSet
+ IN CHAR16 *String OPTIONAL,
+ IN CHAR16 *CharSet
)
{
CHAR16 *Begin;
CHAR16 *End;
-
Begin = (String == NULL) ? mFieldBuffer : String;
if (Begin == NULL) {
return NULL;
@@ -588,7 +599,7 @@ StrTokenField (
End = StrBrk (Begin, CharSet);
if ((End != NULL) && (*End != L'\0')) {
*End = L'\0';
- End ++;
+ End++;
}
mFieldBuffer = End;
@@ -606,8 +617,8 @@ StrTokenField (
CHAR16 *
EFIAPI
StrGetNewTokenLine (
- IN CHAR16 *String,
- IN CHAR16 *CharSet
+ IN CHAR16 *String,
+ IN CHAR16 *CharSet
)
{
return StrTokenLine (String, CharSet);
@@ -623,7 +634,7 @@ StrGetNewTokenLine (
CHAR16 *
EFIAPI
StrGetNextTokenLine (
- IN CHAR16 *CharSet
+ IN CHAR16 *CharSet
)
{
return StrTokenLine (NULL, CharSet);
@@ -640,8 +651,8 @@ StrGetNextTokenLine (
CHAR16 *
EFIAPI
StrGetNewTokenField (
- IN CHAR16 *String,
- IN CHAR16 *CharSet
+ IN CHAR16 *String,
+ IN CHAR16 *CharSet
)
{
return StrTokenField (String, CharSet);
@@ -657,7 +668,7 @@ StrGetNewTokenField (
CHAR16 *
EFIAPI
StrGetNextTokenField (
- IN CHAR16 *CharSet
+ IN CHAR16 *CharSet
)
{
return StrTokenField (NULL, CharSet);
@@ -674,23 +685,24 @@ StrGetNextTokenField (
VOID
EFIAPI
PatchForStrTokenAfter (
- IN CHAR16 *Buffer,
- IN CHAR16 Patch
+ IN CHAR16 *Buffer,
+ IN CHAR16 Patch
)
{
- CHAR16 *Str;
+ CHAR16 *Str;
if (Buffer == NULL) {
- return ;
+ return;
}
Str = Buffer;
while (*Str != 0) {
- Str ++;
+ Str++;
}
+
*Str = Patch;
- while (*(Str ++) != '\0') {
+ while (*(Str++) != '\0') {
if (*Str == 0) {
*Str = Patch;
} else {
@@ -698,7 +710,7 @@ PatchForStrTokenAfter (
}
}
- return ;
+ return;
}
/**
@@ -711,18 +723,18 @@ PatchForStrTokenAfter (
VOID
EFIAPI
PatchForStrTokenBefore (
- IN CHAR16 *Buffer,
- IN CHAR16 Patch
+ IN CHAR16 *Buffer,
+ IN CHAR16 Patch
)
{
- CHAR16 *Str;
+ CHAR16 *Str;
if (Buffer == NULL) {
- return ;
+ return;
}
Str = Buffer;
- while (*(Str --) != '\0') {
+ while (*(Str--) != '\0') {
if ((*Str == 0) || (*Str == Patch)) {
*Str = Patch;
} else {
@@ -730,11 +742,11 @@ PatchForStrTokenBefore (
}
}
- return ;
+ return;
}
-CHAR8 *mAsciiLineBuffer = NULL;
-CHAR8 *mAsciiFieldBuffer = NULL;
+CHAR8 *mAsciiLineBuffer = NULL;
+CHAR8 *mAsciiFieldBuffer = NULL;
/**
@@ -747,18 +759,18 @@ CHAR8 *mAsciiFieldBuffer = NULL;
UINTN
EFIAPI
AsciiStrSpn (
- IN CHAR8 *String,
- IN CHAR8 *CharSet
+ IN CHAR8 *String,
+ IN CHAR8 *CharSet
)
{
- UINTN Count;
+ UINTN Count;
CHAR8 *Str1;
CHAR8 *Str2;
Count = 0;
- for (Str1 = String; *Str1 != '\0'; Str1 ++) {
- for (Str2 = CharSet; *Str2 != '\0'; Str2 ++) {
+ for (Str1 = String; *Str1 != '\0'; Str1++) {
+ for (Str2 = CharSet; *Str2 != '\0'; Str2++) {
if (*Str1 == *Str2) {
break;
}
@@ -768,7 +780,7 @@ AsciiStrSpn (
return Count;
}
- Count ++;
+ Count++;
}
return Count;
@@ -785,17 +797,17 @@ AsciiStrSpn (
CHAR8 *
EFIAPI
AsciiStrBrk (
- IN CHAR8 *String,
- IN CHAR8 *CharSet
+ IN CHAR8 *String,
+ IN CHAR8 *CharSet
)
{
CHAR8 *Str1;
CHAR8 *Str2;
- for (Str1 = String; *Str1 != '\0'; Str1 ++) {
- for (Str2 = CharSet; *Str2 != '\0'; Str2 ++) {
+ for (Str1 = String; *Str1 != '\0'; Str1++) {
+ for (Str2 = CharSet; *Str2 != '\0'; Str2++) {
if (*Str1 == *Str2) {
- return (CHAR8 *) Str1;
+ return (CHAR8 *)Str1;
}
}
}
@@ -814,8 +826,8 @@ AsciiStrBrk (
CHAR8 *
EFIAPI
AsciiStrTokenLine (
- IN CHAR8 *String OPTIONAL,
- IN CHAR8 *CharSet
+ IN CHAR8 *String OPTIONAL,
+ IN CHAR8 *CharSet
)
{
CHAR8 *Begin;
@@ -835,7 +847,7 @@ AsciiStrTokenLine (
End = AsciiStrBrk (Begin, CharSet);
if ((End != NULL) && (*End != '\0')) {
*End = '\0';
- End ++;
+ End++;
}
mAsciiLineBuffer = End;
@@ -853,14 +865,13 @@ AsciiStrTokenLine (
CHAR8 *
EFIAPI
AsciiStrTokenField (
- IN CHAR8 *String OPTIONAL,
- IN CHAR8 *CharSet
+ IN CHAR8 *String OPTIONAL,
+ IN CHAR8 *CharSet
)
{
CHAR8 *Begin;
CHAR8 *End;
-
Begin = (String == NULL) ? mAsciiFieldBuffer : String;
if (Begin == NULL) {
return NULL;
@@ -874,7 +885,7 @@ AsciiStrTokenField (
End = AsciiStrBrk (Begin, CharSet);
if ((End != NULL) && (*End != '\0')) {
*End = '\0';
- End ++;
+ End++;
}
mAsciiFieldBuffer = End;
@@ -892,8 +903,8 @@ AsciiStrTokenField (
CHAR8 *
EFIAPI
AsciiStrGetNewTokenLine (
- IN CHAR8 *String,
- IN CHAR8 *CharSet
+ IN CHAR8 *String,
+ IN CHAR8 *CharSet
)
{
return AsciiStrTokenLine (String, CharSet);
@@ -909,7 +920,7 @@ AsciiStrGetNewTokenLine (
CHAR8 *
EFIAPI
AsciiStrGetNextTokenLine (
- IN CHAR8 *CharSet
+ IN CHAR8 *CharSet
)
{
return AsciiStrTokenLine (NULL, CharSet);
@@ -926,8 +937,8 @@ AsciiStrGetNextTokenLine (
CHAR8 *
EFIAPI
AsciiStrGetNewTokenField (
- IN CHAR8 *String,
- IN CHAR8 *CharSet
+ IN CHAR8 *String,
+ IN CHAR8 *CharSet
)
{
return AsciiStrTokenField (String, CharSet);
@@ -943,7 +954,7 @@ AsciiStrGetNewTokenField (
CHAR8 *
EFIAPI
AsciiStrGetNextTokenField (
- IN CHAR8 *CharSet
+ IN CHAR8 *CharSet
)
{
return AsciiStrTokenField (NULL, CharSet);
@@ -960,23 +971,24 @@ AsciiStrGetNextTokenField (
VOID
EFIAPI
PatchForAsciiStrTokenAfter (
- IN CHAR8 *Buffer,
- IN CHAR8 Patch
+ IN CHAR8 *Buffer,
+ IN CHAR8 Patch
)
{
- CHAR8 *Str;
+ CHAR8 *Str;
if (Buffer == NULL) {
- return ;
+ return;
}
Str = Buffer;
while (*Str != 0) {
- Str ++;
+ Str++;
}
+
*Str = Patch;
- while (*(Str ++) != '\0') {
+ while (*(Str++) != '\0') {
if (*Str == 0) {
*Str = Patch;
} else {
@@ -984,7 +996,7 @@ PatchForAsciiStrTokenAfter (
}
}
- return ;
+ return;
}
/**
@@ -997,18 +1009,18 @@ PatchForAsciiStrTokenAfter (
VOID
EFIAPI
PatchForAsciiStrTokenBefore (
- IN CHAR8 *Buffer,
- IN CHAR8 Patch
+ IN CHAR8 *Buffer,
+ IN CHAR8 Patch
)
{
- CHAR8 *Str;
+ CHAR8 *Str;
if (Buffer == NULL) {
- return ;
+ return;
}
Str = Buffer;
- while (*(Str --) != '\0') {
+ while (*(Str--) != '\0') {
if ((*Str == 0) || (*Str == Patch)) {
*Str = Patch;
} else {
@@ -1016,5 +1028,5 @@ PatchForAsciiStrTokenBefore (
}
}
- return ;
+ return;
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportUI.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportUI.c
index dd881a0212..9844cf8505 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportUI.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSupportUI.c
@@ -48,8 +48,8 @@ SetCursorPosition (
EFI_STATUS
EFIAPI
WaitForSingleEvent (
- IN EFI_EVENT Event,
- IN UINT64 Timeout OPTIONAL
+ IN EFI_EVENT Event,
+ IN UINT64 Timeout OPTIONAL
)
{
EFI_STATUS Status;
@@ -67,10 +67,10 @@ WaitForSingleEvent (
// Set the timer event
//
gBS->SetTimer (
- TimerEvent,
- TimerRelative,
- Timeout
- );
+ TimerEvent,
+ TimerRelative,
+ Timeout
+ );
//
// Wait for the original event or the timer
@@ -83,7 +83,7 @@ WaitForSingleEvent (
//
// If the timer expired, change the return to timed out
//
- if (!EFI_ERROR (Status) && Index == 1) {
+ if (!EFI_ERROR (Status) && (Index == 1)) {
Status = EFI_TIMEOUT;
}
}
@@ -111,9 +111,9 @@ WaitForSingleEvent (
VOID
EFIAPI
ConMoveCursorBackward (
- IN UINTN LineLength,
- IN OUT UINTN *Column,
- IN OUT UINTN *Row
+ IN UINTN LineLength,
+ IN OUT UINTN *Column,
+ IN OUT UINTN *Row
)
{
ASSERT (Column != NULL);
@@ -149,10 +149,10 @@ ConMoveCursorBackward (
VOID
EFIAPI
ConMoveCursorForward (
- IN UINTN LineLength,
- IN UINTN TotalRow,
- IN OUT UINTN *Column,
- IN OUT UINTN *Row
+ IN UINTN LineLength,
+ IN UINTN TotalRow,
+ IN OUT UINTN *Column,
+ IN OUT UINTN *Row
)
{
ASSERT (Column != NULL);
@@ -170,8 +170,8 @@ ConMoveCursorForward (
}
}
-CHAR16 mBackupSpace[EFI_DEBUG_INPUS_BUFFER_SIZE];
-CHAR16 mInputBufferHistory[EFI_DEBUG_INPUS_BUFFER_SIZE];
+CHAR16 mBackupSpace[EFI_DEBUG_INPUS_BUFFER_SIZE];
+CHAR16 mInputBufferHistory[EFI_DEBUG_INPUS_BUFFER_SIZE];
/**
@@ -185,36 +185,36 @@ CHAR16 mInputBufferHistory[EFI_DEBUG_INPUS_BUFFER_SIZE];
VOID
EFIAPI
Input (
- IN CHAR16 *Prompt OPTIONAL,
- OUT CHAR16 *InStr,
- IN UINTN StrLength
+ IN CHAR16 *Prompt OPTIONAL,
+ OUT CHAR16 *InStr,
+ IN UINTN StrLength
)
{
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
- EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
- BOOLEAN Done;
- UINTN Column;
- UINTN Row;
- UINTN StartColumn;
- UINTN Update;
- UINTN Delete;
- UINTN Len;
- UINTN StrPos;
- UINTN Index;
- UINTN LineLength;
- UINTN TotalRow;
- UINTN SkipLength;
- UINTN OutputLength;
- UINTN TailRow;
- UINTN TailColumn;
- EFI_INPUT_KEY Key;
- BOOLEAN InsertMode;
- BOOLEAN NeedAdjust;
- UINTN SubIndex;
- CHAR16 *CommandStr;
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
+ EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
+ BOOLEAN Done;
+ UINTN Column;
+ UINTN Row;
+ UINTN StartColumn;
+ UINTN Update;
+ UINTN Delete;
+ UINTN Len;
+ UINTN StrPos;
+ UINTN Index;
+ UINTN LineLength;
+ UINTN TotalRow;
+ UINTN SkipLength;
+ UINTN OutputLength;
+ UINTN TailRow;
+ UINTN TailColumn;
+ EFI_INPUT_KEY Key;
+ BOOLEAN InsertMode;
+ BOOLEAN NeedAdjust;
+ UINTN SubIndex;
+ CHAR16 *CommandStr;
ConOut = gST->ConOut;
- ConIn = gST->ConIn;
+ ConIn = gST->ConIn;
ASSERT (ConOut != NULL);
ASSERT (ConIn != NULL);
@@ -223,23 +223,25 @@ Input (
if (Prompt != NULL) {
ConOut->OutputString (ConOut, Prompt);
}
+
//
// Read a line from the console
//
- Len = 0;
- StrPos = 0;
- OutputLength = 0;
- Update = 0;
- Delete = 0;
- InsertMode = TRUE;
- NeedAdjust = FALSE;
+ Len = 0;
+ StrPos = 0;
+ OutputLength = 0;
+ Update = 0;
+ Delete = 0;
+ InsertMode = TRUE;
+ NeedAdjust = FALSE;
//
// If buffer is not large enough to hold a CHAR16, do nothing.
//
if (StrLength < 1) {
- return ;
+ return;
}
+
//
// Get the screen setting and the current cursor location
//
@@ -248,7 +250,7 @@ Input (
Row = ConOut->Mode->CursorRow;
ConOut->QueryMode (ConOut, ConOut->Mode->Mode, &LineLength, &TotalRow);
if (LineLength == 0) {
- return ;
+ return;
}
SetMem (InStr, StrLength * sizeof (CHAR16), 0);
@@ -261,191 +263,200 @@ Input (
ConIn->ReadKeyStroke (ConIn, &Key);
switch (Key.UnicodeChar) {
- case CHAR_CARRIAGE_RETURN:
- //
- // All done, print a newline at the end of the string
- //
- TailRow = Row + (Len - StrPos + Column) / LineLength;
- TailColumn = (Len - StrPos + Column) % LineLength;
- Done = TRUE;
- break;
-
- case CHAR_BACKSPACE:
- if (StrPos != 0) {
- //
- // If not move back beyond string beginning, move all characters behind
- // the current position one character forward
+ case CHAR_CARRIAGE_RETURN:
//
- StrPos -= 1;
- Update = StrPos;
- Delete = 1;
- CopyMem (InStr + StrPos, InStr + StrPos + 1, sizeof (CHAR16) * (Len - StrPos));
-
+ // All done, print a newline at the end of the string
//
- // Adjust the current column and row
- //
- ConMoveCursorBackward (LineLength, &Column, &Row);
-
- NeedAdjust = TRUE;
- }
- break;
-
- default:
- if (Key.UnicodeChar >= ' ') {
- //
- // If we are at the buffer's end, drop the key
- //
- if (Len == StrLength - 1 && (InsertMode || StrPos == Len)) {
- break;
- }
- //
- // If in insert mode, move all characters behind the current position
- // one character backward to make space for this character. Then store
- // the character.
- //
- if (InsertMode) {
- for (Index = Len; Index > StrPos; Index -= 1) {
- InStr[Index] = InStr[Index - 1];
- }
- }
-
- InStr[StrPos] = Key.UnicodeChar;
- Update = StrPos;
-
- StrPos += 1;
- OutputLength = 1;
- }
- break;
+ TailRow = Row + (Len - StrPos + Column) / LineLength;
+ TailColumn = (Len - StrPos + Column) % LineLength;
+ Done = TRUE;
+ break;
- case 0:
- switch (Key.ScanCode) {
- case SCAN_DELETE:
- //
- // Move characters behind current position one character forward
- //
- if (Len != 0) {
+ case CHAR_BACKSPACE:
+ if (StrPos != 0) {
+ //
+ // If not move back beyond string beginning, move all characters behind
+ // the current position one character forward
+ //
+ StrPos -= 1;
Update = StrPos;
Delete = 1;
CopyMem (InStr + StrPos, InStr + StrPos + 1, sizeof (CHAR16) * (Len - StrPos));
- NeedAdjust = TRUE;
- }
- break;
-
- case SCAN_LEFT:
- //
- // Adjust current cursor position
- //
- if (StrPos != 0) {
- StrPos -= 1;
+ //
+ // Adjust the current column and row
+ //
ConMoveCursorBackward (LineLength, &Column, &Row);
- }
- break;
- case SCAN_RIGHT:
- //
- // Adjust current cursor position
- //
- if (StrPos < Len) {
- StrPos += 1;
- ConMoveCursorForward (LineLength, TotalRow, &Column, &Row);
+ NeedAdjust = TRUE;
}
- break;
- case SCAN_HOME:
- //
- // Move current cursor position to the beginning of the command line
- //
- Row -= (StrPos + StartColumn) / LineLength;
- Column = StartColumn;
- StrPos = 0;
break;
- case SCAN_END:
- //
- // Move current cursor position to the end of the command line
- //
- TailRow = Row + (Len - StrPos + Column) / LineLength;
- TailColumn = (Len - StrPos + Column) % LineLength;
- Row = TailRow;
- Column = TailColumn;
- StrPos = Len;
- break;
+ default:
+ if (Key.UnicodeChar >= ' ') {
+ //
+ // If we are at the buffer's end, drop the key
+ //
+ if ((Len == StrLength - 1) && (InsertMode || (StrPos == Len))) {
+ break;
+ }
- case SCAN_ESC:
- //
- // Prepare to clear the current command line
- //
- InStr[0] = 0;
- Update = 0;
- Delete = Len;
- Row -= (StrPos + StartColumn) / LineLength;
- Column = StartColumn;
- OutputLength = 0;
-
- NeedAdjust = TRUE;
- break;
+ //
+ // If in insert mode, move all characters behind the current position
+ // one character backward to make space for this character. Then store
+ // the character.
+ //
+ if (InsertMode) {
+ for (Index = Len; Index > StrPos; Index -= 1) {
+ InStr[Index] = InStr[Index - 1];
+ }
+ }
- case SCAN_INSERT:
- //
- // Toggle the SEnvInsertMode flag
- //
- InsertMode = (BOOLEAN)!InsertMode;
- break;
+ InStr[StrPos] = Key.UnicodeChar;
+ Update = StrPos;
- case SCAN_UP:
- case SCAN_DOWN:
- //
- // show history
- //
- CopyMem (InStr, mInputBufferHistory, StrLength * sizeof(CHAR16));
- StrPos = StrLen (mInputBufferHistory);
- Update = 0;
- Delete = 0;
- OutputLength = 0;
-
- TailRow = Row + (StrPos + StartColumn) / LineLength;
- TailColumn = (StrPos + StartColumn) % LineLength;
- Row = TailRow;
- Column = TailColumn;
- NeedAdjust = FALSE;
-
- ConOut->SetCursorPosition (ConOut, StartColumn, Row);
- for (SubIndex = 0; SubIndex < EFI_DEBUG_INPUS_BUFFER_SIZE - (StartColumn - EFI_DEBUG_PROMPT_COLUMN); SubIndex++) {
- mBackupSpace[SubIndex] = L' ';
+ StrPos += 1;
+ OutputLength = 1;
}
- EDBPrint (mBackupSpace);
- SetMem (mBackupSpace, (EFI_DEBUG_INPUS_BUFFER_SIZE - (StartColumn - EFI_DEBUG_PROMPT_COLUMN)) * sizeof(CHAR16), 0);
-
- ConOut->SetCursorPosition (ConOut, StartColumn, Row);
- Len = StrPos;
break;
- case SCAN_F1:
- case SCAN_F2:
- case SCAN_F3:
- case SCAN_F4:
- case SCAN_F5:
- case SCAN_F6:
- case SCAN_F7:
- case SCAN_F8:
- case SCAN_F9:
- case SCAN_F10:
- case SCAN_F11:
- case SCAN_F12:
- CommandStr = GetCommandNameByKey (Key);
- if (CommandStr != NULL) {
- StrnCpyS (InStr, StrLength, CommandStr, StrLength - 1);
- return ;
+ case 0:
+ switch (Key.ScanCode) {
+ case SCAN_DELETE:
+ //
+ // Move characters behind current position one character forward
+ //
+ if (Len != 0) {
+ Update = StrPos;
+ Delete = 1;
+ CopyMem (InStr + StrPos, InStr + StrPos + 1, sizeof (CHAR16) * (Len - StrPos));
+
+ NeedAdjust = TRUE;
+ }
+
+ break;
+
+ case SCAN_LEFT:
+ //
+ // Adjust current cursor position
+ //
+ if (StrPos != 0) {
+ StrPos -= 1;
+ ConMoveCursorBackward (LineLength, &Column, &Row);
+ }
+
+ break;
+
+ case SCAN_RIGHT:
+ //
+ // Adjust current cursor position
+ //
+ if (StrPos < Len) {
+ StrPos += 1;
+ ConMoveCursorForward (LineLength, TotalRow, &Column, &Row);
+ }
+
+ break;
+
+ case SCAN_HOME:
+ //
+ // Move current cursor position to the beginning of the command line
+ //
+ Row -= (StrPos + StartColumn) / LineLength;
+ Column = StartColumn;
+ StrPos = 0;
+ break;
+
+ case SCAN_END:
+ //
+ // Move current cursor position to the end of the command line
+ //
+ TailRow = Row + (Len - StrPos + Column) / LineLength;
+ TailColumn = (Len - StrPos + Column) % LineLength;
+ Row = TailRow;
+ Column = TailColumn;
+ StrPos = Len;
+ break;
+
+ case SCAN_ESC:
+ //
+ // Prepare to clear the current command line
+ //
+ InStr[0] = 0;
+ Update = 0;
+ Delete = Len;
+ Row -= (StrPos + StartColumn) / LineLength;
+ Column = StartColumn;
+ OutputLength = 0;
+
+ NeedAdjust = TRUE;
+ break;
+
+ case SCAN_INSERT:
+ //
+ // Toggle the SEnvInsertMode flag
+ //
+ InsertMode = (BOOLEAN) !InsertMode;
+ break;
+
+ case SCAN_UP:
+ case SCAN_DOWN:
+ //
+ // show history
+ //
+ CopyMem (InStr, mInputBufferHistory, StrLength * sizeof (CHAR16));
+ StrPos = StrLen (mInputBufferHistory);
+ Update = 0;
+ Delete = 0;
+ OutputLength = 0;
+
+ TailRow = Row + (StrPos + StartColumn) / LineLength;
+ TailColumn = (StrPos + StartColumn) % LineLength;
+ Row = TailRow;
+ Column = TailColumn;
+ NeedAdjust = FALSE;
+
+ ConOut->SetCursorPosition (ConOut, StartColumn, Row);
+ for (SubIndex = 0; SubIndex < EFI_DEBUG_INPUS_BUFFER_SIZE - (StartColumn - EFI_DEBUG_PROMPT_COLUMN); SubIndex++) {
+ mBackupSpace[SubIndex] = L' ';
+ }
+
+ EDBPrint (mBackupSpace);
+ SetMem (mBackupSpace, (EFI_DEBUG_INPUS_BUFFER_SIZE - (StartColumn - EFI_DEBUG_PROMPT_COLUMN)) * sizeof (CHAR16), 0);
+
+ ConOut->SetCursorPosition (ConOut, StartColumn, Row);
+ Len = StrPos;
+
+ break;
+
+ case SCAN_F1:
+ case SCAN_F2:
+ case SCAN_F3:
+ case SCAN_F4:
+ case SCAN_F5:
+ case SCAN_F6:
+ case SCAN_F7:
+ case SCAN_F8:
+ case SCAN_F9:
+ case SCAN_F10:
+ case SCAN_F11:
+ case SCAN_F12:
+ CommandStr = GetCommandNameByKey (Key);
+ if (CommandStr != NULL) {
+ StrnCpyS (InStr, StrLength, CommandStr, StrLength - 1);
+ return;
+ }
+
+ break;
}
- break;
- }
}
if (Done) {
break;
}
+
//
// If we need to update the output do so now
//
@@ -455,11 +466,13 @@ Input (
for (SubIndex = 0; SubIndex < EFI_DEBUG_INPUS_BUFFER_SIZE - (Column - EFI_DEBUG_PROMPT_COLUMN); SubIndex++) {
mBackupSpace[SubIndex] = L' ';
}
+
EDBPrint (mBackupSpace);
- SetMem (mBackupSpace, (EFI_DEBUG_INPUS_BUFFER_SIZE - (Column - EFI_DEBUG_PROMPT_COLUMN)) * sizeof(CHAR16), 0);
+ SetMem (mBackupSpace, (EFI_DEBUG_INPUS_BUFFER_SIZE - (Column - EFI_DEBUG_PROMPT_COLUMN)) * sizeof (CHAR16), 0);
ConOut->SetCursorPosition (ConOut, Column, Row);
NeedAdjust = FALSE;
}
+
EDBPrint (InStr + Update);
Len = StrLen (InStr);
@@ -471,19 +484,19 @@ Input (
StrPos = Len;
}
- Update = (UINTN) -1;
+ Update = (UINTN)-1;
//
// After using print to reflect newly updates, if we're not using
// BACKSPACE and DELETE, we need to move the cursor position forward,
// so adjust row and column here.
//
- if (Key.UnicodeChar != CHAR_BACKSPACE && !(Key.UnicodeChar == 0 && Key.ScanCode == SCAN_DELETE)) {
+ if ((Key.UnicodeChar != CHAR_BACKSPACE) && !((Key.UnicodeChar == 0) && (Key.ScanCode == SCAN_DELETE))) {
//
// Calulate row and column of the tail of current string
//
- TailRow = Row + (Len - StrPos + Column + OutputLength) / LineLength;
- TailColumn = (Len - StrPos + Column + OutputLength) % LineLength;
+ TailRow = Row + (Len - StrPos + Column + OutputLength) / LineLength;
+ TailColumn = (Len - StrPos + Column + OutputLength) % LineLength;
//
// If the tail of string reaches screen end, screen rolls up, so if
@@ -492,9 +505,10 @@ Input (
// (if we are recalling commands using UPPER and DOWN key, and if the
// old command is too long to fit the screen, TailColumn must be 79.
//
- if (TailColumn == 0 && TailRow >= TotalRow && (UINTN) Row != TailRow) {
+ if ((TailColumn == 0) && (TailRow >= TotalRow) && ((UINTN)Row != TailRow)) {
Row--;
}
+
//
// Calculate the cursor position after current operation. If cursor
// reaches line end, update both row and column, otherwise, only
@@ -504,7 +518,7 @@ Input (
SkipLength = OutputLength - (LineLength - Column);
Row += SkipLength / LineLength + 1;
- if ((UINTN) Row > TotalRow - 1) {
+ if ((UINTN)Row > TotalRow - 1) {
Row = TotalRow - 1;
}
@@ -516,18 +530,19 @@ Input (
Delete = 0;
}
+
//
// Set the cursor position for this key
//
SetCursorPosition (ConOut, Column, Row, LineLength, TotalRow, InStr, StrPos, Len);
} while (!Done);
- CopyMem (mInputBufferHistory, InStr, StrLength * sizeof(CHAR16));
+ CopyMem (mInputBufferHistory, InStr, StrLength * sizeof (CHAR16));
//
// Return the data to the caller
//
- return ;
+ return;
}
/**
@@ -546,14 +561,14 @@ Input (
VOID
EFIAPI
SetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,
- IN UINTN Column,
- IN INTN Row,
- IN UINTN LineLength,
- IN UINTN TotalRow,
- IN CHAR16 *Str,
- IN UINTN StrPos,
- IN UINTN Len
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,
+ IN UINTN Column,
+ IN INTN Row,
+ IN UINTN LineLength,
+ IN UINTN TotalRow,
+ IN CHAR16 *Str,
+ IN UINTN StrPos,
+ IN UINTN Len
)
{
CHAR16 Backup;
@@ -564,12 +579,12 @@ SetCursorPosition (
Backup = 0;
if (Row >= 0) {
ConOut->SetCursorPosition (ConOut, Column, Row);
- return ;
+ return;
}
if (Len - StrPos > Column * Row) {
- Backup = *(Str + StrPos + Column * Row);
- *(Str + StrPos + Column * Row) = 0;
+ Backup = *(Str + StrPos + Column * Row);
+ *(Str + StrPos + Column * Row) = 0;
}
EDBPrint (L"%s", Str + StrPos);
@@ -591,9 +606,9 @@ SetPageBreak (
VOID
)
{
- EFI_INPUT_KEY Key;
- CHAR16 Str[3];
- BOOLEAN OmitPrint;
+ EFI_INPUT_KEY Key;
+ CHAR16 Str[3];
+ BOOLEAN OmitPrint;
//
// Check
@@ -608,10 +623,10 @@ SetPageBreak (
//
// Wait for user input
//
- Str[0] = ' ';
- Str[1] = 0;
- Str[2] = 0;
- for (;;) {
+ Str[0] = ' ';
+ Str[1] = 0;
+ Str[2] = 0;
+ for ( ; ;) {
WaitForSingleEvent (gST->ConIn->WaitForKey, 0);
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
@@ -632,6 +647,7 @@ SetPageBreak (
gST->ConOut->OutputString (gST->ConOut, L"\r\n");
break;
}
+
//
// Echo input
//
@@ -669,9 +685,9 @@ EDBPrint (
...
)
{
- UINTN Return;
- VA_LIST Marker;
- CHAR16 Buffer[EFI_DEBUG_MAX_PRINT_BUFFER];
+ UINTN Return;
+ VA_LIST Marker;
+ CHAR16 Buffer[EFI_DEBUG_MAX_PRINT_BUFFER];
VA_START (Marker, Format);
Return = UnicodeVSPrint (Buffer, sizeof (Buffer), Format, Marker);
@@ -707,8 +723,8 @@ EDBSPrint (
...
)
{
- UINTN Return;
- VA_LIST Marker;
+ UINTN Return;
+ VA_LIST Marker;
ASSERT (BufferSize > 0);
@@ -741,13 +757,13 @@ EDBSPrintWithOffset (
...
)
{
- UINTN Return;
- VA_LIST Marker;
+ UINTN Return;
+ VA_LIST Marker;
- ASSERT (BufferSize - (Offset * sizeof(CHAR16)) > 0);
+ ASSERT (BufferSize - (Offset * sizeof (CHAR16)) > 0);
VA_START (Marker, Format);
- Return = UnicodeVSPrint (Buffer + Offset, (UINTN)(BufferSize - (Offset * sizeof(CHAR16))), Format, Marker);
+ Return = UnicodeVSPrint (Buffer + Offset, (UINTN)(BufferSize - (Offset * sizeof (CHAR16))), Format, Marker);
VA_END (Marker);
return Return;
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
index 90a9b9fbd7..834c90e32a 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
@@ -48,7 +48,7 @@ EdbLoadSymbolSingleEntry (
//
// Print Debug info
//
- if (sizeof (UINTN) == sizeof(UINT64)) {
+ if (sizeof (UINTN) == sizeof (UINT64)) {
DEBUG ((DEBUG_ERROR, " Symbol: %a, Address: 0x%016lx (%d)\n", Name, (UINT64)Address, (UINTN)Type));
} else {
DEBUG ((DEBUG_ERROR, " Symbol: %a, Address: 0x%08x (%d)\n", Name, Address, (UINTN)Type));
@@ -57,11 +57,12 @@ EdbLoadSymbolSingleEntry (
//
// Fill the entry - name, RVA, type
//
- AsciiStrnCpyS (Entry->Name, sizeof(Entry->Name), Name, sizeof(Entry->Name) - 1);
+ AsciiStrnCpyS (Entry->Name, sizeof (Entry->Name), Name, sizeof (Entry->Name) - 1);
if (ObjName != NULL) {
- AsciiStrnCpyS (Entry->ObjName, sizeof(Entry->ObjName), ObjName, sizeof(Entry->ObjName) - 1);
+ AsciiStrnCpyS (Entry->ObjName, sizeof (Entry->ObjName), ObjName, sizeof (Entry->ObjName) - 1);
}
- Entry->Rva = Address % EFI_DEBUGGER_DEFAULT_LINK_IMAGEBASE;
+
+ Entry->Rva = Address % EFI_DEBUGGER_DEFAULT_LINK_IMAGEBASE;
Entry->Type = Type;
//
@@ -167,34 +168,33 @@ EdbLoadSymbolEntryByIec (
IN VOID *Buffer
)
{
- CHAR8 *LineBuffer;
- CHAR8 *FieldBuffer;
- EDB_EBC_MAP_PARSE_STATE MapParseState;
- EDB_EBC_SYMBOL_PARSE_STATE SymbolParseState;
- CHAR8 *Name;
- CHAR8 *ObjName;
- UINTN Address;
- EFI_DEBUGGER_SYMBOL_TYPE Type;
-
+ CHAR8 *LineBuffer;
+ CHAR8 *FieldBuffer;
+ EDB_EBC_MAP_PARSE_STATE MapParseState;
+ EDB_EBC_SYMBOL_PARSE_STATE SymbolParseState;
+ CHAR8 *Name;
+ CHAR8 *ObjName;
+ UINTN Address;
+ EFI_DEBUGGER_SYMBOL_TYPE Type;
//
// Begin to parse the Buffer
//
- LineBuffer = AsciiStrGetNewTokenLine (Buffer, "\n\r");
+ LineBuffer = AsciiStrGetNewTokenLine (Buffer, "\n\r");
MapParseState = EdbEbcMapParseStateUninitialized;
//
// Check each line
//
while (LineBuffer != NULL) {
- FieldBuffer = AsciiStrGetNewTokenField (LineBuffer, " ");
+ FieldBuffer = AsciiStrGetNewTokenField (LineBuffer, " ");
SymbolParseState = EdbEbcSymbolParseStateUninitialized;
//
// Init entry value
//
- Name = NULL;
+ Name = NULL;
ObjName = NULL;
Address = 0;
- Type = EfiDebuggerSymbolTypeMax;
+ Type = EfiDebuggerSymbolTypeMax;
//
// Check each field
//
@@ -203,6 +203,7 @@ EdbLoadSymbolEntryByIec (
FieldBuffer = AsciiStrGetNextTokenField (" ");
continue;
}
+
//
// check "Address"
//
@@ -210,6 +211,7 @@ EdbLoadSymbolEntryByIec (
MapParseState = EdbEbcMapParseStateSymbolStart;
break;
}
+
//
// check "Static"
//
@@ -224,6 +226,7 @@ EdbLoadSymbolEntryByIec (
//
break;
}
+
if (AsciiStrCmp (FieldBuffer, "entry") == 0) {
//
// Skip entry point
@@ -235,126 +238,132 @@ EdbLoadSymbolEntryByIec (
// Now we start to parse this line for Name, Address, and Object
//
switch (SymbolParseState) {
- case EdbEbcSymbolParseStateUninitialized:
- //
- // Get the Address
- //
- SymbolParseState = EdbEbcSymbolParseStateReadyForName;
- break;
- case EdbEbcSymbolParseStateReadyForName:
- //
- // Get the Name
- //
- if (AsciiStrnCmp (FieldBuffer, "___safe_se_handler", AsciiStrLen ("___safe_se_handler")) == 0) {
+ case EdbEbcSymbolParseStateUninitialized:
//
- // skip SeHandler
+ // Get the Address
//
- MapParseState = EdbEbcMapParseStateSeHandlerSymbol;
- goto ExitFieldParse;
- } else if (AsciiStrnCmp (FieldBuffer, "varbss_init", AsciiStrLen ("varbss_init")) == 0) {
+ SymbolParseState = EdbEbcSymbolParseStateReadyForName;
+ break;
+ case EdbEbcSymbolParseStateReadyForName:
//
- // check VarbssInit
+ // Get the Name
//
- MapParseState = EdbEbcMapParseStateVarbssInitSymbol;
-// goto ExitFieldParse;
- Name = FieldBuffer;
- SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
- } else if (AsciiStrnCmp (FieldBuffer, "Crt", AsciiStrLen ("Crt")) == 0) {
+ if (AsciiStrnCmp (FieldBuffer, "___safe_se_handler", AsciiStrLen ("___safe_se_handler")) == 0) {
+ //
+ // skip SeHandler
+ //
+ MapParseState = EdbEbcMapParseStateSeHandlerSymbol;
+ goto ExitFieldParse;
+ } else if (AsciiStrnCmp (FieldBuffer, "varbss_init", AsciiStrLen ("varbss_init")) == 0) {
+ //
+ // check VarbssInit
+ //
+ MapParseState = EdbEbcMapParseStateVarbssInitSymbol;
+ // goto ExitFieldParse;
+ Name = FieldBuffer;
+ SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
+ } else if (AsciiStrnCmp (FieldBuffer, "Crt", AsciiStrLen ("Crt")) == 0) {
+ //
+ // check Crt
+ //
+ MapParseState = EdbEbcMapParseStateCrtSymbol;
+ // goto ExitFieldParse;
+ Name = FieldBuffer;
+ SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
+ } else {
+ //
+ // Now, it is normal function
+ //
+ switch (MapParseState) {
+ case EdbEbcMapParseStateSeHandlerSymbol:
+ MapParseState = EdbEbcMapParseStateFunctionSymbol;
+ break;
+ case EdbEbcMapParseStateCrtSymbol:
+ MapParseState = EdbEbcMapParseStateVariableSymbol;
+ break;
+ case EdbEbcMapParseStateFunctionSymbol:
+ case EdbEbcMapParseStateVariableSymbol:
+ case EdbEbcMapParseStateStaticFunctionSymbol:
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+
+ Name = FieldBuffer;
+ SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
+ }
+
+ break;
+ case EdbEbcSymbolParseStateReadyForRVA:
//
- // check Crt
+ // Get the RVA
//
- MapParseState = EdbEbcMapParseStateCrtSymbol;
-// goto ExitFieldParse;
- Name = FieldBuffer;
- SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
- } else {
+ Address = AsciiXtoi (FieldBuffer);
+ SymbolParseState = EdbEbcSymbolParseStateReadyForType;
+ break;
+ case EdbEbcSymbolParseStateReadyForType:
//
- // Now, it is normal function
+ // Get the Type. This is optional, only for "f".
//
- switch (MapParseState) {
- case EdbEbcMapParseStateSeHandlerSymbol:
- MapParseState = EdbEbcMapParseStateFunctionSymbol;
- break;
- case EdbEbcMapParseStateCrtSymbol:
- MapParseState = EdbEbcMapParseStateVariableSymbol;
- break;
- case EdbEbcMapParseStateFunctionSymbol:
- case EdbEbcMapParseStateVariableSymbol:
- case EdbEbcMapParseStateStaticFunctionSymbol:
- break;
- default:
- ASSERT (FALSE);
- break;
- }
- Name = FieldBuffer;
- SymbolParseState = EdbEbcSymbolParseStateReadyForRVA;
- }
- break;
- case EdbEbcSymbolParseStateReadyForRVA:
- //
- // Get the RVA
- //
- Address = AsciiXtoi (FieldBuffer);
- SymbolParseState = EdbEbcSymbolParseStateReadyForType;
- break;
- case EdbEbcSymbolParseStateReadyForType:
- //
- // Get the Type. This is optional, only for "f".
- //
- if (AsciiStrCmp (FieldBuffer, "f") == 0) {
- SymbolParseState = EdbEbcSymbolParseStateReadyForObject;
- switch (MapParseState) {
- case EdbEbcMapParseStateFunctionSymbol:
- case EdbEbcMapParseStateVarbssInitSymbol:
- Type = EfiDebuggerSymbolFunction;
- break;
- case EdbEbcMapParseStateStaticFunctionSymbol:
- Type = EfiDebuggerSymbolStaticFunction;
- break;
- default:
- ASSERT (FALSE);
+ if (AsciiStrCmp (FieldBuffer, "f") == 0) {
+ SymbolParseState = EdbEbcSymbolParseStateReadyForObject;
+ switch (MapParseState) {
+ case EdbEbcMapParseStateFunctionSymbol:
+ case EdbEbcMapParseStateVarbssInitSymbol:
+ Type = EfiDebuggerSymbolFunction;
+ break;
+ case EdbEbcMapParseStateStaticFunctionSymbol:
+ Type = EfiDebuggerSymbolStaticFunction;
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+
break;
}
- break;
- }
+
//
// Else it should be Object.
// let it bypass here
//
- case EdbEbcSymbolParseStateReadyForObject:
- switch (Type) {
- case EfiDebuggerSymbolTypeMax:
- switch (MapParseState) {
- case EdbEbcMapParseStateVariableSymbol:
- case EdbEbcMapParseStateCrtSymbol:
- Type = EfiDebuggerSymbolGlobalVariable;
- break;
- case EdbEbcMapParseStateSeHandlerSymbol:
- //
- // do nothing here
- //
- break;
- default:
- ASSERT (FALSE);
- break;
+ case EdbEbcSymbolParseStateReadyForObject:
+ switch (Type) {
+ case EfiDebuggerSymbolTypeMax:
+ switch (MapParseState) {
+ case EdbEbcMapParseStateVariableSymbol:
+ case EdbEbcMapParseStateCrtSymbol:
+ Type = EfiDebuggerSymbolGlobalVariable;
+ break;
+ case EdbEbcMapParseStateSeHandlerSymbol:
+ //
+ // do nothing here
+ //
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
+ }
+
+ break;
+ case EfiDebuggerSymbolFunction:
+ case EfiDebuggerSymbolStaticFunction:
+ break;
+ default:
+ ASSERT (FALSE);
+ break;
}
- break;
- case EfiDebuggerSymbolFunction:
- case EfiDebuggerSymbolStaticFunction:
+
+ //
+ // Get the Object
+ //
+ ObjName = FieldBuffer;
+ SymbolParseState = EdbEbcSymbolParseStateUninitialized;
break;
default:
ASSERT (FALSE);
break;
- }
- //
- // Get the Object
- //
- ObjName = FieldBuffer;
- SymbolParseState = EdbEbcSymbolParseStateUninitialized;
- break;
- default:
- ASSERT (FALSE);
- break;
}
//
@@ -423,12 +432,12 @@ EdbLoadSymbolEntry (
**/
EFI_DEBUGGER_SYMBOL_OBJECT *
EdbFindSymbolFile (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName,
- IN OUT UINTN *Index OPTIONAL
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName,
+ IN OUT UINTN *Index OPTIONAL
)
{
- UINTN ObjectIndex;
+ UINTN ObjectIndex;
//
// Check each Object
@@ -441,6 +450,7 @@ EdbFindSymbolFile (
if (Index != NULL) {
*Index = ObjectIndex;
}
+
return &DebuggerPrivate->DebuggerSymbolContext.Object[ObjectIndex];
}
}
@@ -465,22 +475,22 @@ EdbFindSymbolFile (
**/
UINTN
EbdFindSymbolAddress (
- IN UINTN Address,
- IN EDB_MATCH_SYMBOL_TYPE Type,
- OUT EFI_DEBUGGER_SYMBOL_OBJECT **RetObject,
- OUT EFI_DEBUGGER_SYMBOL_ENTRY **RetEntry
+ IN UINTN Address,
+ IN EDB_MATCH_SYMBOL_TYPE Type,
+ OUT EFI_DEBUGGER_SYMBOL_OBJECT **RetObject,
+ OUT EFI_DEBUGGER_SYMBOL_ENTRY **RetEntry
)
{
- UINTN Index;
- UINTN SubIndex;
- UINTN CandidateLowerAddress;
- UINTN CandidateUpperAddress;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
- EFI_DEBUGGER_SYMBOL_ENTRY *LowEntry;
- EFI_DEBUGGER_SYMBOL_ENTRY *UpperEntry;
- EFI_DEBUGGER_SYMBOL_OBJECT *LowObject;
- EFI_DEBUGGER_SYMBOL_OBJECT *UpperObject;
+ UINTN Index;
+ UINTN SubIndex;
+ UINTN CandidateLowerAddress;
+ UINTN CandidateUpperAddress;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ EFI_DEBUGGER_SYMBOL_ENTRY *Entry;
+ EFI_DEBUGGER_SYMBOL_ENTRY *LowEntry;
+ EFI_DEBUGGER_SYMBOL_ENTRY *UpperEntry;
+ EFI_DEBUGGER_SYMBOL_OBJECT *LowObject;
+ EFI_DEBUGGER_SYMBOL_OBJECT *UpperObject;
if ((Type < 0) || (Type >= EdbMatchSymbolTypeMax)) {
return 0;
@@ -491,10 +501,10 @@ EbdFindSymbolAddress (
//
CandidateLowerAddress = 0;
CandidateUpperAddress = (UINTN)-1;
- LowEntry = NULL;
- UpperEntry = NULL;
- LowObject = NULL;
- UpperObject = NULL;
+ LowEntry = NULL;
+ UpperEntry = NULL;
+ LowObject = NULL;
+ UpperObject = NULL;
//
// Go through each object
@@ -504,6 +514,7 @@ EbdFindSymbolAddress (
if (Object->EntryCount == 0) {
continue;
}
+
//
// Go through each entry
//
@@ -519,8 +530,8 @@ EbdFindSymbolAddress (
//
if (CandidateLowerAddress < Entry->Rva + Object->BaseAddress) {
CandidateLowerAddress = Entry->Rva + Object->BaseAddress;
- LowEntry = Entry;
- LowObject = Object;
+ LowEntry = Entry;
+ LowObject = Object;
}
} else {
//
@@ -528,16 +539,18 @@ EbdFindSymbolAddress (
//
if (CandidateUpperAddress > Entry->Rva + Object->BaseAddress) {
CandidateUpperAddress = Entry->Rva + Object->BaseAddress;
- UpperEntry = Entry;
- UpperObject = Object;
+ UpperEntry = Entry;
+ UpperObject = Object;
}
}
+
continue;
}
+
//
// address match, return directly
//
- *RetEntry = Entry;
+ *RetEntry = Entry;
*RetObject = Object;
return Address;
}
@@ -553,11 +566,12 @@ EbdFindSymbolAddress (
//
if (((Type == EdbMatchSymbolTypeNearestAddress) &&
((CandidateUpperAddress - Address) > (Address - CandidateLowerAddress))) ||
- (Type == EdbMatchSymbolTypeLowerAddress)) {
+ (Type == EdbMatchSymbolTypeLowerAddress))
+ {
//
// return nearest lower address
//
- *RetEntry = LowEntry;
+ *RetEntry = LowEntry;
*RetObject = LowObject;
return CandidateLowerAddress;
}
@@ -569,11 +583,12 @@ EbdFindSymbolAddress (
//
if (((Type == EdbMatchSymbolTypeNearestAddress) &&
((CandidateUpperAddress - Address) < (Address - CandidateLowerAddress))) ||
- (Type == EdbMatchSymbolTypeUpperAddress)) {
+ (Type == EdbMatchSymbolTypeUpperAddress))
+ {
//
// return nearest upper address
//
- *RetEntry = UpperEntry;
+ *RetEntry = UpperEntry;
*RetObject = UpperObject;
return CandidateUpperAddress;
}
@@ -597,17 +612,17 @@ EbdFindSymbolAddress (
**/
EFI_STATUS
EdbUnloadSymbol (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName
)
{
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- UINTN ObjectIndex;
- UINTN Index;
- EFI_DEBUGGER_SYMBOL_ENTRY *OldEntry;
- UINTN OldEntryCount;
- UINTN MaxEntryCount;
- VOID **OldSourceBuffer;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ UINTN ObjectIndex;
+ UINTN Index;
+ EFI_DEBUGGER_SYMBOL_ENTRY *OldEntry;
+ UINTN OldEntryCount;
+ UINTN MaxEntryCount;
+ VOID **OldSourceBuffer;
//
// Find Symbol
@@ -621,33 +636,34 @@ EdbUnloadSymbol (
//
// Record old data
//
- Object = DebuggerPrivate->DebuggerSymbolContext.Object;
- OldEntry = Object->Entry;
+ Object = DebuggerPrivate->DebuggerSymbolContext.Object;
+ OldEntry = Object->Entry;
OldSourceBuffer = Object->SourceBuffer;
- MaxEntryCount = Object->MaxEntryCount;
- OldEntryCount = Object->EntryCount;
+ MaxEntryCount = Object->MaxEntryCount;
+ OldEntryCount = Object->EntryCount;
//
// Remove the matched Object
//
for (Index = ObjectIndex; Index < DebuggerPrivate->DebuggerSymbolContext.ObjectCount - 1; Index++) {
- CopyMem (&Object[Index], &Object[Index + 1], sizeof(EFI_DEBUGGER_SYMBOL_OBJECT));
+ CopyMem (&Object[Index], &Object[Index + 1], sizeof (EFI_DEBUGGER_SYMBOL_OBJECT));
}
- ZeroMem (&Object[Index], sizeof(Object[Index]));
+
+ ZeroMem (&Object[Index], sizeof (Object[Index]));
//
// Move old data to new place
//
- Object[Index].Entry = OldEntry;
- Object[Index].SourceBuffer = OldSourceBuffer;
+ Object[Index].Entry = OldEntry;
+ Object[Index].SourceBuffer = OldSourceBuffer;
Object[Index].MaxEntryCount = MaxEntryCount;
- DebuggerPrivate->DebuggerSymbolContext.ObjectCount --;
+ DebuggerPrivate->DebuggerSymbolContext.ObjectCount--;
//
// Clean old entry data
//
for (Index = 0; Index < OldEntryCount; Index++) {
- ZeroMem (&OldEntry[Index], sizeof(OldEntry[Index]));
+ ZeroMem (&OldEntry[Index], sizeof (OldEntry[Index]));
}
//
@@ -675,14 +691,14 @@ EdbUnloadSymbol (
**/
EFI_STATUS
EdbLoadSymbol (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
)
{
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- EFI_STATUS Status;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ EFI_STATUS Status;
//
// Check duplicated File
@@ -690,7 +706,7 @@ EdbLoadSymbol (
Object = EdbFindSymbolFile (DebuggerPrivate, FileName, NULL);
if (Object != NULL) {
Status = EdbUnloadSymbol (DebuggerPrivate, FileName);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Unload Duplicated Symbol File Error!\n"));
return Status;
}
@@ -712,7 +728,7 @@ EdbLoadSymbol (
//
// Init Object
//
- Object->EntryCount = 0;
+ Object->EntryCount = 0;
Object->MaxEntryCount = EFI_DEBUGGER_SYMBOL_ENTRY_MAX;
//
@@ -727,14 +743,18 @@ EdbLoadSymbol (
//
// Fill Object value
//
- StrnCpyS (Object->Name, sizeof(Object->Name) / sizeof(CHAR16),
- FileName, (sizeof(Object->Name) / sizeof(CHAR16)) - 1);
+ StrnCpyS (
+ Object->Name,
+ sizeof (Object->Name) / sizeof (CHAR16),
+ FileName,
+ (sizeof (Object->Name) / sizeof (CHAR16)) - 1
+ );
Object->BaseAddress = 0;
//
// Increase the object count
//
- DebuggerPrivate->DebuggerSymbolContext.ObjectCount ++;
+ DebuggerPrivate->DebuggerSymbolContext.ObjectCount++;
return EFI_SUCCESS;
}
@@ -751,25 +771,25 @@ EdbLoadSymbol (
**/
CHAR8 *
GetPdbPath (
- VOID *ImageBase
+ VOID *ImageBase
)
{
- CHAR8 *PdbPath;
- UINT32 DirCount;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
- EFI_IMAGE_OPTIONAL_HEADER32 *OptionalHdr32;
- EFI_IMAGE_OPTIONAL_HEADER64 *OptionalHdr64;
- EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
- EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
- VOID *CodeViewEntryPointer;
+ CHAR8 *PdbPath;
+ UINT32 DirCount;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
+ EFI_IMAGE_OPTIONAL_HEADER32 *OptionalHdr32;
+ EFI_IMAGE_OPTIONAL_HEADER64 *OptionalHdr64;
+ EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
+ VOID *CodeViewEntryPointer;
//
// Init value
//
- CodeViewEntryPointer = NULL;
- PdbPath = NULL;
- DosHdr = ImageBase;
+ CodeViewEntryPointer = NULL;
+ PdbPath = NULL;
+ DosHdr = ImageBase;
//
// Check magic
@@ -777,7 +797,8 @@ GetPdbPath (
if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
return NULL;
}
- NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINT8 *) DosHdr + DosHdr->e_lfanew);
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINT8 *)DosHdr + DosHdr->e_lfanew);
//
// Check Machine, filter for EBC
//
@@ -793,39 +814,42 @@ GetPdbPath (
// EBC spec says PE32+, but implementation uses PE32. So check dynamically here.
//
if (NtHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
- OptionalHdr32 = (VOID *) &NtHdr->Pe32.OptionalHeader;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHdr32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ OptionalHdr32 = (VOID *)&NtHdr->Pe32.OptionalHeader;
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHdr32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
} else if (NtHdr->Pe32Plus.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
- OptionalHdr64 = (VOID *) &NtHdr->Pe32Plus.OptionalHeader;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHdr64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ OptionalHdr64 = (VOID *)&NtHdr->Pe32Plus.OptionalHeader;
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHdr64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
} else {
return NULL;
}
+
if (DirectoryEntry->VirtualAddress == 0) {
return NULL;
}
+
//
// Go through DirectoryEntry
//
for (DirCount = 0;
(DirCount < DirectoryEntry->Size / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) && CodeViewEntryPointer == NULL;
DirCount++
- ) {
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (DirectoryEntry->VirtualAddress + (UINTN) ImageBase + DirCount * sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
+ )
+ {
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)(DirectoryEntry->VirtualAddress + (UINTN)ImageBase + DirCount * sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
//
// Match DebugEntry, only CODEVIEW_SIGNATURE_NB10 and CODEVIEW_SIGNATURE_RSDS are supported.
//
- CodeViewEntryPointer = (VOID *) ((UINTN) DebugEntry->RVA + (UINTN) ImageBase);
- switch (*(UINT32 *) CodeViewEntryPointer) {
- case CODEVIEW_SIGNATURE_NB10:
- PdbPath = (CHAR8 *) CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
- break;
- case CODEVIEW_SIGNATURE_RSDS:
- PdbPath = (CHAR8 *) CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
- break;
- default:
- break;
+ CodeViewEntryPointer = (VOID *)((UINTN)DebugEntry->RVA + (UINTN)ImageBase);
+ switch (*(UINT32 *)CodeViewEntryPointer) {
+ case CODEVIEW_SIGNATURE_NB10:
+ PdbPath = (CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
+ break;
+ case CODEVIEW_SIGNATURE_RSDS:
+ PdbPath = (CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
+ break;
+ default:
+ break;
}
}
}
@@ -853,10 +877,10 @@ MatchPdbAndMap (
IN CHAR16 *MapFileName
)
{
- UINTN PdbNameSize;
- UINTN MapNameSize;
- CHAR8 *PurePdbFileName;
- UINTN Index;
+ UINTN PdbNameSize;
+ UINTN MapNameSize;
+ CHAR8 *PurePdbFileName;
+ UINTN Index;
//
// remove dir name
@@ -867,6 +891,7 @@ MatchPdbAndMap (
PurePdbFileName = &PdbFileName[Index + 1];
}
}
+
PdbFileName = PurePdbFileName;
//
@@ -895,9 +920,9 @@ MatchPdbAndMap (
// BUGBUG: work-around start
//
typedef struct {
- EFI_DEBUG_IMAGE_INFO *EfiDebugImageInfoTable;
- volatile UINT32 UpdateStatus;
- UINT32 TableSize;
+ EFI_DEBUG_IMAGE_INFO *EfiDebugImageInfoTable;
+ volatile UINT32 UpdateStatus;
+ UINT32 TableSize;
} EFI_DEBUG_IMAGE_INFO_TABLE_HEADER_OLD;
EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugImageInfoTableHeader;
@@ -932,7 +957,7 @@ For compatibility consideration, we handle 2 cases:
**/
VOID
EdbFixDebugImageInfoTable (
- IN OUT EFI_DEBUG_IMAGE_INFO_TABLE_HEADER **DebugImageInfoTableHeader
+ IN OUT EFI_DEBUG_IMAGE_INFO_TABLE_HEADER **DebugImageInfoTableHeader
)
{
mDebugImageInfoTableHeader.EfiDebugImageInfoTable = ((EFI_DEBUG_IMAGE_INFO_TABLE_HEADER_OLD *)(*DebugImageInfoTableHeader))->EfiDebugImageInfoTable;
@@ -941,16 +966,17 @@ EdbFixDebugImageInfoTable (
if ((*DebugImageInfoTableHeader)->UpdateStatus > 3) {
*DebugImageInfoTableHeader = &mDebugImageInfoTableHeader;
- return ;
+ return;
}
if ((*DebugImageInfoTableHeader)->TableSize % (EFI_PAGE_SIZE / (sizeof (VOID *))) != 0) {
*DebugImageInfoTableHeader = &mDebugImageInfoTableHeader;
- return ;
+ return;
}
- return ;
+ return;
}
+
//
// BUGBUG: work-around end
//
@@ -969,20 +995,20 @@ EdbFixDebugImageInfoTable (
**/
EFI_STATUS
EdbPatchSymbolRVA (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName,
- IN EDB_EBC_IMAGE_RVA_SEARCH_TYPE SearchType
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName,
+ IN EDB_EBC_IMAGE_RVA_SEARCH_TYPE SearchType
)
{
- EFI_STATUS Status;
- UINTN ImageNumber;
- EFI_DEBUG_IMAGE_INFO *ImageTable;
- CHAR8 *PdbPath;
- VOID *ImageBase;
- VOID *CandidateImageBase;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
-
- if (SearchType < 0 || SearchType >= EdbEbcImageRvaSearchTypeMax) {
+ EFI_STATUS Status;
+ UINTN ImageNumber;
+ EFI_DEBUG_IMAGE_INFO *ImageTable;
+ CHAR8 *PdbPath;
+ VOID *ImageBase;
+ VOID *CandidateImageBase;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+
+ if ((SearchType < 0) || (SearchType >= EdbEbcImageRvaSearchTypeMax)) {
return EFI_INVALID_PARAMETER;
}
@@ -1000,13 +1026,14 @@ EdbPatchSymbolRVA (
if (mDebuggerPrivate.DebugImageInfoTableHeader == NULL) {
Status = EfiGetSystemConfigurationTable (
&gEfiDebugImageInfoTableGuid,
- (VOID **) &mDebuggerPrivate.DebugImageInfoTableHeader
+ (VOID **)&mDebuggerPrivate.DebugImageInfoTableHeader
);
if (EFI_ERROR (Status)) {
EDBPrint (L"DebugImageInfoTable not found!\n");
return Status;
}
}
+
DEBUG ((DEBUG_ERROR, "DebugImageInfoTableHeader: %x\n", mDebuggerPrivate.DebugImageInfoTableHeader));
//
@@ -1021,31 +1048,34 @@ EdbPatchSymbolRVA (
// Go through DebugImageInfoTable for each Image
//
CandidateImageBase = NULL;
- ImageTable = mDebuggerPrivate.DebugImageInfoTableHeader->EfiDebugImageInfoTable;
+ ImageTable = mDebuggerPrivate.DebugImageInfoTableHeader->EfiDebugImageInfoTable;
for (ImageNumber = 0; ImageNumber < mDebuggerPrivate.DebugImageInfoTableHeader->TableSize; ImageNumber++) {
if (ImageTable[ImageNumber].NormalImage == NULL) {
continue;
}
+
ImageBase = ImageTable[ImageNumber].NormalImage->LoadedImageProtocolInstance->ImageBase;
//
// Get PDB path
//
- PdbPath = GetPdbPath (ImageBase);
+ PdbPath = GetPdbPath (ImageBase);
if (PdbPath == NULL) {
continue;
}
+
//
// Check PDB name
//
if (!MatchPdbAndMap (PdbPath, FileName)) {
continue;
}
+
DEBUG ((DEBUG_ERROR, "ImageBase: %x\n", ImageBase));
//
// Check SearchType
//
- if (SearchType == EdbEbcImageRvaSearchTypeAny || SearchType == EdbEbcImageRvaSearchTypeFirst) {
+ if ((SearchType == EdbEbcImageRvaSearchTypeAny) || (SearchType == EdbEbcImageRvaSearchTypeFirst)) {
//
// Assign base address and return
//
@@ -1066,6 +1096,7 @@ EdbPatchSymbolRVA (
if (CandidateImageBase == NULL) {
return EFI_NOT_FOUND;
}
+
//
// Assign base address and return
//
@@ -1096,10 +1127,10 @@ MatchObjAndCod (
IN CHAR16 *CodFileName
)
{
- UINTN ObjNameSize;
- UINTN CodNameSize;
- CHAR8 *PureObjFileName;
- UINTN Index;
+ UINTN ObjNameSize;
+ UINTN CodNameSize;
+ CHAR8 *PureObjFileName;
+ UINTN Index;
//
// remove library name
@@ -1111,6 +1142,7 @@ MatchObjAndCod (
break;
}
}
+
ObjFileName = PureObjFileName;
//
@@ -1164,30 +1196,30 @@ typedef enum {
**/
CHAR8 *
EdbLoadCodBySymbolByIec (
- IN CHAR8 *Name,
- IN VOID *Buffer,
- IN UINTN BufferSize,
- OUT UINTN *CodeBufferSize,
- OUT UINTN *FuncOffset
+ IN CHAR8 *Name,
+ IN VOID *Buffer,
+ IN UINTN BufferSize,
+ OUT UINTN *CodeBufferSize,
+ OUT UINTN *FuncOffset
)
{
- CHAR8 *LineBuffer;
- CHAR8 *FieldBuffer;
- VOID *BufferStart;
- VOID *BufferEnd;
- UINTN Offset;
- EDB_EBC_COD_PARSE_STATE CodParseState;
- CHAR8 Char[2];
+ CHAR8 *LineBuffer;
+ CHAR8 *FieldBuffer;
+ VOID *BufferStart;
+ VOID *BufferEnd;
+ UINTN Offset;
+ EDB_EBC_COD_PARSE_STATE CodParseState;
+ CHAR8 Char[2];
//
// Init
//
- Char[0] = 9;
- Char[1] = 0;
- LineBuffer = AsciiStrGetNewTokenLine (Buffer, "\n\r");
- Offset = (UINTN)-1;
- BufferStart = NULL;
- BufferEnd = NULL;
+ Char[0] = 9;
+ Char[1] = 0;
+ LineBuffer = AsciiStrGetNewTokenLine (Buffer, "\n\r");
+ Offset = (UINTN)-1;
+ BufferStart = NULL;
+ BufferEnd = NULL;
CodParseState = EdbEbcCodParseStateUninitialized;
//
@@ -1195,97 +1227,101 @@ EdbLoadCodBySymbolByIec (
//
while (LineBuffer != NULL) {
switch (CodParseState) {
- case EdbEbcCodParseStateUninitialized:
- //
- // check mark_begin, begin to check line after this match
- //
- if (AsciiStrCmp (LineBuffer, "; mark_begin;") == 0) {
- CodParseState = EdbEbcCodParseStateSymbolInitialized;
- }
- LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
- PatchForAsciiStrTokenBefore (LineBuffer, '\n');
- break;
+ case EdbEbcCodParseStateUninitialized:
+ //
+ // check mark_begin, begin to check line after this match
+ //
+ if (AsciiStrCmp (LineBuffer, "; mark_begin;") == 0) {
+ CodParseState = EdbEbcCodParseStateSymbolInitialized;
+ }
- case EdbEbcCodParseStateSymbolInitialized:
- //
- // check mark_end, not check line after this match
- //
- if (AsciiStrCmp (LineBuffer, "; mark_end;") == 0) {
- CodParseState = EdbEbcCodParseStateUninitialized;
LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
PatchForAsciiStrTokenBefore (LineBuffer, '\n');
break;
- }
- //
- // not check this line if the first char is as follows
- //
- if ((*LineBuffer == 0) ||
- (*LineBuffer == '$') ||
- (*LineBuffer == ';') ||
- (*LineBuffer == '_') ||
- (*LineBuffer == ' ')) {
+ case EdbEbcCodParseStateSymbolInitialized:
+ //
+ // check mark_end, not check line after this match
+ //
+ if (AsciiStrCmp (LineBuffer, "; mark_end;") == 0) {
+ CodParseState = EdbEbcCodParseStateUninitialized;
+ LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
+ PatchForAsciiStrTokenBefore (LineBuffer, '\n');
+ break;
+ }
+
+ //
+ // not check this line if the first char is as follows
+ //
+ if ((*LineBuffer == 0) ||
+ (*LineBuffer == '$') ||
+ (*LineBuffer == ';') ||
+ (*LineBuffer == '_') ||
+ (*LineBuffer == ' '))
+ {
+ LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
+ PatchForAsciiStrTokenBefore (LineBuffer, '\n');
+ break;
+ }
+
+ //
+ // get function name, function name is followed by char 0x09.
+ //
+ FieldBuffer = AsciiStrGetNewTokenField (LineBuffer, Char);
+ ASSERT (FieldBuffer != NULL);
+ if (AsciiStriCmp (FieldBuffer, Name) == 0) {
+ BufferStart = FieldBuffer;
+ CodParseState = EdbEbcCodParseStateSymbolStart;
+ }
+
+ PatchForAsciiStrTokenAfter (FieldBuffer, 0x9);
+
+ //
+ // Get next line
+ //
LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
PatchForAsciiStrTokenBefore (LineBuffer, '\n');
break;
- }
- //
- // get function name, function name is followed by char 0x09.
- //
- FieldBuffer = AsciiStrGetNewTokenField (LineBuffer, Char);
- ASSERT (FieldBuffer != NULL);
- if (AsciiStriCmp (FieldBuffer, Name) == 0) {
- BufferStart = FieldBuffer;
- CodParseState = EdbEbcCodParseStateSymbolStart;
- }
- PatchForAsciiStrTokenAfter (FieldBuffer, 0x9);
-
- //
- // Get next line
- //
- LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
- PatchForAsciiStrTokenBefore (LineBuffer, '\n');
- break;
-
- case EdbEbcCodParseStateSymbolStart:
- //
- // check mark_end, if this match, means the function is found successfully.
- //
- if (AsciiStrCmp (LineBuffer, "; mark_end;") == 0) {
- CodParseState = EdbEbcCodParseStateSymbolEnd;
+ case EdbEbcCodParseStateSymbolStart:
//
- // prepare CodeBufferSize, FuncOffset, and FuncStart to return
+ // check mark_end, if this match, means the function is found successfully.
//
- BufferEnd = LineBuffer + sizeof("; mark_end;") - 1;
- *CodeBufferSize = (UINTN)BufferEnd - (UINTN)BufferStart;
- *FuncOffset = Offset;
- PatchForAsciiStrTokenAfter (LineBuffer, '\n');
- return BufferStart;
- }
+ if (AsciiStrCmp (LineBuffer, "; mark_end;") == 0) {
+ CodParseState = EdbEbcCodParseStateSymbolEnd;
+ //
+ // prepare CodeBufferSize, FuncOffset, and FuncStart to return
+ //
+ BufferEnd = LineBuffer + sizeof ("; mark_end;") - 1;
+ *CodeBufferSize = (UINTN)BufferEnd - (UINTN)BufferStart;
+ *FuncOffset = Offset;
+ PatchForAsciiStrTokenAfter (LineBuffer, '\n');
+ return BufferStart;
+ }
- //
- // Get function offset
- //
- if ((Offset == (UINTN)-1) &&
- (*LineBuffer == ' ')) {
- FieldBuffer = AsciiStrGetNewTokenField (LineBuffer + 2, " ");
- Offset = AsciiXtoi (FieldBuffer);
- PatchForAsciiStrTokenAfter (FieldBuffer, ' ');
- }
+ //
+ // Get function offset
+ //
+ if ((Offset == (UINTN)-1) &&
+ (*LineBuffer == ' '))
+ {
+ FieldBuffer = AsciiStrGetNewTokenField (LineBuffer + 2, " ");
+ Offset = AsciiXtoi (FieldBuffer);
+ PatchForAsciiStrTokenAfter (FieldBuffer, ' ');
+ }
- //
- // Get next line
- //
- LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
- PatchForAsciiStrTokenBefore (LineBuffer, '\n');
- break;
+ //
+ // Get next line
+ //
+ LineBuffer = AsciiStrGetNextTokenLine ("\n\r");
+ PatchForAsciiStrTokenBefore (LineBuffer, '\n');
+ break;
- case EdbEbcCodParseStateSymbolEnd:
- break;
+ case EdbEbcCodParseStateSymbolEnd:
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -1310,11 +1346,11 @@ EdbLoadCodBySymbolByIec (
**/
CHAR8 *
EdbLoadCodBySymbol (
- IN CHAR8 *Name,
- IN VOID *Buffer,
- IN UINTN BufferSize,
- OUT UINTN *CodeBufferSize,
- OUT UINTN *FuncOffset
+ IN CHAR8 *Name,
+ IN VOID *Buffer,
+ IN UINTN BufferSize,
+ OUT UINTN *CodeBufferSize,
+ OUT UINTN *FuncOffset
)
{
//
@@ -1342,7 +1378,7 @@ EdbFindCodeFromObject (
IN CHAR16 *FileName
)
{
- UINTN EntryIndex;
+ UINTN EntryIndex;
//
// Go througn each Entry in this Object
@@ -1352,21 +1388,25 @@ EdbFindCodeFromObject (
// This check is for Function only
//
if ((Object->Entry[EntryIndex].Type != EfiDebuggerSymbolFunction) &&
- (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction)) {
+ (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction))
+ {
continue;
}
+
//
// Skip match varbss_init function, because they has no source code
//
- if (AsciiStrnCmp (Object->Entry[EntryIndex].Name, "varbss_init", sizeof("varbss_init") - 1) == 0) {
+ if (AsciiStrnCmp (Object->Entry[EntryIndex].Name, "varbss_init", sizeof ("varbss_init") - 1) == 0) {
continue;
}
+
//
// check the name
//
if (!MatchObjAndCod (Object->Entry[EntryIndex].ObjName, FileName)) {
continue;
}
+
//
// found it, return source buffer
//
@@ -1396,18 +1436,18 @@ EdbFindCodeFromObject (
**/
EFI_STATUS
EdbLoadCode (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *FileName,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *FileName,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
)
{
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- UINTN ObjectIndex;
- UINTN EntryIndex;
- VOID *SourceBuffer;
- EFI_STATUS Status;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ UINTN ObjectIndex;
+ UINTN EntryIndex;
+ VOID *SourceBuffer;
+ EFI_STATUS Status;
//
// Find Symbol
@@ -1426,12 +1466,13 @@ EdbLoadCode (
// unnload duplicated code
//
Status = EdbUnloadCode (DebuggerPrivate, MapFileName, FileName, &SourceBuffer);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Unload Duplicated Code File Error!\n"));
return Status;
}
+
Status = EdbDeleteCodeBuffer (DebuggerPrivate, MapFileName, FileName, SourceBuffer);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Delete Duplicated Code File Error!\n"));
return Status;
}
@@ -1446,21 +1487,25 @@ EdbLoadCode (
// load symbol for function only
//
if ((Object->Entry[EntryIndex].Type != EfiDebuggerSymbolFunction) &&
- (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction)) {
+ (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction))
+ {
continue;
}
+
//
// skip varbss_init
//
- if (AsciiStrnCmp (Object->Entry[EntryIndex].Name, "varbss_init", sizeof("varbss_init") - 1) == 0) {
+ if (AsciiStrnCmp (Object->Entry[EntryIndex].Name, "varbss_init", sizeof ("varbss_init") - 1) == 0) {
continue;
}
+
//
// Check the name
//
if (!MatchObjAndCod (Object->Entry[EntryIndex].ObjName, FileName)) {
continue;
}
+
//
// load code for this symbol
//
@@ -1483,7 +1528,7 @@ EdbLoadCode (
if (Object->Entry[EntryIndex].CodBuffer != NULL) {
*((UINT8 *)Object->Entry[EntryIndex].CodBuffer + Object->Entry[EntryIndex].CodBufferSize) = 0;
DEBUG ((DEBUG_ERROR, " CodeSymbol: %a, FuncOffset: 0x05%x\n", Object->Entry[EntryIndex].Name, Object->Entry[EntryIndex].FuncOffsetBase));
-// DEBUG ((DEBUG_ERROR, " [CODE]:\n%a\n", Object->Entry[EntryIndex].CodBuffer));
+ // DEBUG ((DEBUG_ERROR, " [CODE]:\n%a\n", Object->Entry[EntryIndex].CodBuffer));
}
}
@@ -1507,15 +1552,15 @@ EdbLoadCode (
**/
EFI_STATUS
EdbUnloadCode (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *FileName,
- OUT VOID **Buffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *FileName,
+ OUT VOID **Buffer
)
{
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
- UINTN ObjectIndex;
- UINTN EntryIndex;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ UINTN ObjectIndex;
+ UINTN EntryIndex;
//
// Find Symbol
@@ -1540,22 +1585,26 @@ EdbUnloadCode (
//
for (EntryIndex = 0; EntryIndex < Object->EntryCount; EntryIndex++) {
if ((Object->Entry[EntryIndex].Type != EfiDebuggerSymbolFunction) &&
- (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction)) {
+ (Object->Entry[EntryIndex].Type != EfiDebuggerSymbolStaticFunction))
+ {
continue;
}
- if (AsciiStrnCmp (Object->Entry[EntryIndex].Name, "varbss_init", sizeof("varbss_init") - 1) == 0) {
+
+ if (AsciiStrnCmp (Object->Entry[EntryIndex].Name, "varbss_init", sizeof ("varbss_init") - 1) == 0) {
continue;
}
+
if (!MatchObjAndCod (Object->Entry[EntryIndex].ObjName, FileName)) {
continue;
}
+
//
// clean up the buffer
//
- Object->Entry[EntryIndex].CodBuffer = NULL;
- Object->Entry[EntryIndex].CodBufferSize = 0;
+ Object->Entry[EntryIndex].CodBuffer = NULL;
+ Object->Entry[EntryIndex].CodBufferSize = 0;
Object->Entry[EntryIndex].FuncOffsetBase = 0;
- Object->Entry[EntryIndex].SourceBuffer = NULL;
+ Object->Entry[EntryIndex].SourceBuffer = NULL;
}
//
@@ -1579,15 +1628,15 @@ EdbUnloadCode (
**/
EFI_STATUS
EdbAddCodeBuffer (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *CodeFileName,
- IN UINTN SourceBufferSize,
- IN VOID *SourceBuffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *CodeFileName,
+ IN UINTN SourceBufferSize,
+ IN VOID *SourceBuffer
)
{
- UINTN Index;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ UINTN Index;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
//
// Find Symbol
@@ -1602,8 +1651,8 @@ EdbAddCodeBuffer (
// Add it to last entry
//
for (Index = 0; Object->SourceBuffer[Index] != NULL; Index++) {
- ;
}
+
Object->SourceBuffer[Index] = SourceBuffer;
return EFI_SUCCESS;
@@ -1623,14 +1672,14 @@ EdbAddCodeBuffer (
**/
EFI_STATUS
EdbDeleteCodeBuffer (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *CodeFileName,
- IN VOID *SourceBuffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *CodeFileName,
+ IN VOID *SourceBuffer
)
{
- UINTN Index;
- EFI_DEBUGGER_SYMBOL_OBJECT *Object;
+ UINTN Index;
+ EFI_DEBUGGER_SYMBOL_OBJECT *Object;
//
// Find Symbol
@@ -1665,6 +1714,7 @@ EdbDeleteCodeBuffer (
for (Index = Index + 1; Object->SourceBuffer[Index] != NULL; Index++) {
Object->SourceBuffer[Index - 1] = Object->SourceBuffer[Index];
}
+
Object->SourceBuffer[Index - 1] = NULL;
return EFI_SUCCESS;
@@ -1681,7 +1731,7 @@ EdbDeleteCodeBuffer (
**/
CHAR8 *
FindSymbolStr (
- IN UINTN Address
+ IN UINTN Address
)
{
UINTN ObjectIndex;
@@ -1730,8 +1780,8 @@ FindSymbolStr (
**/
UINTN
EdbGetLineNumberAndOffsetFromThisLine (
- IN VOID *Line,
- OUT UINTN *Offset
+ IN VOID *Line,
+ OUT UINTN *Offset
)
{
UINTN LineNumber;
@@ -1740,7 +1790,7 @@ EdbGetLineNumberAndOffsetFromThisLine (
LineNumber = (UINTN)-1;
LineBuffer = Line;
- *Offset = (UINTN)-1;
+ *Offset = (UINTN)-1;
while (LineBuffer != NULL) {
//
@@ -1756,7 +1806,7 @@ EdbGetLineNumberAndOffsetFromThisLine (
if (*(LineBuffer + 2) != ' ') {
if (*Offset == (UINTN)-1) {
FieldBuffer = AsciiStrGetNewTokenField (LineBuffer + 2, " ");
- *Offset = AsciiXtoi (FieldBuffer);
+ *Offset = AsciiXtoi (FieldBuffer);
PatchForAsciiStrTokenAfter (FieldBuffer, ' ');
}
}
@@ -1779,6 +1829,7 @@ EdbGetLineNumberAndOffsetFromThisLine (
PatchForAsciiStrTokenBefore (LineBuffer, '\n');
continue;
}
+
//
// 3. line number
//
@@ -1835,14 +1886,14 @@ EdbGetLineNumberFromCode (
UINTN CandidateLineNumber;
UINTN CandidateOffset;
- if (SearchType < 0 || SearchType >= EdbEbcLineSearchTypeMax) {
+ if ((SearchType < 0) || (SearchType >= EdbEbcLineSearchTypeMax)) {
return (UINTN)-1;
}
- LineNumber = (UINTN)-1;
+ LineNumber = (UINTN)-1;
CandidateLineNumber = (UINTN)-1;
- CandidateOffset = (UINTN)-1;
- LineBuffer = AsciiStrGetNewTokenLine (Entry->CodBuffer, "\n");
+ CandidateOffset = (UINTN)-1;
+ LineBuffer = AsciiStrGetNewTokenLine (Entry->CodBuffer, "\n");
while (LineBuffer != NULL) {
if (*LineBuffer != ' ') {
LineBuffer = AsciiStrGetNextTokenLine ("\n");
@@ -1904,7 +1955,7 @@ EdbGetLineNumberFromCode (
}
CandidateLineNumber = LineNumber;
- CandidateOffset = Offset;
+ CandidateOffset = Offset;
LineBuffer = AsciiStrGetNextTokenLine ("\n");
PatchForAsciiStrTokenBefore (LineBuffer, '\n');
@@ -1945,7 +1996,7 @@ EdbGetSourceStrFromCodeByLine (
VOID *FuncStart;
UINTN Number;
- FuncStart = NULL;
+ FuncStart = NULL;
LineBuffer = AsciiStrGetNewTokenLine (Entry->CodBuffer, "\n");
while (LineBuffer != NULL) {
if (*LineBuffer != ';') {
@@ -1957,6 +2008,7 @@ EdbGetSourceStrFromCodeByLine (
PatchForAsciiStrTokenAfter (LineBuffer, '\n');
return FuncStart;
}
+
LineBuffer = AsciiStrGetNextTokenLine ("\n");
PatchForAsciiStrTokenBefore (LineBuffer, '\n');
continue;
@@ -1966,7 +2018,7 @@ EdbGetSourceStrFromCodeByLine (
// Check LineNumber
//
FieldBuffer = AsciiStrGetNewTokenField (LineBuffer + 1, " ");
- Number = AsciiAtoi (FieldBuffer);
+ Number = AsciiAtoi (FieldBuffer);
PatchForAsciiStrTokenAfter (FieldBuffer, ' ');
if (Number != LineNumber) {
LineBuffer = AsciiStrGetNextTokenLine ("\n");
@@ -2032,25 +2084,25 @@ EdbGetSourceStrFromCode (
**/
UINTN
EdbPrintSource (
- IN UINTN Address,
- IN BOOLEAN IsPrint
+ IN UINTN Address,
+ IN BOOLEAN IsPrint
)
{
- UINTN SymbolAddress;
- EFI_DEBUGGER_SYMBOL_OBJECT *RetObject;
- EFI_DEBUGGER_SYMBOL_ENTRY *RetEntry;
- UINTN FuncOffset;
- UINT8 *FuncStart;
- UINT8 *FuncEnd;
- UINT8 *FuncIndex;
- CHAR8 Buffer[EFI_DEBUG_MAX_PRINT_BUFFER];
- UINTN BufferSize;
+ UINTN SymbolAddress;
+ EFI_DEBUGGER_SYMBOL_OBJECT *RetObject;
+ EFI_DEBUGGER_SYMBOL_ENTRY *RetEntry;
+ UINTN FuncOffset;
+ UINT8 *FuncStart;
+ UINT8 *FuncEnd;
+ UINT8 *FuncIndex;
+ CHAR8 Buffer[EFI_DEBUG_MAX_PRINT_BUFFER];
+ UINTN BufferSize;
//
// need we display symbol
//
if (!mDebuggerPrivate.DebuggerSymbolContext.DisplaySymbol) {
- return 0 ;
+ return 0;
}
//
@@ -2062,8 +2114,8 @@ EdbPrintSource (
&RetObject,
&RetEntry
);
- if (SymbolAddress == 0 || RetEntry == NULL) {
- return 0 ;
+ if ((SymbolAddress == 0) || (RetEntry == NULL)) {
+ return 0;
}
FuncOffset = Address - SymbolAddress + RetEntry->FuncOffsetBase;
@@ -2071,9 +2123,9 @@ EdbPrintSource (
//
// Get Func String
//
- FuncStart = EdbGetSourceStrFromCode (RetEntry, FuncOffset, (VOID**) &FuncEnd);
+ FuncStart = EdbGetSourceStrFromCode (RetEntry, FuncOffset, (VOID **)&FuncEnd);
if (FuncStart == NULL) {
- return 0 ;
+ return 0;
}
//
@@ -2096,15 +2148,17 @@ EdbPrintSource (
} else {
BufferSize = EFI_DEBUG_MAX_PRINT_BUFFER - 3;
}
+
if (BufferSize != 0) {
CopyMem (Buffer, FuncStart, BufferSize);
}
+
Buffer[BufferSize] = 0;
EDBPrint (L"%a\n", Buffer);
FuncStart = FuncIndex + 1;
FuncIndex = FuncStart;
} else {
- FuncIndex ++;
+ FuncIndex++;
}
}
@@ -2113,7 +2167,7 @@ EdbPrintSource (
//
*(UINT8 *)FuncEnd = '\n';
- return 1 ;
+ return 1;
}
/**
@@ -2135,7 +2189,7 @@ GetMapfileAndSymbol (
CHAR16 *Ch;
*MapfileName = NULL;
- *SymbolName = Symbol;
+ *SymbolName = Symbol;
for (Ch = Symbol; *Ch != 0; Ch++) {
//
@@ -2143,13 +2197,13 @@ GetMapfileAndSymbol (
//
if (*Ch == L':') {
*MapfileName = Symbol;
- *Ch = 0;
- *SymbolName = Ch + 1;
+ *Ch = 0;
+ *SymbolName = Ch + 1;
break;
}
}
- return ;
+ return;
}
/**
@@ -2166,8 +2220,8 @@ GetMapfileAndSymbol (
**/
EFI_STATUS
Symboltoi (
- IN CHAR16 *Symbol,
- OUT UINTN *Address
+ IN CHAR16 *Symbol,
+ OUT UINTN *Address
)
{
UINTN ObjectIndex;
@@ -2194,6 +2248,7 @@ Symboltoi (
if ((MapfileName != NULL) && (StriCmp (Object[ObjectIndex].Name, MapfileName) != 0)) {
continue;
}
+
//
// Go through each entry
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.h b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.h
index f82e5b76c7..a82e9439b6 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.h
@@ -47,10 +47,10 @@ typedef enum {
**/
UINTN
EbdFindSymbolAddress (
- IN UINTN Address,
- IN EDB_MATCH_SYMBOL_TYPE Type,
- OUT EFI_DEBUGGER_SYMBOL_OBJECT **Object,
- OUT EFI_DEBUGGER_SYMBOL_ENTRY **Entry
+ IN UINTN Address,
+ IN EDB_MATCH_SYMBOL_TYPE Type,
+ OUT EFI_DEBUGGER_SYMBOL_OBJECT **Object,
+ OUT EFI_DEBUGGER_SYMBOL_ENTRY **Entry
);
/**
@@ -67,10 +67,10 @@ EbdFindSymbolAddress (
**/
EFI_STATUS
EdbLoadSymbol (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
);
/**
@@ -85,8 +85,8 @@ EdbLoadSymbol (
**/
EFI_STATUS
EdbUnloadSymbol (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName
);
/**
@@ -103,9 +103,9 @@ EdbUnloadSymbol (
**/
EFI_STATUS
EdbPatchSymbolRVA (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *FileName,
- IN EDB_EBC_IMAGE_RVA_SEARCH_TYPE SearchType
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *FileName,
+ IN EDB_EBC_IMAGE_RVA_SEARCH_TYPE SearchType
);
/**
@@ -123,11 +123,11 @@ EdbPatchSymbolRVA (
**/
EFI_STATUS
EdbLoadCode (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *FileName,
- IN UINTN BufferSize,
- IN VOID *Buffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *FileName,
+ IN UINTN BufferSize,
+ IN VOID *Buffer
);
/**
@@ -144,10 +144,10 @@ EdbLoadCode (
**/
EFI_STATUS
EdbUnloadCode (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *FileName,
- OUT VOID **Buffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *FileName,
+ OUT VOID **Buffer
);
/**
@@ -165,11 +165,11 @@ EdbUnloadCode (
**/
EFI_STATUS
EdbAddCodeBuffer (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *CodeFileName,
- IN UINTN SourceBufferSize,
- IN VOID *SourceBuffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *CodeFileName,
+ IN UINTN SourceBufferSize,
+ IN VOID *SourceBuffer
);
/**
@@ -186,10 +186,10 @@ EdbAddCodeBuffer (
**/
EFI_STATUS
EdbDeleteCodeBuffer (
- IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
- IN CHAR16 *MapFileName,
- IN CHAR16 *CodeFileName,
- IN VOID *SourceBuffer
+ IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
+ IN CHAR16 *MapFileName,
+ IN CHAR16 *CodeFileName,
+ IN VOID *SourceBuffer
);
/**
@@ -203,7 +203,7 @@ EdbDeleteCodeBuffer (
**/
CHAR8 *
FindSymbolStr (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -219,8 +219,8 @@ FindSymbolStr (
**/
UINTN
EdbPrintSource (
- IN UINTN Address,
- IN BOOLEAN IsPrint
+ IN UINTN Address,
+ IN BOOLEAN IsPrint
);
/**
@@ -237,8 +237,8 @@ EdbPrintSource (
**/
EFI_STATUS
Symboltoi (
- IN CHAR16 *Symbol,
- OUT UINTN *Address
+ IN CHAR16 *Symbol,
+ OUT UINTN *Address
);
#endif