Add some debugging printfs to linux-nat.c

Message ID m34mwsv6rd.fsf@sspiff.org
State New, archived
Headers

Commit Message

Doug Evans Aug. 31, 2014, 6:44 p.m. UTC
  Hi.

I found these useful when debugging 17247,17314.

2014-08-31  Doug Evans  <xdje42@gmail.com>

	* linux-nat.c (wait_lwp): Add debugging printf.
	(linux_nat_wait_1): Ditto.
  

Comments

Gary Benson Sept. 1, 2014, 9:03 a.m. UTC | #1
Hi Doug,

Doug Evans wrote:
> I found these useful when debugging 17247,17314.
> 
> 2014-08-31  Doug Evans  <xdje42@gmail.com>
> 
> 	* linux-nat.c (wait_lwp): Add debugging printf.
> 	(linux_nat_wait_1): Ditto.
> 
> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
> index 0898442..557c84b 100644
> --- a/gdb/linux-nat.c
> +++ b/gdb/linux-nat.c
> @@ -2311,6 +2311,8 @@ wait_lwp (struct lwp_info *lp)
>  	 again before it gets to sigsuspend so we can safely let the handlers
>  	 get executed here.  */
>  
> +      if (debug_linux_nat)
> +	fprintf_unfiltered (gdb_stdlog, "WL: about to sigsuspend\n");
>        sigsuspend (&suspend_mask);
>      }
>  
> @@ -3441,6 +3443,8 @@ retry:
>        gdb_assert (lp == NULL);
>  
>        /* Block until we get an event reported with SIGCHLD.  */
> +      if (debug_linux_nat)
> +	fprintf_unfiltered (gdb_stdlog, "LNW: about to sigsuspend\n");
>        sigsuspend (&suspend_mask);
>      }

Please use debug_printf.

Thanks,
Gary
  
Doug Evans Sept. 1, 2014, 5 p.m. UTC | #2
On Mon, Sep 1, 2014 at 2:03 AM, Gary Benson <gbenson@redhat.com> wrote:
> Hi Doug,
>
> Doug Evans wrote:
>> I found these useful when debugging 17247,17314.
>>
>> 2014-08-31  Doug Evans  <xdje42@gmail.com>
>>
>>       * linux-nat.c (wait_lwp): Add debugging printf.
>>       (linux_nat_wait_1): Ditto.
>>
>> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
>> index 0898442..557c84b 100644
>> --- a/gdb/linux-nat.c
>> +++ b/gdb/linux-nat.c
>> @@ -2311,6 +2311,8 @@ wait_lwp (struct lwp_info *lp)
>>        again before it gets to sigsuspend so we can safely let the handlers
>>        get executed here.  */
>>
>> +      if (debug_linux_nat)
>> +     fprintf_unfiltered (gdb_stdlog, "WL: about to sigsuspend\n");
>>        sigsuspend (&suspend_mask);
>>      }
>>
>> @@ -3441,6 +3443,8 @@ retry:
>>        gdb_assert (lp == NULL);
>>
>>        /* Block until we get an event reported with SIGCHLD.  */
>> +      if (debug_linux_nat)
>> +     fprintf_unfiltered (gdb_stdlog, "LNW: about to sigsuspend\n");
>>        sigsuspend (&suspend_mask);
>>      }
>
> Please use debug_printf.

All of linux-nat.c doesn't use debug_printf (nor all of gdb/*.c).
Let's leave that for another patch and be consistent with what's there now.
[I looked for a pending patch to convert gdb/*.c, but couldn't find one,
could have missed it though.]
  
Doug Evans Sept. 13, 2014, 11:04 p.m. UTC | #3
Doug Evans <xdje42@gmail.com> writes:
> Hi.
>
> I found these useful when debugging 17247,17314.
>
> 2014-08-31  Doug Evans  <xdje42@gmail.com>
>
> 	* linux-nat.c (wait_lwp): Add debugging printf.
> 	(linux_nat_wait_1): Ditto.

Committed.
  

Patch

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 0898442..557c84b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2311,6 +2311,8 @@  wait_lwp (struct lwp_info *lp)
 	 again before it gets to sigsuspend so we can safely let the handlers
 	 get executed here.  */
 
+      if (debug_linux_nat)
+	fprintf_unfiltered (gdb_stdlog, "WL: about to sigsuspend\n");
       sigsuspend (&suspend_mask);
     }
 
@@ -3441,6 +3443,8 @@  retry:
       gdb_assert (lp == NULL);
 
       /* Block until we get an event reported with SIGCHLD.  */
+      if (debug_linux_nat)
+	fprintf_unfiltered (gdb_stdlog, "LNW: about to sigsuspend\n");
       sigsuspend (&suspend_mask);
     }