Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <palves@redhat.com>,	Joel Brobecker <brobecker@adacore.com>
Subject: [RFA 3/3] Avoid duplicating text in sol-thread.c:info_cb
Date: Tue, 07 May 2013 12:25:00 -0000	[thread overview]
Message-ID: <1367929532-4849-4-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <518284AF.5090802@redhat.com>

This is a minor cleanup that helps avoiding duplicating the output
of a command when handling alternative situations.

gdb/ChangeLog:

        * sol-thread.c (info_cb): Factorize the code a little.

Same as patch #2, I could probably self-approve, but there could be
merit in the current approach if the output was thought to one day
become different depending on some (future) factors...

---
 gdb/sol-thread.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index fb89723..a17a55b 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1176,12 +1176,10 @@ info_cb (const td_thrhandle_t *th, void *s)
 	  const struct bound_minimal_symbol msym
 	    = lookup_minimal_symbol_by_pc (ti.ti_startfunc);
 
-	  if (msym.minsym)
-	    printf_filtered ("   startfunc=%s",
-			     SYMBOL_PRINT_NAME (msym.minsym));
-	  else
-	    printf_filtered ("   startfunc=%s",
-			     paddress (target_gdbarch (), ti.ti_startfunc));
+	  printf_filtered ("   startfunc=%s",
+			   msym.minsym
+			   ? SYMBOL_PRINT_NAME (msym.minsym)
+			   : paddress (target_gdbarch (), ti.ti_startfunc));
 	}
 
       /* If thread is asleep, print function that went to sleep.  */
@@ -1190,12 +1188,10 @@ info_cb (const td_thrhandle_t *th, void *s)
 	  const struct bound_minimal_symbol msym
 	    = lookup_minimal_symbol_by_pc (ti.ti_pc);
 
-	  if (msym.minsym)
-	    printf_filtered ("   sleepfunc=%s",
-			     SYMBOL_PRINT_NAME (msym.minsym));
-	  else
-	    printf_filtered ("   sleepfunc=%s",
-			     paddress (target_gdbarch (), ti.ti_pc));
+	  printf_filtered ("   sleepfunc=%s",
+			   msym.minsym
+			   ? SYMBOL_PRINT_NAME (msym.minsym)
+			   : paddress (target_gdbarch (), ti.ti_pc));
 	}
 
       printf_filtered ("\n");
-- 
1.7.0.4


  parent reply	other threads:[~2013-05-07 12:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 17:09 FYI: copy/paste error in sol-thread.c ? Joel Brobecker
2013-05-02 15:22 ` Pedro Alves
2013-05-07 12:25   ` [RFA 2/3] Improve output of "maintenance info sol-threads" command Joel Brobecker
2013-05-07 14:26     ` Tom Tromey
2013-05-07 14:35     ` Pedro Alves
2013-05-08  6:27       ` Joel Brobecker
2013-05-08  6:28     ` Checked in: " Joel Brobecker
2013-05-07 12:25   ` Joel Brobecker [this message]
2013-05-07 14:27     ` [RFA 3/3] Avoid duplicating text in sol-thread.c:info_cb Tom Tromey
2013-05-08  6:28     ` Checked in: " Joel Brobecker
2013-05-07 12:25   ` [RFA/commit 1/3] ti.ti_pc vs ti.ti_startfunc copy-pasto " Joel Brobecker
2013-05-07 14:31     ` Pedro Alves
2013-05-08  6:28     ` Checked in: " Joel Brobecker
2013-05-07 12:25   ` FYI: copy/paste error in sol-thread.c ? Joel Brobecker

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=1367929532-4849-4-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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