Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@cygnus.com>
To: Jim Kingdon <kingdon@redhat.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Make threads architecture-independent on Linux
Date: Fri, 19 Nov 1999 13:35:00 -0000	[thread overview]
Message-ID: <npvh6y4134.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <199911121858.NAA29893@devserv.devel.redhat.com>

This patch is turning out to be quite helpful for us.  Thanks!

Shouldn't gdb/config/sparc/nm-linux.h #include "nm-linux.h", too?  If
it does, can't we delete the #inclusion of solib.h?

Also, we don't need to test __STDC__, as config/nm-linux.h does.  GDB
only compiles under ANSI C now.  Besides, Linux has only ever had ANSI
C compilers.  :)


> 1999-11-08  Jim Kingdon  < http://developer.redhat.com/ >
> 
> 	Enable threads for all linux architectures:
> 	* config/nm-linux.h: New file.
> 	* config/{alpha,i386,m68k,sparc}/nm-linux.h: Use it.
> 	* config/tm-linux.h: New file.
> 	* config/{i386,m68k,sparc}/tm-linux.h,
> 	config/alpha/tm-alphalinux.h: Use it.
> 	* config/{m68k,sparc}/linux.mh, config/alpha/alpha-linux.mh:
> 	Add linux-thread.o.
> 
> --- /dev/null   Tue May  5 16:32:27 1998
> +++ gdb/config/nm-linux.h       Mon Nov  1 15:33:51 1999
> @@ -0,0 +1,52 @@
> +/* Native support for GNU/Linux, for GDB, the GNU debugger.
> +   Copyright (C) 1999
> +   Free Software Foundation, Inc.
> +
> +   This file is part of GDB.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 2 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program; if not, write to the Free Software
> +   Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +/* Linux is svr4ish but not that much */
> +#undef USE_PROC_FS
> +
> +/* Tell gdb that we can attach and detach other processes */
> +#define ATTACH_DETACH
> +
> +/* We define this if link.h is available, because with ELF we use SVR4 style
> +   shared libraries. */
> +
> +#ifdef HAVE_LINK_H
> +#define SVR4_SHARED_LIBS
> +#include "solib.h"             /* Support for shared libraries. */
> +#endif
> +
> +/* Support for the glibc linuxthreads package. */
> +
> +#ifdef __STDC__
> +struct objfile;
> +#endif
> +
> +extern void
> +linuxthreads_new_objfile PARAMS ((struct objfile *objfile));
> +#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE)
> +
> +extern char *
> +linuxthreads_pid_to_str PARAMS ((int pid));
> +#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID)
> +
> +extern int
> +linuxthreads_prepare_to_proceed PARAMS ((int step));
> +#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1)
> Index: gdb/config/alpha/nm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/alpha/nm-linux.h,v
> retrieving revision 1.1.1.3
> diff -u -r1.1.1.3 nm-linux.h
> --- gdb/config/alpha/nm-linux.h  1999/07/07 20:11:53     1.1.1.3
> +++ gdb/config/alpha/nm-linux.h  1999/11/08 23:09:59
> @@ -18,6 +18,8 @@
>     Foundation, Inc., 59 Temple Place - Suite 330,
>     Boston, MA 02111-1307, USA.  */
>  
> +#include "nm-linux.h"
> +
>  /* Figure out where the longjmp will land.  We expect that we have just entered
>     longjmp and haven't yet setup the stack frame, so the args are still in the
>     argument regs.  A0_REGNUM points at the jmp_buf structure from which we
> @@ -28,13 +30,12 @@
>  extern int
>  get_longjmp_target PARAMS ((CORE_ADDR *));
>  
> -/* Tell gdb that we can attach and detach other processes */
> -#define ATTACH_DETACH
> -
>  /* ptrace register ``addresses'' are absolute.  */
>  
>  #define U_REGS_OFFSET 0
>  
> +/* FIXME: This is probably true, or should be, on all Linux ports.
> +   IA64?  Sparc64?  */
>  #define PTRACE_ARG3_TYPE long
>  
>  /* ptrace transfers longs, the ptrace man page is lying.  */
> @@ -51,10 +52,7 @@
>  
>  /* Support for shared libraries.  */
>  
> -#include "solib.h"
> -
>  #ifdef __ELF__
> -#define SVR4_SHARED_LIBS
>  #define TARGET_ELF64
>  #endif
>  
> @@ -65,3 +63,4 @@
>  /* Given a pointer to either a gregset_t or fpregset_t, return a
>     pointer to the first register.  */
>  #define ALPHA_REGSET_BASE(regsetp)  ((long *) (regsetp))
> +
> Index: gdb/config/i386/nm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/i386/nm-linux.h,v
> retrieving revision 1.1.1.3
> diff -u -r1.1.1.3 nm-linux.h
> --- gdb/config/i386/nm-linux.h  1999/09/08 23:59:52     1.1.1.3
> +++ gdb/config/i386/nm-linux.h  1999/11/08 23:09:59
> @@ -23,14 +23,12 @@
>  #define NM_LINUX_H
>  
>  #include "i386/nm-i386v.h"
> +#include "nm-linux.h"
>  
>  /* Return sizeof user struct to callers in less machine dependent routines */
>  
>  #define KERNEL_U_SIZE kernel_u_size()
>  extern int kernel_u_size PARAMS ((void));
> -
> -/* Tell gdb that we can attach and detach other processes */
> -#define ATTACH_DETACH
>  
>  #define U_REGS_OFFSET 0
>  
> Index: gdb/config/m68k/nm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/m68k/nm-linux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 nm-linux.h
> --- gdb/config/m68k/nm-linux.h  1999/07/07 20:14:04     1.1.1.2
> +++ gdb/config/m68k/nm-linux.h  1999/11/08 23:10:00
> @@ -21,23 +21,14 @@
>  #ifndef NM_LINUX_H
>  #define NM_LINUX_H
>  
> +#include "nm-linux.h"
> +
>  /* Return sizeof user struct to callers in less machine dependent routines */
>  
>  #define KERNEL_U_SIZE kernel_u_size()
>  extern int kernel_u_size PARAMS ((void));
>  
> -/* Tell gdb that we can attach and detach other processes */
> -#define ATTACH_DETACH
> -
>  #define U_REGS_OFFSET 0
> -
> -/* We define this if link.h is available, because with ELF we use SVR4 style
> -   shared libraries. */
> -
> -#ifdef HAVE_LINK_H
> -#define SVR4_SHARED_LIBS
> -#include "solib.h"		/* Support for shared libraries. */
> -#endif
>  
>  #define REGISTER_U_ADDR(addr, blockend, regno) \
>  	(addr) = m68k_linux_register_u_addr ((blockend),(regno));
> Index: gdb/config/sparc/nm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/sparc/nm-linux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 nm-linux.h
> --- gdb/config/sparc/nm-linux.h  1999/07/07 20:17:01     1.1.1.2
> +++ gdb/config/sparc/nm-linux.h  1999/11/08 23:10:00
> @@ -27,6 +27,3 @@
>  
>  #define KERNEL_U_SIZE kernel_u_size()
>  extern int kernel_u_size PARAMS ((void));
> -
> -/* Linux is svr4ish but not that much */
> -#undef USE_PROC_FS
> 
> 
> Index: sparc/tm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/sparc/tm-linux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 tm-linux.h
> --- tm-linux.h	1999/07/07 20:17:06	1.1.1.2
> +++ gdb/config/sparc/tm-linux.h	1999/11/12 13:35:58
> @@ -25,6 +25,6 @@
>  
>  #define SIGCONTEXT_PC_OFFSET 12
>  
> -#include "tm-sysv4.h"
> +#include "tm-linux.h"
>  
>  #endif /* TM_SPARCLINUX_H */
> Index: m68k/tm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/m68k/tm-linux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 tm-linux.h
> --- tm-linux.h	1999/07/07 20:14:22	1.1.1.2
> +++ gdb/config/m68k/tm-linux.h	1999/11/12 13:36:01
> @@ -72,7 +72,7 @@
>      }									\
>  }
>  
> -#include "tm-sysv4.h"
> +#include "tm-linux.h"
>  #include "m68k/tm-m68k.h"
>  
>  /* Extract from an array REGBUF containing the (raw) register state
> Index: i386/tm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/i386/tm-linux.h,v
> retrieving revision 1.1.1.7
> diff -u -r1.1.1.7 tm-linux.h
> --- tm-linux.h	1999/11/02 04:44:22	1.1.1.7
> +++ gdb/config/i386/tm-linux.h	1999/11/12 13:36:03
> @@ -28,6 +28,7 @@
>  #endif
>  
>  #include "i386/tm-i386.h"
> +#include "tm-linux.h"
>  
>  /* Size of sigcontext, from <asm/sigcontext.h>.  */
>  #define LINUX_SIGCONTEXT_SIZE (88)
> @@ -38,10 +39,6 @@
>  /* Offset to saved SP in sigcontext, from <asm/sigcontext.h>.  */
>  #define LINUX_SIGCONTEXT_SP_OFFSET (28)
>  
> -/* We need this file for the SOLIB_TRAMPOLINE stuff. */
> -
> -#include "tm-sysv4.h"
> -
>  #define LOW_RETURN_REGNUM 0	/* holds low four bytes of result */
>  #define HIGH_RETURN_REGNUM 2	/* holds high four bytes of result */
>  
> @@ -166,18 +163,6 @@
>        : read_memory_integer ((FRAME)->frame + 4, 4)))
>  
>  extern CORE_ADDR i386_linux_sigtramp_saved_sp PARAMS ((struct frame_info *));
> -
> -/* Some versions of Linux have real-time signal support in the C library, and
> -   some don't.  We have to include this file to find out.  */
> -#include <signal.h>
> -
> -#ifdef __SIGRTMIN
> -#define REALTIME_LO __SIGRTMIN
> -#define REALTIME_HI (__SIGRTMAX + 1)
> -#else
> -#define REALTIME_LO 32
> -#define REALTIME_HI 64
> -#endif
>  
>  /* When we call a function in a shared library, and the PLT sends us
>     into the dynamic linker to find the function's real address, we
> Index: alpha/tm-alphalinux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/alpha/tm-alphalinux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 tm-alphalinux.h
> --- tm-alphalinux.h	1999/07/07 20:11:59	1.1.1.2
> +++ gdb/config/alpha/tm-alphalinux.h	1999/11/12 13:36:05
> @@ -75,7 +75,6 @@
>  #undef FRAME_PAST_SIGTRAMP_FRAME
>  #define FRAME_PAST_SIGTRAMP_FRAME(frame, pc)	(0)
>  
> -/* We need this for the SOLIB_TRAMPOLINE stuff.  */
> -#include "tm-sysv4.h"
> +#include "tm-linux.h"
>  
>  #endif /* TM_LINUXALPHA_H */
> --- /dev/null	Tue May  5 16:32:27 1998
> +++ gdb/config/tm-linux.h	Thu Nov 11 21:51:21 1999
> @@ -0,0 +1,36 @@
> +/* Native support for GNU/Linux, for GDB, the GNU debugger.
> +   Copyright (C) 1999
> +   Free Software Foundation, Inc.
> +
> +   This file is part of GDB.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 2 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program; if not, write to the Free Software
> +   Foundation, Inc., 59 Temple Place - Suite 330,
> +   Boston, MA 02111-1307, USA.  */
> +
> +/* Some versions of Linux have real-time signal support in the C library, and
> +   some don't.  We have to include this file to find out.  */
> +#include <signal.h>
> +
> +#ifdef __SIGRTMIN
> +#define REALTIME_LO __SIGRTMIN
> +#define REALTIME_HI (__SIGRTMAX + 1)
> +#else
> +#define REALTIME_LO 32
> +#define REALTIME_HI 64
> +#endif
> +
> +/* We need this file for the SOLIB_TRAMPOLINE stuff. */
> +
> +#include "tm-sysv4.h"
> Index: gdb/config/alpha/alpha-linux.mh
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/alpha/alpha-linux.mh,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 alpha-linux.mh
> --- alpha-linux.mh	1999/04/16 01:34:14	1.1.1.1
> +++ gdb/config/alpha/alpha-linux.mh	1999/11/12 17:54:12
> @@ -3,7 +3,7 @@
>  XM_FILE= xm-alphalinux.h
>  NAT_FILE= nm-linux.h
>  NATDEPFILES= infptrace.o inftarg.o corelow.o core-regset.o alpha-nat.o \
> -	fork-child.o solib.o
> +	fork-child.o solib.o linux-thread.o
>  
>  MMALLOC = 
>  MMALLOC_CFLAGS = -DNO_MMALLOC 
> Index: gdb/config/sparc/linux.mh
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/sparc/linux.mh,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 linux.mh
> --- linux.mh	1999/04/16 01:34:25	1.1.1.1
> +++ gdb/config/sparc/linux.mh	1999/11/12 17:54:12
> @@ -2,6 +2,7 @@
>  XDEPFILES= ser-tcp.o
>  XM_FILE= xm-linux.h
>  NAT_FILE= nm-linux.h
> -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
> +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
> +	linux-thread.o
>  HOST_IPC=-DBSD_IPC
>  GDBSERVER_DEPFILES= low-sparc.o
> Index: gdb/config/m68k/linux.mh
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/m68k/linux.mh,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 linux.mh
> --- linux.mh	1999/04/16 01:34:21	1.1.1.1
> +++ gdb/config/m68k/linux.mh	1999/11/12 17:54:12
> @@ -4,6 +4,7 @@
>  XDEPFILES= ser-tcp.o
>  
>  NAT_FILE= nm-linux.h
> -NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o m68klinux-nat.o
> +NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o \
> +	corelow.o core-aout.o core-regset.o m68klinux-nat.o linux-thread.o
>  
>  GDBSERVER_DEPFILES= low-linux.o
> 
From ac131313@cygnus.com Mon Nov 22 01:32:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: FYI: strdup() -> xstrdup()
Date: Mon, 22 Nov 1999 01:32:00 -0000
Message-id: <38390D9A.3BA4969F@cygnus.com>
X-SW-Source: 1999-q4/msg00304.html
Content-length: 638

