From 296b4bcb29e644479f8daf292967f48506c11f49 Mon Sep 17 00:00:00 2001 From: brolley Date: Mon, 22 Mar 2004 21:28:55 +0000 Subject: [PATCH] 2004-03-22 Dave Brolley * 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 | 12 ++++++++++++ sid/main/dynamic/commonCfg.cxx | 25 ++++++++++++++++++++++++- sid/main/dynamic/commonCfg.h | 8 +++++++- sid/main/dynamic/mainDynamic.cxx | 6 +++--- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/sid/main/dynamic/ChangeLog b/sid/main/dynamic/ChangeLog index 68014ffa81..7b2e1267c0 100644 --- a/sid/main/dynamic/ChangeLog +++ b/sid/main/dynamic/ChangeLog @@ -1,3 +1,15 @@ +2004-03-22 Dave Brolley + + * 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 * commonCfg.cxx (BoardCfg): Initialize 'gprof'. diff --git a/sid/main/dynamic/commonCfg.cxx b/sid/main/dynamic/commonCfg.cxx index d8e7c6deb3..45de208ec9 100644 --- a/sid/main/dynamic/commonCfg.cxx +++ b/sid/main/dynamic/commonCfg.cxx @@ -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 (); } diff --git a/sid/main/dynamic/commonCfg.h b/sid/main/dynamic/commonCfg.h index 72bbc1f13e..5eff189763 100644 --- a/sid/main/dynamic/commonCfg.h +++ b/sid/main/dynamic/commonCfg.h @@ -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 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 { diff --git a/sid/main/dynamic/mainDynamic.cxx b/sid/main/dynamic/mainDynamic.cxx index fa42800251..bd1fc95969 100644 --- a/sid/main/dynamic/mainDynamic.cxx +++ b/sid/main/dynamic/mainDynamic.cxx @@ -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"))); -- 2.11.0