diff options
author | Pedro Alves <palves@redhat.com> | 2016-06-21 01:11:57 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-06-21 01:11:57 +0100 |
commit | ac69f7863a6b5dbd1792356275de437371b8c879 (patch) | |
tree | 753e80633e0c23edfff69f969d78c215b9dc2bb3 /gdb/testsuite/lib | |
parent | 49940788ab38b9d58c663cf38855f29c0ebb1b55 (diff) | |
download | gdb-ac69f7863a6b5dbd1792356275de437371b8c879.zip gdb-ac69f7863a6b5dbd1792356275de437371b8c879.tar.gz gdb-ac69f7863a6b5dbd1792356275de437371b8c879.tar.bz2 |
Add "new-ui console" tests
This adds a test that uses new-ui to create a secondary console, and
then runs some basic smoke tests. It ensures that:
- synchronous commands send output to the UI that initiated it
- asynchronous events like breakpoint hits are reported on all
consoles.
- "new-ui" without arguments doesn't crash.
- The "new-ui" command doesn't repeat.
gdb/testsuite/ChangeLog:
2016-06-21 Pedro Alves <palves@redhat.com>
* gdb.base/new-ui.exp: New file.
* lib/mi-support.exp (switch_gdb_spawn_id): Move to ...
* lib/gdb.exp (switch_gdb_spawn_id): ... here.
(with_spawn_id): New procedure.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 32 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 12 |
2 files changed, 32 insertions, 12 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 878da16..b52fdd9 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2075,6 +2075,38 @@ proc with_target_charset { target_charset body } { } } +# Switch the default spawn id to SPAWN_ID, so that gdb_test, +# mi_gdb_test etc. default to using it. + +proc switch_gdb_spawn_id {spawn_id} { + global gdb_spawn_id + global board board_info + + set gdb_spawn_id $spawn_id + set board [host_info name] + set board_info($board,fileid) $spawn_id +} + +# Run BODY with SPAWN_ID as current spawn id. + +proc with_spawn_id { spawn_id body } { + global gdb_spawn_id + + set saved_spawn_id $gdb_spawn_id + switch_gdb_spawn_id $spawn_id + + set code [catch {uplevel 1 $body} result] + + switch_gdb_spawn_id $saved_spawn_id + + if {$code == 1} { + global errorInfo errorCode + return -code $code -errorinfo $errorInfo -errorcode $errorCode $result + } else { + return -code $code $result + } +} + # Select the largest timeout from all the timeouts: # - the local "timeout" variable of the scope two levels above, # - the global "timeout" variable, diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index edfc07d..7b5c90b 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -122,18 +122,6 @@ proc mi_create_inferior_pty {} { } } -# Switch the default spawn id to SPAWN_ID, so that mi_gdb_test -# etc. default to using it. - -proc switch_gdb_spawn_id {spawn_id} { - global gdb_spawn_id - global board board_info - - set gdb_spawn_id $spawn_id - set board [host_info name] - set board_info($board,fileid) $spawn_id -} - proc mi_gdb_start_separate_mi_tty { args } { global gdb_prompt mi_gdb_prompt global timeout |