From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126575 invoked by alias); 5 Mar 2020 23:58:29 -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 125114 invoked by uid 89); 5 Mar 2020 23:58:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx2.freebsd.org Received: from mx2.freebsd.org (HELO mx2.freebsd.org) (96.47.72.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Mar 2020 23:58:28 +0000 Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 74D5CA6C6A; Thu, 5 Mar 2020 23:58:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48YSPY6TDcz471Y; Thu, 5 Mar 2020 23:58:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-7.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 6E0BF30F8; Thu, 5 Mar 2020 23:58:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [PATCH] Use std::string for 'psargs'. To: Simon Marchi , gdb-patches@sourceware.org References: <20200305230658.89374-1-jhb@FreeBSD.org> <7d74b9b3-6a10-f32c-9bfc-8ed89aa32629@simark.ca> From: John Baldwin Message-ID: <32c487ea-717e-8b34-d198-3d8c6c4ec604@FreeBSD.org> Date: Thu, 05 Mar 2020 23:58:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <7d74b9b3-6a10-f32c-9bfc-8ed89aa32629@simark.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-03/txt/msg00138.txt On 3/5/20 3:15 PM, Simon Marchi wrote: > 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. I almost did, but based this on the similar code in linux-tdep.c and went with consistency. -- John Baldwin