Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Add FreeBSD/i386 core file note support
@ 2002-05-11  7:25 Mark Kettenis
  2002-05-13  1:53 ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2002-05-11  7:25 UTC (permalink / raw)
  To: binutils; +Cc: gdb-patches

This patch adds support for FreeBSD/i386 core file notes.  The FreeBSD
notes are distinguished based on the name of the note, which has been
FreeBSD ever since support for ELF core dumps was first added to
FreeBSD.

OK to check this in?

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* elf32-i386.c (elf_i386_grok_prstatus): Add support for FreeBSD.
	(elf_i386_grok_psinfo): Likewise.

Index: elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.67
diff -u -p -r1.67 elf32-i386.c
--- elf32-i386.c 4 Apr 2002 19:53:36 -0000 1.67
+++ elf32-i386.c 11 May 2002 14:16:44 -0000
@@ -328,23 +328,44 @@ elf_i386_grok_prstatus (abfd, note)
   int offset;
   size_t raw_size;
 
-  switch (note->descsz)
+  if (strncmp (note->namedata, "FreeBSD", note->namesz) == 0)
     {
-      default:
+      int pr_version = bfd_get_32 (abfd, note->descdata);
+
+      if (pr_version != 1)
 	return false;
 
-      case 144:		/* Linux/i386 */
-	/* pr_cursig */
-	elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
-
-	/* pr_pid */
-	elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
-
-	/* pr_reg */
-	offset = 72;
-	raw_size = 68;
+      /* pr_cursig */
+      elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 20);
+
+      /* pr_pid */
+      elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+      /* pr_reg */
+      offset = 28;
+      raw_size = bfd_get_32 (abfd, note->descdata + 8);
+    }
+  else
+    {
+      switch (note->descsz)
+	{
+	default:
+	  return false;
+
+	case 144:		/* Linux/i386 */
+	  /* pr_cursig */
+	  elf_tdata (abfd)->core_signal
+	    = bfd_get_16 (abfd, note->descdata + 12);
+
+	  /* pr_pid */
+	  elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+	  /* pr_reg */
+	  offset = 72;
+	  raw_size = 68;
 
-	break;
+	  break;
+	}
     }
 
   /* Make a ".reg/999" section.  */
