diff mbox

[edk2,1/2] ArmPkg/DefaultExceptionHandlerLib: put ASSERT (FALSE) last

Message ID 1467370393-7703-1-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit f9ebccec096742465c0dfbbbb123d2c39f554d40
Headers show

Commit Message

Ard Biesheuvel July 1, 2016, 10:53 a.m. UTC
Putting DEBUG () code after an ASSERT (FALSE) statement is not very
useful, since the code will be unreachable on DEBUG builds and compiled
out on RELEASE builds. So move the ASSERT () statement after it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm July 1, 2016, 10:58 a.m. UTC | #1
On Fri, Jul 01, 2016 at 12:53:12PM +0200, Ard Biesheuvel wrote:
> Putting DEBUG () code after an ASSERT (FALSE) statement is not very

> useful, since the code will be unreachable on DEBUG builds and compiled

> out on RELEASE builds. So move the ASSERT () statement after it.

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> ---

>  ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c

> index 45a166ad21aa..31fc936b21ff 100644

> --- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c

> +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c

> @@ -191,7 +191,6 @@ DefaultExceptionHandler (

>    DEBUG ((EFI_D_ERROR, "\n ESR : EC 0x%02x  IL 0x%x  ISS 0x%08x\n", (SystemContext.SystemContextAArch64->ESR & 0xFC000000) >> 26, (SystemContext.SystemContextAArch64->ESR >> 25) & 0x1, SystemContext.SystemContextAArch64->ESR & 0x1FFFFFF ));

>  

>    DescribeExceptionSyndrome (SystemContext.SystemContextAArch64->ESR);

> -  ASSERT (FALSE);

>  

>    DEBUG ((EFI_D_ERROR, "\nStack dump:\n"));

>    for (Offset = -256; Offset < 256; Offset += 32) {

> @@ -204,5 +203,6 @@ DefaultExceptionHandler (

>        *(UINT64 *)(SystemContext.SystemContextAArch64->SP + Offset + 24)));

>    }

>  

> +  ASSERT (FALSE);

>    CpuDeadLoop ();

>  }

> -- 

> 2.7.4

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
index 45a166ad21aa..31fc936b21ff 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
@@ -191,7 +191,6 @@  DefaultExceptionHandler (
   DEBUG ((EFI_D_ERROR, "\n ESR : EC 0x%02x  IL 0x%x  ISS 0x%08x\n", (SystemContext.SystemContextAArch64->ESR & 0xFC000000) >> 26, (SystemContext.SystemContextAArch64->ESR >> 25) & 0x1, SystemContext.SystemContextAArch64->ESR & 0x1FFFFFF ));
 
   DescribeExceptionSyndrome (SystemContext.SystemContextAArch64->ESR);
-  ASSERT (FALSE);
 
   DEBUG ((EFI_D_ERROR, "\nStack dump:\n"));
   for (Offset = -256; Offset < 256; Offset += 32) {
@@ -204,5 +203,6 @@  DefaultExceptionHandler (
       *(UINT64 *)(SystemContext.SystemContextAArch64->SP + Offset + 24)));
   }
 
+  ASSERT (FALSE);
   CpuDeadLoop ();
 }