Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Chastain <mec.gnu@mindspring.com>
To: pgilliam@us.ibm.com, gdb-patches@sources.redhat.com
Cc: cagney@redhat.com
Subject: Re: Avoid timeouts in call-sc.exp
Date: Fri, 20 Aug 2004 10:34:00 -0000	[thread overview]
Message-ID: <4125D3DA.nailK4211PQ8Y@mindspring.com> (raw)
In-Reply-To: <200408181426.30208.pgilliam@us.ibm.com>

Paul Gilliam <pgilliam@us.ibm.com> wrote:
> The test "call-sc.exp" will attemt to "finish" from main if the prevous 
> "return foo" failed.  Here is what happens:
>
> 257		gdb_test_multiple "return foo" "${test}" {
>
> If this works, then we are in "main".  If it doesn't work (say, due to a gdb 
> bug) then we are left in the function "fun".

First, can you post the gdb.log section for call-sc.exp on your
platform that is failing.  Also, what system is it and what
compiler are you using to run the test suite?

Good analysis, but I think your fix is too complicated and stateful.
I'd like a different approach to this.  Rather than handling various
different places where the program counter could be, it would be
better to do this at the end of the "return foo" test.
Something like this:

  # If the previous test did not work, the program counter might
  # still be inside foo() rather than main().  Get the program
  # counter back to main().
  #
  # This happens on [system] with [compiler].

  set try_finish 0
  set test "return foo; synchronize pc to main"
  gdb_test_multiple "backtrace 1" $test {
    -re "#0.*main \\(\\).*$gdb_prompt $" {
      pass $test
    }
    -re "#0.*fun \\(\\).*$gdb_prompt $" {
      if { $try_finish == 0 } {
	incr try_finish
	gdb_test "finish" ".*" ""
	exp_continue
      }
      fail $test
    }
  }

Also there is a pre-existing cut-and-paste error in the body of
"Make fun return now":

	-re "Make fun return now.*y or n. $" {
	    gdb_test_multiple "y" "${test}" {
		-re "L *= fun.*${gdb_prompt} $" {
		    # Need to step off the function call
		    gdb_test "next" "zed.*" "${test}"
		}
		-re "L[expr  + 1] *= fun[expr  + 1].*${gdb_prompt} $" {
		    pass "${test}"
		}
	    }
	}

The second arm, "L[expr  + 1] *= ...", is supposed to handle the case
where returning from "fun" lands on the line after the call to "fun".
This happens when the compiler generates code so that the last assembly
instruction in "L = fun ();" is the actual assembly-language call
instruction.  But the regular expression is wrong, it was copied from
structs.exp and it was meant for structs.c and does not work with
call-sc.c.

I'll make a patch for the cut-and-pasto first.  If you want to turn
the code snippet with "try_finish" into a patch and do some testing,
that would be great.  Or I could make that into a patch.

Michael


  parent reply	other threads:[~2004-08-20 10:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-18 21:28 Paul Gilliam
2004-08-18 21:58 ` Michael Chastain
2004-08-20 10:34 ` Michael Chastain [this message]
2004-08-20 16:17   ` Paul Gilliam
2004-08-23 21:11   ` Paul Gilliam
2004-08-23 21:55     ` Michael Chastain
2004-08-24 16:15       ` Paul Gilliam
2004-08-24 17:26         ` Michael Chastain
2004-08-24 18:50           ` Paul Gilliam
2004-08-24 18:52             ` Daniel Jacobowitz
2004-08-24 18:55             ` Michael Chastain
2004-08-24 19:14               ` Paul Gilliam
2004-08-25 17:54       ` Paul Gilliam
2004-08-25 18:11         ` Michael Chastain
2004-08-25 18:21           ` Paul Gilliam
2004-08-25 18:52             ` Michael Chastain
2004-08-25 19:08           ` Paul Gilliam
2004-08-26 14:17             ` Michael Chastain
2004-08-26 16:17               ` Paul Gilliam
2004-08-26 16:26                 ` Michael Chastain
2004-08-26 16:34                   ` Paul Gilliam
     [not found] ` <200408261227.58890.pgilliam@us.ibm.com>
     [not found]   ` <412E5915.8010401@gnu.org>
2004-08-31 19:30     ` Paul Gilliam
2004-08-31 20:48       ` Paul Gilliam

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=4125D3DA.nailK4211PQ8Y@mindspring.com \
    --to=mec.gnu@mindspring.com \
    --cc=cagney@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=pgilliam@us.ibm.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