mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 18:44:20 +08:00
Use core regset iterators on GNU Hurd
Remove native-only core file handling on GNU Hurd. Instead, enable the x86 target generic core regset logic on the Hurd by providing an appropriate register offset map. Thanks to Samuel Thibault for testing! gdb/ * config/i386/i386gnu.mh (NATDEPFILES): Remove core-regset.o. * i386gnu-nat.c: Do not include <sys/procfs.h> or "gregset.h". (CREG_OFFSET, creg_offset, CREG_ADDR): Remove. (supply_gregset, supply_fpregset): Remove. * i386gnu-tdep.c (i386gnu_gregset_reg_offset): New variable. (i386gnu_init_abi): Set tdep->gregset_reg_offset, gregset_num_regs, and sizeof_gregset.
This commit is contained in:
parent
591f7597d4
commit
ac3d87c0d2
@ -1,3 +1,13 @@
|
|||||||
|
2014-12-01 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
|
* config/i386/i386gnu.mh (NATDEPFILES): Remove core-regset.o.
|
||||||
|
* i386gnu-nat.c: Do not include <sys/procfs.h> or "gregset.h".
|
||||||
|
(CREG_OFFSET, creg_offset, CREG_ADDR): Remove.
|
||||||
|
(supply_gregset, supply_fpregset): Remove.
|
||||||
|
* i386gnu-tdep.c (i386gnu_gregset_reg_offset): New variable.
|
||||||
|
(i386gnu_init_abi): Set tdep->gregset_reg_offset, gregset_num_regs,
|
||||||
|
and sizeof_gregset.
|
||||||
|
|
||||||
2014-11-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2014-11-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
Add add-auto-load-scripts-directory.
|
Add add-auto-load-scripts-directory.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Host: Intel 386 running the GNU Hurd
|
# Host: Intel 386 running the GNU Hurd
|
||||||
NATDEPFILES= i386gnu-nat.o gnu-nat.o \
|
NATDEPFILES= i386gnu-nat.o gnu-nat.o \
|
||||||
x86-nat.o x86-dregs.o core-regset.o fork-child.o \
|
x86-nat.o x86-dregs.o fork-child.o \
|
||||||
notify_S.o process_reply_S.o msg_reply_S.o \
|
notify_S.o process_reply_S.o msg_reply_S.o \
|
||||||
msg_U.o exc_request_U.o exc_request_S.o
|
msg_U.o exc_request_U.o exc_request_S.o
|
||||||
HAVE_NATIVE_GCORE_HOST = 1
|
HAVE_NATIVE_GCORE_HOST = 1
|
||||||
|
@ -34,11 +34,6 @@
|
|||||||
#include "inf-child.h"
|
#include "inf-child.h"
|
||||||
#include "i387-tdep.h"
|
#include "i387-tdep.h"
|
||||||
|
|
||||||
#ifdef HAVE_SYS_PROCFS_H
|
|
||||||
# include <sys/procfs.h>
|
|
||||||
# include "gregset.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Offset to the thread_state_t location where REG is stored. */
|
/* Offset to the thread_state_t location where REG is stored. */
|
||||||
#define REG_OFFSET(reg) offsetof (struct i386_thread_state, reg)
|
#define REG_OFFSET(reg) offsetof (struct i386_thread_state, reg)
|
||||||
|
|
||||||
@ -52,21 +47,7 @@ static int reg_offset[] =
|
|||||||
REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs)
|
REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Offset to the greg_t location where REG is stored. */
|
|
||||||
#define CREG_OFFSET(reg) (REG_##reg * 4)
|
|
||||||
|
|
||||||
/* At CREG_OFFSET[N] is the offset to the greg_t location where
|
|
||||||
the GDB register N is stored. */
|
|
||||||
static int creg_offset[] =
|
|
||||||
{
|
|
||||||
CREG_OFFSET (EAX), CREG_OFFSET (ECX), CREG_OFFSET (EDX), CREG_OFFSET (EBX),
|
|
||||||
CREG_OFFSET (UESP), CREG_OFFSET (EBP), CREG_OFFSET (ESI), CREG_OFFSET (EDI),
|
|
||||||
CREG_OFFSET (EIP), CREG_OFFSET (EFL), CREG_OFFSET (CS), CREG_OFFSET (SS),
|
|
||||||
CREG_OFFSET (DS), CREG_OFFSET (ES), CREG_OFFSET (FS), CREG_OFFSET (GS)
|
|
||||||
};
|
|
||||||
|
|
||||||
#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
|
#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
|
||||||
#define CREG_ADDR(state, regnum) ((const char *)(state) + creg_offset[regnum])
|
|
||||||
|
|
||||||
|
|
||||||
/* Get the whole floating-point state of THREAD and record the values
|
/* Get the whole floating-point state of THREAD and record the values
|
||||||
@ -100,24 +81,6 @@ fetch_fpregs (struct regcache *regcache, struct proc *thread)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SYS_PROCFS_H
|
|
||||||
/* These two calls are used by the core-regset.c code for
|
|
||||||
reading ELF core files. */
|
|
||||||
void
|
|
||||||
supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregs)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < I386_NUM_GREGS; i++)
|
|
||||||
regcache_raw_supply (regcache, i, CREG_ADDR (gregs, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
|
|
||||||
{
|
|
||||||
i387_supply_fsave (regcache, -1, fpregs);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Fetch register REGNO, or all regs if REGNO is -1. */
|
/* Fetch register REGNO, or all regs if REGNO is -1. */
|
||||||
static void
|
static void
|
||||||
gnu_fetch_registers (struct target_ops *ops,
|
gnu_fetch_registers (struct target_ops *ops,
|
||||||
|
@ -22,6 +22,27 @@
|
|||||||
|
|
||||||
#include "i386-tdep.h"
|
#include "i386-tdep.h"
|
||||||
|
|
||||||
|
/* From <sys/ucontext.h>. */
|
||||||
|
static int i386gnu_gregset_reg_offset[] =
|
||||||
|
{
|
||||||
|
11 * 4, /* %eax */
|
||||||
|
10 * 4, /* %ecx */
|
||||||
|
9 * 4, /* %edx */
|
||||||
|
8 * 4, /* %ebx */
|
||||||
|
17 * 4, /* %uesp */
|
||||||
|
6 * 4, /* %ebp */
|
||||||
|
5 * 4, /* %esi */
|
||||||
|
4 * 4, /* %edi */
|
||||||
|
14 * 4, /* %eip */
|
||||||
|
16 * 4, /* %efl */
|
||||||
|
15 * 4, /* %cs */
|
||||||
|
18 * 4, /* %ss */
|
||||||
|
3 * 4, /* %ds */
|
||||||
|
2 * 4, /* %es */
|
||||||
|
1 * 4, /* %fs */
|
||||||
|
0 * 4, /* %gs */
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
@ -33,6 +54,10 @@ i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|||||||
set_solib_svr4_fetch_link_map_offsets
|
set_solib_svr4_fetch_link_map_offsets
|
||||||
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||||
|
|
||||||
|
tdep->gregset_reg_offset = i386gnu_gregset_reg_offset;
|
||||||
|
tdep->gregset_num_regs = ARRAY_SIZE (i386gnu_gregset_reg_offset);
|
||||||
|
tdep->sizeof_gregset = 19 * 4;
|
||||||
|
|
||||||
tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
|
tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user