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
This commit is contained in:
parent
3bce07ff62
commit
dce52c7901
1 changed files with 24 additions and 0 deletions
24
firmware/include/dbgcheck.h
Normal file
24
firmware/include/dbgcheck.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef __DBGCHECK_H__
|
||||
#define __DBGCHECK_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#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__
|
Loading…
Reference in a new issue