* alpha-tdep.h (gdbarch_tdep): Add jb_pc and jb_elt_size members.
authorJason Thorpe <thorpej@netbsd.org>
Fri, 26 Apr 2002 01:08:19 +0000 (01:08 +0000)
committerJason Thorpe <thorpej@netbsd.org>
Fri, 26 Apr 2002 01:08:19 +0000 (01:08 +0000)
* alpha-linux-tdep.c (alpha_linux_init_abi): Initialize
tdep->jb_pc and tdep->jb_elt_size.
* alpha-osf1-tdep.c (alpha_osf1_init_abi): Likewise.
* alphafbsd-tdep.c (alphafbsd_init_abi): Likewise.
* alphanbsd-tdep.c (alphanbsd_init_abi): Likewise.
* alpha-nat.c (get_longjmp_target): Remove.
(JB_ELEMENT_SIZE): Ditto.
(JB_PC): Ditto.
* alpha-tdep.c (alpha_get_longjmp_target): New function.
(alpha_gdbarch_init): Default tdep->jb_pc to -1.  If the
OS ABI sets jb_pc to a valid value, set gdbarch_get_longjmp_target
to alpha_get_longjmp_target.
(alpha_dump_tdep): Report tdep->jb_pc and tdep->jb_elt_size.
* config/alpha/nm-linux.h (GET_LONGJMP_TARGET): Remove.
* config/alpha/nm-osf.h (GET_LONGJMP_TARGET): Remove.

gdb/ChangeLog
gdb/alpha-linux-tdep.c
gdb/alpha-nat.c
gdb/alpha-osf1-tdep.c
gdb/alpha-tdep.c
gdb/alpha-tdep.h
gdb/alphafbsd-tdep.c
gdb/alphanbsd-tdep.c
gdb/config/alpha/nm-linux.h
gdb/config/alpha/nm-osf.h

index aa51e97ceb55cf99cf1b1bb6807c38df11a16393..d4078a345aec6823648bf7ebb3be36f8b61362d2 100644 (file)
@@ -1,3 +1,22 @@
+2002-04-25  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * alpha-tdep.h (gdbarch_tdep): Add jb_pc and jb_elt_size members.
+       * alpha-linux-tdep.c (alpha_linux_init_abi): Initialize
+       tdep->jb_pc and tdep->jb_elt_size.
+       * alpha-osf1-tdep.c (alpha_osf1_init_abi): Likewise.
+       * alphafbsd-tdep.c (alphafbsd_init_abi): Likewise.
+       * alphanbsd-tdep.c (alphanbsd_init_abi): Likewise.
+       * alpha-nat.c (get_longjmp_target): Remove.
+       (JB_ELEMENT_SIZE): Ditto.
+       (JB_PC): Ditto.
+       * alpha-tdep.c (alpha_get_longjmp_target): New function.
+       (alpha_gdbarch_init): Default tdep->jb_pc to -1.  If the
+       OS ABI sets jb_pc to a valid value, set gdbarch_get_longjmp_target
+       to alpha_get_longjmp_target.
+       (alpha_dump_tdep): Report tdep->jb_pc and tdep->jb_elt_size.
+       * config/alpha/nm-linux.h (GET_LONGJMP_TARGET): Remove.
+       * config/alpha/nm-osf.h (GET_LONGJMP_TARGET): Remove.
+
 2002-04-25  Andrew Cagney  <ac131313@redhat.com>
 
        * README: Update to GDB 5.2.
index ed7a7c640ae431f96a67a4c5166ad2c6b117f98d..05a954457f57e5d73d1e4c03160682b6016d97ce 100644 (file)
@@ -100,6 +100,9 @@ alpha_linux_init_abi (struct gdbarch_info info,
   set_gdbarch_pc_in_sigtramp (gdbarch, alpha_linux_pc_in_sigtramp);
 
   tdep->dynamic_sigtramp_offset = alpha_linux_sigtramp_offset;
+
+  tdep->jb_pc = 2;
+  tdep->jb_elt_size = 8;
 }
 
 void
