Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [commit] Support displaced stepping on S/390
Date: Sun, 27 Sep 2009 21:12:00 -0000	[thread overview]
Message-ID: <20090927211227.GA25447@caradoc.them.org> (raw)
In-Reply-To: <200909272100.n8RL0Dwv012931@d12av02.megacenter.de.ibm.com>

On Sun, Sep 27, 2009 at 11:00:13PM +0200, Ulrich Weigand wrote:
> Hello,
> 
> on s390 the non-stop cases were failing because we do not yet support
> displaced stepping at all.  The following patch implements a basic
> version that should support most common compiler-generated code.
> 
> Tested on s390(x)-linux, fixes the non-stop test cases.
> Committed to mainline.

FYI, I have a local patch to issue an error if you try to connect to a
remote target in non-stop mode and the target supports non-stop but
gdb does not know how to do displaced stepping.  Clearly the check
shouldn't be remote specific - but I didn't post it because I couldn't
figure out how where to put the error to work for native too.

Attached for reference.  I am perfectly happy to commit this if
someone thinks it's an improvement, but I'd rather figure out where to
handle native first...

-- 
Daniel Jacobowitz
CodeSourcery

2009-09-21  Daniel Jacobowitz  <dan@codesourcery.com>

	gdb/
	* inferior.h (missing_displaced_stepping): Declare.
	* infrun.c (need_displaced_stepping): New function, from
	use_displaced_stepping.
	(use_displaced_stepping): Use need_displaced_stepping.
	(missing_displaced_stepping): New function.
	* remote.c (remote_start_remote): Require displaced stepping support
	for non-stop.

	gdb/testsuite/
	* lib/mi-support.exp (mi_gdb_target_cmd): Loosen non-stop error check.
	* gdb.mi/mi-nonstop-exit.exp, gdb.mi/mi-nonstop.exp,
	gdb.mi/mi-nsintrall.exp, gdb.mi/mi-nsmoribund.exp,
	gdb.mi/mi-nsthrexec.exp: Remove perror and fail after mi_run_to_main.

Index: gdb/inferior.h
===================================================================
--- gdb/inferior.h	(revision 262049)
+++ gdb/inferior.h	(revision 262050)
@@ -357,6 +357,11 @@ extern int debug_displaced;
 void displaced_step_dump_bytes (struct ui_file *file,
                                 const gdb_byte *buf, size_t len);
 
+/* Return non-zero if displaced stepping should be used to step
+   over breakpoints, but is not supported.  */
+
+int missing_displaced_stepping (struct gdbarch *gdbarch);
+
 \f
 /* Possible values for gdbarch_call_dummy_location.  */
 #define ON_STACK 1
