changeset a2ebddfe1a37 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=a2ebddfe1a37
description:
        ruby: fold the debugging options into Debug.cc

diffstat:

3 files changed, 42 insertions(+), 35 deletions(-)
src/mem/ruby/common/Debug.cc  |   39 +++++++++++++++++++++++++--------------
src/mem/ruby/common/Debug.def |   17 -----------------
src/mem/ruby/common/Debug.hh  |   21 +++++++++++++++++----

diffs (127 lines):

diff -r ff34514cbf37 -r a2ebddfe1a37 src/mem/ruby/common/Debug.cc
--- a/src/mem/ruby/common/Debug.cc      Mon May 11 10:38:45 2009 -0700
+++ b/src/mem/ruby/common/Debug.cc      Mon May 11 10:38:45 2009 -0700
@@ -43,20 +43,31 @@
 extern Debug* g_debug_ptr;
 std::ostream * debug_cout_ptr;
 
-// component character list
-const char DEFINE_COMP_CHAR[] =
+struct DebugComponentData
 {
-#undef DEFINE_COMP
-#define DEFINE_COMP(component, character, description) character,
-#include "Debug.def"
+    const char *desc;
+    const char ch;
 };
 
-// component description list
-const char* DEFINE_COMP_DESCRIPTION[] =
+// component character list
+DebugComponentData debugComponents[] =
 {
-#undef DEFINE_COMP
-#define DEFINE_COMP(component, character, description) description,
-#include "Debug.def"
+    {"System",            's' },
+    {"Node",              'N' },
+    {"Queue",             'q' },
+    {"Event Queue",       'e' },
+    {"Network",           'n' },
+    {"Sequencer",         'S' },
+    {"Tester",            't' },
+    {"Generated",         'g' },
+    {"SLICC",             'l' },
+    {"Network Queues",    'Q' },
+    {"Time",              'T' },
+    {"Network Internals", 'i' },
+    {"Store Buffer",      'b' },
+    {"Cache",             'c' },
+    {"Predictor",         'p' },
+    {"Allocator",         'a' },
 };
 
 extern "C" void changeDebugVerbosity(VerbosityLevel vb);
@@ -197,7 +208,7 @@
 {
   for (int i=0; i<NUMBER_OF_COMPS; i++) {
     // Look at all components to find a character match
-    if (DEFINE_COMP_CHAR[i] == ch) {
+    if (debugComponents[i].ch == ch) {
       // We found a match - return no error
       return false; // no error
     }
@@ -263,9 +274,9 @@
 {
   for (int i=0; i<NUMBER_OF_COMPS; i++) {
     // Look at all components to find a character match
-    if (DEFINE_COMP_CHAR[i] == ch) {
+    if (debugComponents[i].ch == ch) {
       // We found a match - update the filter bit mask
-      cout << "  Debug: Adding to filter: '" << ch << "' (" << 
DEFINE_COMP_DESCRIPTION[i] << ")" << endl;
+      cout << "  Debug: Adding to filter: '" << ch << "' (" << 
debugComponents[i].desc << ")" << endl;
       m_filter |= (1 << i);
       return false; // no error
     }
@@ -291,7 +302,7 @@
 {
   cerr << "Debug components: " << endl;
   for (int i=0; i<NUMBER_OF_COMPS; i++) {
-    cerr << "  " << DEFINE_COMP_CHAR[i] << ": " << DEFINE_COMP_DESCRIPTION[i] 
<< endl;
+    cerr << "  " << debugComponents[i].ch << ": " << debugComponents[i].desc 
<< endl;
   }
 }
 
diff -r ff34514cbf37 -r a2ebddfe1a37 src/mem/ruby/common/Debug.def
--- a/src/mem/ruby/common/Debug.def     Mon May 11 10:38:45 2009 -0700
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-DEFINE_COMP(SYSTEM_COMP,            's', "System")
-DEFINE_COMP(NODE_COMP,              'N', "Node")
-DEFINE_COMP(QUEUE_COMP,             'q', "Queue")
-DEFINE_COMP(EVENTQUEUE_COMP,        'e', "Event Queue")
-DEFINE_COMP(NETWORK_COMP,           'n', "Network")
-DEFINE_COMP(SEQUENCER_COMP,         'S', "Sequencer")
-DEFINE_COMP(TESTER_COMP,            't', "Tester")
-DEFINE_COMP(GENERATED_COMP,         'g', "Generated")
-DEFINE_COMP(SLICC_COMP,             'l', "SLICC")
-DEFINE_COMP(NETWORKQUEUE_COMP,      'Q', "Network Queues")
-DEFINE_COMP(TIME_COMP,              'T', "Time")
-DEFINE_COMP(NETWORK_INTERNALS_COMP, 'i', "Network Internals")
-DEFINE_COMP(STOREBUFFER_COMP,       'b', "Store Buffer")
-DEFINE_COMP(CACHE_COMP,             'c', "Cache")
-DEFINE_COMP(PREDICTOR_COMP,         'p', "Predictor")
-DEFINE_COMP(ALLOCATOR_COMP,         'a', "Allocator")
-
diff -r ff34514cbf37 -r a2ebddfe1a37 src/mem/ruby/common/Debug.hh
--- a/src/mem/ruby/common/Debug.hh      Mon May 11 10:38:45 2009 -0700
+++ b/src/mem/ruby/common/Debug.hh      Mon May 11 10:38:45 2009 -0700
@@ -42,10 +42,23 @@
 // component enumeration
 enum DebugComponents
 {
-#undef DEFINE_COMP
-#define DEFINE_COMP(component, character, description) component,
-#include "Debug.def"
-  NUMBER_OF_COMPS
+    SYSTEM_COMP,
+    NODE_COMP,
+    QUEUE_COMP,
+    EVENTQUEUE_COMP,
+    NETWORK_COMP,
+    SEQUENCER_COMP,
+    TESTER_COMP,
+    GENERATED_COMP,
+    SLICC_COMP,
+    NETWORKQUEUE_COMP,
+    TIME_COMP,
+    NETWORK_INTERNALS_COMP,
+    STOREBUFFER_COMP,
+    CACHE_COMP,
+    PREDICTOR_COMP,
+    ALLOCATOR_COMP,
+    NUMBER_OF_COMPS
 };
 
 enum PriorityLevel {HighPrio, MedPrio, LowPrio};
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to