2004-02-12 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / hppa-tdep.c
index e5a18909f141a8601e14c2fe2e487be53b951f97..9ca22a93a0dfaa1af0f811a42ea57f57a7c21c21 100644 (file)
@@ -1,7 +1,8 @@
 /* Target-dependent code for the HP PA architecture, for GDB.
 
    Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   Foundation, Inc.
 
    Contributed by the Center for Software Science at the
    University of Utah (pa-gdb-bugs@cs.utah.edu).
@@ -193,7 +194,6 @@ int hppa32_use_struct_convention (int gcc_p, struct type *type);
 int hppa64_use_struct_convention (int gcc_p, struct type *type);
 void hppa32_store_return_value (struct type *type, char *valbuf);
 void hppa64_store_return_value (struct type *type, char *valbuf);
-CORE_ADDR hppa_extract_struct_value_address (char *regbuf);
 int hppa_cannot_store_register (int regnum);
 void hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame);
 CORE_ADDR hppa_frame_chain (struct frame_info *frame);
@@ -510,7 +510,7 @@ read_unwind_info (struct objfile *objfile)
   obj_private_data_t *obj_private;
 
   text_offset = ANOFFSET (objfile->section_offsets, 0);
-  ui = (struct obj_unwind_info *) obstack_alloc (&objfile->psymbol_obstack,
+  ui = (struct obj_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
                                           sizeof (struct obj_unwind_info));
 
   ui->table = NULL;
@@ -560,7 +560,7 @@ read_unwind_info (struct objfile *objfile)
 
   /* Allocate memory for the unwind table.  */
   ui->table = (struct unwind_table_entry *)
-    obstack_alloc (&objfile->psymbol_obstack, total_size);
+    obstack_alloc (&objfile->objfile_obstack, total_size);
   ui->last = total_entries - 1;
 
   /* Now read in each unwind section and internalize the standard unwind
@@ -623,7 +623,7 @@ read_unwind_info (struct objfile *objfile)
   if (objfile->obj_private == NULL)
     {
       obj_private = (obj_private_data_t *)
-       obstack_alloc (&objfile->psymbol_obstack,
+       obstack_alloc (&objfile->objfile_obstack,
                       sizeof (obj_private_data_t));
       obj_private->unwind_info = NULL;
       obj_private->so_info = NULL;
@@ -2060,30 +2060,6 @@ hppa_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
 
 #endif
 
-/* elz: this function returns a value which is built looking at the given address.
-   It is called from call_function_by_hand, in case we need to return a 
-   value which is larger than 64 bits, and it is stored in the stack rather than 
-   in the registers r28 and r29 or fr4.
-   This function does the same stuff as value_being_returned in values.c, but
-   gets the value from the stack rather than from the buffer where all the
-   registers were saved when the function called completed. */
-/* FIXME: cagney/2003-09-27: This function is no longer needed.  The
-   inferior function call code now directly handles the case described
-   above.  */
-struct value *
-hppa_value_returned_from_stack (struct type *valtype, CORE_ADDR addr)
-{
-  struct value *val;
-
-  val = allocate_value (valtype);
-  CHECK_TYPEDEF (valtype);
-  target_read_memory (addr, VALUE_CONTENTS_RAW (val), TYPE_LENGTH (valtype));
-
-  return val;
-}
-
-
-
 /* elz: Used to lookup a symbol in the shared libraries.
    This function calls shl_findsym, indirectly through a
    call to __d_shl_get. __d_shl_get is in end.c, which is always
@@ -2376,7 +2352,7 @@ hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
          {
            stub_symbol
              = lookup_minimal_symbol_solib_trampoline
-             (DEPRECATED_SYMBOL_NAME (funsymbol), NULL, objfile);
+             (DEPRECATED_SYMBOL_NAME (funsymbol), objfile);
 
            if (!stub_symbol)
              stub_symbol = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (funsymbol),
@@ -2633,7 +2609,7 @@ hppa_target_write_pc (CORE_ADDR v, ptid_t ptid)
     write_register_pid (31, v | 0x3, ptid);
 
   write_register_pid (PC_REGNUM, v, ptid);
-  write_register_pid (DEPRECATED_NPC_REGNUM, v + 4, ptid);
+  write_register_pid (PCOQ_TAIL_REGNUM, v + 4, ptid);
 }
 
 /* return the alignment of a type in bytes. Structures have the maximum
@@ -3403,7 +3379,7 @@ hppa_skip_trampoline_code (CORE_ADDR pc)
          ALL_MSYMBOLS (objfile, msymbol)
          {
            if (MSYMBOL_TYPE (msymbol) == mst_text
-               && STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (msym)))
+               && DEPRECATED_STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (msym)))
              {
                function_found = 1;
                break;
@@ -5032,26 +5008,6 @@ hppa_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   write_register (28, addr);
 }
-
-CORE_ADDR
-hppa_extract_struct_value_address (char *regbuf)
-{
-  /* Extract from an array REGBUF containing the (raw) register state
-     the address in which a function should return its structure value,
-     as a CORE_ADDR (or an expression that can be used as one).  */
-  /* FIXME: brobecker 2002-12-26.
-     The current implementation is historical, but we should eventually
-     implement it in a more robust manner as it relies on the fact that
-     the address size is equal to the size of an int* _on the host_...
-     One possible implementation that crossed my mind is to use
-     extract_address.  */
-  /* FIXME: cagney/2003-09-27: This function can probably go.  ELZ
-     writes: We cannot assume on the pa that r28 still contains the
-     address of the returned structure. Usually this will be
-     overwritten by the callee.  */
-  return (*(int *)(regbuf + DEPRECATED_REGISTER_BYTE (28)));
-}
-
 /* Return True if REGNUM is not a register available to the user
    through ptrace().  */
 
