From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89743 invoked by alias); 23 Mar 2016 16:10:04 -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 89469 invoked by uid 89); 23 Mar 2016 16:10:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=bp X-HELO: mail-pf0-f193.google.com Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 23 Mar 2016 16:09:55 +0000 Received: by mail-pf0-f193.google.com with SMTP id q129so4626468pfb.3 for ; Wed, 23 Mar 2016 09:09:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=XnFnYHbH+k3Gcz/Cajae0zpCqL+SkgCSxqNsmIPEiqU=; b=UnCjgWEhk9NWzosG7NATIWqQWcgSbN/ZeGy1S1u/hiQpI+hDZW1YD7QDstyiRjQ90t KX5p1PWgP3Cq8rY6ub/KPfAmAQWsZrwBXzNkPnOZUCe12RaudeFvRUOF9qGL+ugok4u9 EYfwkkQaHievErNB+xXE58CVMo1VBptAoO4UEPRmL/S/4tyFxqM71D9NbDCtoM1ssviZ spe40MITkrbHxY0aBmNj4OmvWZjPX2QhOKFkMniS5h2nAifVYmQkcqV6VtGIqDelld7a j+fzP6wAB5UA0CXB1tkWoGhmESz/IUVrqLg195AR2AiAURmplrZZw02uri5XTZyf53rl NzCQ== X-Gm-Message-State: AD7BkJJH9WpHX0DWyBz3qgsgyXUGga4BbzDoUzFcoi7ADusLuGV5fW2fzANDx5GNh7Ebqg== X-Received: by 10.98.93.12 with SMTP id r12mr5519853pfb.64.1458749394082; Wed, 23 Mar 2016 09:09:54 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id 79sm5206701pfq.65.2016.03.23.09.09.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Mar 2016 09:09:53 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 4/7] Insert breakpoint even when the raw breakpoint is found Date: Wed, 23 Mar 2016 16:10:00 -0000 Message-Id: <1458749384-19793-5-git-send-email-yao.qi@linaro.org> In-Reply-To: <1458749384-19793-1-git-send-email-yao.qi@linaro.org> References: <1458749384-19793-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00477.txt.bz2 When GDBserver inserts a breakpoint, it looks for raw breakpoint, if the raw breakpoint is found, increase its refcount, and return. This doesn't work when it steps over a breakpoint using software single step and the underneath instruction of breakpoint is branch to self. When stepping over a breakpoint on ADDR using software single step, GDBserver uninsert the breakpoint, so the corresponding raw breakpoint RAW's 'inserted' flag is zero. Then, GDBserver insert single step breakpoint at the same address ADDR because the instruction is branch to self, the same raw brekapoint RAW is found, and increase the refcount. However, the raw breakpoint is not inserted, and the program won't stop. gdb/gdbserver: 2016-03-23 Yao Qi * mem-break.c (set_raw_breakpoint_at): Insert raw breakpoint when its refcount is increased. --- gdb/gdbserver/mem-break.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index b06f8e9..af01288 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -411,7 +411,22 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind, if (bp != NULL) { bp->refcount++; - return bp; + + if (!bp->inserted) + { + *err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, + bp); + if (*err != 0) + { + if (debug_threads) + debug_printf ("Failed to insert breakpoint at 0x%s (%d).\n", + paddress (where), *err); + bp->refcount--; + return NULL; + } + bp->inserted = 1; + } + return bp; } bp = XCNEW (struct raw_breakpoint); -- 1.9.1