Just FYI,

I've checked in a patch with the ChangeLog entry:

Thu Nov 18 18:12:48 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* jv-typeprint.c (java_type_print_base), kod-cisco.c
 	(cisco_kod_open), kod.c (kod_set_os), xcoffread.c
 	(process_linenos), symfile.c (add_symbol_file_command),
 	remote-rdi.c (arm_rdi_open, rdilogfile_command), main.c
 	(captured_main), go32-nat.c (go32_create_inferior), exec.c
 	(exec_file_attach), corefile.c (core_file_command,
 	reopen_exec_file): Replace strdup with xstrdup.

None of the calls to strdup() were being checked.  At least this gets
GDB to attempt a clean shutdown :-)

	enjoy,
		Andrew
From jakub@redhat.com Mon Nov 22 02:58:00 1999
From: Jakub Jelinek <jakub@redhat.com>
To: kingdon@redhat.com, "David S. Miller" <davem@redhat.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] gdb 4.18 fix for disassembly
Date: Mon, 22 Nov 1999 02:58:00 -0000
Message-id: <19991122115929.C515@mff.cuni.cz>
X-SW-Source: 1999-q4/msg00305.html
Content-length: 1341

Hi!

gdb we shipped does not disassemble correctly instructions outside of the v8
ISA (e.g. v8plus, v8plusa).
This patch fixes it. In cvs gdb this code changed again so it might well
work just fine, haven't checked yet.