@@ -5088,6 +5044,41 @@ hppa_fetch_pointer_argument (struct frame_info *frame, int argi,
   return addr;
 }
 
+/* Here is a table of C type sizes on hppa with various compiles
+   and options.  I measured this on PA 9000/800 with HP-UX 11.11
+   and these compilers:
+
+     /usr/ccs/bin/cc    HP92453-01 A.11.01.21
+     /opt/ansic/bin/cc  HP92453-01 B.11.11.28706.GP
+     /opt/aCC/bin/aCC   B3910B A.03.45
+     gcc                gcc 3.3.2 native hppa2.0w-hp-hpux11.11
+
+     cc            : 1 2 4 4 8 : 4 8 -- : 4 4
+     ansic +DA1.1  : 1 2 4 4 8 : 4 8 16 : 4 4
+     ansic +DA2.0  : 1 2 4 4 8 : 4 8 16 : 4 4
+     ansic +DA2.0W : 1 2 4 8 8 : 4 8 16 : 8 8
+     acc   +DA1.1  : 1 2 4 4 8 : 4 8 16 : 4 4
+     acc   +DA2.0  : 1 2 4 4 8 : 4 8 16 : 4 4
+     acc   +DA2.0W : 1 2 4 8 8 : 4 8 16 : 8 8
+     gcc           : 1 2 4 4 8 : 4 8 16 : 4 4
+
+   Each line is:
+
+     compiler and options
+     char, short, int, long, long long
+     float, double, long double
+     char *, void (*)()
+
+   So all these compilers use either ILP32 or LP64 model.
+   TODO: gcc has more options so it needs more investigation.
+
+   For floating point types, see:
+
+     http://docs.hp.com/hpux/pdf/B3906-90006.pdf
+     HP-UX floating-point guide, hpux 11.00
+
+   -- chastain 2003-12-18  */
+
 static struct gdbarch *
 hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -5129,34 +5120,12 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
         set_gdbarch_register_name (gdbarch, hppa32_register_name);
         set_gdbarch_deprecated_register_virtual_type
           (gdbarch, hppa32_register_virtual_type);
-        set_gdbarch_deprecated_call_dummy_length
-          (gdbarch, hppa32_call_dummy_length);
-        set_gdbarch_deprecated_stack_align (gdbarch, hppa32_stack_align);
-        set_gdbarch_deprecated_reg_struct_has_addr
-         (gdbarch, hppa_reg_struct_has_addr);
-        set_gdbarch_deprecated_extract_return_value
-          (gdbarch, hppa32_extract_return_value);
-        set_gdbarch_use_struct_convention
-          (gdbarch, hppa32_use_struct_convention);
-        set_gdbarch_deprecated_store_return_value
-          (gdbarch, hppa32_store_return_value);
         break;
       case 8:
         set_gdbarch_num_regs (gdbarch, hppa64_num_regs);
         set_gdbarch_register_name (gdbarch, hppa64_register_name);
         set_gdbarch_deprecated_register_virtual_type
           (gdbarch, hppa64_register_virtual_type);
-        set_gdbarch_deprecated_call_dummy_breakpoint_offset
-          (gdbarch, hppa64_call_dummy_breakpoint_offset);
-        set_gdbarch_deprecated_call_dummy_length
-          (gdbarch, hppa64_call_dummy_length);
-        set_gdbarch_deprecated_stack_align (gdbarch, hppa64_stack_align);
-        set_gdbarch_deprecated_extract_return_value
-          (gdbarch, hppa64_extract_return_value);
-        set_gdbarch_use_struct_convention
-          (gdbarch, hppa64_use_struct_convention);
-        set_gdbarch_deprecated_store_return_value
-          (gdbarch, hppa64_store_return_value);
         break;
       default:
         internal_error (__FILE__, __LINE__, "Unsupported address size: %d",
@@ -5168,46 +5137,33 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_register_bytes
     (gdbarch, gdbarch_num_regs (gdbarch) * tdep->bytes_per_address);
   set_gdbarch_long_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
-  set_gdbarch_long_long_bit (gdbarch, 64);
   set_gdbarch_ptr_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
 
+  /* The following gdbarch vector elements are the same in both ILP32
+     and LP64, but might show differences some day.  */
+  set_gdbarch_long_long_bit (gdbarch, 64);
+  set_gdbarch_long_double_bit (gdbarch, 128);
+  set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big);
+
   /* The following gdbarch vector elements do not depend on the address
      size, or in any other gdbarch element previously set.  */
