Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [RFC] Trailing spaces in solaris_pid_to_str
Date: Fri, 01 May 2009 21:32:00 -0000	[thread overview]
Message-ID: <20090501213218.4488B84890@localhost> (raw)

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  <dje@google.com>

	* 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;
 }


             reply	other threads:[~2009-05-01 21:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-01 21:32 Doug Evans [this message]
2009-05-12  9:19 ` Joel Brobecker
2009-05-12  9:39   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090501213218.4488B84890@localhost \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox