* linux-low.c (linux_stabilize_threads): Wrap debug output in a
authorPedro Alves <palves@redhat.com>
Sat, 28 Aug 2010 14:03:27 +0000 (14:03 +0000)
committerPedro Alves <palves@redhat.com>
Sat, 28 Aug 2010 14:03:27 +0000 (14:03 +0000)
debug_threads check.  Avoid a linear search when not doing debug
output.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c

index 6ba13dd49db32e5f314266c24481cd2e1716aabe..fc7bb90982805cb3e343d2e7b52cc18a19b3cd59 100644 (file)
@@ -1,3 +1,9 @@
+2010-08-28  Pedro Alves  <pedro@codesourcery.com>
+
+       * linux-low.c (linux_stabilize_threads): Wrap debug output in a
+       debug_threads check.  Avoid a linear search when not doing debug
+       output.
+
 2010-08-27  Pedro Alves  <pedro@codesourcery.com>
 
        * event-loop.c (event_handle_func): Adjust to use gdb_fildes_t.
index 0f6c543fbbadeb59c18757605f056e76d0c30057..cbcb84024c9b1cf648b3e0d08e690e5f1ebf696a 100644 (file)
@@ -1884,8 +1884,9 @@ linux_stabilize_threads (void)
                                         stuck_in_jump_pad_callback, NULL);
   if (lwp_stuck != NULL)
     {
-      fprintf (stderr, "can't stabilize, LWP %ld is stuck in jump pad\n",
-              lwpid_of (lwp_stuck));
+      if (debug_threads)
+       fprintf (stderr, "can't stabilize, LWP %ld is stuck in jump pad\n",
+                lwpid_of (lwp_stuck));
       return;
     }
 
@@ -1931,12 +1932,12 @@ linux_stabilize_threads (void)
 
   current_inferior = save_inferior;
 
-  lwp_stuck
-    = (struct lwp_info *) find_inferior (&all_lwps,
-                                        stuck_in_jump_pad_callback, NULL);
-  if (lwp_stuck != NULL)
+  if (debug_threads)
     {
-      if (debug_threads)
+      lwp_stuck
+       = (struct lwp_info *) find_inferior (&all_lwps,
+                                        stuck_in_jump_pad_callback, NULL);
+      if (lwp_stuck != NULL)
        fprintf (stderr, "couldn't stabilize, LWP %ld got stuck in jump pad\n",
                 lwpid_of (lwp_stuck));
     }