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 <laurentiu.mihalcea@nxp.com>
This commit is contained in:
Laurentiu Mihalcea 2023-04-10 14:48:53 +03:00 committed by Daniel Baluta
parent 6aa71dd6f2
commit 0696f7eddc
1 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,16 @@
#ifndef __SOF_DEBUG_GDB_GDB_H__ #ifndef __SOF_DEBUG_GDB_GDB_H__
#define __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 <arch/debug/gdb/init.h> #include <arch/debug/gdb/init.h>
#include <arch/debug/gdb/utilities.h> #include <arch/debug/gdb/utilities.h>
@ -30,4 +40,6 @@ void gdb_debug_info(unsigned char *str);
void gdb_init_debug_exception(void); void gdb_init_debug_exception(void);
void gdb_init(void); void gdb_init(void);
#endif /* CONFIG_GDB_DEBUG */
#endif /* __SOF_DEBUG_GDB_GDB_H__ */ #endif /* __SOF_DEBUG_GDB_GDB_H__ */