Avoid duplicating text in sol-thread.c:info_cb
authorJoel Brobecker <brobecker@gnat.com>
Wed, 8 May 2013 06:25:21 +0000 (06:25 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 8 May 2013 06:25:21 +0000 (06:25 +0000)
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.

gdb/ChangeLog
gdb/sol-thread.c

index 1b5da8d28e613fa5bddfd10eae526f755a29e488..62cc127e92f29de929c98b973be05fa2f2b72f36 100644 (file)
@@ -1,3 +1,7 @@
+2013-05-08  Joel Brobecker  <brobecker@adacore.com>
+
+       * sol-thread.c (info_cb): Factorize the code a little.
+
 2013-05-08  Joel Brobecker  <brobecker@adacore.com>
 
        * sol-thread.c (info_cb): Rework the output of the "maintenance
index c16ad987056a8ac0c4dee019ecb9aef7060be713..cccb935a4c88da39c817f7e485c181009f217deb 100644 (file)
@@ -1118,12 +1118,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.  */
@@ -1132,12 +1130,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");