From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5481 invoked by alias); 30 Sep 2019 14:38:51 -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 5472 invoked by uid 89); 30 Sep 2019 14:38:51 -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: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Sep 2019 14:38:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1569854328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P+LvHvLB3PaMBYsMY7M29xcS4DLEzTu1F6bK+ch0wgI=; b=RKTxN//fqLInbDJttuJiVmYpVrLeoywMMa/3gN/xQT/u0Y1aFvPrfromzpLmMN844ozMks LDHhic2HDMNRkDwqkMuQznWtAizHU6q5ach7gPZ8lMzHNJWivEN1xwC1O6evEjIEor+8UE iKLnwprtcsJag1ilHmCcWcDp0fhRcW4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-2GV2UKevPzGgnZ26HGV6lw-1; Mon, 30 Sep 2019 10:38:47 -0400 Received: by mail-wr1-f72.google.com with SMTP id h6so4596694wrh.6 for ; Mon, 30 Sep 2019 07:38:45 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id b186sm36582210wmd.16.2019.09.30.07.38.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Sep 2019 07:38:44 -0700 (PDT) Subject: Re: [PATCH] Change some arguments to gdb::string_view instead of name+len To: Tom Tromey , Christian Biesinger via gdb-patches References: <20190929053440.144834-1-cbiesinger@google.com> <87zhilamf5.fsf@tromey.com> Cc: Christian Biesinger From: Pedro Alves Message-ID: <3270c053-6981-edc5-e88a-6b836d9f1f24@redhat.com> Date: Mon, 30 Sep 2019 14:38:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <87zhilamf5.fsf@tromey.com> X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-09/txt/msg00613.txt.bz2 On 9/30/19 3:28 PM, Tom Tromey wrote: >>>>>> "Christian" =3D=3D Christian Biesinger via gdb-patches writes: > Christian> if (symtab_create_debug >=3D 2) > Christian> printf_unfiltered ("Recording minsym: %-21s %18s %4d = %s\n", > Christian> - mst_str (ms_type), hex_string (address), secti= on, name); > Christian> + mst_str (ms_type), hex_string (address), secti= on, > Christian> + name.data ()); >=20 > This part made me hesitate a bit, because it seems to be at odds with > the idea that an arbitrary string view can be passed in -- for all we > know the string isn't \0-terminated, and this will cause bad behavior. >=20 > On the other hand, this error already existed, and is only used for > logging. >=20 > Maybe safest is just to transform it to a std::string here? Or=20 "%.*s", name.size (), name.data () Thanks, Pedro Alves