From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24253 invoked by alias); 1 May 2009 21:32:29 -0000 Received: (qmail 24243 invoked by uid 22791); 1 May 2009 21:32:28 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 May 2009 21:32:23 +0000 Received: from zps35.corp.google.com (zps35.corp.google.com [172.25.146.35]) by smtp-out.google.com with ESMTP id n41LWJl0008926 for ; Fri, 1 May 2009 22:32:20 +0100 Received: from localhost (ruffy.mtv.corp.google.com [172.18.118.116]) by zps35.corp.google.com with ESMTP id n41LWIGq013317 for ; Fri, 1 May 2009 14:32:18 -0700 Received: by localhost (Postfix, from userid 67641) id 4488B84890; Fri, 1 May 2009 14:32:18 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [RFC] Trailing spaces in solaris_pid_to_str Message-Id: <20090501213218.4488B84890@localhost> Date: Fri, 01 May 2009 21:32:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes 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 X-SW-Source: 2009-05/txt/msg00042.txt.bz2 I can imagine that the trailing spaces are so the output of "info threads" looks pretty, but these trailing spaces would mess up the text when used elsewhere. [Assuming the trailing spaces are indeed for prettier "info threads" ...] If one wants the output of "info threads" to be prettier in this way then it seems like the right thing to do is have the "info threads" printer add the spaces. (a) info threads presumably knows more about how much alignment is needed, and (b) all ports would win. If the spaces are to line these all up: "Thread %ld (defunct)" "Thread %ld (LWP %ld)" "Thread %ld " "LWP %ld " "process %d " they're already in need of some TLC. Doesn't matter to me whether to check this in or not, just thought I'd pass it on. It is odd. Is there another reason for these spaces that I'm missing? [The spaces in "LWP %ld" are to line up the text with "Thread %ld". They don't bother me as much as the trailing spaces so I left them in, but they could just as well be deleted.] 2009-05-01 Doug Evans * sol-thread.c (solaris_pid_to_str): Remove trailing spaces in result. Index: sol-thread.c =================================================================== RCS file: /cvs/src/src/gdb/sol-thread.c,v retrieving revision 1.72 diff -u -p -r1.72 sol-thread.c --- sol-thread.c 23 Feb 2009 00:03:50 -0000 1.72 +++ sol-thread.c 1 May 2009 21:19:50 -0000 @@ -1152,12 +1152,12 @@ solaris_pid_to_str (struct target_ops *o sprintf (buf, "Thread %ld (LWP %ld)", GET_THREAD (ptid), GET_LWP (lwp)); else - sprintf (buf, "Thread %ld ", GET_THREAD (ptid)); + sprintf (buf, "Thread %ld", GET_THREAD (ptid)); } else if (GET_LWP (ptid) != 0) - sprintf (buf, "LWP %ld ", GET_LWP (ptid)); + sprintf (buf, "LWP %ld", GET_LWP (ptid)); else - sprintf (buf, "process %d ", PIDGET (ptid)); + sprintf (buf, "process %d", PIDGET (ptid)); return buf; }