Changeset View
Changeset View
Standalone View
Standalone View
head/devel/gdb/files/kgdb/i386fbsd-kern.c
Show All 21 Lines | |||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include "defs.h" | ||||
#include <sys/proc.h> | #include "frame-unwind.h" | ||||
#include "gdbcore.h" | |||||
#include "inferior.h" | |||||
#include "osabi.h" | |||||
#include "regcache.h" | |||||
#include "progspace.h" | |||||
#include "solib.h" | |||||
#include "trad-frame.h" | |||||
#include "i386-tdep.h" | |||||
#ifdef __i386__ | #ifdef __i386__ | ||||
#include <sys/proc.h> | |||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#include <machine/segments.h> | #include <machine/segments.h> | ||||
#include <machine/tss.h> | #include <machine/tss.h> | ||||
#endif | #endif | ||||
#include <string.h> | |||||
#include <defs.h> | |||||
#include <frame-unwind.h> | |||||
#include "gdbcore.h" | |||||
#include <inferior.h> | |||||
#include "osabi.h" | |||||
#include <regcache.h> | |||||
#include "progspace.h" | |||||
#include "solib.h" | |||||
#include "trad-frame.h" | |||||
#include <i386-tdep.h> | |||||
#include "kgdb.h" | #include "kgdb.h" | ||||
struct i386fbsd_info { | struct i386fbsd_info { | ||||
int ofs_fix; | int ofs_fix; | ||||
}; | }; | ||||
/* Per-program-space data key. */ | /* Per-program-space data key. */ | ||||
static const struct program_space_data *i386fbsd_pspace_data; | static const struct program_space_data *i386fbsd_pspace_data; | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | i386fbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr) | ||||
gdb_byte buf[4]; | gdb_byte buf[4]; | ||||
int i; | int i; | ||||
for (i = 0; i < ARRAY_SIZE (i386fbsd_pcb_offset); i++) | for (i = 0; i < ARRAY_SIZE (i386fbsd_pcb_offset); i++) | ||||
if (i386fbsd_pcb_offset[i] != -1) { | if (i386fbsd_pcb_offset[i] != -1) { | ||||
if (target_read_memory(pcb_addr + i386fbsd_pcb_offset[i], buf, sizeof buf) | if (target_read_memory(pcb_addr + i386fbsd_pcb_offset[i], buf, sizeof buf) | ||||
!= 0) | != 0) | ||||
continue; | continue; | ||||
regcache_raw_supply(regcache, i, buf); | regcache->raw_supply(i, buf); | ||||
} | } | ||||
regcache_raw_supply_unsigned(regcache, I386_CS_REGNUM, CODE_SEL); | regcache->raw_supply_unsigned(I386_CS_REGNUM, CODE_SEL); | ||||
regcache_raw_supply_unsigned(regcache, I386_DS_REGNUM, DATA_SEL); | regcache->raw_supply_unsigned(I386_DS_REGNUM, DATA_SEL); | ||||
regcache_raw_supply_unsigned(regcache, I386_ES_REGNUM, DATA_SEL); | regcache->raw_supply_unsigned(I386_ES_REGNUM, DATA_SEL); | ||||
regcache_raw_supply_unsigned(regcache, I386_FS_REGNUM, PRIV_SEL); | regcache->raw_supply_unsigned(I386_FS_REGNUM, PRIV_SEL); | ||||
regcache_raw_supply_unsigned(regcache, I386_GS_REGNUM, DATA_SEL); | regcache->raw_supply_unsigned(I386_GS_REGNUM, DATA_SEL); | ||||
regcache_raw_supply_unsigned(regcache, I386_SS_REGNUM, DATA_SEL); | regcache->raw_supply_unsigned(I386_SS_REGNUM, DATA_SEL); | ||||
} | } | ||||
#ifdef __i386__ | #ifdef __i386__ | ||||
/* TODO: Make this cross-debugger friendly. */ | /* TODO: Make this cross-debugger friendly. */ | ||||
static const int i386fbsd_tss_offset[] = { | static const int i386fbsd_tss_offset[] = { | ||||
10 * 4, /* %eax */ | 10 * 4, /* %eax */ | ||||
11 * 4, /* %ecx */ | 11 * 4, /* %ecx */ | ||||
12 * 4, /* %edx */ | 12 * 4, /* %edx */ | ||||
▲ Show 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
frame_unwind_prepend_unwinder(gdbarch, &i386fbsd_trapframe_unwind); | frame_unwind_prepend_unwinder(gdbarch, &i386fbsd_trapframe_unwind); | ||||
set_solib_ops(gdbarch, &kld_so_ops); | set_solib_ops(gdbarch, &kld_so_ops); | ||||
fbsd_vmcore_set_supply_pcb(gdbarch, i386fbsd_supply_pcb); | fbsd_vmcore_set_supply_pcb(gdbarch, i386fbsd_supply_pcb); | ||||
fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb); | fbsd_vmcore_set_cpu_pcb_addr(gdbarch, kgdb_trgt_stop_pcb); | ||||
} | } | ||||
void _initialize_i386_kgdb_tdep(void); | |||||
void | void | ||||
_initialize_i386_kgdb_tdep(void) | _initialize_i386_kgdb_tdep(void) | ||||
{ | { | ||||
/* This is used for both i386 and amd64, but amd64 always | /* This is used for both i386 and amd64, but amd64 always | ||||
includes this target, so just include it here. */ | includes this target, so just include it here. */ | ||||
gdbarch_register_osabi_sniffer(bfd_arch_i386, | gdbarch_register_osabi_sniffer(bfd_arch_i386, | ||||
bfd_target_elf_flavour, | bfd_target_elf_flavour, | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |