From: David Carlton <carlton@math.stanford.edu>
To: gdb-patches@sources.redhat.com
Cc: Fernando Nasser <fnasser@redhat.com>
Subject: [rfa/testsuite] gdb.base/selftest.exp: work with optimization
Date: Wed, 11 Dec 2002 13:24:00 -0000 [thread overview]
Message-ID: <ro1vg20tg02.fsf@jackfruit.Stanford.EDU> (raw)
I recently happened to compare the outputs of gdb.base/selftest.exp
when GDB is compiled with and without optimization, and noticed that
it failed only in the optimized case. Digging further, it happens
during the part of the test that steps through captured_main; when GDB
is compiled with optimization, GDB sometimes stops on the opening
brace. That's not an error, but the regexps in question didn't allow
that.
When I added a regexp to allow that, I found that GDB also sometimes
stopped on the line 'current_directory = gdb_dirbuf', even though it's
after the dirarg initialization line that we're looking for. This
looks like a reordering by the optimizer (or perhaps misleading
location information from the optimizer), so it's not a GDB bug
either.
Here's a patch to selftest.exp to allow those possibilities; with this
patch, all the tests in that file pass whether or not GDB is compiled
with optimization.
David Carlton
carlton@math.stanford.edu
2002-12-11 David Carlton <carlton@math.stanford.edu>
* gdb.base/selftest.exp (do_steps_and_nexts): Allow initial brace
and current_directory initialization.
Index: selftest.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/selftest.exp,v
retrieving revision 1.5
diff -u -p -r1.5 selftest.exp
--- selftest.exp 4 Dec 2002 03:15:27 -0000 1.5
+++ selftest.exp 11 Dec 2002 21:08:19 -0000
@@ -54,6 +54,10 @@ proc do_steps_and_nexts {} {
for {set count 0} {$count < 26} {incr count} {
send_gdb "list\n"
+ # NOTE: carlton/2002-12-11: The "initial brace" and
+ # "current_directory initialization" possibilities happen to
+ # me with GCC 3.1 on i686-pc-linux-gnu when I compile with
+ # optimization.
gdb_expect {
-re ".*context = data.*$gdb_prompt $" {
set description "step over context initialization"
@@ -157,6 +161,14 @@ proc do_steps_and_nexts {} {
-re ".*textdomain .PACKAGE.;.*$gdb_prompt $" {
set description "next over textdomain PACKAGE"
set command "next"
+ }
+ -re "\[0-9\]*\t\{\r\n$gdb_prompt $" {
+ set description "step over initial brace"
+ set command "step"
+ }
+ -re ".*current_directory = gdb_dirbuf.*$gdb_prompt $" {
+ set description "step over current_directory initialization"
+ set command "step"
}
-re "\[ \t\]+\{\r\n$gdb_prompt $" {
setup_xfail "mips-*-irix5*"
next reply other threads:[~2002-12-11 21:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-11 13:24 David Carlton [this message]
2002-12-11 15:22 ` Andrew Cagney
2002-12-22 10:25 ` Fernando Nasser
2002-12-23 9:08 ` David Carlton
2002-12-11 14:19 Michael Elizabeth Chastain
2002-12-11 14:31 ` David Carlton
2002-12-11 21:52 Michael Elizabeth Chastain
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=ro1vg20tg02.fsf@jackfruit.Stanford.EDU \
--to=carlton@math.stanford.edu \
--cc=fnasser@redhat.com \
--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