From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15603 invoked by alias); 28 Aug 2010 14:05:46 -0000 Received: (qmail 15592 invoked by uid 22791); 28 Aug 2010 14:05:45 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 28 Aug 2010 14:05:40 +0000 Received: (qmail 23307 invoked from network); 28 Aug 2010 14:05:38 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Aug 2010 14:05:38 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [gdbserver/linux] fix debug output being output with debug output disabled Date: Sat, 28 Aug 2010 14:05:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.33-29-realtime; KDE/4.4.2; x86_64; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201008281505.36173.pedro@codesourcery.com> 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: 2010-08/txt/msg00478.txt.bz2 Applied. -- Pedro Alves 2010-08-28 Pedro Alves * linux-low.c (linux_stabilize_threads): Wrap debug output in a debug_threads check. Avoid a linear search when not doing debug output. --- gdb/gdbserver/linux-low.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) Index: src/gdb/gdbserver/linux-low.c =================================================================== --- src.orig/gdb/gdbserver/linux-low.c 2010-08-28 14:37:36.000000000 +0100 +++ src/gdb/gdbserver/linux-low.c 2010-08-28 14:59:30.000000000 +0100 @@ -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)); }