public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Check has_more in mi_create_dynamic_varobj
  2013-11-21 11:37 [PATCH 1/2] Use mi_create_floating_varobj Yao Qi
@ 2013-11-21  5:06 ` Yao Qi
  2013-11-21 19:45   ` Tom Tromey
  2013-11-21 19:44 ` [PATCH 1/2] Use mi_create_floating_varobj Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Yao Qi @ 2013-11-21  5:06 UTC (permalink / raw)
  To: gdb-patches

Hi,
I find "has_more" is not checked when a dynamic varobj is created in
proc mi_create_dynamic_varobj.  This patch adds the check to
"has_more".

gdb/testsuite:

2013-11-21  Yao Qi  <yao@codesourcery.com>

	* lib/mi-support.exp (mi_create_dynamic_varobj): Update
	comment and add one more argument "has_more".
	* gdb.python/py-mi.exp: Callers update.
---
 gdb/testsuite/gdb.python/py-mi.exp |   16 +++++++++-------
 gdb/testsuite/lib/mi-support.exp   |    5 +++--
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index 69bc093..b132a56 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -87,7 +87,9 @@ mi_gdb_test "-var-update string" \
     "\\^done,changelist=\\\[{name=\"string\",in_scope=\"true\",type_changed=\"false\",dynamic=\"1\",has_more=\"0\"}\\\]" \
     "update string varobj after assignment"
 
-mi_create_dynamic_varobj container c \
+# The "elements" field of "c" is still empty, so the attribute
+# "has_more" is expected to be zero.
+mi_create_dynamic_varobj container c 0 \
   "create container varobj"
 
 mi_list_varobj_children container {
@@ -202,7 +204,7 @@ mi_next "next over update 5"
 
 # Regression test: examine an object that has no children, then update
 # it to ensure that we don't print the children.
-mi_create_dynamic_varobj container2 c2 \
+mi_create_dynamic_varobj container2 c2 0 \
   "create second container varobj"
 
 mi_gdb_test "-var-update container2" \
@@ -223,7 +225,7 @@ mi_continue_to_line \
     [gdb_get_line_number {MI outer breakpoint here} ${srcfile}] \
     "step to outer breakpoint"
 
-mi_create_dynamic_varobj outer outer \
+mi_create_dynamic_varobj outer outer 1 \
   "create outer varobj"
 
 mi_list_varobj_children outer {
@@ -253,7 +255,7 @@ mi_continue_to_line \
     [gdb_get_line_number {break to inspect struct and union} ${srcfile}] \
     "step to outer breakpoint"
 
-mi_create_dynamic_varobj nscont nstype \
+mi_create_dynamic_varobj nscont nstype 1 \
   "create nstype varobj"
 
 mi_list_varobj_children nscont {
@@ -275,7 +277,7 @@ mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \
 
 mi_gdb_test "python exception_flag = True" ""
 
-mi_create_dynamic_varobj nstype2 nstype2 \
+mi_create_dynamic_varobj nstype2 nstype2 1 \
   "create nstype2 varobj"
 
 mi_list_varobj_children nstype2 {
@@ -290,7 +292,7 @@ mi_gdb_test "-var-evaluate-expression me" \
 	"evaluate me varobj"
 
 # Regression test for python/14836.
-mi_create_dynamic_varobj children_as_list children_as_list \
+mi_create_dynamic_varobj children_as_list children_as_list 1 \
     "printer whose children are returned as a list"
 
 # Regression test for bug 14741.
@@ -298,7 +300,7 @@ mi_continue_to_line \
     [gdb_get_line_number {breakpoint bug 14741} ${srcfile}] \
     "step to breakpoint for bug 14741"
 
-mi_create_dynamic_varobj c c \
+mi_create_dynamic_varobj c c 1 \
   "create varobj for c"
 
 mi_gdb_test "-var-set-visualizer c ArrayPrinter" \
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 7f34c9b..0c3cdbe 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1277,9 +1277,10 @@ proc mi_create_varobj_checked { name expression type testname } {
 
 # Same as mi_create_floating_varobj, but assumes the test is creating
 # a dynamic varobj that has children, so the value must be "{...}".
-proc mi_create_dynamic_varobj {name expression testname} {
+# The "has_more" attribute is checked.
+proc mi_create_dynamic_varobj {name expression has_more testname} {
     mi_gdb_test "-var-create $name @ $expression" \
-	"\\^done,name=\"$name\",numchild=\"\(-1\|\[0-9\]+\)\",value=\"{\\.\\.\\.}\",type=.*" \
+	"\\^done,name=\"$name\",numchild=\"0\",value=\"{\\.\\.\\.}\",type=.*,has_more=\"${has_more}\"" \
 	$testname
 }
 
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Use mi_create_floating_varobj
@ 2013-11-21 11:37 Yao Qi
  2013-11-21  5:06 ` [PATCH 2/2] Check has_more in mi_create_dynamic_varobj Yao Qi
  2013-11-21 19:44 ` [PATCH 1/2] Use mi_create_floating_varobj Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Yao Qi @ 2013-11-21 11:37 UTC (permalink / raw)
  To: gdb-patches

In gdb.python/py-mi.exp, two varobjs container and nscont are created
when pretty-printing is still not enabled, so they are not dynamic
varobj, IIUC.  In this patch, we use mi_create_floating_varobj instead
of mi_create_dynamic_varobj.

gdb/testsuite:

2013-11-21  Yao Qi  <yao@codesourcery.com>

	* gdb.python/py-mi.exp: Use mi_create_floating_varobj instead
	of mi_create_dynamic_varobj.
---
 gdb/testsuite/gdb.python/py-mi.exp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp
index 28aa2c8..69bc093 100644
--- a/gdb/testsuite/gdb.python/py-mi.exp
+++ b/gdb/testsuite/gdb.python/py-mi.exp
@@ -49,7 +49,7 @@ mi_gdb_test "python exec (open ('${remote_python_file}').read ())" ""
 mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${srcfile}] \
   "step to breakpoint"
 
-mi_create_dynamic_varobj container c \
+mi_create_floating_varobj container c \
   "create container varobj, no pretty-printing"
 
 mi_list_varobj_children container {
@@ -60,7 +60,7 @@ mi_list_varobj_children container {
 
 mi_delete_varobj container "delete varobj"
 
-mi_create_dynamic_varobj nscont nstype \
+mi_create_floating_varobj nscont nstype \
   "create nscont varobj, no pretty-printing"
 
 mi_list_varobj_children nscont {
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Use mi_create_floating_varobj
  2013-11-21 11:37 [PATCH 1/2] Use mi_create_floating_varobj Yao Qi
  2013-11-21  5:06 ` [PATCH 2/2] Check has_more in mi_create_dynamic_varobj Yao Qi
