From 76d689a6e39d1e4ed94b4932ccea40cd13b38071 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Mon, 3 Apr 2000 18:58:48 +0000 Subject: [PATCH] IA-64 changes --- gdb/ChangeLog | 13 +++++++ gdb/Makefile.in | 7 ++++ gdb/ia64-linux-nat.c | 80 ++++++++++++++++++++++++++++++++++++++++++-- gdb/ia64-tdep.c | 27 +++++++-------- 4 files changed, 111 insertions(+), 16 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 66574799c05..2885af3cb55 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2000-04-03 Kevin Buettner + + * Makefile.in (ALLDEPFILES): Add ia64-linux-nat.c and ia64-tdep.c. + (ia64-linux-nat.o, ia64-tdep.o): Add dependencies. + + * ia64-linux-nat.c (fill_gregset): Implement. + (supply_fpregset, fill_fpregset): New functions. + + * ia64-tdep.c (ia64_init_extra_frame_info): Revise manner in + which the CFM is fetched for certain frames. + (find_global_pointer, find_extant_func_descr): Don't use + partial symtabs for locating sections. + 2000-04-03 Jim Blandy * solib.c (solib_add): Move all the code for loading symbol tables diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 0fbab208996..ef4a8245a95 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1078,6 +1078,7 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ i387-tdep.c \ i386-linux-tdep.c \ i960-tdep.c \ + ia64-linux-nat.c ia64-tdep.c \ infptrace.c inftarg.c irix4-nat.c irix5-nat.c isi-xdep.c \ lynx-nat.c m3-nat.c \ m68k-tdep.c \ @@ -1433,6 +1434,12 @@ i387-tdep.o: i387-tdep.c $(floatformat_h) $(defs_h) $(gdbcore_h) \ i960-tdep.o: i960-tdep.c $(floatformat_h) $(defs_h) $(expression_h) \ $(frame_h) $(gdbtypes_h) $(symtab_h) $(value_h) $(gdbcore_h) +ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(inferior_h) $(target_h) \ + $(gdbcore_h) + +ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) symfile.h $(gdbcore_h) \ + $(floatformat_h) objfiles.h $(INCLUDE_DIR)/elf/common.h + infcmd.o: infcmd.c $(defs_h) environ.h $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) target.h language.h gdb_string.h diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index 9a29c666ac2..485fa4a0d72 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -394,6 +394,82 @@ fill_gregset (gregsetp, regno) gregset_t *gregsetp; int regno; { - fprintf (stderr, "Warning: fill_gregset not implemented!\n"); - /* FIXME: Implement later */ + int regi; + greg_t *regp = (greg_t *) gregsetp; + +#define COPY_REG(_idx_,_regi_) \ + if ((regno == -1) || regno == _regi_) \ + memcpy (regp + _idx_, ®isters[REGISTER_BYTE (_regi_)], \ + REGISTER_RAW_SIZE (_regi_)) + + for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++) + { + COPY_REG (regi - IA64_GR0_REGNUM, regi); + } + + /* FIXME: NAT collection bits at index 32? */ + + COPY_REG (33, IA64_PR_REGNUM); + + for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++) + { + COPY_REG (34 + (regi - IA64_BR0_REGNUM), regi); + } + + COPY_REG (42, IA64_IP_REGNUM); + COPY_REG (43, IA64_CFM_REGNUM); + COPY_REG (44, IA64_PSR_REGNUM); + COPY_REG (45, IA64_RSC_REGNUM); + COPY_REG (46, IA64_BSP_REGNUM); + COPY_REG (47, IA64_BSPSTORE_REGNUM); + COPY_REG (48, IA64_RNAT_REGNUM); + COPY_REG (49, IA64_CCV_REGNUM); + COPY_REG (50, IA64_UNAT_REGNUM); + COPY_REG (51, IA64_FPSR_REGNUM); + COPY_REG (52, IA64_PFS_REGNUM); + COPY_REG (53, IA64_LC_REGNUM); + COPY_REG (54, IA64_EC_REGNUM); +} + +/* Given a pointer to a floating point register set in /proc format + (fpregset_t *), unpack the register contents and supply them as gdb's + idea of the current floating point register values. */ + +void +supply_fpregset (fpregsetp) + fpregset_t *fpregsetp; +{ + register int regi; + char *from; + + for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++) + { + from = (char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]); + supply_register (regi, from); + } +} + +/* Given a pointer to a floating point register set in /proc format + (fpregset_t *), update the register specified by REGNO from gdb's idea + of the current floating point register set. If REGNO is -1, update + them all. */ + +void +fill_fpregset (fpregsetp, regno) + fpregset_t *fpregsetp; + int regno; +{ + int regi; + char *to; + char *from; + + for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++) + { + if ((regno == -1) || (regno == regi)) + { + from = (char *) ®isters[REGISTER_BYTE (regi)]; + to = (char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]); + memcpy (to, from, REGISTER_RAW_SIZE (regi)); + } + } } diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 850b7263a51..ae35b73a59b 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -1249,7 +1249,7 @@ ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame) if (frn->saved_regs[IA64_CFM_REGNUM] != 0) cfm = read_memory_integer (frn->saved_regs[IA64_CFM_REGNUM], 8); else - cfm = read_register (IA64_CFM_REGNUM); + cfm = read_register (IA64_PFS_REGNUM); bsp = frn->extra_info->bsp; } @@ -1325,20 +1325,20 @@ is_float_or_hfa_type (struct type *t) static CORE_ADDR find_global_pointer (CORE_ADDR faddr) { - struct partial_symtab *pst; + struct obj_section *faddr_sect; - pst = find_pc_psymtab (faddr); - if (pst != NULL) + faddr_sect = find_pc_section (faddr); + if (faddr_sect != NULL) { struct obj_section *osect; - ALL_OBJFILE_OSECTIONS (pst->objfile, osect) + ALL_OBJFILE_OSECTIONS (faddr_sect->objfile, osect) { if (strcmp (osect->the_bfd_section->name, ".dynamic") == 0) break; } - if (osect < pst->objfile->sections_end) + if (osect < faddr_sect->objfile->sections_end) { CORE_ADDR addr; @@ -1383,24 +1383,23 @@ find_global_pointer (CORE_ADDR faddr) static CORE_ADDR find_extant_func_descr (CORE_ADDR faddr) { - struct partial_symtab *pst; - struct obj_section *osect; + struct obj_section *faddr_sect; /* Return early if faddr is already a function descriptor */ - osect = find_pc_section (faddr); - if (osect && strcmp (osect->the_bfd_section->name, ".opd") == 0) + faddr_sect = find_pc_section (faddr); + if (faddr_sect && strcmp (faddr_sect->the_bfd_section->name, ".opd") == 0) return faddr; - pst = find_pc_psymtab (faddr); - if (pst != NULL) + if (faddr_sect != NULL) { - ALL_OBJFILE_OSECTIONS (pst->objfile, osect) + struct obj_section *osect; + ALL_OBJFILE_OSECTIONS (faddr_sect->objfile, osect) { if (strcmp (osect->the_bfd_section->name, ".opd") == 0) break; } - if (osect < pst->objfile->sections_end) + if (osect < faddr_sect->objfile->sections_end) { CORE_ADDR addr; -- 2.30.2