From dce52c790124ff8f89f63f5d4b449cab986e5c99 Mon Sep 17 00:00:00 2001 From: Felix Arends Date: Mon, 24 Jun 2002 16:00:06 +0000 Subject: added debug function header file. it defines macros that can be used for debugging purposes. IS_FUNCTION checks whether a function pointer is inside the memory (not in ROM). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1159 a1c6a512-1295-4272-9138-f99709370657 --- firmware/include/dbgcheck.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 firmware/include/dbgcheck.h (limited to 'firmware') diff --git a/firmware/include/dbgcheck.h b/firmware/include/dbgcheck.h new file mode 100644 index 0000000000..e1f7aefbdb --- /dev/null +++ b/firmware/include/dbgcheck.h @@ -0,0 +1,24 @@ +#ifndef __DBGCHECK_H__ +#define __DBGCHECK_H__ + +#include + +#ifdef DEBUG + #ifndef SIMULATOR + /* check whether a function is inside the valid memory location */ + #define IS_FUNCPTR(fp) ({/ + extern char _text[];/ + extern char _etext[];/ + ((((char *)(fp)) >= _text) && (((char *)(fp)) < _etext)/ + }) + #else + /* check whether a function is inside the valid memory location */ + #define IS_FUNCPTR(fp) (((char*)(fp)) != NULL) + #endif +#else + /* check whether a function is inside the valid memory location */ + #define IS_FUNCPRT (fp) true +#endif + + +#endif // #ifndef __DBGCHECK_H__ \ No newline at end of file -- cgit v1.2.3