]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiDpLib/Dp.c
ShellPkg/UefiDpLib: Support execution break
[mirror_edk2.git] / ShellPkg / Library / UefiDpLib / Dp.c
index 6b06d20749f29c3bc695abd99880fa294061456e..0176e31bc0d6624ad0371b3ecb01b181d69c9beb 100644 (file)
@@ -14,7 +14,7 @@
   timer information to calculate elapsed time for each measurement.\r
  \r
   Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.\r
-  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
+  (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -137,10 +137,10 @@ InitCumulativeData (
   @param[in]  ImageHandle     The image handle.\r
   @param[in]  SystemTable     The system table.\r
   \r
-  @retval EFI_SUCCESS            Command completed successfully.\r
-  @retval EFI_INVALID_PARAMETER  Command usage error.\r
-  @retval value                  Unknown error.\r
-  \r
+  @retval SHELL_SUCCESS            Command completed successfully.\r
+  @retval SHELL_INVALID_PARAMETER  Command usage error.\r
+  @retval SHELL_ABORTED            The user aborts the operation.\r
+  @retval value                    Unknown error.\r
 **/\r
 SHELL_STATUS\r
 EFIAPI\r
@@ -168,6 +168,7 @@ ShellCommandRunDp (
   BOOLEAN                   CumulativeMode;\r
   CONST CHAR16              *CustomCumulativeToken;\r
   PERF_CUM_DATA             *CustomCumulativeData;\r
+  SHELL_STATUS              ShellStatus;\r
 \r
   StringPtr   = NULL;\r
   SummaryMode = FALSE;\r
@@ -179,6 +180,7 @@ ShellCommandRunDp (
   ExcludeMode = FALSE;\r
   CumulativeMode = FALSE;\r
   CustomCumulativeData = NULL;\r
+  ShellStatus = SHELL_SUCCESS;\r
 \r
   // Get DP's entry time as soon as possible.\r
   // This is used as the Shell-Phase end time.\r
@@ -329,14 +331,22 @@ ShellCommandRunDp (
     ProcessCumulative (CustomCumulativeData);\r
   } else if (AllMode) {\r
     if (TraceMode) {\r
-      DumpAllTrace( Number2Display, ExcludeMode);\r
+      Status = DumpAllTrace( Number2Display, ExcludeMode);\r
+      if (Status == EFI_ABORTED) {\r
+        ShellStatus = SHELL_ABORTED;\r
+        goto Done;\r
+      }\r
     }\r
     if (ProfileMode) {\r
       DumpAllProfile( Number2Display, ExcludeMode);\r
     }\r
   } else if (RawMode) {\r
     if (TraceMode) {\r
-      DumpRawTrace( Number2Display, ExcludeMode);\r
+      Status = DumpRawTrace( Number2Display, ExcludeMode);\r
+      if (Status == EFI_ABORTED) {\r
+        ShellStatus = SHELL_ABORTED;\r
+        goto Done;\r
+      }\r
     }\r
     if (ProfileMode) {\r
       DumpRawProfile( Number2Display, ExcludeMode);\r
@@ -347,11 +357,24 @@ ShellCommandRunDp (
       ProcessPhases ( Ticker );\r
       if ( ! SummaryMode) {\r
         Status = ProcessHandles ( ExcludeMode);\r
-        if ( ! EFI_ERROR( Status)) {\r
-          ProcessPeims ();\r
-          ProcessGlobal ();\r
-          ProcessCumulative (NULL);\r
+        if (Status == EFI_ABORTED) {\r
+          ShellStatus = SHELL_ABORTED;\r
+          goto Done;\r
+        }\r
+\r
+        Status = ProcessPeims ();\r
+        if (Status == EFI_ABORTED) {\r
+          ShellStatus = SHELL_ABORTED;\r
+          goto Done;\r
+        }\r
+\r
+        Status = ProcessGlobal ();\r
+        if (Status == EFI_ABORTED) {\r
+          ShellStatus = SHELL_ABORTED;\r
+          goto Done;\r
         }\r
+\r
+        ProcessCumulative (NULL);\r
       }\r
     }\r
     if (ProfileMode) {\r
@@ -362,11 +385,12 @@ ShellCommandRunDp (
     DumpStatistics();\r
   }\r
 \r
+Done:\r
   SHELL_FREE_NON_NULL (StringPtr);\r
   if (CustomCumulativeData != NULL) {\r
     SHELL_FREE_NON_NULL (CustomCumulativeData->Name);\r
   }\r
   SHELL_FREE_NON_NULL (CustomCumulativeData);\r
 \r
-  return SHELL_SUCCESS;\r
+  return ShellStatus;\r
 }\r