From 0696f7eddcf47f503286d9fc050c6badb35f151c Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 10 Apr 2023 14:48:53 +0300 Subject: [PATCH] include: sof: debug: gdb: gdb.h: Add ifdef guard for symbol definition GDB debug should only be used when CONFIG_DBG_DEBUG=y. On ARM64 platforms with Zephyr, including this header will cause compilation errors due to the fact that they don't have an arch/ entry. This commit fixes this issue by conditionally defining all symbols based on CONFIG_GDB_DEBUG. Signed-off-by: Laurentiu Mihalcea --- src/include/sof/debug/gdb/gdb.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/include/sof/debug/gdb/gdb.h b/src/include/sof/debug/gdb/gdb.h index ac6abfb9a..c27e60e64 100644 --- a/src/include/sof/debug/gdb/gdb.h +++ b/src/include/sof/debug/gdb/gdb.h @@ -8,6 +8,16 @@ #ifndef __SOF_DEBUG_GDB_GDB_H__ #define __SOF_DEBUG_GDB_GDB_H__ +/* unconditionally including this header will cause + * problems on architectures such as ARM64 with Zephyr + * since they don't have an entry in arch/. + * + * since GDB debug is only to be used when CONFIG_GDB_DEBUG=y + * we can safely avoid this problem with the below conditional + * definition of the symbols. + */ +#ifdef CONFIG_GDB_DEBUG + #include #include @@ -30,4 +40,6 @@ void gdb_debug_info(unsigned char *str); void gdb_init_debug_exception(void); void gdb_init(void); +#endif /* CONFIG_GDB_DEBUG */ + #endif /* __SOF_DEBUG_GDB_GDB_H__ */