From patchwork Thu Nov 3 09:48:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 17142 Received: (qmail 29726 invoked by alias); 3 Nov 2016 09:48:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 29456 invoked by uid 89); 3 Nov 2016 09:48:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:209.85.192.194, H*RU:209.85.192.194 X-HELO: mail-pf0-f194.google.com Received: from mail-pf0-f194.google.com (HELO mail-pf0-f194.google.com) (209.85.192.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Nov 2016 09:48:23 +0000 Received: by mail-pf0-f194.google.com with SMTP id y68so4384855pfb.1 for ; Thu, 03 Nov 2016 02:48:23 -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=4U5ioEORsClxFxQogs7zE671iZtnsrLoI9W9gXItPV0=; b=Mqroxp5xy8sgSrQnj9l9npwjzNYnkVOLk4rIfbsaqdlCC7bpBL5xpqoOrGUa58ZGfJ FBaWY45i50X4hnW8BuWLDcQ+a5X/m2RsH7iaqN4N+vc2wZFf+1w4F0NDJhPoY+N4hSCJ IA7labQattOMOaFXrvgtm1uAp/gpRoU7smGoBOvqGAreWyT9zPWW6WmCg4vgrw/jlUFG a0Y0CMSHOxMkTW72fmXdh0TOTpPsX88rY5dc6Y2FdN1fBf4BrtBDMovm6OugrApVg7Kf Umf9fEW8offNQlHSIbzsS8dwFQ/SO47ypSi7usTQ6xo2a/5LMXKqpSko4TK1pLIIwaTD IC4Q== X-Gm-Message-State: ABUngvcRI/ZbjV0I72wKCZMSPozOYYjDH4/btYAM8zMJTnMTbGYZtreIM6f/IoGw6zL++A== X-Received: by 10.99.149.72 with SMTP id t8mr12679848pgn.29.1478166502227; Thu, 03 Nov 2016 02:48:22 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id a22sm11215345pfg.7.2016.11.03.02.48.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Nov 2016 02:48:21 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 01/11] gdbarch_breakpoint_from_pc doesn't return NULL Date: Thu, 3 Nov 2016 09:48:01 +0000 Message-Id: <1478166491-11357-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1478166491-11357-1-git-send-email-yao.qi@linaro.org> References: <1478166491-11357-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes gdbarch_breakpoint_from_pc doesn't return NULL except for ia64_breakpoint_from_pc, and we checked its return value in three places. In microblaze_linux_memory_remove_breakpoint and ppc_linux_memory_remove_breakpoint, gdbarch_breakpoint_from_pc never returns NULL, so we can remove the NULL checking. In default_memory_insert_breakpoint, gdbarch_breakpoint_from_pc can't returns NULL too because ia64 defines its own memory_insert_breakpoint. gdb: 2016-11-02 Yao Qi * mem-break.c (default_memory_insert_breakpoint): Don't check 'bp' against NULL. * microblaze-linux-tdep.c (microblaze_linux_memory_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. --- gdb/mem-break.c | 2 -- gdb/microblaze-linux-tdep.c | 2 -- gdb/ppc-linux-tdep.c | 2 -- 3 files changed, 6 deletions(-) diff --git a/gdb/mem-break.c b/gdb/mem-break.c index 803f62b..cc8145c 100644 --- a/gdb/mem-break.c +++ b/gdb/mem-break.c @@ -45,8 +45,6 @@ default_memory_insert_breakpoint (struct gdbarch *gdbarch, /* Determine appropriate breakpoint contents and size for this address. */ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); - if (bp == NULL) - error (_("Software breakpoints not implemented for this target.")); bp_tgt->placed_address = addr; bp_tgt->placed_size = bplen; diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c index 18ddfea..22e5959 100644 --- a/gdb/microblaze-linux-tdep.c +++ b/gdb/microblaze-linux-tdep.c @@ -49,8 +49,6 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, /* Determine appropriate breakpoint contents and size for this address. */ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); - if (bp == NULL) - error (_("Software breakpoints not implemented for this target.")); val = target_read_memory (addr, old_contents, bplen); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index ee158e3..9c0b8fc 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -222,8 +222,6 @@ ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, /* Determine appropriate breakpoint contents and size for this address. */ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen); - if (bp == NULL) - error (_("Software breakpoints not implemented for this target.")); /* Make sure we see the memory breakpoints. */ cleanup = make_show_memory_breakpoints_cleanup (1);