Index: gdb/remote.c
===================================================================
--- gdb/remote.c	(revision 262049)
+++ gdb/remote.c	(revision 262050)
@@ -2788,6 +2788,9 @@ remote_start_remote (struct ui_out *uiou
       if (!rs->non_stop_aware)
 	error (_("Non-stop mode requested, but remote does not support non-stop"));
 
+      if (missing_displaced_stepping (target_gdbarch))
+	error (_("Non-stop mode requested, but displaced stepping is not supported on this architecture"));
+
       putpkt ("QNonStop:1");
       getpkt (&rs->buf, &rs->buf_size, 0);
 
Index: gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb/testsuite/lib/mi-support.exp	(revision 262049)
+++ gdb/testsuite/lib/mi-support.exp	(revision 262050)
@@ -365,7 +365,7 @@ proc mi_gdb_target_cmd { targetname seri
 		sleep 5
 		continue
 	    }
-	    -re "Non-stop mode requested, but remote does not support non-stop.*$mi_gdb_prompt" {
+	    -re "Non-stop mode requested, but .*$mi_gdb_prompt" {
 		unsupported "Non-stop mode not supported"
 		return 1
 	    }
Index: gdb/testsuite/gdb.mi/mi-nsthrexec.exp
===================================================================
--- gdb/testsuite/gdb.mi/mi-nsthrexec.exp	(revision 262049)
+++ gdb/testsuite/gdb.mi/mi-nsthrexec.exp	(revision 262050)
@@ -63,7 +63,6 @@ mi_gdb_test "-gdb-set target-async 1" ".
 detect_async
 
 if { [mi_run_to_main] < 0 } {
-    perror "mi-nsthrexec.exp tests suppressed"
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-nsintrall.exp
===================================================================
--- gdb/testsuite/gdb.mi/mi-nsintrall.exp	(revision 262049)
+++ gdb/testsuite/gdb.mi/mi-nsintrall.exp	(revision 262050)
@@ -53,7 +53,6 @@ mi_gdb_test "-gdb-set target-async 1" ".
 detect_async
 
 if { [mi_run_to_main] < 0 } {
-    perror "mi-nsintrall.exp tests suppressed"
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-nsmoribund.exp
===================================================================
--- gdb/testsuite/gdb.mi/mi-nsmoribund.exp	(revision 262049)
+++ gdb/testsuite/gdb.mi/mi-nsmoribund.exp	(revision 262050)
@@ -53,7 +53,6 @@ mi_gdb_test "-gdb-set target-async 1" ".
 detect_async
 
 if { [mi_run_to_main] < 0 } {
-    perror "mi-nsmoribund.exp tests suppressed"
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-nonstop-exit.exp
===================================================================
--- gdb/testsuite/gdb.mi/mi-nonstop-exit.exp	(revision 262049)
+++ gdb/testsuite/gdb.mi/mi-nonstop-exit.exp	(revision 262050)
@@ -54,7 +54,6 @@ mi_gdb_test "-gdb-set target-async 1" ".
 detect_async
 
 if { [mi_run_to_main] < 0 } {
-    perror "mi-nonstop-exit.exp tests suppressed"
     continue
 }
 
@@ -65,7 +64,6 @@ mi_expect_stop "exited-normally" "" "" "
 # Run the program again.
 
 if { [mi_run_to_main] < 0 } {
-    fail "run (2)"
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-nonstop.exp
===================================================================
--- gdb/testsuite/gdb.mi/mi-nonstop.exp	(revision 262049)
+++ gdb/testsuite/gdb.mi/mi-nonstop.exp	(revision 262050)
@@ -54,7 +54,6 @@ mi_gdb_test "-gdb-set target-async 1" ".
 detect_async
 
 if { [mi_run_to_main] < 0 } {
-    perror "mi-nonstop.exp tests suppressed"
     continue
 }
 
Index: gdb/infrun.c
===================================================================
--- gdb/infrun.c	(revision 262049)
+++ gdb/infrun.c	(revision 262050)
@@ -739,19 +739,38 @@ Debugger's willingness to use displaced 
 breakpoints is %s.\n"), value);
 }
 
-/* Return non-zero if displaced stepping can/should be used to step
+/* Return non-zero if displaced stepping should be used to step
    over breakpoints.  */
 
 static int
-use_displaced_stepping (struct gdbarch *gdbarch)
+need_displaced_stepping (struct gdbarch *gdbarch)
 {
   return (((can_use_displaced_stepping == can_use_displaced_stepping_auto
 	    && non_stop)
 	   || can_use_displaced_stepping == can_use_displaced_stepping_on)
-	  && gdbarch_displaced_step_copy_insn_p (gdbarch)
 	  && !RECORD_IS_USED);
 }
 
+/* Return non-zero if displaced stepping can/should be used to step
+   over breakpoints.  */
+
+static int
+use_displaced_stepping (struct gdbarch *gdbarch)
+{
+  return (need_displaced_stepping (gdbarch)
+	  && gdbarch_displaced_step_copy_insn_p (gdbarch));
+}
+
+/* Return non-zero if displaced stepping should be used to step
+   over breakpoints, but is not supported.  */
+
+int
+missing_displaced_stepping (struct gdbarch *gdbarch)
+{
+  return (need_displaced_stepping (gdbarch)
+	  && !gdbarch_displaced_step_copy_insn_p (gdbarch));
+}
+
 /* Clean out any stray displaced stepping state.  */
 static void
 displaced_step_clear (void)


  reply	other threads:[~2009-09-27 21:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-27 21:00 Ulrich Weigand
2009-09-27 21:12 ` Daniel Jacobowitz [this message]
2009-09-28  9:24   ` Ulrich Weigand
2009-09-28 16:32     ` Daniel Jacobowitz

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=20090927211227.GA25447@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.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