From patchwork Fri Jan 22 01:22:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 10514 Received: (qmail 31477 invoked by alias); 22 Jan 2016 01:22:33 -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 31467 invoked by uid 89); 22 Jan 2016 01:22:32 -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, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2041, wish X-HELO: mail-pf0-f202.google.com Received: from mail-pf0-f202.google.com (HELO mail-pf0-f202.google.com) (209.85.192.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 22 Jan 2016 01:22:31 +0000 Received: by mail-pf0-f202.google.com with SMTP id 65so5883260pff.1 for ; Thu, 21 Jan 2016 17:22:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to :content-type; bh=blstByKyUK9W/AyuZ1felDEaoTf1KBfszRZQZIUrL+g=; b=UTVrREvUylxMJa6ceta5o0hAUjdER2fz+jeX7yRQ8pdxj1aYywrB6Fq/N1Nw2J+scL zEHSHk5II0DpFKpsdZC9misFGpFVdVB4l3tlEIlk548aR6OdhIBBq0X9y7pN1gD3Akdx vJ3SOaPu6Sl4VkjNGv4XT7cUyjtxPDBs1TZdXpbuO5VGqMXGh8yfs0nwpTXWAvbIsNrI t441C1sPzusuqIyo3rnhzuYlfCAKBZnV24xVPLSl7z5dquyIph9McnI3yZ5EY6Crzb1N 3JZ3Sg9TcZCafGFJwEzKdEgYPzK5V8Ys7e6Y7kz+C0ae6b8d2gPFY0DcABBRTMejmcy+ GolA== X-Gm-Message-State: AG10YORsiB0ft5p+DAv76MOPQRIBJ8P2wP7GC7nRZt4ejW2XUEud4Vo0aQkH6qG9Kf/NPA5ltw== MIME-Version: 1.0 X-Received: by 10.98.0.11 with SMTP id 11mr378047pfa.2.1453425749658; Thu, 21 Jan 2016 17:22:29 -0800 (PST) Message-ID: <001a1143a27c8458ad0529e20d1e@google.com> Date: Fri, 22 Jan 2016 01:22:29 +0000 Subject: [PATCH] Partially revert init_breakpoint_sal new_address_location change From: Doug Evans To: brobecker@adacore.com, keiths@redhat.com, gdb-patches@sourceware.org X-IsSubscribed: yes Hi. Sorry I didn't catch this during the initial review. Here's the code as it is today: if (location != NULL) b->location = location; else { const char *addr_string = NULL; int addr_string_len = 0; >>> if (location != NULL) <<< addr_string = event_location_to_string (location); if (addr_string != NULL) addr_string_len = strlen (addr_string); b->location = new_address_location (b->loc->address, addr_string, addr_string_len); } This test ">>> ... <<<" is pointless because we only enter the else clause if location == NULL. Instead, assuming(!) the patch is otherwise correct, we just need to update the call to new_address_location, which the patch below does. I have more changes I wish to make related to this change: https://sourceware.org/ml/gdb-patches/2016-01/msg00352.html but I think they can be handled separately (time will tell). btw, a separate question I have is: Should we even allow passing a NULL location to init_breakpoint_sal? Seems like it introduces some fragility, if not bugs. 2016-01-21 Doug Evans Partially revert: 2016-01-21 Joel Brobecker * breakpoint.c (init_breakpoint_sal): Get the event location's string, if any, and use it to update call to new_address_location. Instead, just update call to new_address_location. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 7b610ef..494cb33 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9370,18 +9370,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, if (location != NULL) b->location = location; else - { - const char *addr_string = NULL; - int addr_string_len = 0; - - if (location != NULL) - addr_string = event_location_to_string (location); - if (addr_string != NULL) - addr_string_len = strlen (addr_string); - - b->location = new_address_location (b->loc->address, - addr_string, addr_string_len); - } + b->location = new_address_location (b->loc->address, NULL, 0); b->filter = filter; }