summaryrefslogtreecommitdiff
path: root/EmbeddedPkg
diff options
context:
space:
mode:
Diffstat (limited to 'EmbeddedPkg')
-rwxr-xr-xEmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c27
-rwxr-xr-xEmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h1
-rwxr-xr-xEmbeddedPkg/Library/GdbDebugAgent/Ia32/Processor.c26
3 files changed, 45 insertions, 9 deletions
diff --git a/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c b/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c
index c5f5932..d3c0504 100755
--- a/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c
+++ b/EmbeddedPkg/Library/GdbDebugAgent/Arm/Processor.c
@@ -15,7 +15,6 @@
#include <GdbDebugAgent.h>
-#include <Library/CacheMaintenanceLib.h>
#include <Library/PrintLib.h>
#include <Library/ArmLib.h>
@@ -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 eee9f6d..2d0570e 100755
--- a/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h
+++ b/EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h
@@ -26,6 +26,7 @@
#include <Library/PrintLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/DebugAgentTimerLib.h>
+#include <Library/DebugAgentLib.h>
#include <IndustryStandard/PeImage.h>
#include <Protocol/DebugSupport.h>
diff --git a/EmbeddedPkg/Library/GdbDebugAgent/Ia32/Processor.c b/EmbeddedPkg/Library/GdbDebugAgent/Ia32/Processor.c
index c2f4b64..96a1a59 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);
+ }
}