This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: (patch) hpjyg15a, was Re: (patch) hpjyg15: hppah-nat.c & related


Jimmy Guo wrote:
> 
> >I'd prefer the name (target_signal_p()) (Well actually I don't prefer
> >that name but its more consistent with the general naming convetion :-).
> >
> >I'll check in a change to target.[ch] that adds the target_singal_p().
> >Hmm, I might do it slightly differently - were getting too many separate
> >places where there is code like:
> >
> >       #if SIG...
> >          case TARGET_SIGNAL...
> >       #endif
> >
> >With that in, can the hppa-nat.c be re-submitted?  BTW, you might also
> >split it, I think it contains two changes - the code that uses this new
> >function and something else.
> 
> Sure.  Here is the part which makes use of target_signal_p (the
> target.[ch] changes you are making).
> 
> Ignore the hpjyg15 patch, but use this (hpjyg15a), and the sequel I'm
> cooking (hpjug15b).
> 
> ChangeLog:
> 
> 1999-11-08      Jimmy Guo       <guo@cup.hp.com>
> 
>         * hppah-nat.c (require_notification_of_events): start by
>         ignoring all signals and then adding back in ones we're
>         interested in.
> 
>         * infrun.c (handle_command): On HP, call
>           require_notification_of_events to ignore signals we don't
>           care.

FYI,

I've so far checked in the attached.  Hopefully some of the comments
added to remote.c will help.
I'll buck-pass the infrun.c change to Stan.

	Andrew
Mon Nov 22 21:39:27 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* target.c (do_target_signal_to_host): New function.  Indicate of
 	the conversion was successful to the caller via an additional
 	parameter.
	(target_signal_to_host_p): New function. Return non-zero if the
 	GDB signal exists on the host system.
	(target_signal_to_host): Rewrite.  Use do_target_signal_to_host.
	* target.h (target_signal_to_host_p): Add declaration. Document
 	target_singal vs host signal vs target OS signal confusion.
	
	From 1999-11-08 Jimmy Guo <guo@cup.hp.com>:
	* hppah-nat.c (require_notification_of_events): Start by ignoring
 	all signals and then adding back in ones we're interested in.
	
Index: hppah-nat.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/hppah-nat.c,v
retrieving revision 2.30
diff -p -r2.30 hppah-nat.c
*** hppah-nat.c	1999/08/16 20:41:00	2.30
--- hppah-nat.c	1999/11/22 11:18:35
*************** require_notification_of_events (pid)
*** 698,703 ****
--- 698,705 ----
  #if defined(PT_SET_EVENT_MASK)
    int pt_status;
    ptrace_event_t ptrace_events;
+   int nsigs;
+   int signum;
  
    /* Instruct the kernel as to the set of events we wish to be
       informed of.  (This support does not exist before HPUX 10.0.
*************** require_notification_of_events (pid)
*** 709,715 ****
       the kernel to keep certain signals hidden from us, we do it
       by calling sigdelset (ptrace_events.pe_signals, signal) for
       each such signal here, before doing PT_SET_EVENT_MASK.  */
!   sigemptyset (&ptrace_events.pe_signals);
  
    ptrace_events.pe_set_event = 0;
  
--- 711,739 ----
       the kernel to keep certain signals hidden from us, we do it
       by calling sigdelset (ptrace_events.pe_signals, signal) for
       each such signal here, before doing PT_SET_EVENT_MASK.  */
!   /* RM: The above comment is no longer true. We start with ignoring
!      all signals, and then add the ones we are interested in. We could
!      do it the other way: start by looking at all signals and then
!      deleting the ones that we aren't interested in, except that
!      multiple gdb signals may be mapped to the same host signal
!      (eg. TARGET_SIGNAL_IO and TARGET_SIGNAL_POLL both get mapped to
!      signal 22 on HPUX 10.20) We want to be notified if we are
!      interested in either signal.  */
!   sigfillset (&ptrace_events.pe_signals);
! 
!   /* RM: Let's not bother with signals we don't care about */
!   nsigs = (int) TARGET_SIGNAL_LAST;
!   for (signum = nsigs; signum > 0; signum--)
!     {
!       if ((signal_stop_state (signum)) ||
! 	  (signal_print_state (signum)) ||
! 	  (!signal_pass_state (signum)))
! 	{
! 	  if (target_signal_to_host_p (signum))
! 	    sigdelset (&ptrace_events.pe_signals,
! 		       target_signal_to_host (signum));
! 	}
!     }
  
    ptrace_events.pe_set_event = 0;
  
