diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2008-04-13 09:33:49 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2008-04-13 09:33:49 +0000 |
commit | fcacd99f87bf1f39ba0b3fde4a71b2876c20bd70 (patch) | |
tree | 75fab46541391f348714e21c53206075958367ae /gdb/testsuite/gdb.mi | |
parent | 350fc95b2b48a859478efc3ba0ba99c56e7971aa (diff) | |
download | gdb-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')
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-var-cmd.exp | 17 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi2-var-cmd.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/var-cmd.c | 57 |
3 files changed, 74 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 8e7db1f..c1ae813 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -550,14 +550,14 @@ mi_gdb_test "-var-create selected_a @ a" \ mi_continue_to incr_a mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \ + "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \ "update selected_a in incr_a" mi_next "step a line in incr_a" mi_next "return from incr_a to do_special_tests" mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \ + "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \ "update selected_a in do_special_tests" mi_delete_varobj selected_a "delete selected_a" @@ -574,6 +574,19 @@ proc set_frozen {varobjs flag} { mi_prepare_inline_tests $srcfile mi_run_inline_test frozen +# Since the inline test framework does not really work with +# function calls, first to inline tests and then do the reminder +# manually. +mi_run_inline_test floating +set do_at_tests_callee_breakpoint [gdb_get_line_number "breakpoint inside callee"] +mi_gdb_test "-break-insert var-cmd.c:$do_at_tests_callee_breakpoint" ".*" \ + "inside breakpoint inside callee" +mi_execute_to "exec-continue" "breakpoint-hit" do_at_tests_callee "" ".*" ".*" ""\ + "continue to where i is initialized" + +mi_varobj_update F {F} "update F inside callee" +mi_check_varobj_value F 7 "check F inside callee" + # Test whether bad varobjs crash GDB. # A varobj we fail to read during -var-update should be considered diff --git a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp index f815041..d980917 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp @@ -513,14 +513,14 @@ mi_gdb_test "-var-create selected_a @ a" \ mi_continue_to incr_a mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \ + "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"char\",new_num_children=\"0\"\}\\\]" \ "update selected_a in incr_a" mi_next "step a line in incr_a" mi_next "return from incr_a to do_special_tests" mi_gdb_test "-var-update selected_a" \ - "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \ + "\\^done,changelist=\\\[\{name=\"selected_a\",in_scope=\"true\",type_changed=\"true\",new_type=\"int\",new_num_children=\"0\"\}\\\]" \ "update selected_a in do_special_tests" mi_gdb_exit 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); } |