--- rpl/src/rpl.h 2010/05/13 19:09:18 1.34 +++ rpl/src/rpl.h 2010/05/16 19:36:20 1.35 @@ -367,12 +367,6 @@ int sem_getvalue2(sem_t *semaphore, int # define abs(i) (((i) >= 0) ? (i) : (-i)) #endif -#define BUG(b, ...) \ - do { if (b) { uprintf("[%d] BUG! <%s()> at line #%d of %s\n", \ - (int) getpid(), __FUNCTION__, __LINE__, __FILE__); \ - __VA_ARGS__; fflush(stdout); \ - pthread_kill(pthread_self(), SIGBUS); }} while(0) - #define NOTICE(m) \ do \ { \ @@ -413,6 +407,21 @@ int sem_getvalue2(sem_t *semaphore, int #define BACKTRACE(n) NOTICE("BACKTRACE only defined in glibc") #endif +#ifdef __BACKTRACE +# define BUG(b, ...) \ + do { if (b) { uprintf("[%d] BUG! <%s()> at line #%d of %s\n", \ + (int) getpid(), __FUNCTION__, __LINE__, __FILE__); \ + __VA_ARGS__; fflush(stdout); \ + BACKTRACE(64); \ + pthread_kill(pthread_self(), SIGBUS); }} while(0) +#else +# define BUG(b, ...) \ + do { if (b) { uprintf("[%d] BUG! <%s()> at line #%d of %s\n", \ + (int) getpid(), __FUNCTION__, __LINE__, __FILE__); \ + __VA_ARGS__; fflush(stdout); \ + pthread_kill(pthread_self(), SIGBUS); }} while(0) +#endif + /* ================================================================================ @@ -421,12 +430,14 @@ int sem_getvalue2(sem_t *semaphore, int */ #ifdef DEBUG_MEMOIRE +void analyse_post_mortem(); void *debug_memoire_ajout(size_t taille, const unsigned char *fonction, unsigned long ligne, const unsigned char *argument); void *debug_memoire_modification(void *pointeur, size_t taille, const unsigned char *fonction, unsigned long ligne, const unsigned char *argument); void debug_memoire_retrait(void *ptr); +void debug_memoire_verification(); #define malloc(s) debug_memoire_ajout(s, __FUNCTION__, __LINE__, #s) #define free(s) debug_memoire_retrait(s) @@ -2493,7 +2504,6 @@ void conversion_majuscule_limitee(unsign void conversion_radians_vers_degres(real8 *angle); void correction_formateur_tex(struct_processus *s_etat_processus, unsigned char **ligne); -void debug_memoire_verification(struct_processus *s_etat_processus); void depilement_pile_systeme(struct_processus *s_etat_processus); void derivation(struct_processus *s_etat_processus, struct_objet **s_expression);