keiths / rpms / gdb

Forked from rpms/gdb 15 days ago
Clone
7115f0b
diff -up gdb-6.8/gdb/sparc64-linux-tdep.c.sparc gdb-6.8/gdb/sparc64-linux-tdep.c
7115f0b
--- gdb-6.8/gdb/sparc64-linux-tdep.c.sparc	2008-01-01 16:53:13.000000000 -0600
7115f0b
+++ gdb-6.8/gdb/sparc64-linux-tdep.c	2008-05-15 14:08:57.000000000 -0500
7115f0b
@@ -174,6 +174,30 @@ sparc64_linux_collect_core_fpregset (con
7115f0b
   sparc64_collect_fpregset (regcache, regnum, fpregs);
7115f0b
 }
7115f0b
 
7115f0b
+/* Set the program counter for process PTID to PC.  */
7115f0b
+
7115f0b
+static void
7115f0b
+sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
7115f0b
+{
7115f0b
+  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
7115f0b
+  ULONGEST state;
7115f0b
+
7115f0b
+  regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
7115f0b
+  regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
7115f0b
+
7115f0b
+  /* Clear the "in syscall" bit to prevent the kernel from
7115f0b
+     messing with the PCs we just installed, if we happen to be
7115f0b
+     within an interrupted system call that the kernel wants to
7115f0b
+     restart.
7115f0b
+
7115f0b
+     Note that after we return from the dummy call, the TSTATE et al.
7115f0b
+     registers will be automatically restored, and the kernel
7115f0b
+     continues to restart the system call at this point.  */
7115f0b
+  regcache_cooked_read_unsigned (regcache, SPARC64_STATE_REGNUM, &state);
7115f0b
+  state &= ~((ULONGEST)0x20);
7115f0b
+  regcache_cooked_write_unsigned (regcache, SPARC64_STATE_REGNUM, state);
7115f0b
+}
7115f0b
+
7115f0b
 
7115f0b
 
7115f0b
 static void
7115f0b
@@ -211,6 +235,8 @@ sparc64_linux_init_abi (struct gdbarch_i
7115f0b
 
7115f0b
   /* Make sure we can single-step over signal return system calls.  */
7115f0b
   tdep->step_trap = sparc64_linux_step_trap;
7115f0b
+
7115f0b
+  set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc);
7115f0b
 }
7115f0b
 
7115f0b
 
7115f0b
diff -up gdb-6.8/gdb/sparc-linux-tdep.c.sparc gdb-6.8/gdb/sparc-linux-tdep.c
7115f0b
--- gdb-6.8/gdb/sparc-linux-tdep.c.sparc	2008-01-01 16:53:13.000000000 -0600
7115f0b
+++ gdb-6.8/gdb/sparc-linux-tdep.c	2008-05-15 14:08:12.000000000 -0500
7115f0b
@@ -211,6 +211,30 @@ sparc32_linux_collect_core_fpregset (con
7115f0b
   sparc32_collect_fpregset (regcache, regnum, fpregs);
7115f0b
 }
7115f0b
 
7115f0b
+/* Set the program counter for process PTID to PC.  */
7115f0b
+
7115f0b
+static void
7115f0b
+sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
7115f0b
+{
7115f0b
+  struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache));
7115f0b
+  ULONGEST psr;
7115f0b
+
7115f0b
+  regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
7115f0b
+  regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
7115f0b
+
7115f0b
+  /* Clear the "in syscall" bit to prevent the kernel from
7115f0b
+     messing with the PCs we just installed, if we happen to be
7115f0b
+     within an interrupted system call that the kernel wants to
7115f0b
+     restart.
7115f0b
+
7115f0b
+     Note that after we return from the dummy call, the PSR et al.
7115f0b
+     registers will be automatically restored, and the kernel
7115f0b
+     continues to restart the system call at this point.  */
7115f0b
+  regcache_cooked_read_unsigned (regcache, SPARC32_PSR_REGNUM, &psr;;
7115f0b
+  psr &= ~0x000004000;
7115f0b
+  regcache_cooked_write_unsigned (regcache, SPARC32_PSR_REGNUM, psr);
7115f0b
+}
7115f0b
+
7115f0b
 
7115f0b
 
7115f0b
 static void
7115f0b
@@ -238,10 +262,6 @@ sparc32_linux_init_abi (struct gdbarch_i
7115f0b
      prologue analysis.  */
7115f0b
   tdep->plt_entry_size = 12;
7115f0b
 
7115f0b
-  /* GNU/Linux doesn't support the 128-bit `long double' from the psABI.  */
7115f0b
-  set_gdbarch_long_double_bit (gdbarch, 64);
7115f0b
-  set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
7115f0b
-
7115f0b
   /* Enable TLS support.  */
7115f0b
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
7115f0b
                                              svr4_fetch_objfile_link_map);
7115f0b
@@ -251,6 +271,8 @@ sparc32_linux_init_abi (struct gdbarch_i
7115f0b
 
7115f0b
   /* Hook in the DWARF CFI frame unwinder.  */
7115f0b
   frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
7115f0b
+
7115f0b
+  set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc);
7115f0b
 }
7115f0b
 
7115f0b
 /* Provide a prototype to silence -Wmissing-prototypes.  */