From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12680 invoked by alias); 27 Mar 2018 13:19:45 -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 11066 invoked by uid 89); 27 Mar 2018 13:19:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=1604, ubuntu, 16.04 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Mar 2018 13:19:03 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id EAF058152A; Tue, 27 Mar 2018 15:19:00 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7p9eTiq7Ycmh; Tue, 27 Mar 2018 15:19:00 +0200 (CEST) Received: from Xaviers-MacBook-Pro.local (unknown [46.18.100.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id A41168139E; Tue, 27 Mar 2018 15:19:00 +0200 (CEST) Subject: Re: [RFA v2] (x86) Fix watchpoint using hardware breakpoint for some distro To: Pedro Alves , gdb-patches@sourceware.org Cc: brobecker@adacore.com References: <1521209212-11264-1-git-send-email-roirand@adacore.com> <9c7c8586-2940-bea9-d3fb-a13b0d38a32e@adacore.com> <736c9dbb-4583-c425-f20f-fd3bc5cf84e8@adacore.com> <38205bbb-35c0-c512-0d2c-df0fe9596b4f@redhat.com> From: Xavier Roirand Message-ID: Date: Tue, 27 Mar 2018 13:19:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <38205bbb-35c0-c512-0d2c-df0fe9596b4f@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00556.txt.bz2 Hello, > Earlier you said that TRAP_HWBKPT was the only case that was different > from current kernels, but turns out that's not accurate. And now > I'm left wondering what do those kernels report for the other cases > you haven't confirmed yet, like hw breakpoints, software breakpoints, > and regular single steps. We need a complete picture to figure out > what the best fix is. > Here's a more complete picture: Ubuntu 16.04 | what | si_code | value | |------------------------------------------+-------------|-------| | software breakpoints (int3) | SI_KERNEL | 0x80 | | single-steps | TRAP_TRACE | 2 | | single-stepping a syscall | TRAP_BRKPT | 1 | | user sent SIGTRAP | 0 | 0 | | exec SIGTRAP (when no PTRACE_EVENT_EXEC) | 0 | 0 | | hardware breakpoints/watchpoints | TRAP_HWBKPT | 4 | CentOs 5.11 | what | si_code | value | |------------------------------------------+-------------|-------| | software breakpoints (int3) | SI_KERNEL | 0x80 | | single-steps | TRAP_TRACE | 2 | | single-stepping a syscall | TRAP_BRKPT | 1 | | user sent SIGTRAP | 0 | 0 | | exec SIGTRAP (when no PTRACE_EVENT_EXEC) | 0 | 0 | | hardware breakpoints/watchpoints | TRAP_HWBKPT | 1 | >> E.g., if hw breakpoints and watchpoints report the same si_code, >> how do hw breakpoints work with your patch? >> In handle_signal_stop function, there's a check done in order to see if there's a breakpoint/watchpoint/catchpoint/etc which handle this stop event and check if there's a breakpoint/watchpoint/catchpoint where the inferior is stopped: /* See if there is a breakpoint/watchpoint/catchpoint/etc. that handles this event. */ ecs->event_thread->control.stop_bpstat = bpstat_stop_status (get_current_regcache ()->aspace (), stop_pc, ecs->ptid, &ecs->ws); Do you think that having a fix handling both cases in save_stop_reason would be better (hardware breakpoint & watchpoint) ? else { if (hardware_breakpoint_inserted_here_p (regcache->aspace (), pc)) lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT; else check_stopped_by_watchpoint (lp); } Rather than my initial proposal: else { check_stopped_by_watchpoint (lp); } Regards > Thanks, > Pedro Alves >