1999-11-22  Jakub Jelinek  <jakub@redhat.com>

	* sparc-tdep.c (_initialize_sparc_tdep): Don't force machine to the
	compiled-in default unless it is sparclite or sparclet - otherwise
	gdb messes up disassembly of any architecture higher than
	bfd_mach_sparc.

--- gdb/sparc-tdep.c.jj	Mon Dec 14 00:28:45 1998
+++ gdb/sparc-tdep.c	Mon Nov 22 11:40:11 1999
@@ -1929,7 +1929,11 @@ sparc_target_architecture_hook (ap)
 void
 _initialize_sparc_tdep ()
 {
-  tm_print_insn = gdb_print_insn_sparc;
+  if (TM_PRINT_INSN_MACH == bfd_mach_sparc_sparclite
+      || TM_PRINT_INSN_MACH == bfd_mach_sparc_sparclet)
+    tm_print_insn = gdb_print_insn_sparc;
+  else
+    tm_print_insn = print_insn_sparc;
   tm_print_insn_info.mach = TM_PRINT_INSN_MACH;  /* Selects sparc/sparclite */
   target_architecture_hook = sparc_target_architecture_hook;
 }

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.18 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
From ac131313@cygnus.com Mon Nov 22 03:41:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg15a, was Re: (patch) hpjyg15: hppah-nat.c & related
Date: Mon, 22 Nov 1999 03:41:00 -0000
Message-id: <38392AEC.CD29960D@cygnus.com>
References: <Pine.LNX.4.10.9911111640190.6426-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00306.html
Content-length: 8196

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));
  
