Hello, at the moment, writing MI tests is not very easy. Part of the problem is that the tests consist of a C program and a Tcl program. The Tcl program has to try certain commands while gdb is standing on a specific line of the C program, and tracking correspondence between the lines in C and in Tcl is hard. It's somewhat possible to keep this in mind while writing a single test, but some time later it becomes completely incomprehensible. To understand what's going on in a test, one has to jump back and forth between C and Tcl. I've just implemented a mechanism to describe tests in a single file -- the C one. The program should contain special comments containing Tcl code. Here's an example: void reference_update_tests () { /*: BEGIN: reference_update :*/ int x = 167; /*: mi_create_varobj "RX" "rx" "create varobj for rx" :*/ int& rx = x; /*: mi_varobj_update RX {RX} "update RX (1)" mi_check_varobj_value RX 167 "check RX: expect 167" :*/ x = 567; /*: mi_varobj_update RX {RX} "update RX (2)" mi_check_varobj_value RX 567 "check RX: expect 567" :*/ x = 567; /*: mi_varobj_update RX {} "update RX (3)" :*/ /*: END: reference_update :*/ } and the Tcl file only contains: mi_prepare_inline_tests $srcfile mi_run_inline_test reference_update Each Tcl block in comment is executed immediately after the preceding C statement is executed, and single-stepping to right positions is handled automaitcally. The only restriction is that each special comment should be immediately preceded by an executable statement. I've converted one of MI tests to use this mechanism and found that the result is much more clear than it was. There are problems -- namely that the syntax of the special comments looks weird and that Emacs does not highlight them as Tcl. But I think those I minor glitches and the new way is overall better? OK? - Volodya * lib/mi-support.exp (mi_autotest_data): New variable. (mi_autotest_source): New variable. (count_newlines, mi_prepare_inline_tests) (mi_get_inline_test, mi_run_to_line) (mi_run_inline_test): New functions. * gdb.mi/mi-var-cp.exp: Move most content to the C file. Run inline tests. * gdb.mi/mi-var-cp.cc: Define tests here.