index a21346b49a8b431a680e9c01d4d7f6150d47c44f..580dcc0e8091e289bb8839bf9911efcc27aee37d 100644 (file)
 static void fetch_osf_core_registers (char *, unsigned, int, CORE_ADDR);
 static void fetch_elf_core_registers (char *, unsigned, int, CORE_ADDR);
 
-/* Size of elements in jmpbuf */
-
-#define JB_ELEMENT_SIZE 8
-
-/* The definition for JB_PC in machine/reg.h is wrong.
-   And we can't get at the correct definition in setjmp.h as it is
-   not always available (eg. if _POSIX_SOURCE is defined which is the
-   default). As the defintion is unlikely to change (see comment
-   in <setjmp.h>, define the correct value here.  */
-
-#undef JB_PC
-#define JB_PC 2
-
-/* Figure out where the longjmp will land.
-   We expect the first arg to be a pointer to the jmp_buf structure from which
-   we extract the pc (JB_PC) that we will land at.  The pc is copied into PC.
-   This routine returns true on success. */
-
-int
-get_longjmp_target (CORE_ADDR *pc)
-{
-  CORE_ADDR jb_addr;
-  char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
-
-  jb_addr = read_register (ALPHA_A0_REGNUM);
-
-  if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, raw_buffer,
-                         sizeof (CORE_ADDR)))
-    return 0;
-
-  *pc = extract_address (raw_buffer, sizeof (CORE_ADDR));
-  return 1;
-}
-
 /* Extract the register values out of the core file and store
    them where `read_register' will find them.
 
index cba9134b07a297ee6ad2d0d373ce6d85e5d155e4..be8f7042bf08bb4daadd33fa9a8dfaa83a53a275 100644 (file)
@@ -52,6 +52,9 @@ alpha_osf1_init_abi (struct gdbarch_info info,
   set_gdbarch_pc_in_sigtramp (gdbarch, alpha_osf1_pc_in_sigtramp);
 
   tdep->skip_sigtramp_frame = alpha_osf1_skip_sigtramp_frame;
+
+  tdep->jb_pc = 2;
+  tdep->jb_elt_size = 8;
 }
 
 void
index 4bec6bcbfe9a2f6b7d18018814132c3f51e49686..81c932c57b986e3a3a4dbf08dc8ce714c337a9a1 100644 (file)
@@ -78,6 +78,8 @@ static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy;
 static gdbarch_init_frame_pc_first_ftype alpha_init_frame_pc_first;
 static gdbarch_init_extra_frame_info_ftype alpha_init_extra_frame_info;
 
+static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target;
+
 struct frame_extra_info
   {
     alpha_extra_func_info_t proc_desc;
@@ -1617,6 +1619,28 @@ alpha_extract_struct_value_address (char *regbuf)
                           REGISTER_RAW_SIZE (ALPHA_V0_REGNUM)));
 }
 
+/* Figure out where the longjmp will land.
+   We expect the first arg to be a pointer to the jmp_buf structure from
+   which we extract the PC (JB_PC) that we will land at.  The PC is copied
+   into the "pc".  This routine returns true on success.  */
+
+static int
+alpha_get_longjmp_target (CORE_ADDR *pc)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  CORE_ADDR jb_addr;
+  char raw_buffer[ALPHA_MAX_REGISTER_RAW_SIZE];
+
+  jb_addr = read_register (ALPHA_A0_REGNUM);
+
+  if (target_read_memory (jb_addr + (tdep->jb_pc * tdep->jb_elt_size),
+                         raw_buffer, tdep->jb_elt_size))
+    return 0;
+
+  *pc = extract_address (raw_buffer, tdep->jb_elt_size);
+  return 1;
+}
+
 /* alpha_software_single_step() is called just before we want to resume
    the inferior, if we want to single-step it but there is no hardware
    or kernel single-step support (NetBSD on Alpha, for example).  We find
@@ -1975,6 +1999,8 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep->dynamic_sigtramp_offset = NULL;
   tdep->skip_sigtramp_frame = NULL;
 
+  tdep->jb_pc = -1;    /* longjmp support not enabled by default  */
+
   /* Type sizes */
   set_gdbarch_short_bit (gdbarch, 16);
   set_gdbarch_int_bit (gdbarch, 32);
