Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Frederic Riss <frederic.riss@gmail.com>
To: Frederic Riss <frederic.riss@gmail.com>,
	Michael Snyder <msnyder@vmware.com>,
		"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [resubmit] gdb.base, r*.exp thru w*.exp
Date: Wed, 16 Jun 2010 08:12:00 -0000	[thread overview]
Message-ID: <AANLkTik4MeK6iFmGY3NYTsoaLgDj-FjVuDJPz7UpeeSE@mail.gmail.com> (raw)
In-Reply-To: <20100615161912.GA7975@caradoc.them.org>

Hi,

On 15 June 2010 18:19, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> This hunk unfortunately exhibits a common subtle pitfall :-(
>
> You can use bare gdb_expect with a string that contains gdb_prompt not
> at the end, or contains more than one gdb_prompt, although it's a bit
> tricky.  You can't do the same with gdb_test_multiple, because it has
> patterns like ".*$gdb_prompt $" -> FAIL.  If the output comes out
> buffered in such a way that the prompt is written separately from the
> post-prompt text, this will match before GDB is done printing output.

OK, I audited the testsuite for uses of gdb_prompt in the middle of
gdb_test_multiple patterns (well to be precise, I looked for such
usage in the first pattern of every gdb_test_multiple. I becomes
harder to grep for the following patterns). Here's the list of the
problematic places I've found, which include all the failures I've
seen:


testsuite/gdb.base/setshow.exp
58:gdb_test_multiple "set annotate 2" "set annotate 2" {
59-    -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
--
64:gdb_test_multiple "show annotate" "show annotate 2" {
65-    -re ".*\032\032post-prompt.*Annotation_level is
2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
--
71:gdb_test_multiple "info line 1" "annotation_level 2" {
72-    -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but
contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$gdb_prompt
.*\032\032prompt.*$" {


testsuite/gdb.mi/mi2-basics.exp
63:    gdb_test_multiple "-gdb-version" "acceptance of MI operations" {
64-	-re "GNU gdb .*\r\n$mi_gdb_prompt$" {
--
212:    gdb_test_multiple "-environment-path" "-environment-path" {
213-	-re "\\\^done,path=\"\(.*\)\"\r\n$mi_gdb_prompt" {
testsuite/gdb.mi/mi2-console.exp
51:gdb_test_multiple "220-exec-next" "Started step over hello" {
52-    -re "220\\^running\r\n(\\*running,thread-id=\"all\"\r\n)?$mi_gdb_prompt"
{


testsuite/gdb.mi/mi2-return.exp
56:    gdb_test_multiple "111-exec-return" "return from callee4 now" {
57-	-re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}\r\n$mi_gdb_prompt$"
{
testsuite/gdb.mi/mi2-var-display.exp
608:gdb_test_multiple "p/x \$fp" "print FP register" {
609-    -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" {
testsuite/gdb.mi/mi-basics.exp
63:    gdb_test_multiple "-gdb-version" "acceptance of MI operations" {
64-	-re "GNU gdb .*\r\n$mi_gdb_prompt$" {
--
210:    gdb_test_multiple "-environment-path" "-environment-path" {
211-	-re "\\\^done,path=\"\(.*\)\"\r\n$mi_gdb_prompt" {


testsuite/gdb.mi/mi-nonstop-exit.exp
40:gdb_test_multiple "-gdb-show non-stop" "" {
41-    -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$"
{


testsuite/gdb.mi/mi-nonstop.exp
50:gdb_test_multiple "-gdb-show non-stop" "" {
51-    -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$"
{
--
96:gdb_test_multiple "-exec-interrupt --thread 1" "interrupted" {
97-    -re "\\^done\r\n$mi_gdb_prompt\\*stopped\[^\r\n\]+\r\n$" {
--
107:gdb_test_multiple "-exec-continue --all" "resume all" {
108-    -re ".*\\*running,thread-id=\"3\"\r\n\\*running,thread-id=\"2\"\r\n\\*running,thread-id=\"1\"\r\n$mi_gdb_prompt"
{
testsuite/gdb.mi/mi-nsintrall.exp
40:gdb_test_multiple "-gdb-show non-stop" "" {
41-    -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$"
{
--
80:gdb_test_multiple "-exec-continue --all" "resume all, no breakpoint" {
81-    -re ".*$running_re$mi_gdb_prompt" {
--
99:gdb_test_multiple "-exec-continue --all" "resume all after interrupting" {
100-    -re ".*$running_re$mi_gdb_prompt" {


testsuite/gdb.mi/mi-nsmoribund.exp
40:gdb_test_multiple "-gdb-show non-stop" "" {
41-    -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$"
{
--
101:gdb_test_multiple "-exec-continue --all" "resume all, thread
specific breakpoint" {
102-    -re ".*$running_re$mi_gdb_prompt" {


testsuite/gdb.mi/mi-ns-stale-regcache.exp
54:gdb_test_multiple "-gdb-show non-stop" "" {
55-    -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$"
{


testsuite/gdb.mi/mi-nsthrexec.exp
50:gdb_test_multiple "-gdb-show non-stop" "" {
51-    -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$"
{


testsuite/gdb.mi/mi-return.exp
56:    gdb_test_multiple "111-exec-return" "return from callee4 now" {
57-	-re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}\r\n$mi_gdb_prompt$"
{
testsuite/gdb.mi/mi-var-display.exp
609:gdb_test_multiple "p/x \$fp" "print FP register" {
610-    -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" {


Note all the cases using mi_gdb_prompt. Even if the mi_gdb_prompt is
at the end of the pattern, as it expands to gdb_prompt followed by a
newline, it's as if we used gdb_prompt in the middle of the pattern.
I've definitely seen at least mi(2)-return.exp exhibit this random
failure.

Cheers,
Fred


  reply	other threads:[~2010-06-16  8:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-20 21:01 Michael Snyder
2010-05-20 21:07 ` Joel Brobecker
2010-05-20 21:14   ` Michael Snyder
2010-05-20 21:28 ` Jan Kratochvil
2010-05-20 21:46   ` Michael Snyder
2010-05-20 21:47     ` Jan Kratochvil
2010-05-20 21:57       ` Michael Snyder
2010-05-20 22:02         ` Jan Kratochvil
2010-05-20 22:07           ` Michael Snyder
2010-05-20 22:07         ` Joel Brobecker
2010-05-20 22:21           ` Michael Snyder
2010-06-15 15:56 ` Frederic Riss
2010-06-15 16:19   ` Daniel Jacobowitz
2010-06-16  8:12     ` Frederic Riss [this message]
2010-06-18  0:23       ` Michael Snyder
2010-06-18  7:30         ` Frederic Riss
2010-06-15 17:44   ` Michael Snyder

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=AANLkTik4MeK6iFmGY3NYTsoaLgDj-FjVuDJPz7UpeeSE@mail.gmail.com \
    --to=frederic.riss@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.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