From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47857 invoked by alias); 26 Sep 2016 11:16:00 -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 47817 invoked by uid 89); 26 Sep 2016 11:15:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Pull X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Sep 2016 11:15:57 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6357C057FA7; Mon, 26 Sep 2016 11:15:56 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8QBFssi016245; Mon, 26 Sep 2016 07:15:55 -0400 Subject: Re: [PATCH] Don't set random_signal for single step breakpoint To: Yao Qi , gdb-patches@sourceware.org References: <1474866074-21720-1-git-send-email-yao.qi@linaro.org> From: Pedro Alves Message-ID: Date: Mon, 26 Sep 2016 12:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1474866074-21720-1-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-09/txt/msg00334.txt.bz2 On 09/26/2016 01:01 AM, Yao Qi wrote: > I happen to see the code, and find the comments are out of date, > because single-step breakpoint is not transparent to the breakpoint > module. If one thread hits another thread's single-step breakpoint, > random_signal should be zero. IOW, if random_signal is one, the > thread shouldn't hit any single-step breakpoints. This patch is to > remove this piece of code. Hmm, not sure. This hunk does predate the move to have single-step breakpoints be regular breakpoints, but, OTOH, the single-step breakpoints are deleted before the bpstat handling takes place: /* Pull the single step breakpoints out of the target. */ if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP) { ... /* However, before doing so, if this single-step breakpoint was actually for another thread, set this thread up for moving past it. */ if (!thread_has_single_step_breakpoint_here (ecs->event_thread, aspace, pc)) { if (single_step_breakpoint_inserted_here_p (aspace, pc)) { ecs->hit_singlestep_breakpoint = 1; ... delete_just_stopped_threads_single_step_breakpoints (); bpstat_clear (&ecs->event_thread->control.stop_bpstat); ... ecs->event_thread->control.stop_bpstat = bpstat_stop_status (get_regcache_aspace (get_current_regcache ()), stop_pc, ecs->ptid, &ecs->ws); /* See if the breakpoints module can explain the signal. */ random_signal = !bpstat_explains_signal (ecs->event_thread->control.stop_bpstat, ecs->event_thread->suspend.stop_signal); So I wonder whether this: /* Maybe this was a trap for a software breakpoint that has since been removed. */ if (random_signal && target_stopped_by_sw_breakpoint ()) { is masking the need for the hunk you're proposing to remove. What happens if you hack your target to no longer support target_stopped_by_sw_breakpoint ? The commit that added the code in question (2adfaa28b5, eliminate thread-hop code) predates that (the whole moribund breakpoints -> siginfo.si_code change). Thanks, Pedro Alves