Diff for /rpl/src/gestion_objets.c between versions 1.11 and 1.16

version 1.11, 2010/04/21 12:30:26 version 1.16, 2010/05/13 19:09:18
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.0.14    RPL/2 (R) version 4.0.15
   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 2762  copie_etat_processus(struct_processus *s Line 2762  copie_etat_processus(struct_processus *s
     (*s_nouvel_etat_processus).nombre_interruptions_en_queue = 0;      (*s_nouvel_etat_processus).nombre_interruptions_en_queue = 0;
     (*s_nouvel_etat_processus).nombre_interruptions_non_affectees = 0;      (*s_nouvel_etat_processus).nombre_interruptions_non_affectees = 0;
   
       (*s_nouvel_etat_processus).at_exit = NULL;
   
     for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)      for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
     {      {
         (*s_nouvel_etat_processus).corps_interruptions[i] = NULL;          (*s_nouvel_etat_processus).corps_interruptions[i] = NULL;
Line 3533  copie_etat_processus(struct_processus *s Line 3535  copie_etat_processus(struct_processus *s
   
 #undef fprintf  #undef fprintf
   
   #ifdef __BACKTRACE
 #define return(a) { if (a == NULL) \  #define return(a) { if (a == NULL) \
         { BACKTRACE(20); fprintf(stderr, ">>> MEDITATION %d\n", __LINE__); } \          { BACKTRACE(20); fprintf(stderr, ">>> MEDITATION %d\n", __LINE__); } \
         return(a); } while(0)          return(a); } while(0)
   #define PROFONDEUR_PILE 64
   #endif
   
 typedef struct memoire  typedef struct memoire
 {  {
Line 3545  typedef struct memoire Line 3550  typedef struct memoire
     unsigned long       ligne;      unsigned long       ligne;
     size_t              taille;      size_t              taille;
     unsigned long long  ordre;      unsigned long long  ordre;
   #   ifdef __BACKTRACE
       void                *pile[PROFONDEUR_PILE];
       int                 profondeur;
   #   endif
     struct memoire      *suivant;      struct memoire      *suivant;
       pthread_t           thread;
       pid_t               pid;
 } struct_memoire;  } struct_memoire;
   
 static struct_memoire       *debug = NULL;  static struct_memoire       *debug = NULL;
Line 3580  debug_memoire_ajout(size_t taille, const Line 3591  debug_memoire_ajout(size_t taille, const
     (*debug).ligne = ligne;      (*debug).ligne = ligne;
     (*debug).taille = taille;      (*debug).taille = taille;
     (*debug).ordre = ordre;      (*debug).ordre = ordre;
       (*debug).thread = pthread_self();
       (*debug).pid = getpid();
   
   #   ifdef __BACKTRACE
       (*debug).profondeur = backtrace((*debug).pile, PROFONDEUR_PILE);
   #   endif
   
     pthread_mutex_unlock(&mutex_allocation);      pthread_mutex_unlock(&mutex_allocation);
   
Line 3726  debug_memoire_retrait(void *pointeur) Line 3743  debug_memoire_retrait(void *pointeur)
 void  void
 debug_memoire_verification(struct_processus *s_etat_processus)  debug_memoire_verification(struct_processus *s_etat_processus)
 {  {
   #   ifdef __BACKTRACE
       char            **appels;
   #   endif
   
       int             j;
   
     integer8        i;      integer8        i;
   
     struct_memoire  *element_courant;      struct_memoire  *element_courant;
Line 3741  debug_memoire_verification(struct_proces Line 3764  debug_memoire_verification(struct_proces
   
     while(element_courant != NULL)      while(element_courant != NULL)
     {      {
         fprintf(stderr, "[%d-%llu] MEDITATION %lld (%llu)\n", getpid(),          if (((*element_courant).pid == getpid()) &&
                 (unsigned long long) pthread_self(), i,                  (pthread_equal((*element_courant).thread, pthread_self()) != 0))
                 (*element_courant).ordre);  
         fprintf(stderr, "[%d-%llu] P: %p, F: %s(), L: %lu, S: %d\n",  
                 getpid(), (unsigned long long) pthread_self(),  
                 (*element_courant).pointeur,  
                 (*element_courant).fonction, (*element_courant).ligne,  
                 (int) (*element_courant).taille);  
         fprintf(stderr, "[%d-%llu] A: %s\n", getpid(),  
                 (unsigned long long) pthread_self(),  
                 (*element_courant).argument);  
   
         switch(i)  
         {          {
             // Affichage des méditations              fprintf(stderr, "[%d-%llu] MEDITATION %lld (%llu)\n", getpid(),
             case 1:                      (unsigned long long) pthread_self(), i,
                       (*element_courant).ordre);
               fprintf(stderr, "[%d-%llu] P: %p, F: %s(), L: %lu, S: %d\n",
                       getpid(), (unsigned long long) pthread_self(),
                       (*element_courant).pointeur,
                       (*element_courant).fonction, (*element_courant).ligne,
                       (int) (*element_courant).taille);
               fprintf(stderr, "[%d-%llu] A: %s\n", getpid(),
                       (unsigned long long) pthread_self(),
                       (*element_courant).argument);
   
   #           ifdef __BACKTRACE
               appels = backtrace_symbols((*element_courant).pile,
                       (*element_courant).profondeur);
   
               fprintf(stderr, "[%d-%llu] BACKTRACE\n",
                       getpid(), (unsigned long long) pthread_self());
   
               if (appels != NULL)
             {              {
                 break;                  for(j = 0; j < (*element_courant).profondeur; j++)
                   {
                       fprintf(stderr, "[%d-%llu] %s\n", getpid(),
                               (unsigned long long) pthread_self(), appels[j]);
                   }
   
                   free(appels);
             }              }
         }  #           endif
   
         i++;              fprintf(stderr, "\n");
   
               i++;
           }
   
         element_suivant = (*element_courant).suivant;          element_suivant = (*element_courant).suivant;
         free((*element_courant).fonction);          free((*element_courant).fonction);

Removed from v.1.11  
changed lines
  Added in v.1.16


CVSweb interface <joel.bertrand@systella.fr>