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]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/2516861c44897e2ce791f9c16c0108464eecb070

The commit has NOT been mentioned in any issue.

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4758

 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 788584bf9..698bb1e8a 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