From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115765 invoked by alias); 5 Mar 2020 23:15:58 -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 115609 invoked by uid 89); 5 Mar 2020 23:15:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:788 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Mar 2020 23:15:05 +0000 Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A94CC1E4B2; Thu, 5 Mar 2020 18:15:03 -0500 (EST) Subject: Re: [PATCH] Use std::string for 'psargs'. To: John Baldwin , gdb-patches@sourceware.org References: <20200305230658.89374-1-jhb@FreeBSD.org> From: Simon Marchi Message-ID: <7d74b9b3-6a10-f32c-9bfc-8ed89aa32629@simark.ca> Date: Thu, 05 Mar 2020 23:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200305230658.89374-1-jhb@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-03/txt/msg00136.txt On 2020-03-05 6:06 p.m., John Baldwin wrote: > diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c > index bc1b5afd02..ffffb18700 100644 > --- a/gdb/fbsd-tdep.c > +++ b/gdb/fbsd-tdep.c > @@ -725,14 +725,14 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) > if (get_exec_file (0)) > { > const char *fname = lbasename (get_exec_file (0)); > - char *psargs = xstrdup (fname); > + std::string psargs = fname; > > - if (get_inferior_args ()) > - psargs = reconcat (psargs, psargs, " ", get_inferior_args (), > - (char *) NULL); > + const char *infargs = get_inferior_args (); > + if (infargs != NULL) > + psargs = psargs + " " + infargs; Doesn't really matter, but you could use += here. LGTM in any case, thanks! Simon