Limit size of log_signal buffer to 100 elements
authorClifford Wolf <clifford@clifford.at>
Sat, 2 Aug 2014 13:52:21 +0000 (15:52 +0200)
committerClifford Wolf <clifford@clifford.at>
Sat, 2 Aug 2014 13:52:21 +0000 (15:52 +0200)
kernel/log.cc
kernel/rtlil.h

index f67d64c25cb9fdf4651849d71c902ef0e77b7228..9cabc6a836e5ae4745247308714e091ff7e54a55 100644 (file)
@@ -41,6 +41,7 @@ int log_verbose_level;
 
 std::vector<int> header_count;
 std::list<std::string> string_buf;
+int string_buf_size = 0;
 
 static struct timeval initial_tv = { 0, 0 };
 static bool next_print_log = false;
@@ -166,6 +167,7 @@ void log_pop()
 {
        header_count.pop_back();
        string_buf.clear();
+       string_buf_size = 0;
        log_flush();
 }
 
@@ -174,6 +176,7 @@ void log_reset_stack()
        while (header_count.size() > 1)
                header_count.pop_back();
        string_buf.clear();
+       string_buf_size = 0;
        log_flush();
 }
 
@@ -197,6 +200,10 @@ const char *log_signal(const RTLIL::SigSpec &sig, bool autoint)
        fputc(0, f);
        fclose(f);
 
+       if (string_buf_size < 100)
+               string_buf_size++;
+       else
+               string_buf.pop_front();
        string_buf.push_back(ptr);
        free(ptr);
 
index 9430da311840f7d247ef8bb0c8098c0c11930b24..7b989385e151fc3f037d50b86aba492f7f82cedd 100644 (file)
@@ -74,7 +74,7 @@ namespace RTLIL
 
        struct IdString
        {
-               // the global string cache
+               // the global id string cache
 
                struct char_ptr_cmp {
                        bool operator()(const char *a, const char *b) {
@@ -134,7 +134,7 @@ namespace RTLIL
                        global_free_idx_list_.push_back(idx);
                }
 
-               // The actual IdString objects just is a single int
+               // the actual IdString object is just is a single int
 
                int index_;