OSDN Git Service

2004-03-22 Dave Brolley <brolley@redhat.com>
authorbrolley <brolley>
Mon, 22 Mar 2004 21:28:55 +0000 (21:28 +0000)
committerbrolley <brolley>
Mon, 22 Mar 2004 21:28:55 +0000 (21:28 +0000)
        * mainDynamic.cxx (main): Call add_board in place of add_child.
        * commonCfg.h (add_gdb): New method of SessionCfg.
        (add_board): Ditto.
        (write_config): Ditto.
        (board_count): New member of SessionCfg.
        (gdb_count): Ditto.
        * commonCfg.cxx (SessionCfg): Initialize board_count and gdb_count.
        (SessionCfg::write_config): New method.
        (set_gdb): Call sess->add_gdb.

sid/main/dynamic/ChangeLog
sid/main/dynamic/commonCfg.cxx
sid/main/dynamic/commonCfg.h
sid/main/dynamic/mainDynamic.cxx

index 68014ff..7b2e126 100644 (file)
@@ -1,3 +1,15 @@
+2004-03-22  Dave Brolley  <brolley@redhat.com>
+
+       * mainDynamic.cxx (main): Call add_board in place of add_child.
+       * commonCfg.h (add_gdb): New method of SessionCfg.
+       (add_board): Ditto.
+       (write_config): Ditto.
+       (board_count): New member of SessionCfg.
+       (gdb_count): Ditto.
+       * commonCfg.cxx (SessionCfg): Initialize board_count and gdb_count.
+       (SessionCfg::write_config): New method.
+       (set_gdb): Call sess->add_gdb.
+
 2003-10-26  Dave Brolley  <brolley@redhat.com>
 
        * commonCfg.cxx (BoardCfg): Initialize 'gprof'.
index d8e7c6d..45de208 100644 (file)
@@ -530,7 +530,9 @@ SessionCfg::SessionCfg (const string name)
     tcl_bridge (NULL),
     loader (NULL),
     verbose (false),
-    use_stdio (true)
+    use_stdio (true),
+    board_count (0),
+    gdb_count (0)
 {
   add_child (host_sched);
   add_child (sim_sched);
@@ -657,6 +659,26 @@ void SessionCfg::use_tcl_bridge ()
   init_seq->add_output (7, tcl_bridge, "!event");
 }
 
+void SessionCfg::write_config (Writer &w)
+{
+  AggregateCfg::write_config (w);
+
+  // Stop the host scheduler if all of the GDB stubs are stopped
+  if (gdb_count)
+    {
+      assert (host_sched);
+      Setting (host_sched, "yield-host-time-threshold",
+              sidutil::make_attribute (gdb_count)).write_to (w);
+      Setting (host_sched, "yield-host-time?", "0").write_to (w);
+    }
+
+  // Stop the sim scheduler if any of the GDB stubs are stopped
+  assert (sim_sched);
+  Setting (sim_sched, "enable-threshold",
+          sidutil::make_attribute (board_count)).write_to (w);
+  Setting (sim_sched, "enabled?",
+          sidutil::make_attribute (board_count)).write_to (w);
+}
 
 // LoaderCfg 
 LoaderCfg::~LoaderCfg () {}
@@ -920,6 +942,7 @@ void BoardCfg::set_gdb (const string port)
   gdb = new GdbCfg ("gdb", port, cpu, this, sess);
   add_child (gdb);
   sess->use_no_stdio ();
+  sess->add_gdb ();
 }
 
 
index 72bbc1f..5eff189 100644 (file)
@@ -182,6 +182,7 @@ struct UlogCfg
 
 // you should really only make one of these, with an empty name,
 // unless you want some crazy multi-session support.
+class BoardCfg;
 class LoaderCfg;
 
 struct SessionCfg :
@@ -214,6 +215,12 @@ struct SessionCfg :
   bool use_stdio;
   void add_ulog_file (const string filename);
   map<const string, AtomicCfg *> ulog_map;
+  void add_gdb () { ++gdb_count; }
+  void add_board (ComponentCfg *b) { ++board_count; add_child (b); }
+  virtual void write_config (Writer &w);
+private:
+  sid::host_int_4 board_count;
+  sid::host_int_4 gdb_count;
 };
 
 class CpuCfg :
@@ -277,7 +284,6 @@ public:
   virtual ~GprofCfg ();
 };
 
-class BoardCfg;
 class GdbCfg :
   virtual public AggregateCfg
 {
index fa42800..bd1fc95 100644 (file)
@@ -1,6 +1,6 @@
 // mainDynamic.cxx - high-tech mainline.  -*- C++ -*-
 
-// Copyright (C) 1999, 2000, 2001, 2002, 2003 Red Hat.
+// Copyright (C) 1999-2004 Red Hat.
 // This file is part of SID and is licensed under the GPL.
 // See the file COPYING.SID for conditions for redistribution.
 
@@ -617,7 +617,7 @@ main(int argc, char* argv[])
              {
                need_sess (sess);
                if (curr_board)
-                 sess->add_child (curr_board);
+                 sess->add_board (curr_board);
                curr_board = NULL;
                string new_board_type = optstring();
                string new_board_name (new_board_type + "-" + 
@@ -878,7 +878,7 @@ main(int argc, char* argv[])
     }
 
   if (sess && curr_board)
-    sess->add_child (curr_board);
+    sess->add_board (curr_board);
 
   if (persistent_p)
     config_items.push_back (make_pair (false, string("set main persistent? true")));