Changeset View
Changeset View
Standalone View
Standalone View
devel/gdb/files/kgdb/fbsd-kvm.c
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#include <frame-unwind.h> | #include <frame-unwind.h> | ||||
#include <gdb.h> | #include <gdb.h> | ||||
#include <gdbcore.h> | #include <gdbcore.h> | ||||
#include <gdbthread.h> | #include <gdbthread.h> | ||||
#include "gdb_obstack.h" | #include "gdb_obstack.h" | ||||
#include <inferior.h> | #include <inferior.h> | ||||
#include <language.h> | #include <language.h> | ||||
#include "objfiles.h" | #include "objfiles.h" | ||||
#include "osabi.h" | |||||
#include <regcache.h> | #include <regcache.h> | ||||
#include <solib.h> | #include <solib.h> | ||||
#include <target.h> | #include <target.h> | ||||
#include <ui-out.h> | #include <ui-out.h> | ||||
#include "kgdb.h" | #include "kgdb.h" | ||||
static CORE_ADDR stoppcbs; | static CORE_ADDR stoppcbs; | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | |||||
enum gdb_osabi | enum gdb_osabi | ||||
fbsd_kernel_osabi_sniffer(bfd *abfd) | fbsd_kernel_osabi_sniffer(bfd *abfd) | ||||
{ | { | ||||
asection *s; | asection *s; | ||||
bfd_byte buf[sizeof(KERNEL_INTERP)]; | bfd_byte buf[sizeof(KERNEL_INTERP)]; | ||||
bfd_byte *bufp; | bfd_byte *bufp; | ||||
/* FreeBSD ELF kernels have a FreeBSD/ELF OS ABI. */ | /* First, determine if this is a FreeBSD/ELF binary. */ | ||||
if (elf_elfheader(abfd)->e_ident[EI_OSABI] != ELFOSABI_FREEBSD) | switch (elf_elfheader(abfd)->e_ident[EI_OSABI]) { | ||||
case ELFOSABI_FREEBSD: | |||||
break; | |||||
case ELFOSABI_NONE: { | |||||
enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; | |||||
bfd_map_over_sections (abfd, | |||||
generic_elf_osabi_sniff_abi_tag_sections, | |||||
&osabi); | |||||
/* | |||||
* aarch64 kernels don't have the right note tag for | |||||
* kernels so just look for /red/herring anyway. | |||||
*/ | |||||
if (osabi == GDB_OSABI_UNKNOWN && | |||||
elf_elfheader(abfd)->e_machine == EM_AARCH64) | |||||
break; | |||||
if (osabi != GDB_OSABI_FREEBSD) | |||||
return (GDB_OSABI_UNKNOWN); | return (GDB_OSABI_UNKNOWN); | ||||
} | |||||
default: | |||||
return (GDB_OSABI_UNKNOWN); | |||||
} | |||||
/* FreeBSD ELF kernels have an interpreter path of "/red/herring". */ | /* FreeBSD ELF kernels have an interpreter path of "/red/herring". */ | ||||
bufp = buf; | bufp = buf; | ||||
s = bfd_get_section_by_name(abfd, ".interp"); | s = bfd_get_section_by_name(abfd, ".interp"); | ||||
if (s != NULL && bfd_section_size(abfd, s) == sizeof(buf) && | if (s != NULL && bfd_section_size(abfd, s) == sizeof(buf) && | ||||
bfd_get_full_section_contents(abfd, s, &bufp) && | bfd_get_full_section_contents(abfd, s, &bufp) && | ||||
memcmp(buf, KERNEL_INTERP, sizeof(buf)) == 0) | memcmp(buf, KERNEL_INTERP, sizeof(buf)) == 0) | ||||
return (GDB_OSABI_FREEBSD_KERNEL); | return (GDB_OSABI_FREEBSD_KERNEL); | ||||
▲ Show 20 Lines • Show All 398 Lines • Show Last 20 Lines |