Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: nickrob@snap.net.nz (Nick Roberts)
Cc: gdb-patches@sourceware.org
Subject: Re: Patch: implement new dynamic varobj spec
Date: Mon, 14 Sep 2009 20:21:00 -0000	[thread overview]
Message-ID: <m3r5u95lcb.fsf@fleche.redhat.com> (raw)
In-Reply-To: <m3vdjl5lr8.fsf@fleche.redhat.com> (Tom Tromey's message of "Mon, 	14 Sep 2009 14:12:11 -0600")

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> Oh, odd.  But not a bug, really, as the order is not specified.

Nick> It might not be a bug but it's desirable to list them in order as
Nick> that makes it easier to insert them into the existing list.

Tom> Ok, I will look into this.

Could you try the appended patch?
If it works for you I will roll it into the main patch.

Tom

diff --git a/gdb/varobj.c b/gdb/varobj.c
index e7fb589..7235635 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1759,7 +1759,6 @@ VEC(varobj_update_result) *varobj_update (struct varobj **varp, int explicit)
 	{
 	  VEC (varobj_p) *changed = 0, *new = 0, *unchanged = 0;
 	  int i, children_changed;
-	  varobj_p tmp;
 
 	  if (v->frozen)
 	    continue;
@@ -1799,15 +1798,21 @@ VEC(varobj_update_result) *varobj_update (struct varobj **varp, int explicit)
 		  r.children_changed = 1;
 		  r.new = new;
 		}
-	      for (i = 0; VEC_iterate (varobj_p, changed, i, tmp); ++i)
+	      /* Push in reverse order so that the first child is
+		 popped from the work stack first, and so will be
+		 added to result first.  This does not affect
+		 correctness, just "nicer".  */
+	      for (i = VEC_length (varobj_p, changed) - 1; i >= 0; --i)
 		{
+		  varobj_p tmp = VEC_index (varobj_p, changed, i);
 		  varobj_update_result r = {tmp};
 		  r.changed = 1;
 		  r.value_installed = 1;
 		  VEC_safe_push (varobj_update_result, stack, &r);
 		}
-	      for (i = 0; VEC_iterate (varobj_p, unchanged, i, tmp); ++i)
+	      for (i = VEC_length (varobj_p, unchanged) - 1; i >= 0; --i)
 	      	{
+		  varobj_p tmp = VEC_index (varobj_p, unchanged, i);
 	      	  if (!tmp->frozen)
 	      	    {
 	      	      varobj_update_result r = {tmp};


  reply	other threads:[~2009-09-14 20:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-13  2:41 Nick Roberts
2009-09-14 20:12 ` Tom Tromey
2009-09-14 20:21   ` Tom Tromey [this message]
2009-09-15  0:03     ` Nick Roberts
2009-09-14 23:48   ` Nick Roberts
2009-09-15 15:38     ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2009-09-10 20:58 Tom Tromey
2009-09-11  5:41 ` Nick Roberts
2009-09-11 19:41   ` Tom Tromey
2009-09-11 20:49     ` Eli Zaretskii
2009-09-11 21:12       ` Tom Tromey
2009-09-12  8:08         ` Eli Zaretskii
2009-09-11 23:55     ` Nick Roberts
2009-09-14 19:59       ` Tom Tromey
2009-09-14 22:55         ` Nick Roberts
2009-09-15 15:37           ` Tom Tromey
2009-09-15 22:28             ` Nick Roberts
2009-09-16  5:45               ` Vladimir Prus
2009-09-16  9:56                 ` Nick Roberts
2009-09-16 17:12               ` Tom Tromey
2009-09-16 22:26                 ` Nick Roberts
2009-09-15 22:43             ` Nick Roberts
2009-09-16  5:39               ` Vladimir Prus
2009-09-16  9:36                 ` Nick Roberts
2009-09-16  5:44         ` Vladimir Prus
2009-09-14 19:56   ` Tom Tromey
2009-09-12  9:18 ` Eli Zaretskii
2009-09-14 20:03   ` Tom Tromey
2009-09-14 20:22     ` Eli Zaretskii
2009-09-14 21:29       ` Tom Tromey
2009-09-15  3:06         ` Eli Zaretskii
2009-09-14 11:24 ` Vladimir Prus
2009-09-16 23:53   ` Tom Tromey
2009-09-16  5:46     ` Vladimir Prus
2009-09-19 12:01     ` Matt Rice
2009-09-19 15:59       ` Joel Brobecker
2009-09-14 20:05 ` Tom Tromey
2009-09-14 20:24   ` Eli Zaretskii
2009-09-14 23:58   ` Nick Roberts
2009-09-18  9:29 ` Vladimir Prus
2009-09-18 18:25   ` Tom Tromey
2009-09-19 12:57   ` Vladimir Prus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3r5u95lcb.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nickrob@snap.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox