aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.mi/var-cmd.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-04-13 09:33:49 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-04-13 09:33:49 +0000
commitfcacd99f87bf1f39ba0b3fde4a71b2876c20bd70 (patch)
tree75fab46541391f348714e21c53206075958367ae /gdb/testsuite/gdb.mi/var-cmd.c
parent350fc95b2b48a859478efc3ba0ba99c56e7971aa (diff)
downloadgdb-fcacd99f87bf1f39ba0b3fde4a71b2876c20bd70.zip
gdb-fcacd99f87bf1f39ba0b3fde4a71b2876c20bd70.tar.gz
gdb-fcacd99f87bf1f39ba0b3fde4a71b2876c20bd70.tar.bz2
Fix @-varobjs.
* varobj.c (value_of_root): Update the expression for floating varobjs. * mi/mi-cmd-var.c (varobj_update_one): If type has changed, report that.
Diffstat (limited to 'gdb/testsuite/gdb.mi/var-cmd.c')
-rw-r--r--gdb/testsuite/gdb.mi/var-cmd.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index 4216461..ffc442f 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -405,6 +405,62 @@ void do_frozen_tests ()
/*: END: frozen :*/
}
+void do_at_tests_callee ()
+{
+ /* This is a test of wrong DWARF data being assigned to expression.
+ The DWARF location expression is bound to symbol when expression
+ is parsed. So, if we create floating varobj in one function,
+ and then try to reevaluate it in other frame without reparsing
+ the expression, we will access local variables using DWARF
+ location expression from the original frame, and are likely
+ to grab wrong symbol. To reliably reproduce this bug, we need
+ to wrap our variable with a bunch of buffers, so that those
+ buffers are accessed instead of the real one. */
+ int buffer1 = 10;
+ int buffer2 = 11;
+ int buffer3 = 12;
+ int i = 7;
+ int buffer4 = 13;
+ int buffer5 = 14;
+ int buffer6 = 15;
+ i++; /* breakpoint inside callee */
+ i++;
+}
+
+void do_at_tests ()
+{
+ int x;
+ /*: BEGIN: floating :*/
+ int i = 10;
+ int y = 15;
+ /*:
+ mi_create_floating_varobj F i "create floating varobj"
+ :*/
+ i++;
+ /*:
+ mi_varobj_update F {F} "update F (1)"
+ mi_check_varobj_value F 11 "check F (1)"
+ :*/
+ i++;
+ {
+ double i = 15;
+ /*:
+ mi_varobj_update_with_type_change F "double" "0" "update F (2)"
+ mi_check_varobj_value F 15 "check F (2)"
+ :*/
+ i += 2.0;
+ }
+ i++;
+ /*:
+ mi_varobj_update_with_type_change F "int" "0" "update F (3)"
+ mi_check_varobj_value F 13 "check F (3)"
+ :*/
+ i++;
+ do_at_tests_callee ();
+ i++;
+ /*: END: floating :*/
+}
+
int
main (int argc, char *argv [])
{
@@ -413,6 +469,7 @@ main (int argc, char *argv [])
do_children_tests ();
do_special_tests ();
do_frozen_tests ();
+ do_at_tests ();
exit (0);
}