version 1.17, 2010/05/16 19:36:20
|
version 1.20, 2010/05/24 10:58:30
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.15 |
RPL/2 (R) version 4.0.16 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 877 liberation(struct_processus *s_etat_proc
|
Line 877 liberation(struct_processus *s_etat_proc
|
{ |
{ |
if (decrementation_atomique(s_objet) > 0) |
if (decrementation_atomique(s_objet) > 0) |
{ |
{ |
liberation(s_etat_processus, (*((struct_fichier *) |
BUG((*(*((struct_fichier *) (*s_objet).objet)).format) |
(*s_objet).objet)).format); |
.nombre_occurrences <= 1, |
|
pthread_mutex_unlock(&((*s_objet).mutex)), |
|
printf("(*(*((struct_fichier *) (*s_objet).objet))" |
|
".format).nombre_occurrences=%ld\n", |
|
(*(*((struct_fichier *) (*s_objet).objet)).format) |
|
.nombre_occurrences)); |
|
|
|
liberation(s_etat_processus, |
|
(*((struct_fichier *) (*s_objet).objet)).format); |
return; |
return; |
} |
} |
|
|
liberation(s_etat_processus, |
liberation(s_etat_processus, |
(*((struct_fichier *) (*s_objet).objet)).format); |
(*((struct_fichier *) (*s_objet).objet)).format); |
|
|
free((unsigned char *) (*((struct_fichier *) |
free((unsigned char *) (*((struct_fichier *) |
(*s_objet).objet)).nom); |
(*s_objet).objet)).nom); |
free((struct_fichier *) ((*s_objet).objet)); |
free((struct_fichier *) ((*s_objet).objet)); |
Line 1210 liberation(struct_processus *s_etat_proc
|
Line 1217 liberation(struct_processus *s_etat_proc
|
{ |
{ |
if (decrementation_atomique(s_objet) > 0) |
if (decrementation_atomique(s_objet) > 0) |
{ |
{ |
|
BUG((*(*((struct_socket *) (*s_objet).objet)).format) |
|
.nombre_occurrences <= 1, |
|
pthread_mutex_unlock(&((*s_objet).mutex)), |
|
printf("(*(*((struct_socket *) (*s_objet).objet))" |
|
".format).nombre_occurrences=%ld\n", |
|
(*(*((struct_socket *) (*s_objet).objet)).format) |
|
.nombre_occurrences)); |
|
|
liberation(s_etat_processus, (*((struct_socket *) |
liberation(s_etat_processus, (*((struct_socket *) |
(*s_objet).objet)).format); |
(*s_objet).objet)).format); |
return; |
return; |
Line 1217 liberation(struct_processus *s_etat_proc
|
Line 1232 liberation(struct_processus *s_etat_proc
|
|
|
liberation(s_etat_processus, (*((struct_socket *) |
liberation(s_etat_processus, (*((struct_socket *) |
(*s_objet).objet)).format); |
(*s_objet).objet)).format); |
|
|
free((unsigned char *) (*((struct_socket *) (*s_objet).objet)) |
free((unsigned char *) (*((struct_socket *) (*s_objet).objet)) |
.adresse); |
.adresse); |
free((unsigned char *) (*((struct_socket *) (*s_objet).objet)) |
free((unsigned char *) (*((struct_socket *) (*s_objet).objet)) |
Line 2278 copie_objet(struct_processus *s_etat_pro
|
Line 2294 copie_objet(struct_processus *s_etat_pro
|
{ |
{ |
incrementation_atomique(s_objet); |
incrementation_atomique(s_objet); |
|
|
if (((*((struct_socket *) ((*s_nouvel_objet).objet))).format = |
if (((*((struct_socket *) ((*s_objet).objet))) |
copie_objet(s_etat_processus, (*((struct_socket *) |
.format = copie_objet(s_etat_processus, |
((*s_objet).objet))).format, 'P')) == NULL) |
(*((struct_socket *) ((*s_objet).objet))).format, 'P')) |
|
== NULL) |
{ |
{ |
return(NULL); |
return(NULL); |
} |
} |
Line 3582 static unsigned long long ordre = 0;
|
Line 3599 static unsigned long long ordre = 0;
|
static pthread_mutex_t mutex_allocation = PTHREAD_MUTEX_INITIALIZER; |
static pthread_mutex_t mutex_allocation = PTHREAD_MUTEX_INITIALIZER; |
|
|
#define check(a, b) ((strcmp(#a, fonction) == 0) && (ligne == b)) |
#define check(a, b) ((strcmp(#a, fonction) == 0) && (ligne == b)) |
#define CORE_DUMP |
#undef CORE_DUMP |
|
|
void * |
void * |
debug_memoire_ajout(size_t taille, const unsigned char *fonction, |
debug_memoire_ajout(size_t taille, const unsigned char *fonction, |
Line 3615 debug_memoire_ajout(size_t taille, const
|
Line 3632 debug_memoire_ajout(size_t taille, const
|
(*debug).profondeur = backtrace((*debug).pile, PROFONDEUR_PILE); |
(*debug).profondeur = backtrace((*debug).pile, PROFONDEUR_PILE); |
# endif |
# endif |
|
|
pthread_mutex_unlock(&mutex_allocation); |
|
|
|
if (((*debug).fonction = malloc((strlen(fonction) + 1) * |
if (((*debug).fonction = malloc((strlen(fonction) + 1) * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_allocation); |
return(NULL); |
return(NULL); |
} |
} |
|
|
if (((*debug).argument = malloc((strlen(argument) + 1) * |
if (((*debug).argument = malloc((strlen(argument) + 1) * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_allocation); |
return(NULL); |
return(NULL); |
} |
} |
|
|
strcpy((*debug).fonction, fonction); |
strcpy((*debug).fonction, fonction); |
strcpy((*debug).argument, argument); |
strcpy((*debug).argument, argument); |
|
|
|
pthread_mutex_unlock(&mutex_allocation); |
ordre++; |
ordre++; |
|
|
return((*debug).pointeur); |
return((*debug).pointeur); |
Line 3676 debug_memoire_modification(void *pointeu
|
Line 3694 debug_memoire_modification(void *pointeu
|
return(NULL); |
return(NULL); |
} |
} |
|
|
pthread_mutex_unlock(&mutex_allocation); |
|
|
|
if (((*element_courant).pointeur = realloc(pointeur, taille)) |
if (((*element_courant).pointeur = realloc(pointeur, taille)) |
== NULL) |
== NULL) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_allocation); |
return(NULL); |
return(NULL); |
} |
} |
|
|
Line 3692 debug_memoire_modification(void *pointeu
|
Line 3709 debug_memoire_modification(void *pointeu
|
if (((*element_courant).fonction = malloc((strlen(fonction) + 1) * |
if (((*element_courant).fonction = malloc((strlen(fonction) + 1) * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_allocation); |
return(NULL); |
return(NULL); |
} |
} |
|
|
if (((*element_courant).argument = malloc((strlen(argument) + 1) * |
if (((*element_courant).argument = malloc((strlen(argument) + 1) * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_allocation); |
return(NULL); |
return(NULL); |
} |
} |
|
|
strcpy((*element_courant).fonction, fonction); |
strcpy((*element_courant).fonction, fonction); |
strcpy((*element_courant).argument, argument); |
strcpy((*element_courant).argument, argument); |
|
|
|
pthread_mutex_unlock(&mutex_allocation); |
|
|
return((*element_courant).pointeur); |
return((*element_courant).pointeur); |
} |
} |
} |
} |
Line 3793 debug_memoire_verification()
|
Line 3814 debug_memoire_verification()
|
(unsigned long long) pthread_self(), |
(unsigned long long) pthread_self(), |
(*element_courant).argument); |
(*element_courant).argument); |
|
|
|
if (strstr((*element_courant).argument, "sizeof(unsigned char)") |
|
!= NULL) |
|
{ |
|
fprintf(stderr, "[%d-%llu] ", getpid(), |
|
(unsigned long long) pthread_self()); |
|
fprintf(stderr, "O: %s\n", (unsigned char *) |
|
(*element_courant).pointeur); |
|
} |
|
else if (strcmp((*element_courant).argument, "sizeof(struct_objet)") |
|
== 0) |
|
{ |
|
fprintf(stderr, "[%d-%llu] ", getpid(), |
|
(unsigned long long) pthread_self()); |
|
fprintf(stderr, "O: %d\n", (*((struct_objet *) |
|
(*element_courant).pointeur)).type); |
|
} |
|
else if (strcmp((*element_courant).argument, |
|
"sizeof(struct_liste_chainee)") == 0) |
|
{ |
|
fprintf(stderr, "[%d-%llu] ", getpid(), |
|
(unsigned long long) pthread_self()); |
|
fprintf(stderr, "O: data=%p next=%p\n", (*((struct_liste_chainee *) |
|
(*element_courant).pointeur)).donnee, |
|
(*((struct_liste_chainee *) (*element_courant).pointeur)) |
|
.suivant); |
|
} |
|
|
# ifdef __BACKTRACE |
# ifdef __BACKTRACE |
appels = backtrace_symbols((*element_courant).pile, |
appels = backtrace_symbols((*element_courant).pile, |
(*element_courant).profondeur); |
(*element_courant).profondeur); |
Line 3834 debug_memoire_verification()
|
Line 3882 debug_memoire_verification()
|
|
|
return; |
return; |
} |
} |
|
|
|
void |
|
debug_memoire_reinitialisation() |
|
{ |
|
ordre = 0; |
|
debug = NULL; |
|
|
|
pthread_mutex_trylock(&mutex_allocation); |
|
pthread_mutex_unlock(&mutex_allocation); |
|
|
|
return; |
|
} |
|
|
void |
void |
analyse_post_mortem() |
analyse_post_mortem() |