Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Cc: cagney@cygnus.com, kevinb@cygnus.com, kettenis@wins.uva.nl
Subject: [rfa] Printf debugging output in lin-lwp.c
Date: Mon, 30 Apr 2001 11:34:00 -0000	[thread overview]
Message-ID: <3AEDAF16.8D27C455@cygnus.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7829 bytes --]

Mark, how about this?
2001-04-30  Michael Snyder  <msnyder@redhat.com>

	* thread-db.c: Revert 2001-04-26 change for debugging output.
	* lin-lwp.c:   Ditto.
	* lin-lwp.c:   Add set/show debug lin-lwp command.  Use this
	command to turn extra debugging output on / off.
	
Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 lin-lwp.c
*** lin-lwp.c	2001/04/30 18:21:17	1.11
--- lin-lwp.c	2001/04/30 18:26:45
***************
*** 30,41 ****
  #include "inferior.h"
  #include "target.h"
  #include "regcache.h"
  
! #define DEBUG 1
! 
! #if DEBUG
  extern const char *strsignal (int sig);
- #endif
  
  /* On Linux there are no real LWP's.  The closest thing to LWP's are
     processes sharing the same VM space.  A multi-threaded process is
--- 30,39 ----
  #include "inferior.h"
  #include "target.h"
  #include "regcache.h"
+ #include "gdbcmd.h"
  
! static int debug_lin_lwp;
  extern const char *strsignal (int sig);
  
  /* On Linux there are no real LWP's.  The closest thing to LWP's are
     processes sharing the same VM space.  A multi-threaded process is
*************** stop_wait_callback (struct lwp_info *lp,
*** 521,529 ****
  	      printf_unfiltered ("[%s exited]\n",
  				 target_pid_to_str (lp->pid));
  	    }
! #if DEBUG
! 	  printf ("%s exited.\n", target_pid_to_str (lp->pid));
! #endif
  	  delete_lwp (lp->pid);
  	  return 0;
  	}
--- 519,527 ----
  	      printf_unfiltered ("[%s exited]\n",
  				 target_pid_to_str (lp->pid));
  	    }
! 	  if (debug_lin_lwp)
! 	    printf ("%s exited.\n", target_pid_to_str (lp->pid));
! 
  	  delete_lwp (lp->pid);
  	  return 0;
  	}
*************** stop_wait_callback (struct lwp_info *lp,
*** 549,569 ****
  		 If we do not do this, then we run the risk that the
  		 user will delete or disable the breakpoint, but the
  		 thread will have already tripped on it.  */
