This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: more cross cores
- To: binutils at sources dot redhat dot com
- Subject: PATCH: more cross cores
- From: Daniel Jacobowitz <drow at mvista dot com>
- Date: Wed, 22 Aug 2001 13:59:50 -0700
This just fills in cross core support for some other Linux targets the same
way that I implemented it for MIPS/Linux; nothing surprising. I think that
when I have a little spare time I will try to redo this in a way that
involves less code duplication, but it's fine the way it is - and BFD has
larger issues of code duplication to shoot, anyway.
All the affected targets have been built, and the cores checked with a
patched cross-gdb.
OK to commit?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2001-08-22 Daniel Jacobowitz <drow@mvista.com>
* elf32-i386.c (elf_i386_grok_prstatus): New function.
(elf_i386_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Likewise.
* elf32-mips.c (_bfd_elf32_mips_grok_psinfo): Fix formatting.
* elf32-ppc.c (ppc_elf_grok_prstatus): New function.
(ppc_elf_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Likewise.
* elf32-sh-lin.c (elf32_shlin_grok_prstatus): New function.
(elf32_shlin_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Likewise.
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): New function.
(elf32_arm_nabi_grok_psinfo): New function.
(elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Likewise.
cvs server: Diffing .
Index: elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.38
diff -u -r1.38 elf32-i386.c
--- elf32-i386.c 2001/08/09 14:38:04 1.38
+++ elf32-i386.c 2001/08/22 20:49:25
@@ -2215,7 +2215,71 @@
return true;
}
+/* Support for core dump NOTE sections */
+static boolean
+elf_i386_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ int raw_size;
+ 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;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+elf_i386_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 128: /* Linux/MIPS 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
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
#define TARGET_LITTLE_NAME "elf32-i386"
#define ELF_ARCH bfd_arch_i386
@@ -2246,5 +2310,7 @@
#define elf_backend_relocate_section elf_i386_relocate_section
#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
#define elf_backend_fake_sections elf_i386_fake_sections
+#define elf_backend_grok_prstatus elf_i386_grok_prstatus
+#define elf_backend_grok_psinfo elf_i386_grok_psinfo
#include "elf32-target.h"
Index: elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.103
diff -u -r1.103 elf32-mips.c
--- elf32-mips.c 2001/07/04 07:15:20 1.103
+++ elf32-mips.c 2001/08/22 20:49:26
@@ -9170,7 +9170,8 @@
raw_size, note->descpos + offset);
}
-static boolean _bfd_elf32_mips_grok_psinfo (abfd, note)
+static boolean
+_bfd_elf32_mips_grok_psinfo (abfd, note)
bfd *abfd;
Elf_Internal_Note *note;
{
Index: elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.24
diff -u -r1.24 elf32-ppc.c
--- elf32-ppc.c 2001/08/17 15:56:58 1.24
+++ elf32-ppc.c 2001/08/22 20:49:26
@@ -3713,6 +3713,71 @@
return ret;
}
+/* Support for core dump NOTE sections */
+static boolean
+ppc_elf_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 268: /* Linux/PPC */
+ /* 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 = 192;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+ppc_elf_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 128: /* Linux/PPC elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
#define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec
#define TARGET_LITTLE_NAME "elf32-powerpcle"
#define TARGET_BIG_SYM bfd_elf32_powerpc_vec
@@ -3757,5 +3822,7 @@
#define elf_backend_fake_sections ppc_elf_fake_sections
#define elf_backend_additional_program_headers ppc_elf_additional_program_headers
#define elf_backend_modify_segment_map ppc_elf_modify_segment_map
+#define elf_backend_grok_prstatus ppc_elf_grok_prstatus
+#define elf_backend_grok_psinfo ppc_elf_grok_psinfo
#include "elf32-target.h"
Index: elf32-sh-lin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh-lin.c,v
retrieving revision 1.1
diff -u -r1.1 elf32-sh-lin.c
--- elf32-sh-lin.c 2000/09/07 04:23:43 1.1
+++ elf32-sh-lin.c 2001/08/22 20:49:26
@@ -26,4 +26,80 @@
#define ELF_MAXPAGESIZE 0x10000
#define elf_symbol_leading_char 0
+#include "bfd.h"
+#include "sysdep.h"
+#include "elf/internal.h"
+#include "elf-bfd.h"
+
+/* Support for core dump NOTE sections */
+static boolean
+elf32_shlin_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 168: /* Linux/SH */
+ /* 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 = 92;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+elf32_shlin_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 124: /* Linux/SH 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
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
+
+#define elf_backend_grok_prstatus elf32_shlin_grok_prstatus
+#define elf_backend_grok_psinfo elf32_shlin_grok_psinfo
+
+
+
#include "elf32-sh.c"
Index: elfarm-nabi.c
===================================================================
RCS file: /cvs/src/src/bfd/elfarm-nabi.c,v
retrieving revision 1.6
diff -u -r1.6 elfarm-nabi.c
--- elfarm-nabi.c 2001/03/08 21:04:01 1.6
+++ elfarm-nabi.c 2001/08/22 20:49:26
@@ -674,4 +674,72 @@
}
}
+/* Support for core dump NOTE sections */
+static boolean
+elf32_arm_nabi_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 148: /* Linux/ARM 32-bit*/
+ /* 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 = 72;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+elf32_arm_nabi_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 124: /* Linux/ARM 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
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
+#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
+#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo
+
#include "elf32-arm.h"
cvs server: Diffing doc
cvs server: Diffing hosts
cvs server: Diffing po