From 685f8c760077cb2fb11b74c5758a6d54aebf539f Mon Sep 17 00:00:00 2001 From: andrewfish Date: Fri, 23 Jul 2010 15:25:32 +0000 Subject: [PATCH 1/1] Fix more InitializeDebugAgent API change bugs. GDB stub was not turned on in example platforms. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10687 6f19259b-4bc3-4df7-8a09-765794883524 --- BeagleBoardPkg/BeagleBoardPkg.dsc | 6 ++++- .../Library/GdbDebugAgent/Arm/Processor.c | 27 +++++++++++++++---- .../Library/GdbDebugAgent/GdbDebugAgent.h | 1 + .../Library/GdbDebugAgent/Ia32/Processor.c | 26 +++++++++++++++--- 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc index bc886201be..0e5f42eddc 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.dsc +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc @@ -109,7 +109,8 @@ OmapLib|Omap35xxPkg/Library/OmapLib/OmapLib.inf OmapDmaLib|Omap35xxPkg/Library/OmapDmaLib/OmapDmaLib.inf EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf - + DebugAgentTimerLib|Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf + GdbSerialLib|Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.inf ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf @@ -129,6 +130,9 @@ # 1/123 faster than Stm or Vstm version BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + # Uncomment to turn on GDB stub in SEC. + #DebugAgentLib|EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf + [LibraryClasses.common.PEI_CORE] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf diff --git a/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c b/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c index c5f59323db..d3c050499a 100755 --- a/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c +++ b/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c @@ -15,7 +15,6 @@ #include -#include #include #include @@ -597,17 +596,31 @@ GdbFPutString ( /** Initialize debug agent. - This function is used to set up debug enviroment. It may enable interrupts. + This function is used to set up debug environment to support source level debugging. + If certain Debug Agent Library instance has to save some private data in the stack, + this function must work on the mode that doesn't return to the caller, then + the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one + function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is + responsible to invoke the passing-in function at the end of InitializeDebugAgent(). - @param[in] InitFlag Init flag is used to decide initialize process. - @param[in] Context Context needed according to InitFlag, it was optional. + If the parameter Function is not NULL, Debug Agent Libary instance will invoke it by + passing in the Context to be its parameter. + + If Function() is NULL, Debug Agent Library instance will return after setup debug + environment. + + @param[in] InitFlag Init flag is used to decide the initialize process. + @param[in] Context Context needed according to InitFlag; it was optional. + @param[in] Function Continue function called by debug agent library; it was + optional. **/ VOID EFIAPI InitializeDebugAgent ( IN UINT32 InitFlag, - IN VOID *Context OPTIONAL + IN VOID *Context, OPTIONAL + IN DEBUG_AGENT_CONTINUE Function OPTIONAL ) { UINTN Offset; @@ -653,6 +666,10 @@ InitializeDebugAgent ( ArmEnableInterrupts (); } + if (Function != NULL) { + Function (Context); + } + return; } diff --git a/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h b/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h index eee9f6d767..2d0570e3dc 100755 --- a/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h +++ b/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/EmbeddedPkg/Library/GdbDebugAgent/Ia32/Processor.c b/EmbeddedPkg/Library/GdbDebugAgent/Ia32/Processor.c index c2f4b640b9..96a1a596f3 100755 --- a/EmbeddedPkg/Library/GdbDebugAgent/Ia32/Processor.c +++ b/EmbeddedPkg/Library/GdbDebugAgent/Ia32/Processor.c @@ -915,19 +915,37 @@ RemoveBreakPoint ( /** Initialize debug agent. - This function is used to set up debug enviroment. It may enable interrupts. + This function is used to set up debug environment to support source level debugging. + If certain Debug Agent Library instance has to save some private data in the stack, + this function must work on the mode that doesn't return to the caller, then + the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one + function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is + responsible to invoke the passing-in function at the end of InitializeDebugAgent(). - @param[in] InitFlag Init flag is used to decide initialize process. - @param[in] Context Context needed according to InitFlag, it was optional. + If the parameter Function is not NULL, Debug Agent Libary instance will invoke it by + passing in the Context to be its parameter. + + If Function() is NULL, Debug Agent Library instance will return after setup debug + environment. + + @param[in] InitFlag Init flag is used to decide the initialize process. + @param[in] Context Context needed according to InitFlag; it was optional. + @param[in] Function Continue function called by debug agent library; it was + optional. **/ VOID EFIAPI InitializeDebugAgent ( IN UINT32 InitFlag, - IN VOID *Context OPTIONAL + IN VOID *Context, OPTIONAL + IN DEBUG_AGENT_CONTINUE Function OPTIONAL ) { // BugBug: Add the code to build an GDT/IDT + + if (Function != NULL) { + Function (Context); + } } -- 2.39.2