! #if DEBUG
! 	      printf ("Tripped breakpoint at %lx in LWP %d"
! 		      " while waiting for SIGSTOP.\n",
! 		      (long) read_pc_pid (lp->pid), pid);
! #endif
  	      /* Set the PC to before the trap.  */
  	      if (DECR_PC_AFTER_BREAK)
  		write_pc_pid (read_pc_pid (pid) - DECR_PC_AFTER_BREAK, pid);
  	    }
  	  else
  	    {
! #if DEBUG
! 	      printf ("Received %s in LWP %d while waiting for SIGSTOP.\n",
! 		      strsignal (WSTOPSIG (status)), pid);
! #endif
  	      /* The thread was stopped with a signal other than
  		 SIGSTOP, and didn't accidentiliy trip a breakpoint.
  		 Record the wait status.  */
--- 547,568 ----
  		 If we do not do this, then we run the risk that the
  		 user will delete or disable the breakpoint, but the
  		 thread will have already tripped on it.  */
! 
! 	      if (debug_lin_lwp)
! 		printf ("Tripped breakpoint at %lx in LWP %d"
! 			" while waiting for SIGSTOP.\n",
! 			(long) read_pc_pid (lp->pid), pid);
! 
  	      /* Set the PC to before the trap.  */
  	      if (DECR_PC_AFTER_BREAK)
  		write_pc_pid (read_pc_pid (pid) - DECR_PC_AFTER_BREAK, pid);
  	    }
  	  else
  	    {
! 	      if (debug_lin_lwp)
! 		printf ("Received %s in LWP %d while waiting for SIGSTOP.\n",
! 			strsignal (WSTOPSIG (status)), pid);
! 
  	      /* The thread was stopped with a signal other than
  		 SIGSTOP, and didn't accidentiliy trip a breakpoint.
  		 Record the wait status.  */
*************** lin_lwp_wait (int pid, struct target_wai
*** 620,629 ****
        lp = iterate_over_lwps (status_callback, NULL);
        if (lp)
  	{
! #if DEBUG
! 	  printf ("Using pending wait status for LWP %d.\n",
! 		  GET_LWP (lp->pid));
! #endif
  	  status = lp->status;
  	  lp->status = 0;
  	}
--- 619,628 ----
        lp = iterate_over_lwps (status_callback, NULL);
        if (lp)
  	{
! 	  if (debug_lin_lwp)
! 	    printf ("Using pending wait status for LWP %d.\n",
! 		    GET_LWP (lp->pid));
! 
  	  status = lp->status;
  	  lp->status = 0;
  	}
*************** lin_lwp_wait (int pid, struct target_wai
*** 635,653 ****
      }
    else if (is_lwp (pid))
      {
! #if DEBUG
!       printf ("Waiting for specific LWP %d.\n", GET_LWP (pid));
! #endif
        /* We have a specific LWP to check.  */
        lp = find_lwp_pid (GET_LWP (pid));
        gdb_assert (lp);
        status = lp->status;
        lp->status = 0;
! #if DEBUG
!       if (status)
  	  printf ("Using pending wait status for LWP %d.\n",
  		  GET_LWP (lp->pid));
- #endif
  
        /* If we have to wait, take into account whether PID is a cloned
           process or not.  And we have to convert it to something that
--- 634,652 ----
      }
    else if (is_lwp (pid))
      {
!       if (debug_lin_lwp)
! 	printf ("Waiting for specific LWP %d.\n", GET_LWP (pid));
! 
        /* We have a specific LWP to check.  */
        lp = find_lwp_pid (GET_LWP (pid));
        gdb_assert (lp);
        status = lp->status;
        lp->status = 0;
! 
!       if (debug_lin_lwp)
! 	if (status)
  	  printf ("Using pending wait status for LWP %d.\n",
  		  GET_LWP (lp->pid));
  
        /* If we have to wait, take into account whether PID is a cloned
           process or not.  And we have to convert it to something that
*************** lin_lwp_wait (int pid, struct target_wai
*** 725,733 ****
  		  printf_unfiltered ("[%s exited]\n",
  				     target_pid_to_str (lp->pid));
  		}
! #if DEBUG
! 	      printf ("%s exited.\n", target_pid_to_str (lp->pid));
! #endif
  	      delete_lwp (lp->pid);
  
  	      /* Make sure there is at least one thread running.  */
--- 724,732 ----
  		  printf_unfiltered ("[%s exited]\n",
  				     target_pid_to_str (lp->pid));
  		}
! 	      if (debug_lin_lwp)
! 		printf ("%s exited.\n", target_pid_to_str (lp->pid));
! 
  	      delete_lwp (lp->pid);
  
  	      /* Make sure there is at least one thread running.  */
*************** lin_lwp_wait (int pid, struct target_wai
*** 743,752 ****
  	  if (lp->signalled && WIFSTOPPED (status)
  	      && WSTOPSIG (status) == SIGSTOP)
  	    {
! #if DEBUG
! 	      printf ("Delayed SIGSTOP caught for %s.\n",
! 		      target_pid_to_str (lp->pid));
! #endif
  	      /* This is a delayed SIGSTOP.  */
  	      lp->signalled = 0;
  
--- 742,751 ----
  	  if (lp->signalled && WIFSTOPPED (status)
  	      && WSTOPSIG (status) == SIGSTOP)
  	    {
! 	      if (debug_lin_lwp)
! 		printf ("Delayed SIGSTOP caught for %s.\n",
! 			target_pid_to_str (lp->pid));
! 
  	      /* This is a delayed SIGSTOP.  */
  	      lp->signalled = 0;
  
*************** _initialize_lin_lwp (void)
*** 1040,1045 ****
--- 1039,1051 ----
    sigdelset (&suspend_mask, SIGCHLD);
  
    sigemptyset (&blocked_mask);
+ 
+   add_show_from_set (add_set_cmd ("lin-lwp", no_class, var_zinteger,
+ 				  (char *) &debug_lin_lwp, 
+ 				  "Set debugging of linux lwp module.\n\
+ Enables printf debugging output.\n",
+ 				      &setdebuglist),
+ 		     &showdebuglist);
  }
  \f
  
From beambro@marioworld.com Mon Apr 30 11:34:00 2001
From: "ªü±l"<beambro@marioworld.com>
To: "" <gdb-patches@sources.redhat.com>
Subject: ¾Ç©f³Q....XXX...
Date: Mon, 30 Apr 2001 11:34:00 -0000
Message-id: <9a6fba934031bc7730ae85c4171accde@NO-ID-FOUND.mhonarc.org>
X-SW-Source: 2001-04/msg00282.html
Content-length: 353

Às­ô,
¤µ¦~¯uªº¤£¦n¹L,§Ú¤w¸g´«¤FN­Ó¤u§@..
§@«á¤½¥q¤S­Ë³¬¤F...³o¤@®a¤½¥qÆZ¦nª±ªº..
§Ú¦b¬ü°ê¦³¸òElena¤@°_ª±¹L....¥xÆW¤]¯u¥ý¶i..
§A¦n¦n¬Ý¬Ý..§Ú­Ì¤]¥i¥H¶}¤@¶¡......
--------«ö¤U­±ªº³s
µ²-------------

©P¬ü¶³.......
p.s. ¬P´Á¤» Friday's ¨£­±!!



             reply	other threads:[~2001-04-30 11:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-30 11:34 Michael Snyder [this message]
2001-04-30 12:06 ` Mark Kettenis
2001-04-30 18:14 ` Andrew Cagney
2001-05-01 13:38   ` [patch] change printf to fprintf_unfiltered Michael Snyder

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=3AEDAF16.8D27C455@cygnus.com \
    --to=msnyder@cygnus.com \
    --cc=cagney@cygnus.com \
    --cc=gdb-patches@sourceware.cygnus.com \
    --cc=kettenis@wins.uva.nl \
    --cc=kevinb@cygnus.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