Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: David Carlton <carlton@math.stanford.edu>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: report failure to restore selected frame, but continue
Date: Wed, 09 Apr 2003 23:21:00 -0000	[thread overview]
Message-ID: <vt24r57qms2.fsf@zenia.red-bean.com> (raw)
In-Reply-To: <ro14r57gvxq.fsf@jackfruit.Stanford.EDU>


David Carlton <carlton@math.stanford.edu> writes:
> Basically fine, just a few comments.  It might be nice if there were a
> test for this somewhere appropriate in gdb.base, in which case the big
> comment could go there: or is there a reason why this only manifests
> itself in C++?

No, it's not specific to C++ at all; if the architecture makes a bad
choice of frame base, GDB may not preserve the selected frame across
inferior calls.

> Actually, I'm not convinced that all of the big
> comment belongs in the test suite at all: why not put it some place in
> the GDB source code and/or the bug database, with a reference to that
> in the testsuite?  The diagnosis of the problem should be in the place
> where it people fixing the problem will be most likely to see it,
> after all.

My thought was, if you're working on a target that has this problem,
one of the earliest places you'll visit is the test script itself, to
see what the failing test is actually doing.  The comments for 'struct
frame_id' could be expanded to point out the subtleties, but that is
less helpful for someone working from the failure: you only know where
to look in the sources after you've partially debugged the problem.

GDB PR 1155 has a decent enough explanation of it; I'll just put
references to that in the .exp files.

I've made the rest of the changes you suggest.  Here's what I've
committed:

2003-04-09  Jim Blandy  <jimb@redhat.com>

	* gdb.c++/derivation.exp, gdb.c++/overload.exp,
	gdb.c++/userdef.exp: If GDB fails to restore the selected frame
	after an inferior function call, report the failure, but allow the
	test to continue.

Index: gdb/testsuite/gdb.c++/derivation.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/derivation.exp,v
retrieving revision 1.10
diff -c -r1.10 derivation.exp
*** gdb/testsuite/gdb.c++/derivation.exp	20 Jan 2002 19:22:13 -0000	1.10
--- gdb/testsuite/gdb.c++/derivation.exp	9 Apr 2003 23:16:43 -0000
***************
*** 300,305 ****
--- 300,323 ----
      timeout           { fail "(timeout) print value of g_instance.afoo()" }
    }
  
+ 
+ # If GDB fails to restore the selected frame properly after the
+ # inferior function call above (see GDB PR 1155 for an explanation of
+ # why this might happen), all the subsequent tests will fail.  We
+ # should detect report that failure, but let the marker call finish so
+ # that the rest of the tests can run undisturbed.
+ gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
+     -re "#0  marker1.*$gdb_prompt $" {
+         setup_kfail "gdb/1155" s390-*-linux-gnu
+         fail "re-selected 'main' frame after inferior call"
+         gdb_test "finish" ".*main.*at .*derivation.cc:21\[79\].*" \
+             "finish call to marker1"
+     }
+     -re "#1  ($hex in )?main.*$gdb_prompt $" {
+         pass "re-selected 'main' frame after inferior call"
+     }
+ }
+         
  send_gdb "print g_instance.bfoo()\n"
  gdb_expect {
      -re ".\[0-9\]* = 2.*$gdb_prompt $" {
Index: gdb/testsuite/gdb.c++/overload.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/overload.exp,v
retrieving revision 1.10
diff -c -r1.10 overload.exp
*** gdb/testsuite/gdb.c++/overload.exp	4 Feb 2003 21:19:27 -0000	1.10
--- gdb/testsuite/gdb.c++/overload.exp	9 Apr 2003 23:16:44 -0000
***************
*** 120,125 ****
--- 120,143 ----
    }
  
  
+ # If GDB fails to restore the selected frame properly after the
+ # inferior function call above (see GDB PR 1155 for an explanation of
+ # why this might happen), all the subsequent tests will fail.  We
+ # should detect and report that failure, but let the marker call
+ # finish so that the rest of the tests can run undisturbed.
+ gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
+     -re "#0  marker1.*$gdb_prompt $" {
+         setup_kfail "gdb/1155" s390-*-linux-gnu
+         fail "re-selected 'main' frame after inferior call"
+         gdb_test "finish" ".*main.*at .*overload.cc:7\[78\].*" \
+             "finish call to marker1"
+     }
+     -re "#1  ($hex in )?main.*$gdb_prompt $" {
+         pass "re-selected 'main' frame after inferior call"
+     }
+ }
+ 
+ 
  send_gdb "print foo_instance1.overloadargs(1, 2)\n"
  gdb_expect {
      -re ".\[0-9\]* = 2\r\n$gdb_prompt $" {
Index: gdb/testsuite/gdb.c++/userdef.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/userdef.exp,v
retrieving revision 1.6
diff -c -r1.6 userdef.exp
*** gdb/testsuite/gdb.c++/userdef.exp	18 Feb 2002 19:07:29 -0000	1.6
--- gdb/testsuite/gdb.c++/userdef.exp	9 Apr 2003 23:16:44 -0000
***************
*** 66,71 ****
--- 66,88 ----
  
  gdb_test "print one + two" "\\\$\[0-9\]* = {x = 6, y = 8}"
  
+ # If GDB fails to restore the selected frame properly after the
+ # inferior function call above (see GDB PR 1155 for an explanation of
+ # why this might happen), all the subsequent tests will fail.  We
+ # should detect report that failure, but let the marker call finish so
+ # that the rest of the tests can run undisturbed.
+ gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
+     -re "#0  marker1.*$gdb_prompt $" {
+         setup_kfail "gdb/1155" s390-*-linux-gnu
+         fail "re-selected 'main' frame after inferior call"
+         gdb_test "finish" ".*main.*at .*userdef.cc:27\[67\].*" \
+                 "finish call to marker1"
+     }
+     -re "#1  ($hex in )?main.*$gdb_prompt $" {
+         pass "re-selected 'main' frame after inferior call"
+     }
+ }
+         
  gdb_test "print one - two" "\\\$\[0-9\]* = {x = -2, y = -2}"
  
  gdb_test "print one * two" "\\\$\[0-9\]* = {x = 8, y = 15}"


  reply	other threads:[~2003-04-09 23:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-09 21:40 Jim Blandy
2003-04-09 22:14 ` David Carlton
2003-04-09 23:21   ` Jim Blandy [this message]
2003-04-10  1:55 ` Andrew Cagney

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=vt24r57qms2.fsf@zenia.red-bean.com \
    --to=jimb@redhat.com \
    --cc=carlton@math.stanford.edu \
    --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