ELF core files

This commit is contained in:
Adriana Szekeres
2011-07-30 06:03:23 +00:00
committed by Ben Gras
parent ebdac755af
commit eaa29370f4
17 changed files with 544 additions and 17 deletions

View File

@@ -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

View 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_ */

View File

@@ -70,6 +70,7 @@ __ElfType(Sword);
__ElfType(Word);
__ElfType(Ehdr);
__ElfType(Shdr);
__ElfType(Nhdr);
__ElfType(Phdr);
__ElfType(Dyn);
__ElfType(Rel);

File diff suppressed because it is too large Load Diff

View 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_ */