public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Jiewen Yao <jiewen.yao@intel.com>, Pete Batard <pete@akeo.ie>
Subject: [PATCH v2] MdeModulePkg: Fix GCC build failure
Date: Fri, 25 Nov 2016 11:32:35 +0800	[thread overview]
Message-ID: <1480044755-6512-1-git-send-email-dandan.bi@intel.com> (raw)

V2: Add check for CreateEvent and CloseEvent.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Pete Batard <pete@akeo.ie>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c          |  3 ---
 .../Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c      |  5 -----
 MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c      | 16 ++++++++++------
 MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c    |  2 --
 4 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
index e0b85c7..adc1c50 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
@@ -192,11 +192,10 @@ Returns:
 
 --*/
 {
   UINT64   Address;
   UINTN    Index;
-  UINT16   OldInstruction;
   BOOLEAN  IsHitBreakpoint;
 
   //
   // Roll back IP for breakpoint instruction (BREAK(3) : 0x0300)
   //
@@ -207,11 +206,10 @@ Returns:
   //
   IsHitBreakpoint = FALSE;
   for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {
     if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&
         (DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {
-      OldInstruction = (UINT16)DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction;
       IsHitBreakpoint = TRUE;
       break;
     }
   }
 
@@ -242,11 +240,10 @@ Returns:
     //
     IsHitBreakpoint = FALSE;
     for (Index = 0; (Index < DebuggerPrivate->DebuggerBreakpointCount) && (Index < EFI_DEBUGGER_BREAKPOINT_MAX); Index++) {
       if ((DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress == Address) &&
           (DebuggerPrivate->DebuggerBreakpointContext[Index].State)) {
-        OldInstruction = (UINT16)DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction;
         IsHitBreakpoint = TRUE;
         break;
       }
     }
 
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
index 4be6dd4..a137ea9 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
@@ -437,12 +437,10 @@ Returns:
 
 --*/
 {
   UINTN      Index;
   EFI_STATUS Status;
-  UINTN      Address;
-  UINT16     OldInstruction;
 
   if (CommandArg == NULL) {
     EDBPrint (L"BreakpointClear Argument error!\n");
     return EFI_DEBUG_CONTINUE;
   }
@@ -464,13 +462,10 @@ Returns:
 
   if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
       (Index >= DebuggerPrivate->DebuggerBreakpointCount)) {
     EDBPrint (L"BreakpointClear error!\n");
     return EFI_DEBUG_CONTINUE;
-  } else {
-    Address = (UINTN)DebuggerPrivate->DebuggerBreakpointContext[Index].BreakpointAddress;
-    OldInstruction = (UINT16)DebuggerPrivate->DebuggerBreakpointContext[Index].OldInstruction;
   }
 
   //
   // Delete breakpoint
   //
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
index 9196adb..9394fb0 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
@@ -455,15 +455,17 @@ Returns:
                   TPL_CALLBACK,
                   EbcDebuggerBreakEventFunc,
                   NULL,
                   &mDebuggerPrivate.BreakEvent
                   );
-  Status = gBS->SetTimer (
-                  mDebuggerPrivate.BreakEvent,
-                  TimerPeriodic,
-                  EFI_DEBUG_BREAK_TIMER_INTERVAL
-                  );
+  if (!EFI_ERROR (Status)) {
+    Status = gBS->SetTimer (
+                    mDebuggerPrivate.BreakEvent,
+                    TimerPeriodic,
+                    EFI_DEBUG_BREAK_TIMER_INTERVAL
+                    );
+  }
 
   return ;
 }
 
 VOID
@@ -491,11 +493,13 @@ Returns:
   EFI_DEBUGGER_SYMBOL_OBJECT *Object;
 
   //
   // Close the break event
   //
-  gBS->CloseEvent (mDebuggerPrivate.BreakEvent);
+  if (mDebuggerPrivate.BreakEvent != NULL) {
+    gBS->CloseEvent (mDebuggerPrivate.BreakEvent);
+  }
 
   //
   // Clean up the symbol
   //
   Object = mDebuggerPrivate.DebuggerSymbolContext.Object;
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
index 9573c43..a1d21aa 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
@@ -191,19 +191,17 @@ Returns:
 
 --*/
 {
   CHAR8                      *LineBuffer;
   CHAR8                      *FieldBuffer;
-  EFI_DEBUGGER_SYMBOL_ENTRY  *Entry;
   EDB_EBC_MAP_PARSE_STATE    MapParseState;
   EDB_EBC_SYMBOL_PARSE_STATE SymbolParseState;
   CHAR8                      *Name;
   CHAR8                      *ObjName;
   UINTN                      Address;
   EFI_DEBUGGER_SYMBOL_TYPE   Type;
 
-  Entry = Object->Entry;
 
   //
   // Begin to parse the Buffer
   //
   LineBuffer = AsciiStrGetNewTokenLine (Buffer, "\n\r");
-- 
1.9.5.msysgit.1



             reply	other threads:[~2016-11-25  3:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25  3:32 Dandan Bi [this message]
2016-11-25  4:19 ` [PATCH v2] MdeModulePkg: Fix GCC build failure Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480044755-6512-1-git-send-email-dandan.bi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox