aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2019-01-15 16:34:19 +0100
committerSandrine Bailleux <sandrine.bailleux@arm.com>2019-01-15 16:40:07 +0100
commita2d516fc5215973b4df38fe072fb68a8899e4ae4 (patch)
tree18da625a1492e7d41a1dc89fab61e50d884354b9
parentc1617386e332973c334b097ad7e188437ef8e1a7 (diff)
downloadtf-a-tests-a2d516fc5215973b4df38fe072fb68a8899e4ae4.tar.gz
Always print file and line number in panic/unreachable macros
Release builds used to have a special variant of these macros without the source code location information. This kind of mechanism is useful when writing software that needs both a development and production version so that the source code information is not leaked when the device is in the field. However, in the context of TF-A Tests, it makes little sense, as it's unlikely somebody would ever ship a device with TF-A Tests installed on it. Change-Id: Ic14ad87c2756762807ee71142f21d6973233144e Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
-rw-r--r--include/common/debug.h12
-rw-r--r--tftf/framework/debug.c19
2 files changed, 1 insertions, 30 deletions
diff --git a/include/common/debug.h b/include/common/debug.h
index 216c53d9..53eebf74 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -66,23 +66,13 @@ void mp_printf(const char *fmt, ...);
#endif
/*
- * For the moment this Panic function is very basic, Report an error and
+ * For the moment this panic function is very basic: report an error and
* spin. This can be expanded in the future to provide more information.
*/
-#if DEBUG
void __attribute__((__noreturn__)) do_panic(const char *file, int line);
#define panic() do_panic(__FILE__, __LINE__)
void __attribute__((__noreturn__)) do_bug_unreachable(const char *file, int line);
#define bug_unreachable() do_bug_unreachable(__FILE__, __LINE__)
-#else
-void __attribute__((__noreturn__)) do_panic(void);
-#define panic() do_panic()
-
-void __attribute__((__noreturn__)) do_bug_unreachable(void);
-#define bug_unreachable() do_bug_unreachable()
-
-#endif
-
#endif /* __DEBUG_H__ */
diff --git a/tftf/framework/debug.c b/tftf/framework/debug.c
index 4b4364d7..0927ed47 100644
--- a/tftf/framework/debug.c
+++ b/tftf/framework/debug.c
@@ -7,7 +7,6 @@
#include <console.h>
#include <debug.h>
-#if DEBUG
void __attribute__((__noreturn__)) do_panic(const char *file, int line)
{
printf("PANIC in file: %s line: %d\n", file, line);
@@ -23,21 +22,3 @@ void __attribute__((__noreturn__)) do_bug_unreachable(const char *file, int line
mp_printf("BUG: Unreachable code!\n");
do_panic(file, line);
}
-
-#else
-void __attribute__((__noreturn__)) do_panic(void)
-{
- printf("PANIC\n");
-
- console_flush();
-
- while (1)
- continue;
-}
-
-void __attribute__((__noreturn__)) do_bug_unreachable(void)
-{
- mp_printf("BUG: Unreachable code!\n");
- do_panic();
-}
-#endif