Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1946 - in trunk/Core: Exceptions Thread


Chronological Thread 
  • From: thiago@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1946 - in trunk/Core: Exceptions Thread
  • Date: Tue, 25 Dec 2007 23:18:09 -0700 (MST)

Author: thiago
Date: Tue Dec 25 23:18:09 2007
New Revision: 1946

Modified:
   trunk/Core/Exceptions/Exception.cc
   trunk/Core/Thread/Thread.cc
Log:
GDB now correctly attaches to manta (need to pass -c before the
pid). As a bonus, nasty dirty tabs were also removed from Exception.cc

Also, is there any reason to still offer cvd as an option?

Modified: trunk/Core/Exceptions/Exception.cc
==============================================================================
--- trunk/Core/Exceptions/Exception.cc  (original)
+++ trunk/Core/Exceptions/Exception.cc  Tue Dec 25 23:18:09 2007
@@ -166,7 +166,7 @@
 #ifdef HAVE_EXC
         sprintf(command, "winterm -c dbx -p %d &", getpid());
 #else
-        sprintf(command, "xterm -e gdb %d&", getpid());
+        sprintf(command, "xterm -e gdb -c %d&", getpid());
 #endif
       }
       cerr << "Starting: " << command << '\n';

Modified: trunk/Core/Thread/Thread.cc
==============================================================================
--- trunk/Core/Thread/Thread.cc (original)
+++ trunk/Core/Thread/Thread.cc Tue Dec 25 23:18:09 2007
@@ -117,8 +117,8 @@
 {
     if(runner_){
         runner_->my_thread_=0;
-       if(runner_->delete_on_exit)
-         delete runner_;
+        if(runner_->delete_on_exit)
+          delete runner_;
     }
     free(const_cast<char *>(threadname_));
 }
@@ -139,17 +139,17 @@
 Thread::run_body()
 {
     try {
-       runner_->run();
+      runner_->run();
     } catch(const ThreadError& e){
-       fprintf(stderr, "Caught unhandled Thread error:\n%s\n",
-               e.message());
-       Thread::niceAbort();
+      fprintf(stderr, "Caught unhandled Thread error:\n%s\n",
+              e.message());
+      Thread::niceAbort();
     } catch(const Exception& e){
-       fprintf(stderr, "Caught unhandled exception:\n%s\n",e.message());
+      fprintf(stderr, "Caught unhandled exception:\n%s\n",e.message());
         const char *trace = e.stackTrace();
         if (trace)
           fprintf(stderr, "Exception %s", trace);
-       Thread::niceAbort();
+        Thread::niceAbort();
     } catch(const std::string &e){
       fprintf(stderr, "Caught unhandled string exception:\n%s\n", e.c_str());
       Thread::niceAbort();
@@ -160,14 +160,14 @@
     // catch these differently with MS compiler, we can get the whole stack 
trace, but it must be done with
     // an MS-specific exception handler in a different function
     } catch(...){
-       fprintf(stderr, "Caught unhandled exception of unknown type\n");
-       Thread::niceAbort();
+      fprintf(stderr, "Caught unhandled exception of unknown type\n");
+      Thread::niceAbort();
 #endif
     }
 }
 
 Thread::Thread(Runnable* runner, const char* name,
-              ThreadGroup* group, ActiveState state,
+               ThreadGroup* group, ActiveState state,
                unsigned long stacksize)
     : runner_(runner),
       threadname_(strdup(name)),
@@ -179,7 +179,7 @@
 {
     if(group_ == 0){
         if(!ThreadGroup::s_default_group)
-           Thread::initialize();
+          Thread::initialize();
         group_=ThreadGroup::s_default_group;
     }
 
@@ -187,17 +187,17 @@
     group_->addme(this);
     switch(state){
     case Activated:
-       os_start(false);
-       activated_=true;
-       break;
+      os_start(false);
+      activated_=true;
+      break;
     case Stopped:
-       os_start(true);
-       activated_=true;
-       break;
+      os_start(true);
+      activated_=true;
+      break;
     case NotActivated:
-       activated_=false;
-       priv_=0;
-       break;
+      activated_=false;
+      priv_=0;
+      break;
     }
 }
 
@@ -205,7 +205,7 @@
 Thread::activate(bool stopped)
 {
     if(activated_)
-       throw ThreadError("Thread is already activated");
+      throw ThreadError("Thread is already activated");
     activated_=true;
     os_start(stopped);
 }
@@ -249,7 +249,7 @@
 
 ThreadGroup*
 Thread::parallel(ParallelBase& helper, int nthreads,
-                bool block, ThreadGroup* threadGroup)
+                 bool block, ThreadGroup* threadGroup)
 {
   if (block && nthreads <= 1)
   {
@@ -267,7 +267,7 @@
     char buf[50];
     sprintf(buf, "Parallel thread %d of %d", i, nthreads);
     new Thread(new ParallelHelper(helper, i), buf,
-              newgroup, Thread::Stopped);
+               newgroup, Thread::Stopped);
   }
   newgroup->gangSchedule();
   newgroup->resume();
@@ -290,7 +290,7 @@
   const char* smode = getenv("SCI_SIGNALMODE");
   if (!smode)
     smode = defaultAbortMode; //"e"; 
-       
+
   Thread* s=Thread::self();
   print_threads();
   fprintf(stderr, "\n");
@@ -306,31 +306,31 @@
       fprintf(stderr, "resume(r)/dbx(d)/cvd(c)/kill thread(k)/exit(e)? ");
       fflush(stderr);
       while(read(fileno(stdin), buf, 100) <= 0){
-       if(errno != EINTR){
-         fprintf(stderr, "\nCould not read response, sleeping for 20 
seconds.\n");
+        if(errno != EINTR){
+          fprintf(stderr, "\nCould not read response, sleeping for 20 
seconds.\n");
           Time::waitFor(20.0);
-         buf[0]='e';
-         exitAll(1);
-       }
+          buf[0]='e';
+          exitAll(1);
+        }
       }
       switch (buf[0]) {
       case 'r': case 'R':
-       smode = "resume";
-       break;
+        smode = "resume";
+        break;
       case 'd': case 'D':
-       smode = "dbx";
-       break;
+        smode = "dbx";
+        break;
       case 'c': case 'C':
-       smode = "cvd";
-       break;
+        smode = "cvd";
+        break;
       case 'k': case 'K':
-       smode = "kill";
-       break;
+        smode = "kill";
+        break;
       case 'e': case 'E':
-       smode = "exit";
-       break;
+        smode = "exit";
+        break;
       default:
-       break;
+        break;
       }
     }
 
@@ -343,12 +343,12 @@
 #else
       char command[500];
       if(getenv("SCI_DBXCOMMAND")){
-       sprintf(command, getenv("SCI_DBXCOMMAND"), getpid());
+        sprintf(command, getenv("SCI_DBXCOMMAND"), getpid());
       } else {
 #ifdef __sgi
-       sprintf(command, "winterm -c dbx -p %d &", getpid());
+        sprintf(command, "winterm -c dbx -p %d &", getpid());
 #else
-       sprintf(command, "xterm -e gdb %d &", getpid());
+        sprintf(command, "xterm -e gdb -c %d &", getpid());
 #endif
       }
       system(command);




  • [Manta] r1946 - in trunk/Core: Exceptions Thread, thiago, 12/26/2007

Archive powered by MHonArc 2.6.16.

Top of page