This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
[PATCH] IA-64 changes
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH] IA-64 changes
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Mon, 3 Apr 2000 12:16:44 -0700
I've just committed the following IA-64 related changes:
* 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.
* config/ia64/linux.mh (LOADLIBES): Define.
(NATDEPFILES): Add linux-thread.o and lin-thread.o.
* config/ia64/nm-linux.h (nm-linux.h): Include this upper-level
file containing generic linux declarations/definitions.
(SVR4_SHARED_LIBS, ATTACH_DETACH): Remove defines; already
defined in generic nm-linux.h.
(solib.h): Remove include; already included in generic nm-linux.h.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile.in
--- Makefile.in 2000/04/03 15:12:59 1.19
+++ Makefile.in 2000/04/03 18:17:16
@@ -1078,6 +1078,7 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 2
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 \
@@ -1432,6 +1433,12 @@ i387-tdep.o: i387-tdep.c $(floatformat_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
Index: ia64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-linux-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 ia64-linux-nat.c
--- ia64-linux-nat.c 2000/03/23 04:27:26 1.2
+++ ia64-linux-nat.c 2000/04/03 18:17:17
@@ -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));
+ }
+ }
}
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 ia64-tdep.c
--- ia64-tdep.c 2000/03/23 04:27:26 1.2
+++ ia64-tdep.c 2000/04/03 18:17:19
@@ -1249,7 +1249,7 @@ ia64_init_extra_frame_info (int fromleaf
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;
Index: config/ia64/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/linux.mh,v
retrieving revision 1.1
diff -u -p -r1.1 linux.mh
--- linux.mh 2000/03/21 00:11:10 1.1
+++ linux.mh 2000/04/03 18:17:20
@@ -5,7 +5,9 @@ XDEPFILES= ser-tcp.o
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
- core-aout.o core-regset.o ia64-linux-nat.o
+ core-aout.o core-regset.o ia64-linux-nat.o linux-thread.o lin-thread.o
+
+LOADLIBES = -ldl -rdynamic
# Don't use gnu-regex.c; it interferes with some stuff in libc.
REGEX=
Index: config/ia64/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/nm-linux.h,v
retrieving revision 1.1
diff -u -p -r1.1 nm-linux.h
--- nm-linux.h 2000/03/21 00:11:10 1.1
+++ nm-linux.h 2000/04/03 18:17:20
@@ -22,14 +22,8 @@
#ifndef NM_LINUX_H
#define NM_LINUX_H
-/* We define this if link.h is available, because with ELF we use SVR4 style
- shared libraries. */
+#include "nm-linux.h"
-#ifdef HAVE_LINK_H
-#define SVR4_SHARED_LIBS
-#include "solib.h" /* Support for shared libraries. */
-#endif
-
/* Note: It seems likely that we'll have to eventually define
FETCH_INFERIOR_REGISTERS. But until that time, we'll make do
with the following. */
@@ -49,8 +43,5 @@ extern int ia64_register_u_addr(int, int
#define PTRACE_ARG3_TYPE long
#define PTRACE_XFER_TYPE long
-
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
#endif /* #ifndef NM_LINUX_H */