This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [commit] Support displaced stepping on S/390


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);
+
 
 /* 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]