ELF core files
This commit is contained in:
committed by
Ben Gras
parent
ebdac755af
commit
eaa29370f4
@@ -4,5 +4,5 @@
|
||||
INCS+= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \
|
||||
interrupt.h memory.h multiboot.h partition.h \
|
||||
pci.h pci_amd.h pci_intel.h pci_sis.h pci_via.h \
|
||||
ports.h stackframe.h vm.h elf.h
|
||||
ports.h stackframe.h vm.h elf.h elf_machdep.h
|
||||
|
||||
|
||||
63
common/include/arch/i386/elf_machdep.h
Normal file
63
common/include/arch/i386/elf_machdep.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* $NetBSD: elf_machdep.h,v 1.10 2009/05/30 05:56:52 skrll Exp $ */
|
||||
|
||||
#define ELF32_MACHDEP_ENDIANNESS ELFDATA2LSB
|
||||
#define ELF32_MACHDEP_ID_CASES \
|
||||
case EM_386: \
|
||||
case EM_486: \
|
||||
break;
|
||||
|
||||
#define ELF64_MACHDEP_ENDIANNESS XXX /* break compilation */
|
||||
#define ELF64_MACHDEP_ID_CASES \
|
||||
/* no 64-bit ELF machine types supported */
|
||||
|
||||
#define ELF32_MACHDEP_ID EM_386
|
||||
|
||||
#define ARCH_ELFSIZE 32 /* MD native binary size */
|
||||
|
||||
/* i386 relocations */
|
||||
#define R_386_NONE 0
|
||||
#define R_386_32 1
|
||||
#define R_386_PC32 2
|
||||
#define R_386_GOT32 3
|
||||
#define R_386_PLT32 4
|
||||
#define R_386_COPY 5
|
||||
#define R_386_GLOB_DAT 6
|
||||
#define R_386_JMP_SLOT 7
|
||||
#define R_386_RELATIVE 8
|
||||
#define R_386_GOTOFF 9
|
||||
#define R_386_GOTPC 10
|
||||
|
||||
/* TLS relocations */
|
||||
#define R_386_TLS_TPOFF 14
|
||||
#define R_386_TLS_IE 15
|
||||
#define R_386_TLS_GOTIE 16
|
||||
#define R_386_TLS_LE 17
|
||||
#define R_386_TLS_GD 18
|
||||
#define R_386_TLS_LDM 19
|
||||
|
||||
/* The following relocations are GNU extensions. */
|
||||
#define R_386_16 20
|
||||
#define R_386_PC16 21
|
||||
#define R_386_8 22
|
||||
#define R_386_PC8 23
|
||||
|
||||
/* More TLS relocations */
|
||||
#define R_386_TLS_GD_32 24
|
||||
#define R_386_TLS_GD_PUSH 25
|
||||
#define R_386_TLS_GD_CALL 26
|
||||
#define R_386_TLS_GD_POP 27
|
||||
#define R_386_TLS_LDM_32 28
|
||||
#define R_386_TLS_LDM_PUSH 29
|
||||
#define R_386_TLS_LDM_CALL 30
|
||||
#define R_386_TLS_LDM_POP 31
|
||||
#define R_386_TLS_LDO_32 32
|
||||
#define R_386_TLS_IE_32 33
|
||||
#define R_386_TLS_LE_32 34
|
||||
#define R_386_TLS_DTPMOD32 35
|
||||
#define R_386_TLS_DTPOFF32 36
|
||||
#define R_386_TLS_TPOFF32 37
|
||||
#define R_386_TLS_GOTDESC 39
|
||||
#define R_386_TLS_DESC_CALL 40
|
||||
#define R_386_TLS_DESC 41
|
||||
|
||||
#define R_TYPE(name) __CONCAT(R_386_,name)
|
||||
@@ -792,6 +792,9 @@
|
||||
# define PM_PPROC m1_i2 /* parent process endpoint */
|
||||
# define PM_CPID m1_i3 /* child pid */
|
||||
|
||||
/* Additional parameters for PM_DUMPCORE */
|
||||
# define PM_TERM_SIG m1_i2 /* process's termination signal */
|
||||
|
||||
/* Parameters for the EXEC_NEWMEM call */
|
||||
#define EXC_NM_PROC m1_i1 /* process that needs new map */
|
||||
#define EXC_NM_PTR m1_p1 /* parameters in struct exec_newmem */
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
INCS+= elf32.h elf64.h elf_common.h elf_generic.h \
|
||||
ioc_file.h ioc_tape.h ioc_disk.h \
|
||||
ioc_memory.h ioc_sound.h ioc_tty.h \
|
||||
kbdio.h mtio.h svrctl.h video.h vm.h
|
||||
kbdio.h mtio.h svrctl.h video.h vm.h procfs.h elf_core.h exec_elf.h
|
||||
|
||||
|
||||
50
common/include/sys/elf_core.h
Normal file
50
common/include/sys/elf_core.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file mainly provides a definition of the structures used
|
||||
* to describe the notes section of an ELF file.
|
||||
*
|
||||
* It is the interface between MINIX core dump and GDB
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ELF_CORE_H_
|
||||
#define _SYS_ELF_CORE_H_
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <machine/stackframe.h>
|
||||
|
||||
/* MINIX core file format:
|
||||
*
|
||||
* The core file is in ELF format. Besides the regular program segments,
|
||||
* it has a NOTE segment which contains two NOTE entries
|
||||
* - one containing a minix_elfcore_info_t and the other one containing
|
||||
* the general purpose registers (a stackframe_s structure)
|
||||
*/
|
||||
|
||||
typedef struct stackframe_s gregset_t; /* General purpose registers */
|
||||
|
||||
/*
|
||||
* A lot more things should be added to these structures. At present,
|
||||
* they contain the absolute bare minimum required to allow GDB to work
|
||||
* with MINIX ELF core dumps.
|
||||
*/
|
||||
|
||||
#define ELF_NOTE_MINIX_ELFCORE_NAME "MINIX-CORE"
|
||||
#define NT_MINIX_ELFCORE_INFO 1
|
||||
#define NT_MINIX_ELFCORE_GREGS 2
|
||||
|
||||
#define MINIX_ELFCORE_VERSION 1 /* Current version of minix_elfcore_info_t */
|
||||
#define RESERVED_SIZE 5
|
||||
|
||||
typedef struct minix_elfcore_info {
|
||||
/* Version 1 fields */
|
||||
uint32_t mei_version; /* Version number of struct */
|
||||
uint32_t mei_meisize; /* sizeof(minix_elfcore_info_t) */
|
||||
uint32_t mei_signo; /* killing signal */
|
||||
int32_t mei_pid; /* Process ID */
|
||||
int8_t mei_command[MAXCOMLEN]; /* Command */
|
||||
uint32_t flags; /* Flags */
|
||||
int32_t reserved[RESERVED_SIZE];/* Reserved space*/
|
||||
/* Put below version 2 fields */
|
||||
} minix_elfcore_info_t;
|
||||
|
||||
#endif /* _SYS_ELF_CORE_H_ */
|
||||
|
||||
@@ -70,6 +70,7 @@ __ElfType(Sword);
|
||||
__ElfType(Word);
|
||||
__ElfType(Ehdr);
|
||||
__ElfType(Shdr);
|
||||
__ElfType(Nhdr);
|
||||
__ElfType(Phdr);
|
||||
__ElfType(Dyn);
|
||||
__ElfType(Rel);
|
||||
|
||||
1090
common/include/sys/exec_elf.h
Normal file
1090
common/include/sys/exec_elf.h
Normal file
File diff suppressed because it is too large
Load Diff
61
common/include/sys/procfs.h
Normal file
61
common/include/sys/procfs.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file mainly provides a definition of the structures used
|
||||
* to describe the notes section of an ELF file. It doesn't have
|
||||
* anything to do with the /proc file system, even though MINIX
|
||||
* has one.
|
||||
*
|
||||
* The whole purpose of this file is for GDB and GDB only.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_PROCFS_H_
|
||||
#define _SYS_PROCFS_H_
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <i386/stackframe.h>
|
||||
|
||||
/*
|
||||
*
|
||||
* These structures define an interface between core files and the debugger.
|
||||
* Never change or delete any elements. These structures are modeled from
|
||||
* the file with the same name from FreeBSD
|
||||
*
|
||||
* A lot more things should be added to these structures. At present,
|
||||
* they contain the absolute bare minimum required to allow GDB to work
|
||||
* with ELF core dumps.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The parenthsized numbers like (1) indicate the minimum version number
|
||||
* for which each element exists in the structure.
|
||||
*/
|
||||
|
||||
#define PRSTATUS_VERSION 1 /* Current version of prstatus_t */
|
||||
|
||||
typedef struct prstatus {
|
||||
int pr_version; /* Version number of struct (1) */
|
||||
size_t pr_statussz; /* sizeof(prstatus_t) (1) */
|
||||
size_t pr_gregsetsz; /* sizeof(gregset_t) (1) */
|
||||
size_t pr_fpregsetsz; /* sizeof(fpregset_t) (1) */
|
||||
int pr_osreldate; /* Kernel version (1) */
|
||||
int pr_cursig; /* Current signal (1) */
|
||||
pid_t pr_pid; /* Process ID (1) */
|
||||
gregset_t pr_reg; /* General purpose registers (1) */
|
||||
} prstatus_t;
|
||||
|
||||
#define PRARGSZ 80 /* Maximum argument bytes saved */
|
||||
|
||||
#ifndef MAXCOMLEN
|
||||
# define MAXCOMLEN 16 /* Maximum command line arguments */
|
||||
#endif
|
||||
|
||||
#define PRPSINFO_VERSION 1 /* Current version of prpsinfo_t */
|
||||
|
||||
typedef struct prpsinfo {
|
||||
int pr_version; /* Version number of struct (1) */
|
||||
size_t pr_psinfosz; /* sizeof(prpsinfo_t) (1) */
|
||||
char pr_fname[MAXCOMLEN+1]; /* Command name, null terminated (1) */
|
||||
char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */
|
||||
} prpsinfo_t;
|
||||
|
||||
#endif /* _SYS_PROCFS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user