diff options
author | Yao Qi <yao@codesourcery.com> | 2013-02-06 14:45:20 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-02-06 14:45:20 +0000 |
commit | 134a20666733a1db093d7da3554a8b74bb03bfc2 (patch) | |
tree | 32d9bced44175dd904bfceb55f6060e54d54363b /gdb/testsuite/gdb.trace/mi-tsv-changed.exp | |
parent | 8952bc699feff37d71177256c81eb153f642ceec (diff) | |
download | gdb-134a20666733a1db093d7da3554a8b74bb03bfc2.zip gdb-134a20666733a1db093d7da3554a8b74bb03bfc2.tar.gz gdb-134a20666733a1db093d7da3554a8b74bb03bfc2.tar.bz2 |
gdb/doc:
2013-02-06 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Async Records): Document new MI
notification "=tsv-modified". Update the document of MI
notification "=tsv-created".
* observer.texi (GDB Observers): New observer tsv_modified.
Update observer tsv_created and tsv_deleted.
gdb:
2013-02-06 Yao Qi <yao@codesourcery.com>
* mi/mi-interp.c: Include "tracepoint.h".
(mi_tsv_modified): Declare.
(mi_tsv_created, mi_tsv_deleted): Update declaration.
(mi_interpreter_init): Call observer_attach_tsv_modified.
(mi_tsv_modified): New.
(mi_tsv_created, mi_tsv_deleted): Update.
* tracepoint.c (trace_variable_command): Call
observer_notify_tsv_modified if the initial value of tsv is
changed.
(delete_trace_state_variable): Call
observer_notify_tsv_deleted earlier.
(trace_variable_command): Caller update.
(create_tsv_from_upload): Likewise.
* observer.sh: Declare "struct trace_state_variable".
* NEWS: Mention the new MI notification "=tsv-modified".
gdb/testsuite:
2013-02-06 Yao Qi <yao@codesourcery.com>
* gdb.trace/mi-tsv-changed.exp (test_create_delete_tsv): Rename
to ...
(test_create_delete_modify_tsv): ... here. New test on modifying
the initial value of a tsv.
Diffstat (limited to 'gdb/testsuite/gdb.trace/mi-tsv-changed.exp')
-rw-r--r-- | gdb/testsuite/gdb.trace/mi-tsv-changed.exp | 88 |
1 files changed, 81 insertions, 7 deletions
diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp index 4e7d5a4..0b9475e 100644 --- a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp +++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp @@ -23,11 +23,14 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ return -1 } -# Test notifications on creating and deleting TSV. +# Test notifications on creating, deleting and modifying TSV. -proc test_create_delete_tsv { } {with_test_prefix "create delete" { +proc test_create_delete_modify_tsv { } {with_test_prefix "create delete modify" { global binfile global decimal + global testfile + global srcdir subdir + global mi_gdb_prompt if [mi_gdb_start] { return @@ -35,10 +38,18 @@ proc test_create_delete_tsv { } {with_test_prefix "create delete" { mi_gdb_load ${binfile} mi_gdb_test "tvariable \$tvar1" \ - ".*=tsv-created,name=\"tvar1\",value=\"0\"\\\\n.*\\^done" \ + ".*=tsv-created,name=\"tvar1\",initial=\"0\"\\\\n.*\\^done" \ "tvariable \$tvar1" + mi_gdb_test "tvariable \$tvar1 = 1" \ + ".*=tsv-modified,name=\"tvar1\",initial=\"1\".*\\^done" \ + "tvariable \$tvar1 modified" + # No "=tsv-modified" notification is emitted, because the initial + # value is not changed. + mi_gdb_test "tvariable \$tvar1 = 1" \ + ".*\\\$tvar1 = 1\\\\n\"\r\n~\"Trace state .*\\\\n.*\\^done" \ + "tvariable \$tvar1 modified without notification" mi_gdb_test "tvariable \$tvar2 = 45" \ - ".*=tsv-created,name=\"tvar2\",value=\"45\"\\\\n.*\\^done" \ + ".*=tsv-created,name=\"tvar2\",initial=\"45\"\\\\n.*\\^done" \ "tvariable \$tvar2" mi_gdb_test "delete tvariable \$tvar2" \ @@ -49,6 +60,69 @@ proc test_create_delete_tsv { } {with_test_prefix "create delete" { ".*=tsv-deleted\\\\n.*\\^done" \ "delete all tvariables" + # Test target supports tracepoints or not. + clean_restart $testfile + + if ![runto_main] { + fail "Can't run to main to check for trace support" + return -1 + } + + if ![gdb_target_supports_trace] { + unsupported "Current target does not support trace" + return -1; + } + gdb_exit + if [mi_gdb_start] { + continue + } + + mi_gdb_reinitialize_dir $srcdir/$subdir + mi_gdb_load ${binfile} + + mi_gdb_test "tvariable \$tvar3 = 3" \ + ".*=tsv-created,name=\"tvar3\",initial=\"3\".*\\^done" \ + "tvariable \$tvar3 modified" + mi_gdb_test "-break-insert -a gdb_c_test" \ + {.*\^done,bkpt=.*} \ + "insert tracepoint on gdb_c_test" + # Define an action that increases $tvar3 + send_gdb "actions\n" + gdb_expect { + -re "End with" { + } + } + send_gdb "collect \$tvar3 += 3\nend\n" + set test "define actions" + gdb_expect { + -re ".*${mi_gdb_prompt}$" { + pass $test + } + timeout { + fail "$test (timeout)" + } + } + + mi_gdb_test "-break-insert begin" \ + {.*\^done,bkpt=.*} \ + "insert tracepoint on begin" + mi_gdb_test "-break-insert end" \ + {.*\^done,bkpt=.*} \ + "insert tracepoint on end" + mi_run_cmd + + mi_expect_stop "breakpoint-hit" "begin" ""\ + ".*" ".*" {"" "disp=\"keep\""} \ + "continue to begin breakpoint" + mi_gdb_test "-trace-start" {.*\^done} "trace start" + mi_send_resuming_command "exec-continue" "continuing to end" + mi_gdb_test "-trace-stop" {.*} "trace stop" + # Force GDB to get the current value of trace state variable. + mi_gdb_test "-trace-list-variables" ".*" "list trace variables" + mi_gdb_test "tvariable \$tvar3 = 2" \ + ".*=tsv-modified,name=\"tvar3\",initial=\"2\",current=\"6\".*\\^done" \ + "tvariable \$tvar3 modified" + }} @@ -121,11 +195,11 @@ proc test_upload_tsv { } { with_test_prefix "upload" { set tsv1_created 0 set tsv2_created 0 gdb_expect { - -re "=tsv-created,name=\"tvar1\",value=\"0\"" { + -re "=tsv-created,name=\"tvar1\",initial=\"0\"" { set tsv1_created 1 exp_continue } - -re "=tsv-created,name=\"tvar2\",value=\"45\"" { + -re "=tsv-created,name=\"tvar2\",initial=\"45\"" { set tsv2_created 1 exp_continue } @@ -148,7 +222,7 @@ proc test_upload_tsv { } { with_test_prefix "upload" { set gdbserver_reconnect_p 0 }} - test_create_delete_tsv + test_create_delete_modify_tsv # Test target supports tracepoints or not. |