From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71252 invoked by alias); 25 Oct 2019 17:55:15 -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 71244 invoked by uid 89); 25 Oct 2019 17:55:14 -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= 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; Fri, 25 Oct 2019 17:55:13 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 967E120B46; Fri, 25 Oct 2019 13:55:11 -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 6F70620E5F; Fri, 25 Oct 2019 13:55:10 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 58ECD204C9; Fri, 25 Oct 2019 13:55:10 -0400 (EDT) X-Gerrit-PatchSet: 4 Date: Fri, 25 Oct 2019 17:55:00 -0000 From: "Tom Tromey (Code Review)" To: Christian Biesinger , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review v4] Change some arguments to gdb::string_view instead of name+len X-Gerrit-Change-Id: I2675c6865e0368f9c755a1081088a53aa54dda4c X-Gerrit-Change-Number: 125 X-Gerrit-ChangeURL: X-Gerrit-Commit: f7b79967f3c89a1d04f489f7acff374c9a62eb1c In-Reply-To: References: X-Gerrit-Comment-Date: Fri, 25 Oct 2019 13:55:10 -0400 Reply-To: gnutoolchain-gerrit@osci.io 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: <20191025175510.58ECD204C9@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-10/txt/msg00923.txt.bz2 Tom Tromey has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/125 ...................................................................... Patch Set 4: (1 comment) Thank you for the patch. I'm sorry about the delay on this. I agree with Pedro when he wrote: > My feeling is that one of the points of vocabulary types like string_view is > that you replace documentation with rules or contracts enforced by, or > encoded in the types. To me, it feels like a bit of a hack or design issue that > we switch to string_view while at the same time, find that we need to step > outside its contract. This particular bit of code (I added a comment below for those reading along) has always been a bit fishy. It's an attempt to micro-optimize in a maybe unusual case. I think it would be better to just drop this little optimization in favor of copying here. Perhaps in conjunction with your other patches, this won't even be a bit hit. https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/125/4/gdb/symtab.c File gdb/symtab.c: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/125/4/gdb/symtab.c@858 PS4, Line 858: /* Don't use string_view::operator[] because we are accessing beyond : the size of the string_view, which is technically unsupported. */ : if (l This is the problem spot. -- Gerrit-Project: binutils-gdb Gerrit-Branch: master Gerrit-Change-Id: I2675c6865e0368f9c755a1081088a53aa54dda4c Gerrit-Change-Number: 125 Gerrit-PatchSet: 4 Gerrit-Owner: Christian Biesinger Gerrit-Reviewer: Christian Biesinger Gerrit-Reviewer: Tom Tromey Gerrit-Comment-Date: Fri, 25 Oct 2019 17:55:10 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment