Index: gdb/configure.host =================================================================== RCS file: /nfs/CVS/gdb6/gdb/configure.host,v retrieving revision 1.1.1.5 retrieving revision 1.6 diff -u -r1.1.1.5 -r1.6 --- gdb/configure.host 18 Mar 2004 03:02:13 -0000 1.1.1.5 +++ gdb/configure.host 18 Mar 2004 04:58:48 -0000 1.6 @@ -80,6 +80,7 @@ i[34567]86-*-cygwin*) gdb_host=cygwin ;; ia64-*-aix*) gdb_host=aix ;; +ia64-*-freebsd*) gdb_host=fbsd ;; ia64-*-linux*) gdb_host=linux ;; # OBSOLETE m680[01]0-sun-sunos3*) gdb_host=sun2os3 ;; Index: gdb/ia64-aix-tdep.c =================================================================== RCS file: /nfs/CVS/gdb6/gdb/ia64-aix-tdep.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- gdb/ia64-aix-tdep.c 1 Oct 2003 07:21:08 -0000 1.1.1.1 +++ gdb/ia64-aix-tdep.c 6 Dec 2003 21:06:24 -0000 1.3 @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "ia64-tdep.h" /* External hook for finding gate addresses on AIX. */ void (*aix5_find_gate_addresses_hook) (CORE_ADDR *, CORE_ADDR *) = 0; @@ -27,6 +28,17 @@ /* Offset to sc_context member of sigcontext structure from frame of handler */ #define IA64_AIX_SIGCONTEXT_OFFSET 64 +/* Hook for determining the global pointer when calling functions in + the inferior under AIX. The initialization code in ia64-aix-nat.c + sets this hook to the address of a function which will find the + global pointer for a given address. + + The generic code which uses the dynamic section in the inferior for + finding the global pointer is not of much use on AIX since the + values obtained from the inferior have not been relocated. */ + +CORE_ADDR (*native_find_global_pointer) (CORE_ADDR) = 0; + /* Return a non-zero value iff PC is in a signal trampoline. On AIX, we determine this by seeing if the pc is in a special execute only page called the ``gate page''. The addresses in @@ -104,4 +116,24 @@ default : return 0; } +} + +static void +ia64_aix_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + set_gdbarch_pc_in_sigtramp (gdbarch, ia64_aix_in_sigtramp); + tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address; + if (native_find_global_pointer != NULL) + tdep->find_global_pointer = native_find_global_pointer; + else + tdep->find_global_pointer = ia64_generic_find_global_pointer; +} + +void +_initialize_ia64_aix_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_ia64, 0ul, GDB_OSABI_SVR4, + ia64_aix_init_abi); } Index: gdb/ia64-fbsd-nat.c =================================================================== RCS file: gdb/ia64-fbsd-nat.c diff -N gdb/ia64-fbsd-nat.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/ia64-fbsd-nat.c 17 Mar 2004 06:00:09 -0000 1.4 @@ -0,0 +1,410 @@ +/* GNU GPL */ + +#include "defs.h" +#include "inferior.h" +#include "regcache.h" + +#include +#include +#include + +#ifdef HAVE_SYS_PROCFS_H +#include +#endif + +#ifndef HAVE_GREGSET_T +typedef struct reg gregset_t; +#endif + +#ifndef HAVE_FPREGSET_T +typedef struct fpreg fpregset_t; +#endif + +#include "gregset.h" + +/* These must match the order of the register names. + + Some sort of lookup table is needed because the offsets associated + with the registers are all over the board. */ + +#define PRESERVED(x) offsetof(struct reg, r_preserved) \ + + offsetof(struct _callee_saved, x) +#define SCRATCH(x) offsetof(struct reg, r_scratch) \ + + offsetof(struct _caller_saved, x) +#define SPECIAL(x) offsetof(struct reg, r_special) \ + + offsetof(struct _special, x) + +#define HIGH_FP(x) offsetof(struct fpreg, fpr_high) \ + + offsetof(struct _high_fp, x) +#define PRESERVED_FP(x) offsetof(struct fpreg, fpr_preserved) \ + + offsetof(struct _callee_saved_fp, x) +#define SCRATCH_FP(x) offsetof(struct fpreg, fpr_scratch) \ + + offsetof(struct _caller_saved_fp, x) + +static int reg_offset[] = { + /* + * general registers (0-127) + */ + -1, /* gr0 */ + SPECIAL(gp), + SCRATCH(gr2), SCRATCH(gr3), + PRESERVED(gr4), PRESERVED(gr5), PRESERVED(gr6), PRESERVED(gr7), + SCRATCH(gr8), SCRATCH(gr9), SCRATCH(gr10), SCRATCH(gr11), + SPECIAL(sp), SPECIAL(tp), + SCRATCH(gr14), SCRATCH(gr15), SCRATCH(gr16), SCRATCH(gr17), + SCRATCH(gr18), SCRATCH(gr19), SCRATCH(gr20), SCRATCH(gr21), + SCRATCH(gr22), SCRATCH(gr23), SCRATCH(gr24), SCRATCH(gr25), + SCRATCH(gr26), SCRATCH(gr27), SCRATCH(gr28), SCRATCH(gr29), + SCRATCH(gr30), SCRATCH(gr31), + /* + * gr32 through gr127 are not directly available via the ptrace + * interface + */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr32-gr39 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr40-gr47 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr48-gr55 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr56-gr63 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr64-gr71 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr72-gr79 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr80-gr87 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr88-gr95 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr96-gr103 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr104-gr111 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr112-gr119 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* gr120-gr127 */ + /* + * floating-point registers (128-255) + */ + -1, /* fr0: constant 0.0 */ + -1, /* fr1: constant 1.0 */ + PRESERVED_FP(fr2), PRESERVED_FP(fr3), + PRESERVED_FP(fr4), PRESERVED_FP(fr5), + SCRATCH_FP(fr6), SCRATCH_FP(fr7), + SCRATCH_FP(fr8), SCRATCH_FP(fr9), + SCRATCH_FP(fr10), SCRATCH_FP(fr11), + SCRATCH_FP(fr12), SCRATCH_FP(fr13), + SCRATCH_FP(fr14), SCRATCH_FP(fr15), + PRESERVED_FP(fr16), PRESERVED_FP(fr17), + PRESERVED_FP(fr18), PRESERVED_FP(fr19), + PRESERVED_FP(fr20), PRESERVED_FP(fr21), + PRESERVED_FP(fr22), PRESERVED_FP(fr23), + PRESERVED_FP(fr24), PRESERVED_FP(fr25), + PRESERVED_FP(fr26), PRESERVED_FP(fr27), + PRESERVED_FP(fr28), PRESERVED_FP(fr29), + PRESERVED_FP(fr30), PRESERVED_FP(fr31), + HIGH_FP(fr32), HIGH_FP(fr33), HIGH_FP(fr34), HIGH_FP(fr35), + HIGH_FP(fr36), HIGH_FP(fr37), HIGH_FP(fr38), HIGH_FP(fr39), + HIGH_FP(fr40), HIGH_FP(fr41), HIGH_FP(fr42), HIGH_FP(fr43), + HIGH_FP(fr44), HIGH_FP(fr45), HIGH_FP(fr46), HIGH_FP(fr47), + HIGH_FP(fr48), HIGH_FP(fr49), HIGH_FP(fr50), HIGH_FP(fr51), + HIGH_FP(fr52), HIGH_FP(fr53), HIGH_FP(fr54), HIGH_FP(fr55), + HIGH_FP(fr56), HIGH_FP(fr57), HIGH_FP(fr58), HIGH_FP(fr59), + HIGH_FP(fr60), HIGH_FP(fr61), HIGH_FP(fr62), HIGH_FP(fr63), + HIGH_FP(fr64), HIGH_FP(fr65), HIGH_FP(fr66), HIGH_FP(fr67), + HIGH_FP(fr68), HIGH_FP(fr69), HIGH_FP(fr70), HIGH_FP(fr71), + HIGH_FP(fr72), HIGH_FP(fr73), HIGH_FP(fr74), HIGH_FP(fr75), + HIGH_FP(fr76), HIGH_FP(fr77), HIGH_FP(fr78), HIGH_FP(fr79), + HIGH_FP(fr80), HIGH_FP(fr81), HIGH_FP(fr82), HIGH_FP(fr83), + HIGH_FP(fr84), HIGH_FP(fr85), HIGH_FP(fr86), HIGH_FP(fr87), + HIGH_FP(fr88), HIGH_FP(fr89), HIGH_FP(fr90), HIGH_FP(fr91), + HIGH_FP(fr92), HIGH_FP(fr93), HIGH_FP(fr94), HIGH_FP(fr95), + HIGH_FP(fr96), HIGH_FP(fr97), HIGH_FP(fr98), HIGH_FP(fr99), + HIGH_FP(fr100), HIGH_FP(fr101), HIGH_FP(fr102), HIGH_FP(fr103), + HIGH_FP(fr104), HIGH_FP(fr105), HIGH_FP(fr106), HIGH_FP(fr107), + HIGH_FP(fr108), HIGH_FP(fr109), HIGH_FP(fr110), HIGH_FP(fr111), + HIGH_FP(fr112), HIGH_FP(fr113), HIGH_FP(fr114), HIGH_FP(fr115), + HIGH_FP(fr116), HIGH_FP(fr117), HIGH_FP(fr118), HIGH_FP(fr119), + HIGH_FP(fr120), HIGH_FP(fr121), HIGH_FP(fr122), HIGH_FP(fr123), + HIGH_FP(fr124), HIGH_FP(fr125), HIGH_FP(fr126), HIGH_FP(fr127), + /* + * predicate registers - (256-319) + */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr0-pr7 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr8-pr15 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr16-pr23 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr24-pr31 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr32-pr39 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr40-pr47 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr48-pr55 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* pr56-pr63 */ + /* + * branch registers (320+327) + */ + SPECIAL(rp), + PRESERVED(br1), PRESERVED(br2), PRESERVED(br3), PRESERVED(br4), + PRESERVED(br5), + SCRATCH(br6), SCRATCH(br7), + /* + * Misc other registers (328-333) + */ + -1, -1, + SPECIAL(pr), + SPECIAL(iip), + SPECIAL(psr), + SPECIAL(cfm), + /* + * application registers (334-461) + */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar.k0-ar.k7 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar8-ar15 (reserved) */ + SPECIAL(rsc), /* ar.rsc */ + -1, /* ar.bsp */ + SPECIAL(bspstore), /* ar.bspstore */ + SPECIAL(rnat), /* ar.rnat */ + -1, /* ar20 (reserved) */ + -1, /* ar.fcr */ + -1, -1, /* ar22-ar23 (reserved) */ + -1, /* ar.eflag */ + SCRATCH(csd), /* ar.csd */ + SCRATCH(ssd), /* ar.ssd */ + -1, /* ar.cflg */ + -1, /* ar.fsr */ + -1, /* ar.fir */ + -1, /* ar.fdr */ + -1, /* ar31 (reserved) */ + SCRATCH(ccv), /* ar.ccv */ + -1, -1, -1, /* ar33-ar35 (reserved) */ + SPECIAL(unat), /* ar.unat */ + -1, -1, -1, /* ar37-ar39 (reserved) */ + SPECIAL(fpsr), /* ar.fpsr */ + -1, -1, -1, /* ar41-ar43 (reserved) */ + -1, /* ar.itc */ + -1, -1, -1, /* ar45-ar47 (reserved) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar48-ar55 (ignored) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar56-ar63 (ignored) */ + SPECIAL(pfs), /* ar.pfs */ + PRESERVED(lc), /* ar.lc */ + -1, /* ar.ec */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar67-ar74 (reserved) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar75-ar82 (reserved) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar83-ar90 (reserved) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar91-ar98 (reserved) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar99-ar106 (reserved) */ + -1, -1, -1, -1, -1, /* ar107-ar111 (reserved) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar112-ar119 (ignored) */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ar120-ar127 (ignored) */ + /* + * nat bits - not fetched directly; instead we obtain these bits + * from either rnat or unat or from memory. + */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +}; + +static __inline int +getfpregs_supplies (int regno) +{ + return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM); +} + +static __inline int +getregs_supplies (int regno) +{ + return (regno < IA64_FR0_REGNUM || regno > IA64_FR127_REGNUM); +} + +static void +supply_fpreg (struct fpreg *fpr, int regno) +{ + int ofs; + + if (regno < 0 || regno >= NUM_REGS) + return; + if (!getfpregs_supplies (regno)) + return; + + ofs = reg_offset[regno]; + if (ofs < 0) + supply_register (regno, NULL); + else + supply_register (regno, (char*)fpr + ofs); +} + +static void +supply_fpregs (struct fpreg *fpr, int regno) +{ + if (regno == -1) + { + for (regno = 0; regno < NUM_REGS; regno++) + supply_fpreg (fpr, regno); + } + else + { + supply_fpreg (fpr, regno); + } +} + +static void +supply_reg (struct reg *r, int regno) +{ + int ofs; + + if (regno < 0 || regno >= NUM_REGS) + return; + if (!getregs_supplies (regno)) + return; + + ofs = reg_offset[regno]; + if (ofs < 0) + { + if (regno >= IA64_GR32_REGNUM && regno <= IA64_GR127_REGNUM) + { + supply_register (regno, NULL); + } + else if (regno == IA64_BSP_REGNUM) + { + unsigned long tmp = r->r_special.bspstore + r->r_special.ndirty; + supply_register (regno, (char*)&tmp); + } + else + { +#if 0 + printf_filtered ("%s: fetching register %d\n", __func__, regno); +#endif + supply_register (regno, NULL); + } + } + else + { + supply_register (regno, (char*)r + ofs); + } +} + +static void +supply_regs(struct reg *r, int regno) +{ + if (regno == -1) + { + for (regno = 0; regno < NUM_REGS; regno++) + supply_reg (r, regno); + } + else + { + supply_reg (r, regno); + } +} + +/* + * + */ + +void +fill_fpregset(fpregset_t *fpr, int regno) +{ + printf_filtered("XXX: %s(%p,%d)\n", __func__, fpr, regno); +} + +void +fill_gregset (gregset_t *r, int regno) +{ + printf_filtered("XXX: %s(%p,%d)\n", __func__, r, regno); +} + +void +fetch_inferior_registers (int regno) +{ + union { + fpregset_t fpr; + gregset_t r; + } regs; + + if (regno == -1 || getregs_supplies (regno)) + { + if (ptrace (PT_GETREGS, PIDGET(inferior_ptid), + (PTRACE_ARG3_TYPE)®s.r, 0) == -1) + perror_with_name ("Couldn't get registers"); + supply_regs (®s.r, regno); + if (regno != -1) + return; + } + + if (regno == -1 || getfpregs_supplies (regno)) + { + if (ptrace (PT_GETFPREGS, PIDGET(inferior_ptid), + (PTRACE_ARG3_TYPE)®s.fpr, 0) == -1) + perror_with_name ("Couldn't get FP registers"); + supply_fpregs (®s.fpr, regno); + if (regno != -1) + return; + } +} + +void +store_inferior_registers (int regno) +{ + union { + fpregset_t fpr; + gregset_t r; + } regs; + + if (regno == -1 || getregs_supplies (regno)) + { + if (ptrace (PT_GETREGS, PIDGET(inferior_ptid), + (PTRACE_ARG3_TYPE)®s.r, 0) == -1) + perror_with_name ("Couldn't get registers"); + fill_gregset (®s.r, regno); + if (ptrace (PT_SETREGS, PIDGET(inferior_ptid), + (PTRACE_ARG3_TYPE)®s.r, 0) == -1) + perror_with_name ("Couldn't get registers"); + if (regno != -1) + return; + } + + if (regno == -1 || getfpregs_supplies (regno)) + { + if (ptrace (PT_GETFPREGS, PIDGET(inferior_ptid), + (PTRACE_ARG3_TYPE)®s.fpr, 0) == -1) + perror_with_name ("Couldn't get FP registers"); + fill_fpregset (®s.fpr, regno); + if (ptrace (PT_SETFPREGS, PIDGET(inferior_ptid), + (PTRACE_ARG3_TYPE)®s.fpr, 0) == -1) + perror_with_name ("Couldn't get FP registers"); + if (regno != -1) + return; + } +} + +void +supply_fpregset (fpregset_t *fpr) +{ + supply_fpregs (fpr, -1); +} + +void +supply_gregset (gregset_t *r) +{ + supply_regs (r, -1); +} + +LONGEST ia64_xfer_dirty(struct target_ops *ops, enum target_object obj, + const char *annex, void *rbuf, const void *wbuf, ULONGEST ofs, + LONGEST len) +{ + if (len != 8) + return (-1); + if (rbuf != NULL) { + if (ptrace (PT_GETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)rbuf, + ofs >> 3) == -1) { + perror_with_name ("Couldn't read dirty register"); + return (-1); + } + } else { + if (ptrace (PT_SETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)wbuf, + ofs >> 3) == -1) { + perror_with_name ("Couldn't write dirty register"); + return (-1); + } + } + return (len); +} + +void +_initialize_ia64_fbsd_nat (void) +{ +} Index: gdb/ia64-fbsd-tdep.c =================================================================== RCS file: gdb/ia64-fbsd-tdep.c diff -N gdb/ia64-fbsd-tdep.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/ia64-fbsd-tdep.c 6 Dec 2003 21:09:05 -0000 1.4 @@ -0,0 +1,28 @@ +/* GNU GPL */ + +#include "defs.h" +#include "value.h" + +#include "ia64-tdep.h" + +static int +ia64_fbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +{ + return (pc >= (5UL << 61)) ? 1 : 0; +} + +static void +ia64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + set_gdbarch_pc_in_sigtramp (gdbarch, ia64_fbsd_pc_in_sigtramp); + tdep->find_global_pointer = ia64_generic_find_global_pointer; +} + +void +_initialize_ia64_fbsd_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_ia64, 0ul, GDB_OSABI_FREEBSD_ELF, + ia64_fbsd_init_abi); +} Index: gdb/ia64-linux-tdep.c =================================================================== RCS file: /nfs/CVS/gdb6/gdb/ia64-linux-tdep.c,v retrieving revision 1.1.1.4 retrieving revision 1.8 diff -u -r1.1.1.4 -r1.8 --- gdb/ia64-linux-tdep.c 18 Mar 2004 03:04:20 -0000 1.1.1.4 +++ gdb/ia64-linux-tdep.c 18 Mar 2004 06:42:22 -0000 1.8 @@ -112,3 +112,21 @@ called as part of setting up an inferior call. */ write_register_pid (IA64_GR10_REGNUM, 0, ptid); } + +static void +ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + set_gdbarch_pc_in_sigtramp (gdbarch, ia64_linux_in_sigtramp); + set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc); + tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address; + tdep->find_global_pointer = ia64_generic_find_global_pointer; +} + +void +_initialize_ia64_linux_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_ia64, 0ul, GDB_OSABI_LINUX, + ia64_linux_init_abi); +} Index: gdb/ia64-tdep.c =================================================================== RCS file: /nfs/CVS/gdb6/gdb/ia64-tdep.c,v retrieving revision 1.1.1.9 retrieving revision 1.12 diff -u -r1.1.1.9 -r1.12 --- gdb/ia64-tdep.c 18 Mar 2004 03:04:21 -0000 1.1.1.9 +++ gdb/ia64-tdep.c 18 Mar 2004 06:42:22 -0000 1.12 @@ -45,17 +45,6 @@ #include "libunwind-ia64.h" #endif -/* Hook for determining the global pointer when calling functions in - the inferior under AIX. The initialization code in ia64-aix-nat.c - sets this hook to the address of a function which will find the - global pointer for a given address. - - The generic code which uses the dynamic section in the inferior for - finding the global pointer is not of much use on AIX since the - values obtained from the inferior have not been relocated. */ - -CORE_ADDR (*native_find_global_pointer) (CORE_ADDR) = 0; - /* An enumeration of the different IA-64 instruction types. */ typedef enum instruction_type @@ -256,20 +245,6 @@ }; -struct gdbarch_tdep - { - CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int); - /* OS specific function which, given a frame address - and register number, returns the offset to the - given register from the start of the frame. */ - CORE_ADDR (*find_global_pointer) (CORE_ADDR); - }; - -#define SIGCONTEXT_REGISTER_ADDRESS \ - (gdbarch_tdep (current_gdbarch)->sigcontext_register_address) -#define FIND_GLOBAL_POINTER \ - (gdbarch_tdep (current_gdbarch)->find_global_pointer) - int ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group) @@ -682,9 +657,18 @@ if ((cfm & 0x7f) > regnum - V32_REGNUM) { + ULONGEST bspstore; ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); - reg = read_memory_integer ((CORE_ADDR)reg_addr, 8); - store_unsigned_integer (buf, register_size (current_gdbarch, regnum), reg); + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (reg_addr < bspstore) { + reg = read_memory_integer ((CORE_ADDR)reg_addr, 8); + store_unsigned_integer (buf, register_size (current_gdbarch, + regnum), reg); + } else + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY, NULL, + buf, reg_addr - bspstore, register_size + (current_gdbarch, regnum)); } else store_unsigned_integer (buf, register_size (current_gdbarch, regnum), 0); @@ -725,7 +709,20 @@ if (nat_addr >= bsp) regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM, &nat_collection); else - nat_collection = read_memory_integer (nat_addr, 8); + { + ULONGEST bspstore; + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (nat_addr < bspstore) + nat_collection = read_memory_integer (nat_addr, 8); + else { + char natbuf[8]; + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY, + NULL, natbuf, nat_addr - bspstore, + register_size (current_gdbarch, regnum)); + nat_collection = *((uint64_t*)natbuf); + } + } nat_bit = (gr_addr >> 3) & 0x3f; natN_val = (nat_collection >> nat_bit) & 1; } @@ -789,8 +786,16 @@ if ((cfm & 0x7f) > regnum - V32_REGNUM) { + ULONGEST bspstore; ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); - write_memory (reg_addr, (void *)buf, 8); + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (reg_addr < bspstore) + write_memory (reg_addr, (void *)buf, 8); + else + target_write_partial (¤t_target, TARGET_OBJECT_DIRTY, + NULL, buf, reg_addr - bspstore, + register_size (current_gdbarch, regnum)); } } else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM) @@ -845,13 +850,31 @@ else { char nat_buf[8]; - nat_collection = read_memory_integer (nat_addr, 8); + ULONGEST bspstore; + regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM, + &bspstore); + if (nat_addr < bspstore) + nat_collection = read_memory_integer (nat_addr, 8); + else { + char natbuf[8]; + target_read_partial (¤t_target, TARGET_OBJECT_DIRTY, + NULL, natbuf, nat_addr - bspstore, + register_size (current_gdbarch, regnum)); + nat_collection = *((uint64_t*)natbuf); + } if (natN_val) nat_collection |= natN_mask; else nat_collection &= ~natN_mask; - store_unsigned_integer (nat_buf, register_size (current_gdbarch, regnum), nat_collection); - write_memory (nat_addr, nat_buf, 8); + store_unsigned_integer (nat_buf, register_size (current_gdbarch, + regnum), + nat_collection); + if (nat_addr < bspstore) + write_memory (nat_addr, nat_buf, 8); + else + target_write_partial (¤t_target, TARGET_OBJECT_DIRTY, + NULL, nat_buf, nat_addr - bspstore, + register_size (current_gdbarch, regnum)); } } } @@ -1813,6 +1836,7 @@ prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f)); addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM)); + /* XXX marcel */ *lvalp = lval_memory; *addrp = addr; read_memory (addr, valuep, register_size (current_gdbarch, regnum)); @@ -2858,8 +2882,8 @@ DT_PLTGOT tag. If it finds one of these, the corresponding d_un.d_ptr value is the global pointer. */ -static CORE_ADDR -generic_elf_find_global_pointer (CORE_ADDR faddr) +CORE_ADDR +ia64_generic_find_global_pointer (CORE_ADDR faddr) { struct obj_section *faddr_sect; @@ -3255,32 +3279,9 @@ tdep = xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); - - /* Set the method of obtaining the sigcontext addresses at which - registers are saved. The method of checking to see if - native_find_global_pointer is nonzero to indicate that we're - on AIX is kind of hokey, but I can't think of a better way - to do it. */ - if (info.osabi == GDB_OSABI_LINUX) - tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address; - else if (native_find_global_pointer != 0) - tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address; - else - tdep->sigcontext_register_address = 0; - - /* We know that GNU/Linux won't have to resort to the - native_find_global_pointer hackery. But that's the only one we - know about so far, so if native_find_global_pointer is set to - something non-zero, then use it. Otherwise fall back to using - generic_elf_find_global_pointer. This arrangement should (in - theory) allow us to cross debug GNU/Linux binaries from an AIX - machine. */ - if (info.osabi == GDB_OSABI_LINUX) - tdep->find_global_pointer = generic_elf_find_global_pointer; - else if (native_find_global_pointer != 0) - tdep->find_global_pointer = native_find_global_pointer; - else - tdep->find_global_pointer = generic_elf_find_global_pointer; + tdep->osabi = info.osabi; + tdep->sigcontext_register_address = NULL; + tdep->find_global_pointer = ia64_generic_find_global_pointer; /* Define the ia64 floating-point format to gdb. */ builtin_type_ia64_ext = @@ -3338,10 +3339,7 @@ set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint); set_gdbarch_breakpoint_from_pc (gdbarch, ia64_breakpoint_from_pc); set_gdbarch_read_pc (gdbarch, ia64_read_pc); - if (info.osabi == GDB_OSABI_LINUX) - set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc); - else - set_gdbarch_write_pc (gdbarch, ia64_write_pc); + set_gdbarch_write_pc (gdbarch, ia64_write_pc); /* Settings for calling functions in the inferior. */ set_gdbarch_push_dummy_call (gdbarch, ia64_push_dummy_call); Index: gdb/ia64-tdep.h =================================================================== RCS file: /nfs/CVS/gdb6/gdb/ia64-tdep.h,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- gdb/ia64-tdep.h 18 Mar 2004 03:04:24 -0000 1.1.1.1 +++ gdb/ia64-tdep.h 25 Mar 2004 07:02:15 -0000 1.3 @@ -22,10 +22,25 @@ #ifndef IA64_TDEP_H #define IA64_TDEP_H -extern CORE_ADDR ia64_linux_sigcontext_register_address (CORE_ADDR, int); -extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int); -extern unsigned long ia64_linux_getunwind_table (void *, size_t); -extern void ia64_write_pc (CORE_ADDR, ptid_t); -extern void ia64_linux_write_pc (CORE_ADDR, ptid_t); +#include "osabi.h" + +/* Target-dependent structure in gdbarch. */ +struct gdbarch_tdep +{ + enum gdb_osabi osabi; /* OS/ABI of inferior. */ + + CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int); + /* OS specific function which, given a frame address + and register number, returns the offset to the + given register from the start of the frame. */ + CORE_ADDR (*find_global_pointer) (CORE_ADDR); +}; + +#define SIGCONTEXT_REGISTER_ADDRESS \ + (gdbarch_tdep (current_gdbarch)->sigcontext_register_address) +#define FIND_GLOBAL_POINTER \ + (gdbarch_tdep (current_gdbarch)->find_global_pointer) + +extern CORE_ADDR ia64_generic_find_global_pointer (CORE_ADDR); #endif /* IA64_TDEP_H */ Index: gdb/inftarg.c =================================================================== RCS file: /nfs/CVS/gdb6/gdb/inftarg.c,v retrieving revision 1.1.1.5 retrieving revision 1.3 diff -u -r1.1.1.5 -r1.3 --- gdb/inftarg.c 18 Mar 2004 03:04:35 -0000 1.1.1.5 +++ gdb/inftarg.c 18 Mar 2004 04:58:51 -0000 1.3 @@ -592,6 +592,13 @@ return NATIVE_XFER_WCOOKIE (ops, object, annex, readbuf, writebuf, offset, len); + case TARGET_OBJECT_DIRTY: +#ifndef TARGET_XFER_DIRTY +#define TARGET_XFER_DIRTY(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1) +#endif + return TARGET_XFER_DIRTY (ops, object, annex, readbuf, writebuf, + offset, len); + default: return -1; } Index: gdb/sparc64-tdep.c =================================================================== RCS file: /nfs/CVS/gdb6/gdb/sparc64-tdep.c,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- gdb/sparc64-tdep.c 18 Mar 2004 03:07:23 -0000 1.1.1.3 +++ gdb/sparc64-tdep.c 18 Mar 2004 04:58:54 -0000 1.4 @@ -34,6 +34,7 @@ #include "regcache.h" #include "target.h" #include "value.h" +#include "dis-asm.h" #include "gdb_assert.h" #include "gdb_string.h" Index: gdb/target.h =================================================================== RCS file: /nfs/CVS/gdb6/gdb/target.h,v retrieving revision 1.1.1.7 retrieving revision 1.4 diff -u -r1.1.1.7 -r1.4 --- gdb/target.h 18 Mar 2004 03:07:51 -0000 1.1.1.7 +++ gdb/target.h 18 Mar 2004 06:42:26 -0000 1.4 @@ -229,7 +229,9 @@ /* Transfer auxilliary vector. */ TARGET_OBJECT_AUXV, /* StackGhost cookie. See "sparc-tdep.c". */ - TARGET_OBJECT_WCOOKIE + TARGET_OBJECT_WCOOKIE, + /* Dirty registers. See "ia64-tdep.c". */ + TARGET_OBJECT_DIRTY /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */ }; Index: gdb/config/ia64/fbsd.mh =================================================================== RCS file: gdb/config/ia64/fbsd.mh diff -N gdb/config/ia64/fbsd.mh --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/fbsd.mh 1 Oct 2003 23:38:25 -0000 1.1 @@ -0,0 +1,5 @@ +NATDEPFILES= core-regset.o corelow.o fbsd-proc.o fork-child.o gcore.o \ + ia64-fbsd-nat.o infptrace.o inftarg.o +NATDEPFILES+= solib.o solib-legacy.o solib-svr4.o +NAT_FILE= nm-fbsd.h +XM_FILE= xm-fbsd.h Index: gdb/config/ia64/fbsd.mt =================================================================== RCS file: gdb/config/ia64/fbsd.mt diff -N gdb/config/ia64/fbsd.mt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/fbsd.mt 1 Oct 2003 23:38:25 -0000 1.1 @@ -0,0 +1,2 @@ +TDEPFILES= ia64-fbsd-tdep.o ia64-tdep.o +TM_FILE= tm-fbsd.h Index: gdb/config/ia64/nm-fbsd.h =================================================================== RCS file: gdb/config/ia64/nm-fbsd.h diff -N gdb/config/ia64/nm-fbsd.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/nm-fbsd.h 17 Mar 2004 05:54:42 -0000 1.2 @@ -0,0 +1,22 @@ +/* GNU GPL */ + +#ifndef NM_FBSD_H +#define NM_FBSD_H + +#define ATTACH_DETACH +#define CHILD_PID_TO_EXEC_FILE +#define FETCH_INFERIOR_REGISTERS +#define SVR4_SHARED_LIBS + +#define PTRACE_ARG3_TYPE caddr_t + +#include "solib.h" /* Support for shared libraries. */ +#include "elf/common.h" + +#include "target.h" + +#define TARGET_XFER_DIRTY ia64_xfer_dirty +extern LONGEST ia64_xfer_dirty(struct target_ops *, enum target_object, + const char *, void *, const void *, ULONGEST, LONGEST); + +#endif /* NM_FBSD_H */ Index: gdb/config/ia64/tm-fbsd.h =================================================================== RCS file: gdb/config/ia64/tm-fbsd.h diff -N gdb/config/ia64/tm-fbsd.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/tm-fbsd.h 1 Oct 2003 23:38:26 -0000 1.1 @@ -0,0 +1,8 @@ +/* GNU GPL */ + +#ifndef TM_FBSD_H +#define TM_FBSD_H + +#include "ia64/tm-ia64.h" + +#endif /* TM_FBSD_H */ Index: gdb/config/ia64/xm-fbsd.h =================================================================== RCS file: gdb/config/ia64/xm-fbsd.h diff -N gdb/config/ia64/xm-fbsd.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/config/ia64/xm-fbsd.h 1 Oct 2003 23:38:27 -0000 1.1 @@ -0,0 +1,6 @@ +/* GNU GPL */ + +#ifndef XM_FBSD_H +#define XM_FBSD_H + +#endif /* XM_FBSD_H */