Salome HOME
27c5fe410d6a41c07b48c845efd5ba16e57cd4fa
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI_Trace.cxx
1 // Copyright (C) 2009-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include <cstdlib>
21 #include <iostream>
22 #include <sstream>
23
24 #include "HEXABLOCKGUI_Trace.hxx"
25
26
27 #ifdef WNT
28 #include <process.h>
29 #define getpid _getpid
30 #else                         // Modification INCKA AD
31 #include<stdio.h>
32 #include<sys/types.h>
33 #include <unistd.h>
34 #endif
35
36 namespace HEXABLOCK{
37   namespace GUI{
38     int traceLevel=0;
39   }
40 }
41
42 void AttachDebugger()
43 {
44   if(getenv ("HEXABLOCKDEBUGGER"))
45     {
46       std::stringstream exec;
47       exec << "$HEXABLOCKDEBUGGER " << getpid() << "&";
48       std::cerr << exec.str() << std::endl;
49       system(exec.str().c_str());
50       while(1);
51     }
52 }