@@ -2113,6 +2139,12 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
        }
     }
 
+  /* Now that we have tuned the configuration, set a few final things
+     based on what the OS ABI has told us.  */
+
+  if (tdep->jb_pc >= 0)
+    set_gdbarch_get_longjmp_target (gdbarch, alpha_get_longjmp_target);
+
   return gdbarch;
 }
 
@@ -2134,6 +2166,13 @@ alpha_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "alpha_dump_tdep: vm_min_address = 0x%lx\n",
                      (long) tdep->vm_min_address);
+
+  fprintf_unfiltered (file,
+                     "alpha_dump_tdep: jb_pc = %d\n",
+                     tdep->jb_pc);
+  fprintf_unfiltered (file,
+                     "alpha_dump_tdep: jb_elt_size = %ld\n",
+                     (long) tdep->jb_elt_size);
 }
 
 void
index a9a724d27a1f8deb267fde6147be5d8037622112..8b1cf3ece6b4a9246a9531aa6f3bea0af965266b 100644 (file)
@@ -105,6 +105,11 @@ struct gdbarch_tdep
   /* If FRAME refers to a sigtramp frame, return the address of the next
      frame.  */
   CORE_ADDR (*skip_sigtramp_frame) (struct frame_info *, CORE_ADDR);
+
+  int jb_pc;                   /* Offset to PC value in jump buffer.
+                                  If htis is negative, longjmp support
+                                  will be disabled.  */
+  size_t jb_elt_size;          /* And the size of each entry in the buf. */
 };
 
 void alpha_software_single_step (enum target_signal, int);
index 2e52252fc1a70f8e31fe6dbf7279b3cee8e5b729..3c1e64da3e85ab58dbd460c2d0a480b4aef299bf 100644 (file)
@@ -70,6 +70,9 @@ alphafbsd_init_abi (struct gdbarch_info info,
   set_gdbarch_pc_in_sigtramp (gdbarch, alphafbsd_pc_in_sigtramp);
 
   set_gdbarch_use_struct_convention (gdbarch, alphafbsd_use_struct_convention);
+
+  tdep->jb_pc = 2;
+  tdep->jb_elt_size = 8;
 }
 
 void
index c29b3f92fdc8a06115eee8e291e1aea830f2b76c..33c3cd7f0a686256a7fc147e4fcccbae54698ef7 100644 (file)
@@ -145,6 +145,9 @@ alphanbsd_init_abi (struct gdbarch_info info,
                                   alphanbsd_solib_svr4_fetch_link_map_offsets);
 
   tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
+
+  tdep->jb_pc = 2;
+  tdep->jb_elt_size = 8;
 }
 
 void
index 5d5e945c773859b2c3849bbb33578551d79cec25..05ac5518121ab30563dec9fabda4ed8bf39afdd4 100644 (file)
 
 #include "nm-linux.h"
 
-/* Figure out where the longjmp will land.  We expect that we have just entered
-   longjmp and haven't yet setup the stack frame, so the args are still in the
-   argument regs.  A0_REGNUM points at the jmp_buf structure from which we
-   extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
-   This routine returns true on success */
-
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-extern int get_longjmp_target (CORE_ADDR *);
-
 /* ptrace register ``addresses'' are absolute.  */
 
 #define U_REGS_OFFSET 0
index 5fc99e4ad573ef6fca9112cb7bf256282d161e3f..1316603c5bede9ee0a6d6175cefa12c3cbec68bc 100644 (file)
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* Figure out where the longjmp will land.  We expect that we have just entered
-   longjmp and haven't yet setup the stack frame, so the args are still in the
-   argument regs.  A0_REGNUM points at the jmp_buf structure from which we
-   extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
-   This routine returns true on success */
-
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
-extern int get_longjmp_target (CORE_ADDR *);
-
 /* ptrace register ``addresses'' are absolute.  */
 
 #define U_REGS_OFFSET 0
This page took 0.041321 seconds and 4 git commands to generate.