This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

Re: Additional patches for UnixWare - procfs.c patch


My logic is that the type of the structure holding the process status is
being unified (hidden) into a gdb_prstatus_t type.  Using a define
for elfcore_write_gdb_prstatus keeps that unification and prototypes
only the correct function, at the cost of hiding which is being called.
If elfcore_write_p{r,}status are only for gdb support would it be worth
modifying bfd/elf.c to have one elfcore_write_gdb_prstatus.

I assume that prstatus_t & pstatus_t in procfs.h are mutually exclusive.
(Need to start up a Solaris 2.7 box ...)

ie
#if defined(HAVE_PRSTATUS_T) || defined(HAVE_PSTATUS_T)
char *
elfcore_write_gdb_prstatus(....)
{
#if defined(HAVE_PRSTATUS_T)
guts of elfcore_write_prstatus
#endif
#if defined(HAVE_PSTATUS_T)
guts of elfcore_write_pstatus
#endif
}




Michael Snyder <msnyder@redhat.com> on 16/01/2002 15:47:35

To:   rbrown64@csc.com.au
cc:   gdb-patches@sources.redhat.com
Subject:  Re: Additional patches for UnixWare - procfs.c patch


rbrown64@csc.com.au wrote:
>
> See if you prefer this patch - though using elfcore_write_gdb_prstatus
> as a #define may not be according to the coding standards. If so, please
> upshift it.

No, I can't see any reason for doing that.  I suggested
NEW_PROC_API because that's exactly what it's for, and
using it is consistant with the usage in the rest of
procfs.c

> The prototypes get rid of -Wprototype warnings.
>
> 2001-01-15  Rodney Brown  <rbrown64@csc.com.au>
>      * procfs.c: Define elfcore_write_gdb_prstatus.
>      Prototype elfcore_write_gdb_prstatus, elfcore_write_prfpreg,
>      elfcore_write_prpsinfo.
>      (procfs_do_thread_registers): Call elfcore_write_gdb_prstatus.
>
> --- procfs.c.orig   Tue Jan 15 15:01:48 2002
> +++ procfs.c   Wed Jan 16 12:28:16 2002
> @@ -55,7 +55,7 @@ Inc., 59 Temple Place - Suite 330, Bosto
>   *   Unixware
>   *   AIX5
>   *
> - * /proc works by immitating a file system: you open a simulated file
> + * /proc works by imitating a file system: you open a simulated file
>   * that represents the process you wish to interact with, and
>   * perform operations on that "file" in order to examine or change
>   * the state of the other process.
> @@ -310,6 +310,7 @@ typedef struct siginfo gdb_siginfo_t;
>  /* the name of the proc status struct depends on the implementation */
>  typedef pstatus_t   gdb_prstatus_t;
>  typedef lwpstatus_t gdb_lwpstatus_t;
> +#  define elfcore_write_gdb_prstatus    elfcore_write_pstatus
>  #else /* ! NEW_PROC_API */
>  /* format strings for /proc paths */
>  # ifndef CTL_PROC_NAME_FMT
> @@ -323,8 +324,13 @@ typedef lwpstatus_t gdb_lwpstatus_t;
>  /* the name of the proc status struct depends on the implementation */
>  typedef prstatus_t gdb_prstatus_t;
>  typedef prstatus_t gdb_lwpstatus_t;
> +#  define elfcore_write_gdb_prstatus    elfcore_write_prstatus
>  #endif /* NEW_PROC_API */
>
> +char *elfcore_write_gdb_prstatus (bfd *, char *, int *, long, int, void
*);
> +char *elfcore_write_prfpreg (bfd  *, char *, int  *, void *, int);
> +char *elfcore_write_prpsinfo (bfd  *, char *, int  *, char *, char *);
> +
>  typedef struct procinfo {
>    struct procinfo *next;
>    int pid;              /* Process ID    */
> @@ -5733,12 +5739,12 @@ procfs_do_thread_registers (bfd *obfd, p
>    merged_pid = TIDGET (ptid) << 16 | PIDGET (ptid);
>
>    fill_gregset (&gregs, -1);
> -  note_data = (char *) elfcore_write_prstatus (obfd,
> -                                               note_data,
> -                                               note_size,
> -                               merged_pid,
> -                               stop_signal,
> -                                               &gregs);
> +  note_data = (char *) elfcore_write_gdb_prstatus (obfd,
> +                                note_data,
> +                                note_size,
> +                                merged_pid,
> +                                stop_signal,
> +                                &gregs);
>    fill_fpregset (&fpregs, -1);
>    note_data = (char *) elfcore_write_prfpreg (obfd,
>                                note_data,
>
> Michael Snyder wrote:
> >
> > rbrown64@csc.com.au wrote:
> > >
> > > 2002-01-15  Rodney Brown  <rbrown64@csc.com.au>
> > >
> > >      * config/i386/tm-i386v4.h: Define HAVE_I387_REGS.
> > >      * config/i386/i386v42mp.mh: Add i387-nat.o .
> > >      * i386v4-nat.c: Include i387-nat.h.
> > >      (supply_fpregset): Use i387_supply_fsave.
> > >      (fill_fpregset): Use i387_fill_fsave.
> > >      * procfs.c(procfs_do_thread_registers): Use
elfcore_write_pstatus
> > >      if pstatus_t is available.
> >
> > The procfs.c portion is approved.
>
> Actually, let me reconsider that.  Would you please try using
> #ifdef NEW_PROC_API instead of HAVE_PSTATUS_T?




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