From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7355 invoked by alias); 9 Dec 2016 06:22:42 -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 7268 invoked by uid 89); 9 Dec 2016 06:22:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=H*f:sk:87shpyi, liner, H*f:sk:9abd06e, H*i:sk:9abd06e X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 06:22:31 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1cFEZh-0003Uj-9H from Thomas_Schwinge@mentor.com ; Thu, 08 Dec 2016 22:22:29 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Thu, 8 Dec 2016 22:22:28 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 57C1EC22F1; Thu, 8 Dec 2016 22:22:28 -0800 (PST) From: Thomas Schwinge To: Simon Marchi , CC: Antoine Tremblay , Subject: Re: [PATCH v3 1/2] Emit inferior, thread and frame selection events to all UIs In-Reply-To: <9abd06e0a89f0409f2797c34bd4c08f7@polymtl.ca> References: <20160924201331.23605-1-simon.marchi@polymtl.ca> <87shpyiq8n.fsf@euler.schwinge.homeip.net> <9abd06e0a89f0409f2797c34bd4c08f7@polymtl.ca> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 09 Dec 2016 06:22:00 -0000 Message-ID: <87mvg5ipuo.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-12/txt/msg00220.txt.bz2 Hi! On Thu, 08 Dec 2016 10:25:53 -0500, Simon Marchi = wrote: > On 2016-12-08 07:01, Thomas Schwinge wrote: > > On GNU/Hurd, there is no "#define PATH_MAX", so this fails to build. > > --- gdb/inferior.c > > +++ gdb/inferior.c > > [...] > Yeah it looks much better. Also, if you want to factor out complexity=20 > from this big one liner by using temporary variables, I think it would=20 > improve it further. Pushed to master: commit 53488a6e194af11c2528e5e284facb8a6171b695 Author: Thomas Schwinge Date: Thu Dec 8 18:42:03 2016 +0100 Avoid PATH_MAX usage =20=20=20=20 On GNU/Hurd, there is no "#define PATH_MAX", so this failed to build. =20=20=20=20 gdb/ * inferior.c (print_selected_inferior): Avoid PATH_MAX usage. --- gdb/ChangeLog | 4 ++++ gdb/inferior.c | 15 +++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git gdb/ChangeLog gdb/ChangeLog index 2bd99f1..302eb6e 100644 --- gdb/ChangeLog +++ gdb/ChangeLog @@ -1,3 +1,7 @@ +2016-12-09 Thomas Schwinge + + * inferior.c (print_selected_inferior): Avoid PATH_MAX usage. + 2016-12-08 Simon Marchi Thomas Schwinge =20 diff --git gdb/inferior.c gdb/inferior.c index 9fcdbd3..af6f3af 100644 --- gdb/inferior.c +++ gdb/inferior.c @@ -556,17 +556,12 @@ inferior_pid_to_str (int pid) void print_selected_inferior (struct ui_out *uiout) { - char buf[PATH_MAX + 256]; struct inferior *inf =3D current_inferior (); - - xsnprintf (buf, sizeof (buf), - _("[Switching to inferior %d [%s] (%s)]\n"), - inf->num, - inferior_pid_to_str (inf->pid), - (inf->pspace->pspace_exec_filename !=3D NULL - ? inf->pspace->pspace_exec_filename - : _(""))); - ui_out_text (uiout, buf); + const char *filename =3D inf->pspace->pspace_exec_filename; + if (filename =3D=3D NULL) + filename =3D _(""); + ui_out_message (uiout, _("[Switching to inferior %d [%s] (%s)]\n"), + inf->num, inferior_pid_to_str (inf->pid), filename); } =20 /* Prints the list of inferiors and their details on UIOUT. This is a Gr=C3=BC=C3=9Fe Thomas