diff options
author | Alan Modra <amodra@gmail.com> | 2016-01-22 11:03:47 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2016-01-22 11:06:13 +1030 |
commit | 3a36c1c7b4395f9489a3d6ad27ab5ac873d1e62c (patch) | |
tree | af7f5b5c6e49c4b67bb61ea881f0481b394aa4b8 | |
parent | abd215c9bd3752a9bb475ee30affb5a26d65b1a7 (diff) | |
download | gdb-3a36c1c7b4395f9489a3d6ad27ab5ac873d1e62c.zip gdb-3a36c1c7b4395f9489a3d6ad27ab5ac873d1e62c.tar.gz gdb-3a36c1c7b4395f9489a3d6ad27ab5ac873d1e62c.tar.bz2 |
Remove elf_backend_write_core_noteusers/palves/core-prstatus-rework
This function was added in 2007 to support powerpc gdb "gcore" writing
32-bit powerpc linux core files on a 64-bit powerpc host, when
PowerPC64 glibc lacked (and still lacks) 32-bit versions of prstatus_t
and prpsinfo_t. Now that gdb has elfcore_write_linux_prstatus32/64
and elfcore_write_linux_prpsinfo32/64, this linux specific backend
function should disappear.
* elf-bfd.h (struct elf_backend_data): Remove
elf_backend_write_core_note.
* elf.c (elfcore_write_prpsinfo, elfcore_write_prstatus): Don't call
elf_backend_write_core_note.
* elf32-arm.c (elf32_arm_nabi_write_core_note): Delete function.
(elf_backend_write_core_note): Don't define.
* elf32-ppc.c (ppc_elf_write_core_note): Delete function.
(elf_backend_write_core_note): Don't define.
* elf64-ppc.c (ppc64_elf_write_core_note): Delete function.
(elf_backend_write_core_note): Don't define.
* elf64-x86-64.c (elf_x86_64_write_core_note): Delete function.
(elf_backend_write_core_note): Don't define.
(CORE_HEADER): Don't include.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Delete function.
* elfxx-aarch64.h (_bfd_aarch64_elf_write_core_note): Delete prototype.
(elf_backend_write_core_note): Don't define.
* elfxx-target.h (elf_backend_write_core_note): Don't define.
(elfNN_bed): Adjust.
* hosts/x86-64linux.h: Delete file.
* configure.ac (CORE_HEADER): Delete.
* configure: Regenerate.
* config.in: Regenerate.
-rw-r--r-- | bfd/config.in | 3 | ||||
-rwxr-xr-x | bfd/configure | 15 | ||||
-rw-r--r-- | bfd/configure.ac | 12 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 4 | ||||
-rw-r--r-- | bfd/elf.c | 45 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 49 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 47 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 48 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 96 | ||||
-rw-r--r-- | bfd/elfxx-aarch64.c | 48 | ||||
-rw-r--r-- | bfd/elfxx-aarch64.h | 4 | ||||
-rw-r--r-- | bfd/elfxx-target.h | 4 | ||||
-rw-r--r-- | bfd/hosts/x86-64linux.h | 232 |
13 files changed, 13 insertions, 594 deletions
diff --git a/bfd/config.in b/bfd/config.in index 58248bd..fcf09a7 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -7,9 +7,6 @@ #endif #define __CONFIG_H__ 1 -/* Name of host specific core header file to include in elf.c. */ -#undef CORE_HEADER - /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS diff --git a/bfd/configure b/bfd/configure index c376644..0dde00a 100755 --- a/bfd/configure +++ b/bfd/configure @@ -14644,7 +14644,6 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar # If we are configured native, pick a core file support file. COREFILE= COREFLAG= -CORE_HEADER= TRAD_HEADER= if test "${target}" = "${host}"; then case "${host}" in @@ -14722,10 +14721,6 @@ if test "${target}" = "${host}"; then i[3-7]86-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386linux.h"' - case "$enable_targets"-"$want64" in - *x86_64-*linux*|*-true) - CORE_HEADER='"hosts/x86-64linux.h"' - esac ;; i[3-7]86-*-isc*) COREFILE=trad-core.lo ;; i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;; @@ -14876,9 +14871,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxbsd.h"' ;; - x86_64-*-linux*) - CORE_HEADER='"hosts/x86-64linux.h"' - ;; x86_64-*-netbsd* | x86_64-*-openbsd*) COREFILE=netbsd-core.lo ;; @@ -15694,13 +15686,6 @@ $as_echo "$bfd_cv_have_sys_procfs_type_win32_pstatus_t" >&6; } fi -if test -n "$CORE_HEADER"; then - -cat >>confdefs.h <<_ACEOF -#define CORE_HEADER $CORE_HEADER -_ACEOF - -fi if test -n "$TRAD_HEADER"; then cat >>confdefs.h <<_ACEOF diff --git a/bfd/configure.ac b/bfd/configure.ac index b69891c..824599a 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -841,7 +841,6 @@ AC_SUBST(havevecs) # If we are configured native, pick a core file support file. COREFILE= COREFLAG= -CORE_HEADER= TRAD_HEADER= if test "${target}" = "${host}"; then case "${host}" in @@ -941,10 +940,6 @@ changequote(,)dnl changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386linux.h"' - case "$enable_targets"-"$want64" in - *x86_64-*linux*|*-true) - CORE_HEADER='"hosts/x86-64linux.h"' - esac ;; changequote(,)dnl i[3-7]86-*-isc*) COREFILE=trad-core.lo ;; @@ -1081,9 +1076,6 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxbsd.h"' ;; - x86_64-*-linux*) - CORE_HEADER='"hosts/x86-64linux.h"' - ;; x86_64-*-netbsd* | x86_64-*-openbsd*) COREFILE=netbsd-core.lo ;; @@ -1132,10 +1124,6 @@ changequote([,])dnl fi AC_SUBST(COREFILE) AC_SUBST(COREFLAG) -if test -n "$CORE_HEADER"; then - AC_DEFINE_UNQUOTED(CORE_HEADER, $CORE_HEADER, - [Name of host specific core header file to include in elf.c.]) -fi if test -n "$TRAD_HEADER"; then AC_DEFINE_UNQUOTED(TRAD_HEADER, $TRAD_HEADER, [Name of host specific header file to include in trad-core.c.]) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index b0f5026..c14ec46 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1190,10 +1190,6 @@ struct elf_backend_data bfd_boolean (*elf_backend_grok_psinfo) (bfd *, Elf_Internal_Note *); - /* This function, if defined, is called to write a note to a corefile. */ - char *(*elf_backend_write_core_note) - (bfd *abfd, char *buf, int *bufsiz, int note_type, ...); - /* This function, if defined, is called to convert target-specific section flag names into hex values. */ flagword (*elf_backend_lookup_section_flags_hook) @@ -9726,25 +9726,16 @@ elfcore_write_note (bfd *abfd, } char * -elfcore_write_prpsinfo (bfd *abfd, +elfcore_write_prpsinfo (bfd *abfd ATTRIBUTE_UNUSED, char *buf, - int *bufsiz, - const char *fname, - const char *psargs) + int *bufsiz ATTRIBUTE_UNUSED, + const char *fname ATTRIBUTE_UNUSED, + const char *psargs ATTRIBUTE_UNUSED) { - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (bed->elf_backend_write_core_note != NULL) - { - char *ret; - ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz, - NT_PRPSINFO, fname, psargs); - if (ret != NULL) - return ret; - } - #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) #if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T) + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + if (bed->s->elfclass == ELFCLASS32) { #if defined (HAVE_PSINFO32_T) @@ -9843,27 +9834,17 @@ elfcore_write_linux_prstatus64 } char * -elfcore_write_prstatus (bfd *abfd, +elfcore_write_prstatus (bfd *abfd ATTRIBUTE_UNUSED, char *buf, - int *bufsiz, - long pid, - int cursig, - const void *gregs) + int *bufsiz ATTRIBUTE_UNUSED, + long pid ATTRIBUTE_UNUSED, + int cursig ATTRIBUTE_UNUSED, + const void *gregs ATTRIBUTE_UNUSED) { - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (bed->elf_backend_write_core_note != NULL) - { - char *ret; - ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz, - NT_PRSTATUS, - pid, cursig, gregs); - if (ret != NULL) - return ret; - } - #if defined (HAVE_PRSTATUS_T) #if defined (HAVE_PRSTATUS32_T) + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + if (bed->s->elfclass == ELFCLASS32) { prstatus32_t prstat; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 81ebf67..b63701f 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -2050,54 +2050,6 @@ elf32_arm_nabi_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } -static char * -elf32_arm_nabi_write_core_note (bfd *abfd, char *buf, int *bufsiz, - int note_type, ...) -{ - switch (note_type) - { - default: - return NULL; - - case NT_PRPSINFO: - { - char data[124]; - va_list ap; - - va_start (ap, note_type); - memset (data, 0, sizeof (data)); - strncpy (data + 28, va_arg (ap, const char *), 16); - strncpy (data + 44, va_arg (ap, const char *), 80); - va_end (ap); - - return elfcore_write_note (abfd, buf, bufsiz, - "CORE", note_type, data, sizeof (data)); - } - - case NT_PRSTATUS: - { - char data[148]; - va_list ap; - long pid; - int cursig; - const void *greg; - - va_start (ap, note_type); - memset (data, 0, sizeof (data)); - pid = va_arg (ap, long); - bfd_put_32 (abfd, pid, data + 24); - cursig = va_arg (ap, int); - bfd_put_16 (abfd, cursig, data + 12); - greg = va_arg (ap, const void *); - memcpy (data + 72, greg, 72); - va_end (ap); - - return elfcore_write_note (abfd, buf, bufsiz, - "CORE", note_type, data, sizeof (data)); - } - } -} - #define TARGET_LITTLE_SYM arm_elf32_le_vec #define TARGET_LITTLE_NAME "elf32-littlearm" #define TARGET_BIG_SYM arm_elf32_be_vec @@ -2105,7 +2057,6 @@ elf32_arm_nabi_write_core_note (bfd *abfd, char *buf, int *bufsiz, #define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus #define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo -#define elf_backend_write_core_note elf32_arm_nabi_write_core_note typedef unsigned long int insn32; typedef unsigned short int insn16; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 369a5e6..9cd96fa 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2307,52 +2307,6 @@ elfcore_write_ppc_linux_prpsinfo32 "CORE", NT_PRPSINFO, &data, sizeof (data)); } -static char * -ppc_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, ...) -{ - switch (note_type) - { - default: - return NULL; - - case NT_PRPSINFO: - { - char data[128]; - va_list ap; - - va_start (ap, note_type); - memset (data, 0, sizeof (data)); - strncpy (data + 32, va_arg (ap, const char *), 16); - strncpy (data + 48, va_arg (ap, const char *), 80); - va_end (ap); - return elfcore_write_note (abfd, buf, bufsiz, - "CORE", note_type, data, sizeof (data)); - } - - case NT_PRSTATUS: - { - char data[268]; - va_list ap; - long pid; - int cursig; - const void *greg; - - va_start (ap, note_type); - memset (data, 0, 72); - pid = va_arg (ap, long); - bfd_put_32 (abfd, pid, data + 24); - cursig = va_arg (ap, int); - bfd_put_16 (abfd, cursig, data + 12); - greg = va_arg (ap, const void *); - memcpy (data + 72, greg, 192); - memset (data + 264, 0, 4); - va_end (ap); - return elfcore_write_note (abfd, buf, bufsiz, - "CORE", note_type, data, sizeof (data)); - } - } -} - static flagword ppc_elf_lookup_section_flags (char *flag_name) { @@ -10746,7 +10700,6 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #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 -#define elf_backend_write_core_note ppc_elf_write_core_note #define elf_backend_reloc_type_class ppc_elf_reloc_type_class #define elf_backend_begin_write_processing ppc_elf_begin_write_processing #define elf_backend_final_write_processing ppc_elf_final_write_processing diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index f9c37b5..63e1495 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -90,7 +90,6 @@ static bfd_vma opd_entry_value #define elf_backend_object_p ppc64_elf_object_p #define elf_backend_grok_prstatus ppc64_elf_grok_prstatus #define elf_backend_grok_psinfo ppc64_elf_grok_psinfo -#define elf_backend_write_core_note ppc64_elf_write_core_note #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol #define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook @@ -2947,53 +2946,6 @@ ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } -static char * -ppc64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, - ...) -{ - switch (note_type) - { - default: - return NULL; - - case NT_PRPSINFO: - { - char data[136]; - va_list ap; - - va_start (ap, note_type); - memset (data, 0, sizeof (data)); - strncpy (data + 40, va_arg (ap, const char *), 16); - strncpy (data + 56, va_arg (ap, const char *), 80); - va_end (ap); - return elfcore_write_note (abfd, buf, bufsiz, - "CORE", note_type, data, sizeof (data)); - } - - case NT_PRSTATUS: - { - char data[504]; - va_list ap; - long pid; - int cursig; - const void *greg; - - va_start (ap, note_type); - memset (data, 0, 112); - pid = va_arg (ap, long); - bfd_put_32 (abfd, pid, data + 32); - cursig = va_arg (ap, int); - bfd_put_16 (abfd, cursig, data + 12); - greg = va_arg (ap, const void *); - memcpy (data + 112, greg, 384); - memset (data + 496, 0, 8); - va_end (ap); - return elfcore_write_note (abfd, buf, bufsiz, - "CORE", note_type, data, sizeof (data)); - } - } -} - /* Add extra PPC sections. */ static const struct bfd_elf_special_section ppc64_elf_special_sections[]= diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index bbdb03a..824354a 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -34,11 +34,6 @@ #include "opcode/i386.h" #include "elf/x86-64.h" -#ifdef CORE_HEADER -#include <stdarg.h> -#include CORE_HEADER -#endif - /* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ #define MINUS_ONE (~ (bfd_vma) 0) @@ -436,94 +431,6 @@ elf_x86_64_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } - -#ifdef CORE_HEADER -static char * -elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, - int note_type, ...) -{ - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - va_list ap; - const char *fname, *psargs; - long pid; - int cursig; - const void *gregs; - - switch (note_type) - { - default: - return NULL; - - case NT_PRPSINFO: - va_start (ap, note_type); - fname = va_arg (ap, const char *); - psargs = va_arg (ap, const char *); - va_end (ap); - - if (bed->s->elfclass == ELFCLASS32) - { - prpsinfo32_t data; - memset (&data, 0, sizeof (data)); - strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); - strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); - return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, - &data, sizeof (data)); - } - else - { - prpsinfo64_t data; - memset (&data, 0, sizeof (data)); - strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); - strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); - return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, - &data, sizeof (data)); - } - /* NOTREACHED */ - - case NT_PRSTATUS: - va_start (ap, note_type); - pid = va_arg (ap, long); - cursig = va_arg (ap, int); - gregs = va_arg (ap, const void *); - va_end (ap); - - if (bed->s->elfclass == ELFCLASS32) - { - if (bed->elf_machine_code == EM_X86_64) - { - prstatusx32_t prstat; - 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, "CORE", note_type, - &prstat, sizeof (prstat)); - } - else - { - prstatus32_t prstat; - 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, "CORE", note_type, - &prstat, sizeof (prstat)); - } - } - else - { - prstatus64_t prstat; - 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, "CORE", note_type, - &prstat, sizeof (prstat)); - } - } - /* NOTREACHED */ -} -#endif /* Functions for the x86-64 ELF linker. */ @@ -6359,9 +6266,6 @@ static const struct bfd_elf_special_section #define elf_backend_gc_sweep_hook elf_x86_64_gc_sweep_hook #define elf_backend_grok_prstatus elf_x86_64_grok_prstatus #define elf_backend_grok_psinfo elf_x86_64_grok_psinfo -#ifdef CORE_HEADER -#define elf_backend_write_core_note elf_x86_64_write_core_note -#endif #define elf_backend_reloc_type_class elf_x86_64_reloc_type_class #define elf_backend_relocate_section elf_x86_64_relocate_section #define elf_backend_size_dynamic_sections elf_x86_64_size_dynamic_sections diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index 498171c..a0dcf9f 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -611,51 +611,3 @@ _bfd_aarch64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } - -char * -_bfd_aarch64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type, - ...) -{ - switch (note_type) - { - default: - return NULL; - - case NT_PRPSINFO: - { - char data[136]; - va_list ap; - - va_start (ap, note_type); - memset (data, 0, sizeof (data)); - strncpy (data + 40, va_arg (ap, const char *), 16); - strncpy (data + 56, va_arg (ap, const char *), 80); - va_end (ap); - - return elfcore_write_note (abfd, buf, bufsiz, "CORE", - note_type, data, sizeof (data)); - } - - case NT_PRSTATUS: - { - char data[392]; - va_list ap; - long pid; - int cursig; - const void *greg; - - va_start (ap, note_type); - memset (data, 0, sizeof (data)); - pid = va_arg (ap, long); - bfd_put_32 (abfd, pid, data + 32); - cursig = va_arg (ap, int); - bfd_put_16 (abfd, cursig, data + 12); - greg = va_arg (ap, const void *); - memcpy (data + 112, greg, 272); - va_end (ap); - - return elfcore_write_note (abfd, buf, bufsiz, "CORE", - note_type, data, sizeof (data)); - } - } -} diff --git a/bfd/elfxx-aarch64.h b/bfd/elfxx-aarch64.h index 2a3dd81..5f62543 100644 --- a/bfd/elfxx-aarch64.h +++ b/bfd/elfxx-aarch64.h @@ -58,10 +58,6 @@ _bfd_aarch64_elf_grok_prstatus (bfd *, Elf_Internal_Note *); extern bfd_boolean _bfd_aarch64_elf_grok_psinfo (bfd *, Elf_Internal_Note *); -extern char * -_bfd_aarch64_elf_write_core_note (bfd *, char *, int *, int, ...); - #define elf_backend_add_symbol_hook _bfd_aarch64_elf_add_symbol_hook #define elf_backend_grok_prstatus _bfd_aarch64_elf_grok_prstatus #define elf_backend_grok_psinfo _bfd_aarch64_elf_grok_psinfo -#define elf_backend_write_core_note _bfd_aarch64_elf_write_core_note diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index b3227ed..7827700 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -550,9 +550,6 @@ #ifndef elf_backend_grok_psinfo #define elf_backend_grok_psinfo NULL #endif -#ifndef elf_backend_write_core_note -#define elf_backend_write_core_note NULL -#endif #ifndef elf_backend_lookup_section_flags_hook #define elf_backend_lookup_section_flags_hook NULL #endif @@ -762,7 +759,6 @@ static struct elf_backend_data elfNN_bed = elf_backend_sort_relocs_p, elf_backend_grok_prstatus, elf_backend_grok_psinfo, - elf_backend_write_core_note, elf_backend_lookup_section_flags_hook, elf_backend_reloc_type_class, elf_backend_discard_info, diff --git a/bfd/hosts/x86-64linux.h b/bfd/hosts/x86-64linux.h deleted file mode 100644 index 4e420a1..0000000 --- a/bfd/hosts/x86-64linux.h +++ /dev/null @@ -1,232 +0,0 @@ -/* Copyright (C) 2006-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This is somewhat modelled after the file of the same name on SVR4 - systems. It provides a definition of the core file format for ELF - used on Linux. It doesn't have anything to do with the /proc file - system, even though Linux has one. - - Anyway, the whole purpose of this file is for GDB and GDB only. - Don't read too much into it. Don't use it for anything other than - GDB unless you know what you are doing. */ - -#include <features.h> -#include <sys/time.h> -#include <sys/types.h> - -/* We define here only the symbols differing from their 64-bit variant. */ -#include <sys/procfs.h> - -#ifdef HAVE_STDINT_H -#include <stdint.h> -#else -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; -#endif - -/* Unsigned 64-bit integer aligned to 8 bytes. */ -typedef uint64_t __attribute__ ((__aligned__ (8))) a8_uint64_t; - -#undef HAVE_PRPSINFO32_T -#define HAVE_PRPSINFO32_T -#undef HAVE_PRPSINFO32_T_PR_PID -#define HAVE_PRPSINFO32_T_PR_PID - -#undef HAVE_PRSTATUS32_T -#define HAVE_PRSTATUS32_T - -/* These are the 32-bit x86 structures. */ - -struct user_regs32_struct -{ - int32_t ebx; - int32_t ecx; - int32_t edx; - int32_t esi; - int32_t edi; - int32_t ebp; - int32_t eax; - int32_t xds; - int32_t xes; - int32_t xfs; - int32_t xgs; - int32_t orig_eax; - int32_t eip; - int32_t xcs; - int32_t eflags; - int32_t esp; - int32_t xss; -}; - -struct user_regs64_struct -{ - a8_uint64_t r15; - a8_uint64_t r14; - a8_uint64_t r13; - a8_uint64_t r12; - a8_uint64_t rbp; - a8_uint64_t rbx; - a8_uint64_t r11; - a8_uint64_t r10; - a8_uint64_t r9; - a8_uint64_t r8; - a8_uint64_t rax; - a8_uint64_t rcx; - a8_uint64_t rdx; - a8_uint64_t rsi; - a8_uint64_t rdi; - a8_uint64_t orig_rax; - a8_uint64_t rip; - a8_uint64_t cs; - a8_uint64_t eflags; - a8_uint64_t rsp; - a8_uint64_t ss; - a8_uint64_t fs_base; - a8_uint64_t gs_base; - a8_uint64_t ds; - a8_uint64_t es; - a8_uint64_t fs; - a8_uint64_t gs; -}; - -/* Type for a general-purpose register. */ -typedef uint32_t elf_greg32_t; -typedef a8_uint64_t elf_greg64_t; - -/* And the whole bunch of them. We could have used `struct - user_regs_struct' directly in the typedef, but tradition says that - the register set is an array, which does have some peculiar - semantics, so leave it that way. */ -#define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t)) -typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32]; -#define ELF_NGREG64 (sizeof (struct user_regs64_struct) / sizeof(elf_greg64_t)) -typedef elf_greg64_t elf_gregset64_t[ELF_NGREG64]; - -/* Definitions to generate Intel SVR4-like core files. These mostly - have the same names as the SVR4 types with "elf_" tacked on the - front to prevent clashes with Linux definitions, and the typedef - forms have been avoided. This is mostly like the SVR4 structure, - but more Linuxy, with things that Linux does not support and which - GDB doesn't really use excluded. */ - -struct prstatus32_timeval - { - int tv_sec; - int tv_usec; - }; - -struct prstatus64_timeval - { - a8_uint64_t tv_sec; - a8_uint64_t tv_usec; - }; - -struct elf_prstatus32 - { - struct elf_siginfo pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - unsigned int pr_sigpend; /* Set of pending signals. */ - unsigned int pr_sighold; /* Set of held signals. */ - pid_t pr_pid; - pid_t pr_ppid; - pid_t pr_pgrp; - pid_t pr_sid; - struct prstatus32_timeval pr_utime; /* User time. */ - struct prstatus32_timeval pr_stime; /* System time. */ - struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ - struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ - elf_gregset32_t pr_reg; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - -struct elf_prstatusx32 - { - struct elf_siginfo pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - unsigned int pr_sigpend; /* Set of pending signals. */ - unsigned int pr_sighold; /* Set of held signals. */ - pid_t pr_pid; - pid_t pr_ppid; - pid_t pr_pgrp; - pid_t pr_sid; - struct prstatus32_timeval pr_utime; /* User time. */ - struct prstatus32_timeval pr_stime; /* System time. */ - struct prstatus32_timeval pr_cutime; /* Cumulative user time. */ - struct prstatus32_timeval pr_cstime; /* Cumulative system time. */ - elf_gregset64_t pr_reg; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - -struct elf_prstatus64 - { - struct elf_siginfo pr_info; /* Info associated with signal. */ - short int pr_cursig; /* Current signal. */ - a8_uint64_t pr_sigpend; /* Set of pending signals. */ - a8_uint64_t pr_sighold; /* Set of held signals. */ - pid_t pr_pid; - pid_t pr_ppid; - pid_t pr_pgrp; - pid_t pr_sid; - struct prstatus64_timeval pr_utime; /* User time. */ - struct prstatus64_timeval pr_stime; /* System time. */ - struct prstatus64_timeval pr_cutime; /* Cumulative user time. */ - struct prstatus64_timeval pr_cstime; /* Cumulative system time. */ - elf_gregset64_t pr_reg; /* GP registers. */ - int pr_fpvalid; /* True if math copro being used. */ - }; - -struct elf_prpsinfo32 - { - char pr_state; /* Numeric process state. */ - char pr_sname; /* Char for pr_state. */ - char pr_zomb; /* Zombie. */ - char pr_nice; /* Nice val. */ - unsigned int pr_flag; /* Flags. */ - unsigned short int pr_uid; - unsigned short int pr_gid; - int pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ - }; - -struct elf_prpsinfo64 - { - char pr_state; /* Numeric process state. */ - char pr_sname; /* Char for pr_state. */ - char pr_zomb; /* Zombie. */ - char pr_nice; /* Nice val. */ - a8_uint64_t pr_flag; /* Flags. */ - unsigned int pr_uid; - unsigned int pr_gid; - int pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ - }; - -/* The rest of this file provides the types for emulation of the - Solaris <proc_service.h> interfaces that should be implemented by - users of libthread_db. */ - -/* Process status and info. In the end we do provide typedefs for them. */ -typedef struct elf_prstatus32 prstatus32_t; -typedef struct elf_prstatusx32 prstatusx32_t; -typedef struct elf_prstatus64 prstatus64_t; -typedef struct elf_prpsinfo32 prpsinfo32_t; -typedef struct elf_prpsinfo64 prpsinfo64_t; |