aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-11-02 13:48:42 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-11-17 14:49:41 +0000
commitcbda14deaf49b48450207cfb0990c71c11d07a64 (patch)
treed087c5cc98cc361a0a95ee9984e6e9b1d05aecb7 /gdbsupport
parent91f63aa2e2002a1533991b0e52579b2e026f50da (diff)
downloadgdb-cbda14deaf49b48450207cfb0990c71c11d07a64.zip
gdb-cbda14deaf49b48450207cfb0990c71c11d07a64.tar.gz
gdb-cbda14deaf49b48450207cfb0990c71c11d07a64.tar.bz2
gdb: new $_inferior_thread_count convenience variable
Add a new convenience variable $_inferior_thread_count that contains the number of live (non-exited) threads in the current inferior. This can be used in command scripts, or breakpoint conditions, etc to adjust the behaviour for multi-threaded inferiors. This value is only stable in all-stop mode. In non-stop mode, where new threads can be started, and existing threads exit, at any time, this convenience variable can give a different value each time it is evaluated.
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/iterator-range.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdbsupport/iterator-range.h b/gdbsupport/iterator-range.h
index d35b03a..c99bdc8 100644
--- a/gdbsupport/iterator-range.h
+++ b/gdbsupport/iterator-range.h
@@ -53,6 +53,10 @@ struct iterator_range
IteratorType end () const
{ return m_end; }
+ /* The number of items in this iterator_range. */
+ std::size_t size () const
+ { return std::distance (m_begin, m_end); }
+
private:
IteratorType m_begin, m_end;
};