From: Pierre-Emmanuel Patry <[email protected]>

This data structure is complex, when using the debug dump within a
debugger we often need to know what is the current state and where new
nodes will be pushed within the forever stack.

gcc/rust/ChangeLog:

        * resolve/rust-forever-stack.hxx: Debug the forever stack cursor
        position.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>

Tested on x86_64-pc-linux-gnu.

---
 gcc/rust/resolve/rust-forever-stack.hxx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/resolve/rust-forever-stack.hxx 
b/gcc/rust/resolve/rust-forever-stack.hxx
index 788584bf93a..698bb1e8a2b 100644
--- a/gcc/rust/resolve/rust-forever-stack.hxx
+++ b/gcc/rust/resolve/rust-forever-stack.hxx
@@ -717,7 +717,11 @@ ForeverStack<N>::stream_node (std::stringstream &stream, 
unsigned indentation,
   auto next = std::string (indentation + 4, ' ');
   auto next_next = std::string (indentation + 8, ' ');
 
-  stream << indent << "Node {\n"
+  std::string cursor_text = "";
+  if (node.id == cursor ().id)
+    cursor_text = "(C)";
+
+  stream << indent << "Node " << cursor_text << "{\n"
         << next << "is_root: " << (node.is_root () ? "true" : "false") << ",\n"
         << next << "is_leaf: " << (node.is_leaf () ? "true" : "false")
         << ",\n";
-- 
2.55.0

Reply via email to