Message ID | 1459759138-1494-2-git-send-email-yao.qi@linaro.org |
---|---|
State | New, archived |
Headers |
Received: (qmail 92585 invoked by alias); 4 Apr 2016 08:39:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 92189 invoked by uid 89); 4 Apr 2016 08:39:18 -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=XNEW, xnew X-HELO: mail-pa0-f49.google.com Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 04 Apr 2016 08:39:08 +0000 Received: by mail-pa0-f49.google.com with SMTP id zm5so139702430pac.0 for <gdb-patches@sourceware.org>; Mon, 04 Apr 2016 01:39:08 -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=2LP5pboQtLeX510N+fOJZSzy2J5Jh76VUHm8LTPiKR8=; b=jt4Bf2NGWXocXrvgydRWzmvt/+aRWqO0iMSg1SXk7fGJ4rlFoJ0wvLr8uzx4CaEVQC M5gq/+Gq5T9JOwmsh6LXB7Nm1/R11eJxCobhafYs5GROe3A1FrvGd1DUO2TaVWyZhAAs eb9H4jb24HwBuRxv/V4k5QXsALd5gEUky1eznEuwN9T8cMIVvAWKQEk8GYXu/ZF87oxg 1ngtHF2glxGisT1TKys+sTq0NtmdXGjd+9nCIgwUw2eGoapYT34M9Gk25npupBxf9IWH lKk5ut/m/VB+XrcRyoMQwTWX2hn8D3JKoEoLZ3p6yERv56OohJ1cE/iz5urXVBuELtkS nrOg== X-Gm-Message-State: AD7BkJJ3QThTGU7nCByiG0CrwJY8wgX2BCPtbZ7yF6qwjbCVSs1HDJn3mx0fcmaTBOAw1Q== X-Received: by 10.66.65.109 with SMTP id w13mr50991313pas.142.1459759147024; Mon, 04 Apr 2016 01:39:07 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id dg1sm39662470pad.18.2016.04.04.01.39.05 for <gdb-patches@sourceware.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 01:39:06 -0700 (PDT) From: Yao Qi <qiyaoltc@gmail.com> X-Google-Original-From: Yao Qi <yao.qi@linaro.org> To: gdb-patches@sourceware.org Subject: [PATCH 1/2] Set bp_tgt->reqstd_address and bp_tgt->placed_size in record_full_insert_breakpoint Date: Mon, 4 Apr 2016 09:38:57 +0100 Message-Id: <1459759138-1494-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1459759138-1494-1-git-send-email-yao.qi@linaro.org> References: <1459759138-1494-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes |
Commit Message
Yao Qi
April 4, 2016, 8:38 a.m. UTC
I notice that bp_tgt won't be fully initialized if to_insert_breakpoint isn't called in record_full_insert_breakpoint, and bp_tgt->reqstd_address is zero, so an entry is added to record_full_breakpoints, but its address is zero, which is wrong. This patch is to call gdbarch_breakpoint_from_pc in the else branch to set bp_tgt->reqstd_address and bp_tgt->placed_size. gdb: 2016-04-04 Yao Qi <yao.qi@linaro.org> * record-full.c (record_full_insert_breakpoint): Set bp_tgt->reqstd_address and bp_tgt->placed_size. --- gdb/record-full.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
Comments
On 04/04/2016 03:38 AM, Yao Qi wrote: > I notice that bp_tgt won't be fully initialized if to_insert_breakpoint > isn't called in record_full_insert_breakpoint, and bp_tgt->reqstd_address > is zero, so an entry is added to record_full_breakpoints, but its address > is zero, which is wrong. This patch is to call gdbarch_breakpoint_from_pc > in the else branch to set bp_tgt->reqstd_address and bp_tgt->placed_size. > > gdb: > > 2016-04-04 Yao Qi <yao.qi@linaro.org> > > * record-full.c (record_full_insert_breakpoint): Set > bp_tgt->reqstd_address and bp_tgt->placed_size. > --- > gdb/record-full.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/gdb/record-full.c b/gdb/record-full.c > index f6023bf..066a8e7 100644 > --- a/gdb/record-full.c > +++ b/gdb/record-full.c > @@ -1670,6 +1670,16 @@ record_full_insert_breakpoint (struct target_ops *ops, > > in_target_beneath = 1; > } > + else > + { > + CORE_ADDR addr = bp_tgt->reqstd_address; Do we really need to get this initialized? > + int bplen; > + > + gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); > + > + bp_tgt->placed_address = addr; > + bp_tgt->placed_size = bplen; > + } > > bp = XNEW (struct record_full_breakpoint); > bp->addr = bp_tgt->placed_address; > Otherwise looks good.
Luis Machado <lgustavo@codesourcery.com> writes: >> + CORE_ADDR addr = bp_tgt->reqstd_address; > > Do we really need to get this initialized? > Yes, 'addr' is passed to gdbarch_breakpoint_from_pc below. >> + int bplen; >> + >> + gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); >> + >> + bp_tgt->placed_address = addr; >> + bp_tgt->placed_size = bplen;
On 04/06/2016 03:36 AM, Yao Qi wrote: > Luis Machado <lgustavo@codesourcery.com> writes: > >>> + CORE_ADDR addr = bp_tgt->reqstd_address; >> >> Do we really need to get this initialized? >> > > Yes, 'addr' is passed to gdbarch_breakpoint_from_pc below. > Ah, indeed. For a moment i thought addr was initialized within gdbarch_breakpoint_from_pc. >>> + int bplen; >>> + >>> + gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); >>> + >>> + bp_tgt->placed_address = addr; >>> + bp_tgt->placed_size = bplen; >
diff --git a/gdb/record-full.c b/gdb/record-full.c index f6023bf..066a8e7 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1670,6 +1670,16 @@ record_full_insert_breakpoint (struct target_ops *ops, in_target_beneath = 1; } + else + { + CORE_ADDR addr = bp_tgt->reqstd_address; + int bplen; + + gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); + + bp_tgt->placed_address = addr; + bp_tgt->placed_size = bplen; + } bp = XNEW (struct record_full_breakpoint); bp->addr = bp_tgt->placed_address;