From ac131313@cygnus.com Mon Nov 22 03:42:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: Stan Shebs <shebs@cygnus.com>
Cc: Jimmy Guo <guo@cup.hp.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg15a, was Re: (patch) hpjyg15: hppah-nat.c & related
Date: Mon, 22 Nov 1999 03:42:00 -0000
Message-id: <38392B57.B3395317@cygnus.com>
References: <Pine.LNX.4.10.9911111640190.6426-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00307.html
Content-length: 1698

Stan,

Here is the infrun.c part of HP's patch 15.

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>
> 
>         * infrun.c (handle_command): On HP, call
>           require_notification_of_events to ignore signals we don't
>           care.
> 
> Index: gdb/infrun.c
> /opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/infrun.c gdb/infrun.c
> *** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/infrun.c    Fri Nov  5 18:37:38 1999
> --- gdb/infrun.c        Fri Nov  5 18:38:41 1999
> ***************
> *** 3621,3626 ****
> --- 3621,3633 ----
>         }
>       }
> 
> +
> + #ifdef GDB_TARGET_IS_HPPA
> +   /* RM: Use OS interface to ignore signals we don't care about */
> +   if (target_has_execution)
> +     require_notification_of_events (inferior_pid);
> + #endif
> +
>     do_cleanups (old_chain);
>   }
> 

	Andrew
