From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14115 invoked by alias); 15 Oct 2019 03:11:39 -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 13991 invoked by uid 89); 15 Oct 2019 03:11:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 spammy=visit, HContent-Transfer-Encoding:8bit X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Oct 2019 03:11:28 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 63EC8208B6; Mon, 14 Oct 2019 23:11:25 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 4382E2061D; Mon, 14 Oct 2019 23:11:24 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 19C9629ECF; Mon, 14 Oct 2019 23:11:24 -0400 (EDT) X-Gerrit-PatchSet: 2 Date: Tue, 15 Oct 2019 03:11:00 -0000 From: "Simon Marchi (Code Review)" To: Christian Biesinger , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: Change in binutils-gdb[master]: Change iterate_over_breakpoints to take a function_view X-Gerrit-Change-Id: Ia9de4deecae562a70a40f5cd49f5a74d64570251 X-Gerrit-Change-Number: 21 X-Gerrit-ChangeURL: X-Gerrit-Commit: 10611e5fa4f1ddc92bde10815cb61405f12424b6 In-Reply-To: References: X-Gerrit-Comment-Date: Mon, 14 Oct 2019 23:11:23 -0400 Reply-To: simon.marchi@polymtl.ca, cbiesinger@google.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191015031124.19C9629ECF@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-10/txt/msg00394.txt.bz2 Simon Marchi has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21 ...................................................................... Patch Set 2: Code-Review-1 (6 comments) https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/breakpoint.c File gdb/breakpoint.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/breakpoint.c@15131 PS2, Line 15131: iterate_over_breakpoints : (gdb::function_view callback) This would fit on a single line. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/dummy-frame.c File gdb/dummy-frame.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/dummy-frame.c@169 PS2, Line 169: iterate_over_breakpoints ([dummy] (breakpoint* bp) Same comment about formatting as in py-finishbreakpoint.c. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/guile/scm-breakpoint.c File gdb/guile/scm-breakpoint.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/guile/scm-breakpoint.c@551 PS2, Line 551: ([&] (breakpoint *bp) { return bpscm_build_bp_list(bp, &list); }) For readability, I'd like if you took that out of the "if". Either: auto callback = [&] (breakpoint *bp) { return bpscm_build_bp_list(bp, &list); }; if (iterate_over_breakpoints (callback) != NULL) return SCM_BOOL_F; or breakpoint *bp_ret = iterate_over_breakpoints ([&] (breakpoint *bp) { return bpscm_build_bp_list(bp, &list); }); if (bp_ret != NULL) return SCM_BOOL_F; Oooooor, it seems to me like bpscm_build_bp_list can never return true, so iterate_over_breakpoints will never return a breakpoint. So you could maybe get rid of this "if", that's indeed the case. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/python/py-breakpoint.c File gdb/python/py-breakpoint.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/python/py-breakpoint.c@909 PS2, Line 909: ([&] (breakpoint *bp) { return build_bp_list(bp, list.get ()); }) != NULL) Same comment about formatting as in scm-breakpoint.o, except here the callback function can actually fail (in theory). https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/python/py-finishbreakpoint.c File gdb/python/py-finishbreakpoint.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/python/py-finishbreakpoint.c@386 PS2, Line 386: iterate_over_breakpoints ([&] (breakpoint *bp) { : return bpfinishpy_detect_out_scope_cb : (bp, bs == NULL ? NULL : bs->breakpoint_at); }); I was told before to place the curly braces of the lambda like this, to mimic how we format scopes: iterate_over_breakpoints ([&] (breakpoint *bp) { return bpfinishpy_detect_out_scope_cb (bp, bs == NULL ? NULL : bs->breakpoint_at); }); I'd suggest to use that, I think it's quite readable. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21/2/gdb/python/py-finishbreakpoint.c@399 PS2, Line 399: iterate_over_breakpoints ([&] (breakpoint *bp) { Same. -- To view, visit https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/21 To unsubscribe, or for help writing mail filters, visit https://gnutoolchain-gerrit.osci.io/r/settings