]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
PWGPP-4 Functionality to make a program snapshot -core file
authormivanov <marian.ivanov@cern.ch>
Sat, 10 May 2014 21:12:02 +0000 (23:12 +0200)
committerhristov <Peter.Hristov@cern.ch>
Thu, 29 May 2014 14:36:02 +0000 (16:36 +0200)
  //   gcore - Generate a core file for a running process
  //   gcore dmake a current snapshot, program can continue further
  //   We assum that gcore is installed
  //   for details see:  man gcore
  // Example use - make default core file for current process:  AliLog::MakeCoreDump(0)
  // Automatic core dump creation in case of the AliFatal can be specified using
  // static void  EnableCoreDump(Bool_t enabled);
  // Core dump is created in addition to the stack trace ()
  // marian.ivanov@cern.ch

STEER/STEERBase/AliLog.cxx STEER/STEERBase/AliLog.h - functionality to make a core file

PWGPP-4 Memory leak (M.Gheata)
PWGPP/TPC/AliPerformanceMatch.cxx

PWGPP/TPC/AliPerformanceMatch.cxx
STEER/STEERBase/AliLog.cxx
STEER/STEERBase/AliLog.h

index 46408dad6f7ed0ee1ac63df684d59b50c2423537..d59bd37495ac991ca16a1a8cec173bd772957c2c 100644 (file)
@@ -259,23 +259,20 @@ void AliPerformanceMatch::ProcessITSTPC(Int_t iTrack, AliESDEvent *const esdEven
     // if(trackTPC->GetTPCNclsIter1()<fCutsRC->GetMinNClustersTPC()) continue;
     tpcTrack2 = AliESDtrackCuts::GetTPCOnlyTrack(esdEvent, jTrack);
     if(!tpcTrack2) continue;
-    if(!tpcTrack2->RelateToVertex(vtxESD,esdEvent->GetMagneticField(),100.)) { delete tpcTrack2; continue; } 
+    if(!tpcTrack2->RelateToVertex(vtxESD,esdEvent->GetMagneticField(),100.)) { delete tpcTrack2; tpcTrack2=0; continue; } 
     
-     if(!fCutsRC->AcceptTrack(tpcTrack2)) { delete tpcTrack2; continue; }
+     if(!fCutsRC->AcceptTrack(tpcTrack2)) { delete tpcTrack2; tpcTrack2=0; continue; }
     // check matching
-    if (TMath::Abs(esdTrack->GetY() - tpcTrack2->GetY()) > 3) { delete tpcTrack2; continue; }
-    if (TMath::Abs(esdTrack->GetSnp() - tpcTrack2->GetSnp()) > 0.2) { delete tpcTrack2; continue; }
-    if (TMath::Abs(esdTrack->GetTgl() - tpcTrack2->GetTgl()) > 0.2) { delete tpcTrack2; continue; }
+    if (TMath::Abs(esdTrack->GetY() - tpcTrack2->GetY()) > 3) { delete tpcTrack2; tpcTrack2=0; continue; }
+    if (TMath::Abs(esdTrack->GetSnp() - tpcTrack2->GetSnp()) > 0.2) { delete tpcTrack2; tpcTrack2=0; continue; }
+    if (TMath::Abs(esdTrack->GetTgl() - tpcTrack2->GetTgl()) > 0.2) { delete tpcTrack2; tpcTrack2=0; continue; }
     
     hasMatch=kTRUE;
     break;
   }
   
   FillHistograms(tpcTrack2,esdTrack,hasMatch);     
-  /*  if(tpcTrack2) { 
-    delete tpcTrack2;
-   
-    }*/
+  delete tpcTrack2;
 }
 
 //_____________________________________________________________________________
index af92d3dce88b1b1c2a10c339e24d29c72db292ee..a37e4270844fb33e1ddb3c5599a2c0bba8d7fc71 100644 (file)
@@ -55,6 +55,7 @@ ClassImp(AliLog)
 AliLog* AliLog::fgInstance = NULL;
 
 Bool_t AliLog::fgDebugEnabled = kTRUE;
+Bool_t AliLog::fgCoreEnabled = kFALSE;
 
 /**
  * get root logger singleton instance
@@ -413,6 +414,19 @@ void AliLog::EnableDebug(Bool_t enabled)
   fgDebugEnabled = enabled;
 }
 
+void AliLog::EnableCoreDump(Bool_t enabled)
+{
+// enable or disable debug output
+
+  fgCoreEnabled = enabled;
+  gSystem->ResetSignal(kSigFloatingException,enabled);
+  gSystem->ResetSignal(kSigSegmentationViolation,enabled);
+
+
+}
+
+
+
 //_____________________________________________________________________________
 void AliLog::SetGlobalLogLevel(EType_t type)
 {
@@ -919,13 +933,17 @@ void AliLog::Message(UInt_t level, const char* message,
     delete fgInstance;
     if (gSystem) {
       gSystem->StackTrace();
+      if (fgCoreEnabled) MakeCoreDump("core.AliRoot");
       gSystem->Abort();
     } else {
+      if (fgCoreEnabled) MakeCoreDump("core.AliRoot");
       ::abort();
     }
   }
 }
 
+
+
 //_____________________________________________________________________________
 void AliLog::Debug(UInt_t level, const char* message, 
                   const char* module, const char* className,
@@ -1173,3 +1191,29 @@ void  AliLog::PrintString(Int_t type, FILE* stream, const char* format, ...)
   }
   va_end(ap);
 }
+
+
+void AliLog::MakeCoreDump(const char *fout){
+  //
+  // Functionality to make a program snapshot 
+  //   gcore - Generate a core file for a running process 
+  //   gcore dmake a current snapshot, program can continue further
+  //   We assum that gcore is installed
+  //   for details see:  man gcore
+  //
+  // Example use - make default core file for current process:  AliLog::MakeCoreDump(0)
+  //
+  //
+  // Automatic core dump creation in case of the AliFatal can be specified using
+  // static void  EnableCoreDump(Bool_t enabled);
+  // Core dump is created in addition to the stack trace ()  
+  // marian.ivanov@cern.ch
+  //
+  if (!gSystem) return;
+  printf("AliLog::MakeCoreDump\n");
+  if (fout){
+    gSystem->Exec(Form("gcore -o %s  %d",fout, gSystem->GetPid()));
+  }else{
+    gSystem->Exec(Form("gcore   %d", gSystem->GetPid()));
+  }
+}
index e3256924dd827bcca00b3812b6699e2488829450..edc045bbf4aa14cfc047d9dfa41331ab4542876e 100644 (file)
@@ -43,10 +43,12 @@ class AliLog: public TObject
                static AliLog *GetRootLogger();
 
                // delete root logger singleton instance
-               static void DeleteRootLogger();
+               static void DeleteRootLogger(); 
 
                // NB: the following functions should not be static
                // NB: deprecated: logging configuration should be made through to a configuration file
+  static void  EnableCoreDump(Bool_t enabled);
+  static void MakeCoreDump(const char *fout);  
   static void  EnableDebug(Bool_t enabled);
   static void  SetGlobalLogLevel(EType_t type);
   static Int_t GetGlobalLogLevel();
@@ -148,6 +150,7 @@ class AliLog: public TObject
 
   static AliLog* fgInstance;                 //! pointer to current instance
   static Bool_t  fgDebugEnabled;             // flag for debug en-/disabling
+  static Bool_t  fgCoreEnabled;             // flag for core dump en-/disabling
 
   UInt_t         fGlobalLogLevel;            // global logging level
   TObjArray      fModuleDebugLevels;         // debug levels for modules