PATCH bfd/elf.c for UnixWare 2.1,7.1 (v2)

rbrown64@csc.com.au rbrown64@csc.com.au
Thu Jan 17 21:04:00 GMT 2002


elfcore_write_prstatus and elfcore_write_pstatus were called from
gdb/procfs.c which had hidden which process status structure type was
being used in a gdb_prstatus_t typedef. Keep that information hiding
inside the elf.c(elfcore_write_gdb_prstatus) interface - which assumes
that HAVE_PRSTATUS_T and HAVE_PSTATUS_T are disjoint.
No gdb regressions on Solaris 2.7 and UnixWare 7.1.0.

2002-01-18  Rodney Brown  <rbrown64@csc.com.au>

     * elf.c: Merge elfcore_write_prstatus and elfcore_write_pstatus
     into elfcore_write_gdb_prstatus. Assign cursig to pr_lwp.pr_cursig.

*** elf.c.bu   Fri Jan 11 10:05:21 2002
--- elf.c Thu Jan 17 17:01:55 2002
*************** elfcore_write_prpsinfo (abfd, buf, bufsi
*** 6556,6564 ****
  }
  #endif  /* PSINFO_T or PRPSINFO_T */

! #if defined (HAVE_PRSTATUS_T)
  char *
! elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs)
       bfd *abfd;
       char *buf;
       int *bufsiz;
--- 6556,6564 ----
  }
  #endif  /* PSINFO_T or PRPSINFO_T */

! #if defined (HAVE_PRSTATUS_T) || defined (HAVE_PSTATUS_T)
  char *
! elfcore_write_gdb_prstatus (abfd, buf, bufsiz, pid, cursig, gregs)
       bfd *abfd;
       char *buf;
       int *bufsiz;
*************** elfcore_write_prstatus (abfd, buf, bufsi
*** 6566,6603 ****
       int cursig;
       void *gregs;
  {
-   prstatus_t prstat;
    char *note_name = "CORE";

    memset (&prstat, 0, sizeof (prstat));
    prstat.pr_pid = pid;
    prstat.pr_cursig = cursig;
    memcpy (prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
!   return elfcore_write_note (abfd, buf, bufsiz,
!                   note_name, NT_PRSTATUS, &prstat, sizeof (prstat));
! }
! #endif /* HAVE_PRSTATUS_T */
!
! #if defined (HAVE_PSTATUS_T)
! char *
! elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs)
!      bfd *abfd;
!      char *buf;
!      int *bufsiz;
!      long pid;
!      int cursig;
!      void *gregs;
! {
!   pstatus_t pstat;
!   char *note_name = "CORE";
!
!   memset (&pstat, 0, sizeof (prstat));
!   pstat.pr_pid = pid;
!   memcpy (pstat.pr_reg, gregs, sizeof (pstat.pr_reg));
!   return elfcore_write_note (abfd, buf, bufsiz,
!                   note_name, NT_PSTATUS, &pstat, sizeof (pstat));
  }
! #endif /* HAVE_PSTATUS_T */

  char *
  elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size)
--- 6566,6604 ----
       int cursig;
       void *gregs;
  {
    char *note_name = "CORE";
+ #if defined (HAVE_PRSTATUS_T)
+ #define NT_GDB_PRSTATUS     NT_PRSTATUS
+   prstatus_t prstat;
+ #elif defined (HAVE_PSTATUS_T)
+ #define NT_GDB_PRSTATUS     NT_PSTATUS
+   pstatus_t prstat;
+ #endif

    memset (&prstat, 0, sizeof (prstat));
    prstat.pr_pid = pid;
+ #if defined(HAVE_PRSTATUS_T) || !defined (HAVE_LWPSTATUS_T)
    prstat.pr_cursig = cursig;
    memcpy (prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
! #elif defined (HAVE_LWPSTATUS_T_PR_REG)
!   prstat.pr_lwp.pr_cursig = cursig;
!   memcpy (prstat.pr_lwp.pr_reg, gregs, sizeof (prstat.pr_lwp.pr_reg));
! #elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
!   prstat.pr_lwp.pr_cursig = cursig;
! #if !defined(gregs)
!   memcpy (prstat.pr_lwp.pr_context.uc_mcontext.gregs,
!           gregs, sizeof (gregset_t));
! #else
!   memcpy (prstat.pr_lwp.pr_context.uc_mcontext.__gregs,
!          gregs, sizeof (gregset_t));
! #endif
! #else
! #error  FixMe
! #endif
!   return elfcore_write_note (abfd, buf, bufsiz, note_name, NT_GDB_PRSTATUS,
!                              &prstat, sizeof (prstat));
  }
! #endif /* HAVE_PRSTATUS_T || HAVE_PSTATUS_T */

  char *
  elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size)



More information about the Binutils mailing list