26 if (GET_OPCODE (Address) != OPCODE_BREAK) {
30 if (GET_OPERANDS (Address) != 3) {
59 for (Index = 0; Index < DebuggerPrivate->DebuggerBreakpointCount; Index++) {
60 if (DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) {
96 EDBPrint (L
"Breakpoint duplicated!\n");
97 return EFI_ALREADY_STARTED;
104 EDBPrint (L
"Breakpoint can not be set on BREAK 3 instruction!\n");
105 return EFI_ALREADY_STARTED;
108 if (DebuggerPrivate->DebuggerBreakpointCount >= EFI_DEBUGGER_BREAKPOINT_MAX) {
109 EDBPrint (L
"Breakpoint out of resource!\n");
110 return EFI_OUT_OF_RESOURCES;
116 DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].BreakpointAddress = Address;
117 DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].State =
TRUE;
118 DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].OldInstruction = 0;
120 &DebuggerPrivate->DebuggerBreakpointContext[DebuggerPrivate->DebuggerBreakpointCount].OldInstruction,
125 DebuggerPrivate->DebuggerBreakpointCount++;
152 if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
153 (Index >= DebuggerPrivate->DebuggerBreakpointCount))
155 return EFI_NOT_FOUND;
161 for (BpIndex = Index; BpIndex < DebuggerPrivate->DebuggerBreakpointCount - 1; BpIndex++) {
163 &DebuggerPrivate->DebuggerBreakpointContext[BpIndex],
164 &DebuggerPrivate->DebuggerBreakpointContext[BpIndex + 1],
165 sizeof (DebuggerPrivate->DebuggerBreakpointContext[BpIndex])
170 &DebuggerPrivate->DebuggerBreakpointContext[BpIndex],
171 sizeof (DebuggerPrivate->DebuggerBreakpointContext[BpIndex])
174 DebuggerPrivate->DebuggerBreakpointCount--;
199 if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
200 (Index >= DebuggerPrivate->DebuggerBreakpointCount))
202 return EFI_NOT_FOUND;
208 DebuggerPrivate->DebuggerBreakpointContext[Index].State =
FALSE;
230 if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
231 (Index >= DebuggerPrivate->DebuggerBreakpointCount))
233 return EFI_NOT_FOUND;
239 DebuggerPrivate->DebuggerBreakpointContext[Index].State =
TRUE;
258 IN CHAR16 *CommandArg,
269 if (DebuggerPrivate->DebuggerBreakpointCount == 0) {
271 return EFI_DEBUG_CONTINUE;
272 }
else if (DebuggerPrivate->DebuggerBreakpointCount > EFI_DEBUGGER_BREAKPOINT_MAX) {
273 EDBPrint (L
"Breakpoint too many!\n");
274 DebuggerPrivate->DebuggerBreakpointCount = 0;
275 return EFI_DEBUG_CONTINUE;
282 EDBPrint (L
" Index Address Status\n");
283 EDBPrint (L
"======= ================== ========\n");
286 for (Index = 0; Index < DebuggerPrivate->DebuggerBreakpointCount; Index++) {
290 EDBPrint (L
" %2d 0x%016lx", Index, DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress);
291 if (DebuggerPrivate->DebuggerBreakpointContext[Index].State) {
301 return EFI_DEBUG_CONTINUE;
318 IN CHAR16 *CommandArg,
327 if (CommandArg ==
NULL) {
328 EDBPrint (L
"BreakpointSet Argument error!\n");
329 return EFI_DEBUG_CONTINUE;
335 Status =
Symboltoi (CommandArg, &Address);
336 if (EFI_ERROR (Status)) {
337 if (Status == EFI_NOT_FOUND) {
338 Address =
Xtoi (CommandArg);
343 EDBPrint (L
"Command Argument error!\n");
344 return EFI_DEBUG_CONTINUE;
352 if (EFI_ERROR (Status)) {
353 EDBPrint (L
"BreakpointSet error!\n");
359 return EFI_DEBUG_CONTINUE;
376 IN CHAR16 *CommandArg,
385 if (CommandArg ==
NULL) {
386 EDBPrint (L
"BreakpointClear Argument error!\n");
387 return EFI_DEBUG_CONTINUE;
390 if (
StriCmp (CommandArg, L
"*") == 0) {
394 DebuggerPrivate->DebuggerBreakpointCount = 0;
395 ZeroMem (DebuggerPrivate->DebuggerBreakpointContext, sizeof (DebuggerPrivate->DebuggerBreakpointContext));
396 EDBPrint (L
"All the Breakpoint is cleared\n");
397 return EFI_DEBUG_CONTINUE;
403 Index =
Atoi (CommandArg);
404 if (Index == (
UINTN)-1) {
405 EDBPrint (L
"BreakpointClear Argument error!\n");
406 return EFI_DEBUG_CONTINUE;
409 if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
410 (Index >= DebuggerPrivate->DebuggerBreakpointCount))
412 EDBPrint (L
"BreakpointClear error!\n");
413 return EFI_DEBUG_CONTINUE;
420 if (EFI_ERROR (Status)) {
421 EDBPrint (L
"BreakpointClear error!\n");
427 return EFI_DEBUG_CONTINUE;
444 IN CHAR16 *CommandArg,
453 if (CommandArg ==
NULL) {
454 EDBPrint (L
"BreakpointDisable Argument error!\n");
455 return EFI_DEBUG_CONTINUE;
458 if (
StriCmp (CommandArg, L
"*") == 0) {
462 for (Index = 0; Index < DebuggerPrivate->DebuggerBreakpointCount; Index++) {
466 EDBPrint (L
"All the Breakpoint is disabled\n");
467 return EFI_DEBUG_CONTINUE;
473 Index =
Atoi (CommandArg);
474 if (Index == (
UINTN)-1) {
475 EDBPrint (L
"BreakpointDisable Argument error!\n");
476 return EFI_DEBUG_CONTINUE;
483 if (EFI_ERROR (Status)) {
484 EDBPrint (L
"BreakpointDisable error!\n");
490 return EFI_DEBUG_CONTINUE;
506 IN CHAR16 *CommandArg,
515 if (CommandArg ==
NULL) {
516 EDBPrint (L
"BreakpointEnable Argument error!\n");
517 return EFI_DEBUG_CONTINUE;
520 if (
StriCmp (CommandArg, L
"*") == 0) {
524 for (Index = 0; Index < DebuggerPrivate->DebuggerBreakpointCount; Index++) {
528 EDBPrint (L
"All the Breakpoint is enabled\n");
529 return EFI_DEBUG_CONTINUE;
535 Index =
Atoi (CommandArg);
536 if (Index == (
UINTN)-1) {
537 EDBPrint (L
"BreakpointEnable Argument error!\n");
538 return EFI_DEBUG_CONTINUE;
545 if (EFI_ERROR (Status)) {
546 EDBPrint (L
"BreakpointEnable error!\n");
552 return EFI_DEBUG_CONTINUE;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_DEBUG_STATUS DebuggerBreakpointDisable(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
EFI_DEBUG_STATUS DebuggerBreakpointList(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
BOOLEAN DebuggerBreakpointIsDuplicated(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN UINTN Address)
EFI_DEBUG_STATUS DebuggerBreakpointEnable(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
BOOLEAN IsEBCBREAK3(IN UINTN Address)
EFI_STATUS DebuggerBreakpointDel(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN UINTN Index)
EFI_STATUS DebuggerBreakpointDis(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN UINTN Index)
EFI_STATUS DebuggerBreakpointAdd(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN UINTN Address)
EFI_DEBUG_STATUS DebuggerBreakpointSet(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
EFI_DEBUG_STATUS DebuggerBreakpointClear(IN CHAR16 *CommandArg, IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
EFI_STATUS DebuggerBreakpointEn(IN EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate, IN UINTN Index)
UINTN EFIAPI Xtoi(CHAR16 *Str)
UINTN EFIAPI Atoi(CHAR16 *Str)
UINTN EFIAPI EDBPrint(IN CONST CHAR16 *Format,...)
INTN EFIAPI StriCmp(IN CHAR16 *String, IN CHAR16 *String2)
EFI_STATUS Symboltoi(IN CHAR16 *Symbol, OUT UINTN *Address)