11CHAR16 *mBranchTypeStr[] = {
30 IN EFI_DEBUGGER_BRANCH_TYPE Type
33 if ((Type < 0) || (Type >= EfiDebuggerBranchTypeEbcMax)) {
34 return L
"(Unknown Type)";
37 return mBranchTypeStr[Type];
54 IN CHAR16 *CommandArg,
64 BOOLEAN ShowParameter;
65 UINTN ParameterNumber;
67 ShowParameter =
FALSE;
68 ParameterNumber = EFI_DEBUGGER_CALL_DEFAULT_PARAMETER;
73 if (CommandArg !=
NULL) {
74 if (
StriCmp (CommandArg, L
"c") == 0) {
78 DebuggerPrivate->CallStackEntryCount = 0;
79 ZeroMem (DebuggerPrivate->CallStackEntry, sizeof (DebuggerPrivate->CallStackEntry));
80 EDBPrint (L
"Call-Stack is cleared\n");
81 return EFI_DEBUG_CONTINUE;
82 }
else if (
StriCmp (CommandArg, L
"p") == 0) {
88 if (CommandArg !=
NULL) {
92 ParameterNumber =
Atoi (CommandArg);
93 if (ParameterNumber > 16) {
94 EDBPrint (L
"Call-Stack argument Invalid\n");
95 return EFI_DEBUG_CONTINUE;
99 EDBPrint (L
"Call-Stack argument Invalid\n");
100 return EFI_DEBUG_CONTINUE;
107 if (DebuggerPrivate->CallStackEntryCount == 0) {
109 return EFI_DEBUG_CONTINUE;
110 }
else if (DebuggerPrivate->CallStackEntryCount > EFI_DEBUGGER_CALLSTACK_MAX) {
111 EDBPrint (L
"Call-Stack Crash, re-initialize!\n");
112 DebuggerPrivate->CallStackEntryCount = 0;
113 return EFI_DEBUG_CONTINUE;
120 EDBPrint (L
" Caller Callee Name\n");
121 EDBPrint (L
" ================== ================== ========\n");
123 for (Index = (
INTN)(DebuggerPrivate->CallStackEntryCount - 1); Index >= 0; Index--) {
127 CallStackEntry = &DebuggerPrivate->CallStackEntry[Index];
129 L
" 0x%016lx 0x%016lx",
130 CallStackEntry->SourceAddress,
131 CallStackEntry->DestAddress
134 if (FuncName !=
NULL) {
144 if (
sizeof (
UINTN) ==
sizeof (UINT64)) {
146 L
" Parameter Address (0x%016lx) (\n",
147 CallStackEntry->ParameterAddr
149 if (ParameterNumber == 0) {
157 for (SubIndex = 0; SubIndex < ParameterNumber - 1; SubIndex++) {
158 if (SubIndex % 2 == 0) {
164 CallStackEntry->Parameter[SubIndex]
166 if (SubIndex % 2 == 1) {
171 if (SubIndex % 2 == 0) {
177 CallStackEntry->Parameter[SubIndex]
183 if ((((DebuggerPrivate->CallStackEntryCount - Index) % (16 / ParameterNumber)) == 0) &&
192 L
" Parameter Address (0x%08x) (\n",
193 CallStackEntry->ParameterAddr
195 if (ParameterNumber == 0) {
203 for (SubIndex = 0; SubIndex < ParameterNumber - 1; SubIndex++) {
204 if (SubIndex % 4 == 0) {
210 CallStackEntry->Parameter[SubIndex]
212 if (SubIndex % 4 == 3) {
217 if (SubIndex % 4 == 0) {
223 CallStackEntry->Parameter[SubIndex]
229 if ((((DebuggerPrivate->CallStackEntryCount - Index) % (32 / ParameterNumber)) == 0) &&
243 return EFI_DEBUG_CONTINUE;
260 IN CHAR16 *CommandArg,
271 if (CommandArg !=
NULL) {
272 if (
StriCmp (CommandArg, L
"c") == 0) {
276 DebuggerPrivate->TraceEntryCount = 0;
277 ZeroMem (DebuggerPrivate->TraceEntry, sizeof (DebuggerPrivate->TraceEntry));
278 EDBPrint (L
"Instruction Trace is cleared\n");
280 EDBPrint (L
"Trace argument Invalid\n");
283 return EFI_DEBUG_CONTINUE;
289 if (DebuggerPrivate->TraceEntryCount == 0) {
290 EDBPrint (L
"No Instruction Trace\n");
291 return EFI_DEBUG_CONTINUE;
292 }
else if (DebuggerPrivate->TraceEntryCount > EFI_DEBUGGER_TRACE_MAX) {
293 EDBPrint (L
"Instruction Trace Crash, re-initialize!\n");
294 DebuggerPrivate->TraceEntryCount = 0;
295 return EFI_DEBUG_CONTINUE;
301 EDBPrint (L
"Instruction Trace (->Latest):\n");
302 EDBPrint (L
" Source Addr Destination Addr Type\n");
303 EDBPrint (L
" ================== ================== ========\n");
305 for (Index = 0; Index < DebuggerPrivate->TraceEntryCount; Index++) {
307 L
" 0x%016lx 0x%016lx %s\n",
308 DebuggerPrivate->TraceEntry[Index].SourceAddress,
309 DebuggerPrivate->TraceEntry[Index].DestAddress,
317 return EFI_DEBUG_CONTINUE;
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_DEBUG_STATUS DebuggerInstructionBranch(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
CHAR16 * EdbBranchTypeToStr(IN EFI_DEBUGGER_BRANCH_TYPE Type)
EFI_DEBUG_STATUS DebuggerCallStack(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
BOOLEAN EFIAPI SetPageBreak(VOID)
CHAR16 *EFIAPI StrGetNextTokenLine(IN CHAR16 *CharSet)
UINTN EFIAPI Atoi(CHAR16 *Str)
UINTN EFIAPI EDBPrint(IN CONST CHAR16 *Format,...)
INTN EFIAPI StriCmp(IN CHAR16 *String, IN CHAR16 *String2)
CHAR8 * FindSymbolStr(IN UINTN Address)