From: Bob Rossi <bob@brasko.net>
To: gdb-patches@sources.redhat.com
Subject: Fully anchor mi_gdb_test expected results.
Date: Thu, 04 Aug 2005 02:50:00 -0000 [thread overview]
Message-ID: <20050804025045.GC32108@white> (raw)
Hi,
This testsuite change simply does several simple things. First, when
creating a new pty for the inferior, this change turn's terminal
echo'ing off. This allows the expected results back from GDB/MI to not
have to have the command sent to GDB in it. The surprising thing with
this change is that even when GDB shares the terminal's PTY with the
inferior, not putting the echo'd data in the expected command still
works.
The only other notable change here is this,
- -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
+ -re "^(.*$pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
that is the change that fully anchor's the output from GDB. The reason
this is necessary is because with this change, I can grab the full
response from GDB for a command. With this response I can do syntax
checking with the parser that I wrote.
What does everyone think?
Thanks,
Bob Rossi
Index: gdb/testsuite/ChangeLog
+ * gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Remove .*
+ from test. Escape the | in mi_gdb_test call.
+ * lib/mi-support.exp: If using inferior pty, turn terminal echo off.
+ Remove arbitrary .* from test. Remove terminal echo'd data from
+ expected test results.
+ (mi_gdb_test): Fully anchor GDB/MI expected results in mi_gdb_test.
Index: gdb/testsuite/gdb.mi/mi-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-disassemble.exp,v
retrieving revision 1.13
diff -u -r1.13 mi-disassemble.exp
--- gdb/testsuite/gdb.mi/mi-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.13
+++ gdb/testsuite/gdb.mi/mi-disassemble.exp 4 Aug 2005 02:44:42 -0000
@@ -163,7 +163,7 @@
# -data-disassembly -f basics.c -l 32 -- 9
mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
- ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+ "123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
"data-disassemble bogus filename"
mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
@@ -171,7 +171,7 @@
"data-disassemble bogus address"
mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
- "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+ "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"
mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
Index: gdb/testsuite/gdb.mi/mi2-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-disassemble.exp,v
retrieving revision 1.3
diff -u -r1.3 mi2-disassemble.exp
--- gdb/testsuite/gdb.mi/mi2-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.3
+++ gdb/testsuite/gdb.mi/mi2-disassemble.exp 4 Aug 2005 02:44:42 -0000
@@ -163,7 +163,7 @@
# -data-disassembly -f basics.c -l 32 -- 9
mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
- ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+ "123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
"data-disassemble bogus filename"
mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
@@ -171,7 +171,7 @@
"data-disassemble bogus address"
mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
- "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+ "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"
mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
Index: gdb/testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.29
diff -u -r1.29 mi-support.exp
--- gdb/testsuite/lib/mi-support.exp 4 Aug 2005 01:52:31 -0000 1.29
+++ gdb/testsuite/lib/mi-support.exp 4 Aug 2005 02:44:42 -0000
@@ -225,6 +225,17 @@
warning "Couldn't redirect inferior output." 2
}
}
+
+ # tell GDB not to echo
+ send_gdb "103-interpreter-exec console \"shell stty -echo\"\n"
+ gdb_expect 10 {
+ -re ".*$mi_gdb_prompt$" {
+ verbose "turning off the terminal echoing" 2
+ }
+ timeout {
+ warning "Couldn't turn off the terminal's echoing."
+ }
+ }
}
return 0;
@@ -246,7 +257,7 @@
send_gdb "y\n";
exp_continue
}
- -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {
+ -re "102\\\^done\r\n$mi_gdb_prompt$" {
# This happens if there were no breakpoints
}
timeout { perror "Delete all breakpoints in mi_delete_breakpoints (timeout)" ; return }
@@ -256,9 +267,9 @@
# empty BreakpointTable. Also, a query is not acceptable with mi.
send_gdb "103-break-list\n"
gdb_expect 30 {
- -re "103-break-list\r\n103\\\^done,BreakpointTable=\{\}\r\n$mi_gdb_prompt$" {}
- -re "103-break-list\r\n103\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[\\\]\}" {}
- -re "103-break-list\r\n103\\\^doneNo breakpoints or watchpoints.\r\n\r\n$mi_gdb_prompt$" {warning "Unexpected console text received"}
+ -re "103\\\^done,BreakpointTable=\{\}\r\n$mi_gdb_prompt$" {}
+ -re "103\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[\\\]\}" {}
+ -re "103\\\^doneNo breakpoints or watchpoints.\r\n\r\n$mi_gdb_prompt$" {warning "Unexpected console text received"}
-re "$mi_gdb_prompt$" { perror "Breakpoints not deleted" ; return }
-re "Delete all breakpoints.*or n.*$" {
warning "Unexpected prompt for breakpoints deletion";
@@ -433,7 +444,7 @@
perror "($arg) No such file or directory\n"
return -1
}
- -re "105-file-exec-and-symbols .*\r\n105\\\^done\r\n$mi_gdb_prompt$" {
+ -re "105\\\^done\r\n$mi_gdb_prompt$" {
# We (MI) are just giving the prompt back for now, instead of giving
# some acknowledgement.
return 0
@@ -659,7 +670,8 @@
gdb_start
set result -1
}
- -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
+ -re "^(.*$pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
+
if ![string match "" $message] then {
pass "$message"
}
@@ -917,11 +929,11 @@
global fullname_syntax
send_gdb "220-$cmd\n"
gdb_expect {
- -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
+ -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
pass "$test"
return 0
}
- -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
+ -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
fail "$test (stopped at wrong place)"
return -1
}
next reply other threads:[~2005-08-04 2:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-04 2:50 Bob Rossi [this message]
2005-08-04 4:11 ` Daniel Jacobowitz
2005-08-04 14:09 ` Bob Rossi
2005-08-04 14:18 ` Daniel Jacobowitz
2005-08-04 14:26 ` Bob Rossi
2005-08-04 14:33 ` Daniel Jacobowitz
2005-08-04 20:37 ` Bob Rossi
2005-08-04 20:48 ` Bob Rossi
2005-08-04 20:58 ` Daniel Jacobowitz
2005-08-04 21:17 ` Bob Rossi
2005-08-04 20:57 ` Daniel Jacobowitz
2005-08-04 21:18 ` Bob Rossi
2005-08-04 22:40 ` Bob Rossi
2005-08-04 22:43 ` Daniel Jacobowitz
2005-08-04 23:50 ` Bob Rossi
2005-09-18 1:32 ` Daniel Jacobowitz
2005-09-18 2:10 ` Bob Rossi
2005-09-21 1:26 ` Bob Rossi
2005-09-26 1:42 ` Daniel Jacobowitz
2005-09-27 22:41 ` Bob Rossi
2005-08-04 14:34 ` Bob Rossi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050804025045.GC32108@white \
--to=bob@brasko.net \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox