From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76565 invoked by alias); 16 Sep 2018 00:13:14 -0000 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 Received: (qmail 76548 invoked by uid 89); 16 Sep 2018 00:13:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr1-f67.google.com Received: from mail-wr1-f67.google.com (HELO mail-wr1-f67.google.com) (209.85.221.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Sep 2018 00:13:12 +0000 Received: by mail-wr1-f67.google.com with SMTP id g33-v6so13842817wrd.1 for ; Sat, 15 Sep 2018 17:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=to:from:subject:openpgp:autocrypt:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=y2wNDKZYlcBU7QmxrDHFDecvZoUiadQMFOKqrDQXQOo=; b=hEkwr8NWuW5JWSTcUpVs3iJNWyoslzMLj66lLSilRQN7j8qlnj7xfpKmFvotIFBRGp tFsjyocX3Y1Ai6X3V1Ytn27PHNBS/hqYS0+Ria0ED2J8+ABVdfEgW4+4n1c8lFDLvQeC O7FeQuKNTKyoMzzv1FZ35TXxLt+KdvD/PXLz7c4G6GponhD0VnazWX0hdcxXEecP5L2Y bA4Uy3ZHgoHVvpIAAdbravkIFRlZEHi5Qd2JYtAMHwF1yp+N18JBRVr43WB10yTrhuWm Op4KVQJ40W81DQpnE3DeVjcKzg3gHwdsVhpsu4ZVUBCe5ntxMZXnnniKyMblMR+YLJRb Ve3Q== Return-Path: Received: from [192.168.0.11] (cpc1-sals4-2-0-cust757.know.cable.virginm.net. [80.0.42.246]) by smtp.gmail.com with ESMTPSA id v2-v6sm2388616wme.36.2018.09.15.17.13.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Sep 2018 17:13:09 -0700 (PDT) To: gdb-patches@sourceware.org From: Craig Blackmore Subject: [PATCH] RISC-V: enable have_nonsteppable_watchpoint by default Openpgp: preference=signencrypt Message-ID: Date: Sun, 16 Sep 2018 00:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2018-09/txt/msg00509.txt.bz2 The RISC-V debug spec 0.13 recommends that write triggers fire before the write is committed. If the target follows this behaviour, then have_nonsteppable_watchpoint needs to be set to 1 so that GDB will step over the watchpoint before checking if the value has changed. =20=20=20=20 This patch adds a setshow for have_nonsteppable_watchpoint which defaults to 1 to match the recommended behaviour. If a target does not follow this timing, then 'set riscv have_nonsteppable_watchpoint 0' will need to be issued on the command line. =20=20=20=20 gdb/ChangeLog: =20=20=20=20 * riscv-tdep.c (set_have_nonsteppable_watchpoint): add callback for 'set riscv have_nonsteppable_watchpoint' (riscv_gdbarch_init): initialise gdbarch setting for have_nonesteppable_watchpoint --- diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 254914c9c7..8f301d8b01 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -226,6 +226,20 @@ show_use_compressed_breakpoints (struct ui_file *file,= int from_tty, "to %s%s.\n"), value, additional_info); } =20 +static int riscv_have_nonsteppable_watchpoint =3D 1; + +/* The set callback for 'set riscv have-nonsteppable-watchpoint'. */ + +static void +set_have_nonsteppable_watchpoint (const char *args, int from_tty, + struct cmd_list_element *c) +{ + struct gdbarch *gdbarch =3D target_gdbarch (); + + set_gdbarch_have_nonsteppable_watchpoint (gdbarch, + riscv_have_nonsteppable_watchpoint); +} + /* The set and show lists for 'set riscv' and 'show riscv' prefixes. */ =20 static struct cmd_list_element *setriscvcmdlist =3D NULL; @@ -2736,6 +2750,8 @@ riscv_gdbarch_init (struct gdbarch_info info, set_gdbarch_return_value (gdbarch, riscv_return_value); set_gdbarch_breakpoint_kind_from_pc (gdbarch, riscv_breakpoint_kind_from= _pc); set_gdbarch_sw_breakpoint_from_kind (gdbarch, riscv_sw_breakpoint_from_k= ind); + set_gdbarch_have_nonsteppable_watchpoint (gdbarch, + riscv_have_nonsteppable_watchpoint); =20 /* Register architecture. */ set_gdbarch_num_regs (gdbarch, RISCV_LAST_REGNUM + 1); @@ -2980,4 +2996,20 @@ can be used."), show_use_compressed_breakpoints, &setriscvcmdlist, &showriscvcmdlist); + + add_setshow_boolean_cmd ("have-nonsteppable-watchpoint", no_class, + &riscv_have_nonsteppable_watchpoint, + _("\ +Set whether debugger must step over hardware watchpoints"), + _("\ +Show whether debugger must step over hardware watchpoints"), + _("\ +The RISC-V debug spec recommends that hardware write watchpoints fire befo= re\n\ +the write is committed, in which case, GDB must step over the watchpoint\n\ +before checking the old and new values. Set this option to 1 (default) for= \n\ +targets that follow this behaviour, otherwise set to 0."), + set_have_nonsteppable_watchpoint, + NULL, + &setriscvcmdlist, + &showriscvcmdlist); }