@@ -357,16 +378,31 @@ elf_i386_grok_psinfo (abfd, note)
      bfd *abfd;
      Elf_Internal_Note *note;
 {
-  switch (note->descsz)
+  if (strncmp (note->namedata, "FreeBSD", note->namesz) == 0)
     {
-      default:
+      int pr_version = bfd_get_32 (abfd, note->descdata);
+
+      if (pr_version != 1)
 	return false;
 
-      case 124:		/* Linux/i386 elf_prpsinfo */
-	elf_tdata (abfd)->core_program
-	 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-	elf_tdata (abfd)->core_command
-	 = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+      elf_tdata (abfd)->core_program
+	= _bfd_elfcore_strndup (abfd, note->descdata + 8, 17);
+      elf_tdata (abfd)->core_command
+	= _bfd_elfcore_strndup (abfd, note->descdata + 25, 81);
+    }
+  else
+    {
+      switch (note->descsz)
+	{
+	default:
+	  return false;
+
+	case 124:		/* Linux/i386 elf_prpsinfo */
+	  elf_tdata (abfd)->core_program
+	    = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+	  elf_tdata (abfd)->core_command
+	    = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+	}
     }
 
   /* Note that for some reason, a spurious space is tacked


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add FreeBSD/i386 core file note support
  2002-05-11  7:25 [PATCH] Add FreeBSD/i386 core file note support Mark Kettenis
@ 2002-05-13  1:53 ` Nick Clifton
  2002-05-13  7:32   ` Mark Kettenis
  2002-05-18  3:23   ` David O'Brien
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Clifton @ 2002-05-13  1:53 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: binutils, gdb-patches

Hi Mark,

> This patch adds support for FreeBSD/i386 core file notes.  The
> FreeBSD notes are distinguished based on the name of the note, which
> has been FreeBSD ever since support for ELF core dumps was first
> added to FreeBSD.
> 
> OK to check this in?

Unfortunately you do not appear to have a binutils copyright
assignment on file with the FSF.  Please could you fix this so that we
can accept the patch ?

It would also help. if you are willing, if you could provide a
supplimental patch to add suppoort for these notes to readelf.

Cheers
        Nick


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add FreeBSD/i386 core file note support
  2002-05-13  1:53 ` Nick Clifton
@ 2002-05-13  7:32   ` Mark Kettenis
  2002-05-18  3:23   ` David O'Brien
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2002-05-13  7:32 UTC (permalink / raw)
  To: nickc; +Cc: binutils, gdb-patches

   From: Nick Clifton <nickc@cambridge.redhat.com>
   Date: 13 May 2002 09:53:19 +0100

   Hi Mark,

   > This patch adds support for FreeBSD/i386 core file notes.  The
   > FreeBSD notes are distinguished based on the name of the note, which
   > has been FreeBSD ever since support for ELF core dumps was first
   > added to FreeBSD.
   > 
   > OK to check this in?

   Unfortunately you do not appear to have a binutils copyright
   assignment on file with the FSF.  Please could you fix this so that we
   can accept the patch ?

Hmm, I was more or less counting on my GDB assignment being
sufficient.  If not, can you point me at the necessary forms?

   It would also help. if you are willing, if you could provide a
   supplimental patch to add suppoort for these notes to readelf.

They're all standard note types which are already supported by readelf
:-).

Mark


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add FreeBSD/i386 core file note support
  2002-05-13  1:53 ` Nick Clifton
  2002-05-13  7:32   ` Mark Kettenis
@ 2002-05-18  3:23   ` David O'Brien
  2002-05-18  6:56     ` Mark Kettenis
  1 sibling, 1 reply; 5+ messages in thread
From: David O'Brien @ 2002-05-18  3:23 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Mark Kettenis, binutils, gdb-patches

On Mon, May 13, 2002 at 09:53:19AM +0100, Nick Clifton wrote:
> > This patch adds support for FreeBSD/i386 core file notes.  The
> > FreeBSD notes are distinguished based on the name of the note, which
> > has been FreeBSD ever since support for ELF core dumps was first
> > added to FreeBSD.
> > 
> > OK to check this in?
> 
> Unfortunately you do not appear to have a binutils copyright
> assignment on file with the FSF.  Please could you fix this so that we
> can accept the patch ?

I'd love to have this committed.  Isn't Mark already covered?

$ grep src/gdb/MAINTAINERS
Mark Kettenis           	kettenis@gnu.org
			Mark Kettenis           kettenis@gnu.org
			Mark Kettenis		kettenis@gnu.org
FreeBSD native & host	Mark Kettenis		kettenis@gnu.org
hurd native		Mark Kettenis		kettenis@gnu.org
			Mark Kettenis		kettenis@gnu.org


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add FreeBSD/i386 core file note support
  2002-05-18  3:23   ` David O'Brien
@ 2002-05-18  6:56     ` Mark Kettenis
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2002-05-18  6:56 UTC (permalink / raw)
  To: obrien; +Cc: nickc, binutils, gdb-patches

   Date: Sat, 18 May 2002 03:23:02 -0700
   From: "David O'Brien" <obrien@FreeBSD.org>

   On Mon, May 13, 2002 at 09:53:19AM +0100, Nick Clifton wrote:
   > > This patch adds support for FreeBSD/i386 core file notes.  The
   > > FreeBSD notes are distinguished based on the name of the note, which
   > > has been FreeBSD ever since support for ELF core dumps was first
   > > added to FreeBSD.
   > > 
   > > OK to check this in?
   > 
   > Unfortunately you do not appear to have a binutils copyright
   > assignment on file with the FSF.  Please could you fix this so that we
   > can accept the patch ?

   I'd love to have this committed.  Isn't Mark already covered?

Apparently my GDB assignment doesn't cover BFD.  I'll try to get the
paperwork done ASAP.

By the way, this patch isn't that urgent.  It's necessary to support
cross-debugging of FreeBSD/i386 core files.  But that won't work
before I've added the necessary support to GDB.  Since I'm in the
middle of some pretty invasive changes in the i386 target, that'll
have to wait a bit longer.

Mark


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-05-18 13:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-11  7:25 [PATCH] Add FreeBSD/i386 core file note support Mark Kettenis
2002-05-13  1:53 ` Nick Clifton
2002-05-13  7:32   ` Mark Kettenis
2002-05-18  3:23   ` David O'Brien
2002-05-18  6:56     ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox