From: Daniel Jacobowitz <drow@false.org>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: gdb-patches@sources.redhat.com
Subject: Re: MI testsuite failures [PATCH]
Date: Mon, 08 Jan 2007 17:11:00 -0000 [thread overview]
Message-ID: <20070108171149.GC15412@nevyn.them.org> (raw)
In-Reply-To: <17825.56391.466504.569955@kahikatea.snap.net.nz>
On Mon, Jan 08, 2007 at 06:53:11PM +1300, Nick Roberts wrote:
> Here's a patch with fixes for the testsuite. I've made a further change to
> varobj.c to fix a failure in mi-var-child.exp.
Was this:
FAIL: gdb.mi/mi-var-child.exp: update all vars int_ptr_ptr and children changed
FAIL: gdb.mi/mi-var-child.exp: update all vars struct_declarations.long_array.0 changed
?
The patch below fixes those, and this one too:
FAIL: gdb.mi/mi-var-cmd.exp: assign same value to func (update)
I can't quite tell what your patch does, but I do see why these
failures happen. Because the var->updated and the var->value
previously NULL cases were not updating print_value, you sometimes had
to -var-update twice to get a value to leave the list.
This is the same reason you had to add spurious -var-update's to the
testsuite. We should only need this testsuite change:
> * gdb.mi/mi-var-cmd.exp: Add fields to changelists for string
> contents changes.
The first time we do that it's a good thing, i.e. we want lpcharacter
to be listed now. The second time it's kind of dodgy: lpcharacter
is not a NULL terminated string and it just so happens that linteger
is right after lcharacter in memory, so -var-assign'ing to linteger
"changes" the string pointer to by lpcharacter.
--
Daniel Jacobowitz
CodeSourcery
2007-01-08 Daniel Jacobowitz <dan@codesourcery.com>
* varobj.c (install_new_value): Always update print_value.
(value_get_print_value): Immediately return NULL for missing
values.
2007-01-08 Nick Roberts <nickrob@snap.net.nz>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.mi/mi-var-cmd.exp: Expect lpcharacter to update when
lcharacter or linteger change. Correct duplicated test name.
* gdb.mi/mi2-var-cmd.exp: Likewise.
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.76
diff -u -p -r1.76 varobj.c
--- varobj.c 5 Jan 2007 21:58:48 -0000 1.76
+++ varobj.c 8 Jan 2007 17:08:01 -0000
@@ -966,9 +966,13 @@ install_new_value (struct varobj *var, s
/* If the value of the varobj was changed by -var-set-value, then the
value in the varobj and in the target is the same. However, that value
is different from the value that the varobj had after the previous
- -var-update. So need to the varobj as changed. */
+ -var-update. So need to the varobj as changed. */
if (var->updated)
- changed = 1;
+ {
+ xfree (var->print_value);
+ var->print_value = value_get_print_value (value, var->format);
+ changed = 1;
+ }
else
{
/* Try to compare the values. That requires that both
@@ -979,7 +983,11 @@ install_new_value (struct varobj *var, s
/* Equal. */
;
else if (var->value == NULL || value == NULL)
- changed = 1;
+ {
+ xfree (var->print_value);
+ var->print_value = value_get_print_value (value, var->format);
+ changed = 1;
+ }
else
{
char *print_value;
@@ -987,6 +995,7 @@ install_new_value (struct varobj *var, s
gdb_assert (!value_lazy (value));
print_value = value_get_print_value (value, var->format);
+ gdb_assert (var->print_value != NULL && print_value != NULL);
if (strcmp (var->print_value, print_value) != 0)
{
xfree (var->print_value);
@@ -1687,12 +1696,19 @@ static char *
value_get_print_value (struct value *value, enum varobj_display_formats format)
{
long dummy;
- struct ui_file *stb = mem_fileopen ();
- struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
+ struct ui_file *stb;
+ struct cleanup *old_chain;
char *thevalue;
-
+
+ if (value == NULL)
+ return NULL;
+
+ stb = mem_fileopen ();
+ old_chain = make_cleanup_ui_file_delete (stb);
+
common_val_print (value, stb, format_code[(int) format], 1, 0, 0);
thevalue = ui_file_xstrdup (stb, &dummy);
+
do_cleanups (old_chain);
return thevalue;
}
Index: testsuite/gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.22
diff -u -p -r1.22 mi-var-cmd.exp
--- testsuite/gdb.mi/mi-var-cmd.exp 4 Jan 2007 21:59:10 -0000 1.22
+++ testsuite/gdb.mi/mi-var-cmd.exp 8 Jan 2007 17:08:01 -0000
@@ -261,8 +261,8 @@ mi_execute_to "exec-step 8" "end-steppin
# Note: this test also checks that lpsimple->integer and lsimple.integer have
# changed (they are the same)
mi_gdb_test "-var-update *" \
- "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
- "update all vars: func and lpsimple changed"
+ "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
+ "update all vars: lsimple and others changed"
###
@@ -278,8 +278,13 @@ mi_gdb_test "-var-assign linteger 3333"
"\\^done,value=\"3333\"" \
"assign to linteger"
+# Allow lpcharacter to update, optionally. Because it points to a
+# char variable instead of a zero-terminated string, if linteger is
+# directly after it in memory the printed characters may appear to
+# change.
+set lpchar_update "\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},"
mi_gdb_test "-var-update *" \
- "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
+ "\\^done,changelist=\\\[($lpchar_update)?\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
"update all vars: linteger changed after assign"
mi_gdb_test "-var-assign linteger 3333" \
Index: testsuite/gdb.mi/mi2-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-var-cmd.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi2-var-cmd.exp
--- testsuite/gdb.mi/mi2-var-cmd.exp 4 Jan 2007 18:58:03 -0000 1.6
+++ testsuite/gdb.mi/mi2-var-cmd.exp 8 Jan 2007 17:08:01 -0000
@@ -261,8 +261,8 @@ mi_execute_to "exec-step 8" "end-steppin
# Note: this test also checks that lpsimple->integer and lsimple.integer have
# changed (they are the same)
mi_gdb_test "-var-update *" \
- "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
- "update all vars: func and lpsimple changed"
+ "\\^done,changelist=\\\[\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"ldouble\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lfloat\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
+ "update all vars: lsimple and others changed"
###
@@ -278,8 +278,13 @@ mi_gdb_test "-var-assign linteger 3333"
"\\^done,value=\"3333\"" \
"assign to linteger"
+# Allow lpcharacter to update, optionally. Because it points to a
+# char variable instead of a zero-terminated string, if linteger is
+# directly after it in memory the printed characters may appear to
+# change.
+set lpchar_update "\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\},"
mi_gdb_test "-var-update *" \
- "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
+ "\\^done,changelist=\\\[($lpchar_update)?\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
"update all vars: linteger changed after assign"
mi_gdb_test "-var-assign linteger 3333" \
next prev parent reply other threads:[~2007-01-08 17:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-07 23:34 MI testsuite failures Nick Roberts
2007-01-08 5:53 ` MI testsuite failures [PATCH] Nick Roberts
2007-01-08 17:11 ` Daniel Jacobowitz [this message]
2007-01-08 22:33 ` Nick Roberts
2007-01-08 22:45 ` Daniel Jacobowitz
2007-01-08 23:27 ` Nick Roberts
2007-01-09 14:26 ` Daniel Jacobowitz
2007-01-09 22:18 ` Nick Roberts
2007-01-09 22:50 ` Daniel Jacobowitz
2007-01-10 7:09 ` Nick Roberts
2007-01-10 20:23 ` Daniel Jacobowitz
2007-01-08 7:44 ` MI testsuite failures Vladimir Prus
2007-01-08 8:15 ` Nick Roberts
2007-01-08 9:40 ` 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=20070108171149.GC15412@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--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