diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2006-11-28 17:23:10 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2006-11-28 17:23:10 +0000 |
commit | acd65feb7ed6511f571de5b5ec7f2dd759819fe5 (patch) | |
tree | e0a7f98afb50eae5c17ae270bc31974c9e384697 /gdb/testsuite/gdb.mi | |
parent | 74ca34cea9f2a3521ecb6b58f57bb799cd19b3ae (diff) | |
download | binutils-acd65feb7ed6511f571de5b5ec7f2dd759819fe5.zip binutils-acd65feb7ed6511f571de5b5ec7f2dd759819fe5.tar.gz binutils-acd65feb7ed6511f571de5b5ec7f2dd759819fe5.tar.bz2 |
2006-11-28 Vladimir Prus <vladimir@codesourcery.com>
Fetch varobj values from memory in a single place,
and only fetch the values that are really needed.
* varobj.c (struct varobj): Clarify comment.
(my_value_equal): Remove.
(install_new_value): New function.
(type_of_child): Remove.
(varobj_create): Use install_new_value.
(varobj_set_value): Use value_contents_equal, not
my_value_equal.
(varobj_update): Use install_new_value.
(create_child): Likewise. Inline type_of_child here.
(value_of_child): Don't fetch the value.
(c_value_of_root): Likewise.
(c_value_of_variable): Likewise.
(type_changeable): Improve comments.
Diffstat (limited to 'gdb/testsuite/gdb.mi')
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-var-cmd.exp | 37 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/var-cmd.c | 4 |
2 files changed, 41 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index a6023e9..7efb438 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -382,6 +382,43 @@ mi_gdb_test "-var-assign lsimple.integer 333" \ "\\^done,value=\"333\"" \ "assign to lsimple.integer" +mi_gdb_test "-var-update *" \ + "\\^done,changelist=.*" \ + "var update" + +# Check that assignment of function and array values +# promotes the assigned value to function pointer/data +# pointer before comparing with the existing value, +# and does not incorrectly make the value as changed. +mi_gdb_test "-var-assign func do_block_tests" \ + "\\^done,value=\"$hex <do_block_tests>\"" \ + "assign same value to func" + +mi_gdb_test "-var-update *" \ + "\\^done,changelist=\\\[\\\]" \ + "assign same value to func (update)" + +mi_gdb_test "-var-create array_ptr * array_ptr" \ + "\\^done,name=\"array_ptr\",numchild=\"1\",type=\"int \\*\"" \ + "create global variable array_ptr" + +mi_gdb_test "-var-assign array_ptr array2" \ + "\\^done,value=\"$hex\"" \ + "assign array to pointer" + +mi_gdb_test "-var-update *" \ + "\\^done,changelist=\\\[\{name=\"array_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \ + "assign array to pointer (update)" + +mi_gdb_test "-var-assign array_ptr array2" \ + "\\^done,value=\"$hex\"" \ + "assign same array to pointer" + +mi_gdb_test "-var-update *" \ + "\\^done,changelist=\\\[\\\]" \ + "assign same array to pointer (update)" + + ###### # End of assign tests ##### diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c index 761e804..d0eb6f8 100644 --- a/gdb/testsuite/gdb.mi/var-cmd.c +++ b/gdb/testsuite/gdb.mi/var-cmd.c @@ -106,6 +106,10 @@ void incr_a (char a) b = a; } +int array[] = {1,2,3}; +int array2[] = {4,5,6}; +int *array_ptr = array; + void do_locals_tests () { |