From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7184 invoked by alias); 27 Sep 2009 21:12:36 -0000 Received: (qmail 7174 invoked by uid 22791); 27 Sep 2009 21:12:35 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Sep 2009 21:12:30 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 4B2D91088A; Sun, 27 Sep 2009 21:12:52 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 1DF8F10666; Sun, 27 Sep 2009 21:12:51 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1Ms12h-0006lc-L1; Sun, 27 Sep 2009 17:12:27 -0400 Date: Sun, 27 Sep 2009 21:12:00 -0000 From: Daniel Jacobowitz To: Ulrich Weigand Cc: gdb-patches@sourceware.org Subject: Re: [commit] Support displaced stepping on S/390 Message-ID: <20090927211227.GA25447@caradoc.them.org> Mail-Followup-To: Ulrich Weigand , gdb-patches@sourceware.org References: <200909272100.n8RL0Dwv012931@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200909272100.n8RL0Dwv012931@d12av02.megacenter.de.ibm.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00854.txt.bz2 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 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)