[edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision

Hao Wu posted 1 patch 6 years, 7 months ago
Failed in applying to current master (apply log)
.../Library/DebugAgent/DebugAgentCommon/DebugAgent.c               | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
[edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision
Posted by Hao Wu 6 years, 7 months ago
Since some static code checkers complain that comparing two macros will
generate a constant result, this commit uses a global variable to
reflect the revision information of the debug agent, rather than using a
macro directly.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 .../Library/DebugAgent/DebugAgentCommon/DebugAgent.c               | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
index f156fe24db..93af009f96 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
@@ -130,7 +130,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAge
   }
 };
 
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN  mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
+GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mDebugAgentRevision     = DEBUG_AGENT_REVISION;
 
 /**
   Calculate CRC16 for target data.
@@ -1564,7 +1565,7 @@ ReadMemoryAndSendResponsePacket (
     // Compression/decompression support was added since revision 0.4.
     // Revision 0.3 shouldn't compress the packet.
     //
-    if (DEBUG_AGENT_REVISION >= DEBUG_AGENT_REVISION_04) {
+    if (mDebugAgentRevision >= DEBUG_AGENT_REVISION_04) {
       //
       // Get the compressed data size without modifying the packet.
       //
@@ -2192,7 +2193,7 @@ CommandCommunication (
       break;
 
     case DEBUG_COMMAND_GET_REVISION:
-      DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
+      DebugAgentRevision.Revision = mDebugAgentRevision;
       DebugAgentRevision.Capabilities = DEBUG_AGENT_CAPABILITIES;
       Status = SendDataResponsePacket ((UINT8 *) &DebugAgentRevision, (UINT16) sizeof (DEBUG_DATA_RESPONSE_GET_REVISION), DebugHeader);
       break;
-- 
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision
Posted by Ni, Ruiyu 6 years, 7 months ago
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

-----Original Message-----
From: Wu, Hao A 
Sent: Tuesday, August 29, 2017 9:09 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision

Since some static code checkers complain that comparing two macros will
generate a constant result, this commit uses a global variable to
reflect the revision information of the debug agent, rather than using a
macro directly.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 .../Library/DebugAgent/DebugAgentCommon/DebugAgent.c               | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
index f156fe24db..93af009f96 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
@@ -130,7 +130,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAge
   }
 };
 
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN  mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
+GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mDebugAgentRevision     = DEBUG_AGENT_REVISION;
 
 /**
   Calculate CRC16 for target data.
@@ -1564,7 +1565,7 @@ ReadMemoryAndSendResponsePacket (
     // Compression/decompression support was added since revision 0.4.
     // Revision 0.3 shouldn't compress the packet.
     //
-    if (DEBUG_AGENT_REVISION >= DEBUG_AGENT_REVISION_04) {
+    if (mDebugAgentRevision >= DEBUG_AGENT_REVISION_04) {
       //
       // Get the compressed data size without modifying the packet.
       //
@@ -2192,7 +2193,7 @@ CommandCommunication (
       break;
 
     case DEBUG_COMMAND_GET_REVISION:
-      DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
+      DebugAgentRevision.Revision = mDebugAgentRevision;
       DebugAgentRevision.Capabilities = DEBUG_AGENT_CAPABILITIES;
       Status = SendDataResponsePacket ((UINT8 *) &DebugAgentRevision, (UINT16) sizeof (DEBUG_DATA_RESPONSE_GET_REVISION), DebugHeader);
       break;
-- 
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision
Posted by Ard Biesheuvel 6 years, 7 months ago
On 29 August 2017 at 14:09, Hao Wu <hao.a.wu@intel.com> wrote:
> Since some static code checkers complain that comparing two macros will
> generate a constant result, this commit uses a global variable to
> reflect the revision information of the debug agent, rather than using a
> macro directly.
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  .../Library/DebugAgent/DebugAgentCommon/DebugAgent.c               | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
> index f156fe24db..93af009f96 100644
> --- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
> +++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
> @@ -130,7 +130,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAge
>    }
>  };
>
> -GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
> +GLOBAL_REMOVE_IF_UNREFERENCED UINTN  mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
> +GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mDebugAgentRevision     = DEBUG_AGENT_REVISION;
>
>  /**
>    Calculate CRC16 for target data.
> @@ -1564,7 +1565,7 @@ ReadMemoryAndSendResponsePacket (
>      // Compression/decompression support was added since revision 0.4.
>      // Revision 0.3 shouldn't compress the packet.
>      //
> -    if (DEBUG_AGENT_REVISION >= DEBUG_AGENT_REVISION_04) {
> +    if (mDebugAgentRevision >= DEBUG_AGENT_REVISION_04) {
>        //
>        // Get the compressed data size without modifying the packet.
>        //
> @@ -2192,7 +2193,7 @@ CommandCommunication (
>        break;
>
>      case DEBUG_COMMAND_GET_REVISION:
> -      DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
> +      DebugAgentRevision.Revision = mDebugAgentRevision;
>        DebugAgentRevision.Capabilities = DEBUG_AGENT_CAPABILITIES;
>        Status = SendDataResponsePacket ((UINT8 *) &DebugAgentRevision, (UINT16) sizeof (DEBUG_DATA_RESPONSE_GET_REVISION), DebugHeader);
>        break;
> --
> 2.12.0.windows.1
>

Can we *please* fix the tools instead? mDebugAgentRevision has
external linkage, and so the compiler is forced to perform this check
at runtime instead of at build time. Or at least use a STATIC variable
so the compiler can see that mDebugAgentRevision is never modified
from its default value.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision
Posted by Kinney, Michael D 6 years, 7 months ago
Ard,

I agree.  Adding const would be an improvement too.

But I would prefer to not add a global variable at all.

When could this check ever evaluate to false?  Compression has
been supported for a long time now.

It appears that a developer would have to modify
SourceLevelDebugPkg\Include\TransferProtocol.h to select an
older protocol revision.

If we really want build configuration of the protocol revision
then we should use a PCD feature flag or a FixedAtBuild PCD to
allow the developer to configure it from the DSC file.

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On
> Behalf Of Ard Biesheuvel
> Sent: Tuesday, August 29, 2017 8:01 AM
> To: Wu, Hao A <hao.a.wu@intel.com>
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH]
> SourceLevelDebugPkg/DebugAgentCommon: Use global variable for
> revision
> 
> On 29 August 2017 at 14:09, Hao Wu <hao.a.wu@intel.com> wrote:
> > Since some static code checkers complain that comparing two
> macros will
> > generate a constant result, this commit uses a global
> variable to
> > reflect the revision information of the debug agent, rather
> than using a
> > macro directly.
> >
> > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> > ---
> >  .../Library/DebugAgent/DebugAgentCommon/DebugAgent.c
> | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> Agent.c
> b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> Agent.c
> > index f156fe24db..93af009f96 100644
> > ---
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> Agent.c
> > +++
> b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> Agent.c
> > @@ -130,7 +130,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED
> EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAge
> >    }
> >  };
> >
> > -GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount
> = sizeof (mVectorHandoffInfoDebugAgent) / sizeof
> (EFI_VECTOR_HANDOFF_INFO);
> > +GLOBAL_REMOVE_IF_UNREFERENCED UINTN  mVectorHandoffInfoCount
> = sizeof (mVectorHandoffInfoDebugAgent) / sizeof
> (EFI_VECTOR_HANDOFF_INFO);
> > +GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mDebugAgentRevision
> = DEBUG_AGENT_REVISION;
> >
> >  /**
> >    Calculate CRC16 for target data.
> > @@ -1564,7 +1565,7 @@ ReadMemoryAndSendResponsePacket (
> >      // Compression/decompression support was added since
> revision 0.4.
> >      // Revision 0.3 shouldn't compress the packet.
> >      //
> > -    if (DEBUG_AGENT_REVISION >= DEBUG_AGENT_REVISION_04) {
> > +    if (mDebugAgentRevision >= DEBUG_AGENT_REVISION_04) {
> >        //
> >        // Get the compressed data size without modifying the
> packet.
> >        //
> > @@ -2192,7 +2193,7 @@ CommandCommunication (
> >        break;
> >
> >      case DEBUG_COMMAND_GET_REVISION:
> > -      DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
> > +      DebugAgentRevision.Revision = mDebugAgentRevision;
> >        DebugAgentRevision.Capabilities =
> DEBUG_AGENT_CAPABILITIES;
> >        Status = SendDataResponsePacket ((UINT8 *)
> &DebugAgentRevision, (UINT16) sizeof
> (DEBUG_DATA_RESPONSE_GET_REVISION), DebugHeader);
> >        break;
> > --
> > 2.12.0.windows.1
> >
> 
> Can we *please* fix the tools instead? mDebugAgentRevision has
> external linkage, and so the compiler is forced to perform this
> check
> at runtime instead of at build time. Or at least use a STATIC
> variable
> so the compiler can see that mDebugAgentRevision is never
> modified
> from its default value.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision
Posted by Wu, Hao A 6 years, 7 months ago
Thanks a lot for the feedbacks.

I will switch to using PCD for configuring revision and send out V2 of the patch.


Best Regards,
Hao Wu


> -----Original Message-----
> From: Kinney, Michael D
> Sent: Wednesday, August 30, 2017 12:00 AM
> To: Ard Biesheuvel; Wu, Hao A; Kinney, Michael D
> Cc: Ni, Ruiyu; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use
> global variable for revision
> 
> Ard,
> 
> I agree.  Adding const would be an improvement too.
> 
> But I would prefer to not add a global variable at all.
> 
> When could this check ever evaluate to false?  Compression has
> been supported for a long time now.
> 
> It appears that a developer would have to modify
> SourceLevelDebugPkg\Include\TransferProtocol.h to select an
> older protocol revision.
> 
> If we really want build configuration of the protocol revision
> then we should use a PCD feature flag or a FixedAtBuild PCD to
> allow the developer to configure it from the DSC file.
> 
> Mike
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On
> > Behalf Of Ard Biesheuvel
> > Sent: Tuesday, August 29, 2017 8:01 AM
> > To: Wu, Hao A <hao.a.wu@intel.com>
> > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
> > Subject: Re: [edk2] [PATCH]
> > SourceLevelDebugPkg/DebugAgentCommon: Use global variable for
> > revision
> >
> > On 29 August 2017 at 14:09, Hao Wu <hao.a.wu@intel.com> wrote:
> > > Since some static code checkers complain that comparing two
> > macros will
> > > generate a constant result, this commit uses a global
> > variable to
> > > reflect the revision information of the debug agent, rather
> > than using a
> > > macro directly.
> > >
> > > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> > > ---
> > >  .../Library/DebugAgent/DebugAgentCommon/DebugAgent.c
> > | 7 ++++---
> > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > diff --git
> > a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > > index f156fe24db..93af009f96 100644
> > > ---
> > a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > > +++
> > b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > > @@ -130,7 +130,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED
> > EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAge
> > >    }
> > >  };
> > >
> > > -GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount
> > = sizeof (mVectorHandoffInfoDebugAgent) / sizeof
> > (EFI_VECTOR_HANDOFF_INFO);
> > > +GLOBAL_REMOVE_IF_UNREFERENCED UINTN  mVectorHandoffInfoCount
> > = sizeof (mVectorHandoffInfoDebugAgent) / sizeof
> > (EFI_VECTOR_HANDOFF_INFO);
> > > +GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mDebugAgentRevision
> > = DEBUG_AGENT_REVISION;
> > >
> > >  /**
> > >    Calculate CRC16 for target data.
> > > @@ -1564,7 +1565,7 @@ ReadMemoryAndSendResponsePacket (
> > >      // Compression/decompression support was added since
> > revision 0.4.
> > >      // Revision 0.3 shouldn't compress the packet.
> > >      //
> > > -    if (DEBUG_AGENT_REVISION >= DEBUG_AGENT_REVISION_04) {
> > > +    if (mDebugAgentRevision >= DEBUG_AGENT_REVISION_04) {
> > >        //
> > >        // Get the compressed data size without modifying the
> > packet.
> > >        //
> > > @@ -2192,7 +2193,7 @@ CommandCommunication (
> > >        break;
> > >
> > >      case DEBUG_COMMAND_GET_REVISION:
> > > -      DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
> > > +      DebugAgentRevision.Revision = mDebugAgentRevision;
> > >        DebugAgentRevision.Capabilities =
> > DEBUG_AGENT_CAPABILITIES;
> > >        Status = SendDataResponsePacket ((UINT8 *)
> > &DebugAgentRevision, (UINT16) sizeof
> > (DEBUG_DATA_RESPONSE_GET_REVISION), DebugHeader);
> > >        break;
> > > --
> > > 2.12.0.windows.1
> > >
> >
> > Can we *please* fix the tools instead? mDebugAgentRevision has
> > external linkage, and so the compiler is forced to perform this
> > check
> > at runtime instead of at build time. Or at least use a STATIC
> > variable
> > so the compiler can see that mDebugAgentRevision is never
> > modified
> > from its default value.
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision
Posted by Ni, Ruiyu 6 years, 7 months ago
Yes. I agree with Mike's idea to use FixedAtBuild PCD for the debug agent transfer protocol revision.

-----Original Message-----
From: Wu, Hao A 
Sent: Wednesday, August 30, 2017 7:13 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
Subject: RE: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use global variable for revision

Thanks a lot for the feedbacks.

I will switch to using PCD for configuring revision and send out V2 of the patch.


Best Regards,
Hao Wu


> -----Original Message-----
> From: Kinney, Michael D
> Sent: Wednesday, August 30, 2017 12:00 AM
> To: Ard Biesheuvel; Wu, Hao A; Kinney, Michael D
> Cc: Ni, Ruiyu; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH] SourceLevelDebugPkg/DebugAgentCommon: Use 
> global variable for revision
> 
> Ard,
> 
> I agree.  Adding const would be an improvement too.
> 
> But I would prefer to not add a global variable at all.
> 
> When could this check ever evaluate to false?  Compression has been 
> supported for a long time now.
> 
> It appears that a developer would have to modify 
> SourceLevelDebugPkg\Include\TransferProtocol.h to select an older 
> protocol revision.
> 
> If we really want build configuration of the protocol revision then we 
> should use a PCD feature flag or a FixedAtBuild PCD to allow the 
> developer to configure it from the DSC file.
> 
> Mike
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf 
> > Of Ard Biesheuvel
> > Sent: Tuesday, August 29, 2017 8:01 AM
> > To: Wu, Hao A <hao.a.wu@intel.com>
> > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
> > Subject: Re: [edk2] [PATCH]
> > SourceLevelDebugPkg/DebugAgentCommon: Use global variable for 
> > revision
> >
> > On 29 August 2017 at 14:09, Hao Wu <hao.a.wu@intel.com> wrote:
> > > Since some static code checkers complain that comparing two
> > macros will
> > > generate a constant result, this commit uses a global
> > variable to
> > > reflect the revision information of the debug agent, rather
> > than using a
> > > macro directly.
> > >
> > > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> > > ---
> > >  .../Library/DebugAgent/DebugAgentCommon/DebugAgent.c
> > | 7 ++++---
> > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > diff --git
> > a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > > index f156fe24db..93af009f96 100644
> > > ---
> > a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > > +++
> > b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Debug
> > Agent.c
> > > @@ -130,7 +130,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED
> > EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAge
> > >    }
> > >  };
> > >
> > > -GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount
> > = sizeof (mVectorHandoffInfoDebugAgent) / sizeof 
> > (EFI_VECTOR_HANDOFF_INFO);
> > > +GLOBAL_REMOVE_IF_UNREFERENCED UINTN  mVectorHandoffInfoCount
> > = sizeof (mVectorHandoffInfoDebugAgent) / sizeof 
> > (EFI_VECTOR_HANDOFF_INFO);
> > > +GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mDebugAgentRevision
> > = DEBUG_AGENT_REVISION;
> > >
> > >  /**
> > >    Calculate CRC16 for target data.
> > > @@ -1564,7 +1565,7 @@ ReadMemoryAndSendResponsePacket (
> > >      // Compression/decompression support was added since
> > revision 0.4.
> > >      // Revision 0.3 shouldn't compress the packet.
> > >      //
> > > -    if (DEBUG_AGENT_REVISION >= DEBUG_AGENT_REVISION_04) {
> > > +    if (mDebugAgentRevision >= DEBUG_AGENT_REVISION_04) {
> > >        //
> > >        // Get the compressed data size without modifying the
> > packet.
> > >        //
> > > @@ -2192,7 +2193,7 @@ CommandCommunication (
> > >        break;
> > >
> > >      case DEBUG_COMMAND_GET_REVISION:
> > > -      DebugAgentRevision.Revision = DEBUG_AGENT_REVISION;
> > > +      DebugAgentRevision.Revision = mDebugAgentRevision;
> > >        DebugAgentRevision.Capabilities =
> > DEBUG_AGENT_CAPABILITIES;
> > >        Status = SendDataResponsePacket ((UINT8 *)
> > &DebugAgentRevision, (UINT16) sizeof 
> > (DEBUG_DATA_RESPONSE_GET_REVISION), DebugHeader);
> > >        break;
> > > --
> > > 2.12.0.windows.1
> > >
> >
> > Can we *please* fix the tools instead? mDebugAgentRevision has 
> > external linkage, and so the compiler is forced to perform this 
> > check at runtime instead of at build time. Or at least use a STATIC 
> > variable so the compiler can see that mDebugAgentRevision is never 
> > modified from its default value.
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel