diff options
Diffstat (limited to 'gdb/completer.h')
-rw-r--r-- | gdb/completer.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/completer.h b/gdb/completer.h index 8b4ad8e..67d2fbf 100644 --- a/gdb/completer.h +++ b/gdb/completer.h @@ -145,7 +145,12 @@ public: /* Mark the range between [BEGIN, END) as ignored. */ void mark_ignored_range (const char *begin, const char *end) - { m_ignored_ranges.emplace_back (begin, end); } + { + gdb_assert (begin < end); + gdb_assert (m_ignored_ranges.empty () + || m_ignored_ranges.back ().second < begin); + m_ignored_ranges.emplace_back (begin, end); + } /* Get the resulting LCD, after a successful match. If there are ignored ranges, then this builds a new string with the ignored @@ -160,9 +165,14 @@ public: { m_finished_storage.clear (); + gdb_assert (m_ignored_ranges.back ().second + <= (m_match + strlen (m_match))); + const char *prev = m_match; for (const auto &range : m_ignored_ranges) { + gdb_assert (prev < range.first); + gdb_assert (range.second > range.first); m_finished_storage.append (prev, range.first); prev = range.second; } @@ -179,6 +189,13 @@ public: m_ignored_ranges.clear (); } + /* Return true if this object has had no match data set since its + creation, or the last call to clear. */ + bool empty () const + { + return m_match == nullptr && m_ignored_ranges.empty (); + } + private: /* The completion match result for LCD. This is usually either a pointer into to a substring within a symbol's name, or to the |