-  set_gdbarch_function_start_offset (gdbarch, 0);
   set_gdbarch_skip_prologue (gdbarch, hppa_skip_prologue);
   set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code);
   set_gdbarch_in_solib_call_trampoline (gdbarch, hppa_in_solib_call_trampoline);
   set_gdbarch_in_solib_return_trampoline (gdbarch,
                                           hppa_in_solib_return_trampoline);
-  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call);
   set_gdbarch_inner_than (gdbarch, hppa_inner_than);
-  set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_deprecated_register_size (gdbarch, tdep->bytes_per_address);
   set_gdbarch_deprecated_fp_regnum (gdbarch, 3);
   set_gdbarch_sp_regnum (gdbarch, 30);
   set_gdbarch_fp0_regnum (gdbarch, 64);
   set_gdbarch_pc_regnum (gdbarch, PCOQ_HEAD_REGNUM);
-  set_gdbarch_deprecated_npc_regnum (gdbarch, PCOQ_TAIL_REGNUM);
   set_gdbarch_deprecated_register_raw_size (gdbarch, hppa_register_raw_size);
   set_gdbarch_deprecated_register_byte (gdbarch, hppa_register_byte);
   set_gdbarch_deprecated_register_virtual_size (gdbarch, hppa_register_raw_size);
   set_gdbarch_deprecated_max_register_raw_size (gdbarch, tdep->bytes_per_address);
   set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
-  set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return);
-  set_gdbarch_deprecated_extract_struct_value_address
-    (gdbarch, hppa_extract_struct_value_address);
   set_gdbarch_cannot_store_register (gdbarch, hppa_cannot_store_register);
-  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info);
-  set_gdbarch_deprecated_frame_chain (gdbarch, hppa_frame_chain);
-  set_gdbarch_deprecated_frame_chain_valid (gdbarch, hppa_frame_chain_valid);
-  set_gdbarch_frameless_function_invocation
-    (gdbarch, hppa_frameless_function_invocation);
-  set_gdbarch_deprecated_frame_saved_pc (gdbarch, hppa_frame_saved_pc);
-  set_gdbarch_frame_args_skip (gdbarch, 0);
-  set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame);
-  set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame);
-  /* set_gdbarch_deprecated_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */
-  set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments);
   set_gdbarch_addr_bits_remove (gdbarch, hppa_smash_text_address);
   set_gdbarch_smash_text_address (gdbarch, hppa_smash_text_address);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
@@ -5226,6 +5182,47 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      whether any watched location changed.  */
   set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
 
+  /* Inferior function call methods.  */
+#if 0
+#else
+  switch (tdep->bytes_per_address)
+    {
+    case 4:
+      set_gdbarch_deprecated_call_dummy_length (gdbarch, hppa32_call_dummy_length);
+      set_gdbarch_deprecated_stack_align (gdbarch, hppa32_stack_align);
+      set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, hppa_reg_struct_has_addr);
+      set_gdbarch_deprecated_extract_return_value (gdbarch, hppa32_extract_return_value);
+      set_gdbarch_use_struct_convention (gdbarch, hppa32_use_struct_convention);
+      set_gdbarch_deprecated_store_return_value (gdbarch, hppa32_store_return_value);
+      break;
+    case 8:
+      set_gdbarch_deprecated_call_dummy_breakpoint_offset (gdbarch, hppa64_call_dummy_breakpoint_offset);
+      set_gdbarch_deprecated_call_dummy_length (gdbarch, hppa64_call_dummy_length);
+      set_gdbarch_deprecated_stack_align (gdbarch, hppa64_stack_align);
+      set_gdbarch_deprecated_extract_return_value (gdbarch, hppa64_extract_return_value);
+      set_gdbarch_use_struct_convention (gdbarch, hppa64_use_struct_convention);
+      set_gdbarch_deprecated_store_return_value (gdbarch, hppa64_store_return_value);
+      break;
+    }
+  set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return);
+  set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame);
+  /* set_gdbarch_deprecated_fix_call_dummy (gdbarch, hppa_fix_call_dummy); */
+  set_gdbarch_deprecated_push_arguments (gdbarch, hppa_push_arguments);
+#endif
+
+  /* Frame unwind methods.  */
+#if 0
+#else
+  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, hppa_saved_pc_after_call);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info);
+  set_gdbarch_deprecated_frame_chain (gdbarch, hppa_frame_chain);
+  set_gdbarch_deprecated_frame_chain_valid (gdbarch, hppa_frame_chain_valid);
+  set_gdbarch_frameless_function_invocation
+    (gdbarch, hppa_frameless_function_invocation);
+  set_gdbarch_deprecated_frame_saved_pc (gdbarch, hppa_frame_saved_pc);
+  set_gdbarch_deprecated_pop_frame (gdbarch, hppa_pop_frame);
+#endif
+
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
This page took 0.028419 seconds and 4 git commands to generate.