From shebs@cygnus.com Mon Nov 22 13:40:00 1999
From: Stan Shebs <shebs@cygnus.com>
To: cagney@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: FYI: strdup() -> xstrdup()
Date: Mon, 22 Nov 1999 13:40:00 -0000
Message-id: <199911222140.NAA24525@andros.cygnus.com>
References: <38390D9A.3BA4969F@cygnus.com>
X-SW-Source: 1999-q4/msg00308.html
Content-length: 932

   Date: Mon, 22 Nov 1999 20:32:10 +1100
   From: Andrew Cagney <ac131313@cygnus.com>

   I've checked in a patch with the ChangeLog entry:

   Thu Nov 18 18:12:48 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	   * jv-typeprint.c (java_type_print_base), kod-cisco.c
	   (cisco_kod_open), kod.c (kod_set_os), xcoffread.c
	   (process_linenos), symfile.c (add_symbol_file_command),
	   remote-rdi.c (arm_rdi_open, rdilogfile_command), main.c
	   (captured_main), go32-nat.c (go32_create_inferior), exec.c
	   (exec_file_attach), corefile.c (core_file_command,
	   reopen_exec_file): Replace strdup with xstrdup.

   None of the calls to strdup() were being checked.  At least this gets
   GDB to attempt a clean shutdown :-)

Good stuff!  Could you perhaps add a note to the internals manual?  Strdup
is a standard function, and a year from now somebody will forget about
xstrdup and use the standard function instead.

								Stan


  reply	other threads:[~1999-11-19 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19991110234852.420C61B493@ocean.lucon.org>
1999-11-12 10:58 ` Jim Kingdon
1999-11-19 13:35   ` Jim Blandy [this message]
     [not found] <19991108233623.805581B493@ocean.lucon.org>
1999-11-10 13:38 ` Mark Kettenis

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=npvh6y4134.fsf@zwingli.cygnus.com \
    --to=jimb@cygnus.com \
    --cc=gdb-patches@sourceware.cygnus.com \
    --cc=kingdon@redhat.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