@ 2013-11-21 19:44 ` Tom Tromey
  2013-11-22  1:45   ` Yao Qi
  1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2013-11-21 19:44 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> In gdb.python/py-mi.exp, two varobjs container and nscont are created
Yao> when pretty-printing is still not enabled, so they are not dynamic
Yao> varobj, IIUC.  In this patch, we use mi_create_floating_varobj instead
Yao> of mi_create_dynamic_varobj.

Yao> gdb/testsuite:

Yao> 2013-11-21  Yao Qi  <yao@codesourcery.com>

Yao> 	* gdb.python/py-mi.exp: Use mi_create_floating_varobj instead
Yao> 	of mi_create_dynamic_varobj.

This is ok, thanks.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] Check has_more in mi_create_dynamic_varobj
  2013-11-21  5:06 ` [PATCH 2/2] Check has_more in mi_create_dynamic_varobj Yao Qi
@ 2013-11-21 19:45   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2013-11-21 19:45 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> Hi,
Yao> I find "has_more" is not checked when a dynamic varobj is created in
Yao> proc mi_create_dynamic_varobj.  This patch adds the check to
Yao> "has_more".

Yao> gdb/testsuite:

Yao> 2013-11-21  Yao Qi  <yao@codesourcery.com>

Yao> 	* lib/mi-support.exp (mi_create_dynamic_varobj): Update
Yao> 	comment and add one more argument "has_more".
Yao> 	* gdb.python/py-mi.exp: Callers update.

Ok.  Thanks!

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] Use mi_create_floating_varobj
  2013-11-21 19:44 ` [PATCH 1/2] Use mi_create_floating_varobj Tom Tromey
@ 2013-11-22  1:45   ` Yao Qi
  0 siblings, 0 replies; 5+ messages in thread
From: Yao Qi @ 2013-11-22  1:45 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 11/22/2013 03:37 AM, Tom Tromey wrote:
>>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
>
> Yao> In gdb.python/py-mi.exp, two varobjs container and nscont are created
> Yao> when pretty-printing is still not enabled, so they are not dynamic
> Yao> varobj, IIUC.  In this patch, we use mi_create_floating_varobj instead
> Yao> of mi_create_dynamic_varobj.
>
> Yao> gdb/testsuite:
>
> Yao> 2013-11-21  Yao Qi  <yao@codesourcery.com>
>
> Yao> 	* gdb.python/py-mi.exp: Use mi_create_floating_varobj instead
> Yao> 	of mi_create_dynamic_varobj.
>
> This is ok, thanks.
>

Thanks for the review.  Two patches are pushed.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-22  1:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-21 11:37 [PATCH 1/2] Use mi_create_floating_varobj Yao Qi
2013-11-21  5:06 ` [PATCH 2/2] Check has_more in mi_create_dynamic_varobj Yao Qi
2013-11-21 19:45   ` Tom Tromey
2013-11-21 19:44 ` [PATCH 1/2] Use mi_create_floating_varobj Tom Tromey
2013-11-22  1:45   ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).