Index: target.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/target.c,v
retrieving revision 1.112
diff -p -r1.112 target.c
*** target.c	1999/11/07 23:28:41	1.112
--- target.c	1999/11/22 11:18:42
*************** target_signal_from_host (hostsig)
*** 1675,1684 ****
    return TARGET_SIGNAL_UNKNOWN;
  }
  
! int
! target_signal_to_host (oursig)
!      enum target_signal oursig;
  {
    switch (oursig)
      {
      case TARGET_SIGNAL_0:
--- 1675,1690 ----
    return TARGET_SIGNAL_UNKNOWN;
  }
  
! /* Convert a OURSIG (an enum target_signal) to the form used by the
!    target operating system (refered to as the ``host'') or zero if the
!    equivalent host signal is not available.  Set/clear OURSIG_OK
!    accordingly. */
! 
! static int
! do_target_signal_to_host (enum target_signal oursig,
! 			  int *oursig_ok)
  {
+   *oursig_ok = 1;
    switch (oursig)
      {
      case TARGET_SIGNAL_0:
*************** target_signal_to_host (oursig)
*** 1913,1924 ****
--- 1919,1952 ----
  	    return retsig;
  	}
  #endif
+       *oursig_ok = 0;
+       return 0;
+     }
+ }
+ 
+ int
+ target_signal_to_host_p (enum target_signal oursig)
+ {
+   int oursig_ok;
+   do_target_signal_to_host (oursig, &oursig_ok);
+   return oursig_ok;
+ }
+ 
+ int
+ target_signal_to_host (enum target_signal oursig)
+ {
+   int oursig_ok;
+   int targ_signo = do_target_signal_to_host (oursig, &oursig_ok);
+   if (!oursig_ok)
+     {
        /* The user might be trying to do "signal SIGSAK" where this system
           doesn't have SIGSAK.  */
        warning ("Signal %s does not exist on this system.\n",
  	       target_signal_to_name (oursig));
        return 0;
      }
+   else
+     return targ_signo;
  }
  
  /* Helper function for child_wait and the Lynx derivatives of child_wait.
Index: target.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/target.h,v
retrieving revision 1.91
diff -p -r1.91 target.h
*** target.h	1999/11/07 23:28:41	1.91
--- target.h	1999/11/22 11:18:44
*************** extern asection *target_memory_bfd_secti
*** 1343,1349 ****
  /* This is for native targets which use a unix/POSIX-style waitstatus.  */
  extern void store_waitstatus PARAMS ((struct target_waitstatus *, int));
  
! /* Convert between host signal numbers and enum target_signal's.  */
  extern enum target_signal target_signal_from_host PARAMS ((int));
  extern int target_signal_to_host PARAMS ((enum target_signal));
  
--- 1343,1365 ----
  /* This is for native targets which use a unix/POSIX-style waitstatus.  */
  extern void store_waitstatus PARAMS ((struct target_waitstatus *, int));
  
! /* Predicate to target_signal_to_host(). Return non-zero if the enum
!    targ_signal SIGNO has an equivalent ``host'' representation. */
! /* FIXME: cagney/1999-11-22: The name below was chosen in preference
!    to the shorter target_signal_p() because it is far less ambigious.
!    In this context ``target_signal'' refers to GDB's internal
!    representation of the target's set of signals while ``host signal''
!    refers to the target operating system's signal.  Confused? */
! extern int target_signal_to_host_p (enum target_signal signo);
! 
! /* Convert between host signal numbers and enum target_signal's.
!    target_signal_to_host() returns 0 and prints a warning() on GDB's
!    console if SIGNO has no equivalent host representation. */
! /* FIXME: cagney/1999-11-22: Here ``host'' is used incorrectly, it is
!    refering to the target operating system's signal numbering.
!    Similarly, ``enum target_signal'' is named incorrectly, ``enum
!    gdb_signal'' would probably be better as it is refering to GDB's
!    internal representation of a target operating system's signal. */
  extern enum target_signal target_signal_from_host PARAMS ((int));
  extern int target_signal_to_host PARAMS ((enum target_signal));
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]