From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by sourceware.org (Postfix) with ESMTPS id 31C6438930D0 for ; Mon, 29 Jun 2020 13:49:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 31C6438930D0 IronPort-SDR: ahMRbIh2Pesh+LOD4722G9Rl8EKfjbccXsE0j3HIAzB4ZwSeQwRnUf6bTy5xPS/v0JcDP+Ursb v5WDUwNERFIg== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="134282785" X-IronPort-AV: E=Sophos;i="5.75,294,1589266800"; d="scan'208";a="134282785" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 06:49:31 -0700 IronPort-SDR: AvxqU8JLxQdhjQ5dwOC5xtpGKrLN50LuuHUsJng6FjyFcySLjtukk47ekH/VzEz1GGUvtXuryq 0D6CKkWxIygw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,294,1589266800"; d="scan'208";a="320645049" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 29 Jun 2020 06:49:31 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 05TDnUEj028076; Mon, 29 Jun 2020 14:49:30 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 05TDnU47025821; Mon, 29 Jun 2020 15:49:30 +0200 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 05TDnUON025817; Mon, 29 Jun 2020 15:49:30 +0200 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH 3/3] gdb/breakpoint: refactor 'set_breakpoint_condition' Date: Mon, 29 Jun 2020 15:48:28 +0200 Message-Id: <453f3c95a7e485dd900541defcc98f0c9cf1dd62.1593438119.git.tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: X-Spam-Status: No, score=-22.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2020 13:49:34 -0000 Apply minor refactoring to 'set_breakpoint_condition'. gdb/ChangeLog: 2020-06-29 Tankut Baris Aktemur * breakpoint.c (set_breakpoint_condition): Do minor refactoring. --- gdb/breakpoint.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index abda470fe21..aebc123f86f 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -840,16 +840,10 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp, b->cond_string = nullptr; if (is_watchpoint (b)) - { - struct watchpoint *w = (struct watchpoint *) b; - - w->cond_exp.reset (); - } + static_cast (b)->cond_exp.reset (); else { - struct bp_location *loc; - - for (loc = b->loc; loc; loc = loc->next) + for (bp_location *loc = b->loc; loc != nullptr; loc = loc->next) { loc->cond.reset (); @@ -864,31 +858,26 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp, } else { - const char *arg = exp; - if (is_watchpoint (b)) { - struct watchpoint *w = (struct watchpoint *) b; - innermost_block_tracker tracker; - arg = exp; + const char *arg = exp; expression_up new_exp = parse_exp_1 (&arg, 0, 0, 0, &tracker); - if (*arg) + if (*arg != 0) error (_("Junk at end of expression")); + watchpoint *w = static_cast (b); w->cond_exp = std::move (new_exp); w->cond_exp_valid_block = tracker.block (); } else { - struct bp_location *loc; - - for (loc = b->loc; loc; loc = loc->next) + for (bp_location *loc = b->loc; loc != nullptr; loc = loc->next) { - arg = exp; + const char *arg = exp; expression_up new_exp = parse_exp_1 (&arg, loc->address, block_for_pc (loc->address), 0); - if (*arg) + if (*arg != 0) error (_("Junk at end of expression")); loc->cond = std::move (new_exp); } -- 2.17.1