This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/resend/rfa] (2/4) Cleanup tm-hppa.h for multiarch.


2004-04-13  Randolph Chung  <tausq@debian.org>

	* Makefile.in (hpread.o, pa64solib.o, somsolib.o): Add $(hppa_tdep_h)
	* hppa-tdep.h (INSTRUCTION_SIZE): Move from tm-hppa.h.
	(hpread_adjust_stack_address): Move to hpread.c.
	* hppa-tdep.h (unwind_table_entry, unwind_stub_types, obj_unwind_info,
	obj_private_struct): Move from tm-hppa.h.
	* hpread.c (hppa-tdep.h): Include.
	(hpread_adjust_stack_address): Move from hppa-tdep.c.
	(hpread_read_function_type, hpread_read_doc_function_type, 
	hpread_process_one_debug_symbol): Call hpread_adjust_stack_address 
	directly.
	* pa64solib.c (hppa-tdep.h): Include.
	* somsolib.c (hppa-tdep.h): Include.
	* config/pa/tm-hppa.h (frame_info, frame_saved_regs, value, type,
	inferior_status): Remove unused forward declarations.
	(INSTRUCTION_SIZE): Move to hppa-tdep.c.
	(unwind_table_entry, unwind_stub_types, obj_unwind_info, 
	obj_private_struct): Move to hppa-tdep.h.
	(HPREAD_ADJUST_STACK_ADDRESS): Remove.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.538
diff -u -p -r1.538 Makefile.in
--- Makefile.in	12 Apr 2004 19:49:48 -0000	1.538
+++ Makefile.in	14 Apr 2004 05:01:18 -0000
@@ -1830,7 +1830,7 @@ hppa-tdep.o: hppa-tdep.c $(defs_h) $(fra
 hpread.o: hpread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(hp_symtab_h) \
 	$(syms_h) $(symtab_h) $(symfile_h) $(objfiles_h) $(buildsym_h) \
 	$(complaints_h) $(gdb_stabs_h) $(gdbtypes_h) $(demangle_h) \
-	$(somsolib_h) $(gdb_assert_h) $(gdb_string_h)
+	$(somsolib_h) $(gdb_assert_h) $(gdb_string_h) $(hppa_tdep_h)
 hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
 	$(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h)
 i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
@@ -2121,7 +2121,7 @@ osabi.o: osabi.c $(defs_h) $(gdb_assert_
 pa64solib.o: pa64solib.c $(defs_h) $(frame_h) $(bfd_h) $(libhppa_h) \
 	$(gdbcore_h) $(symtab_h) $(breakpoint_h) $(symfile_h) $(objfiles_h) \
 	$(inferior_h) $(gdb_stabs_h) $(gdb_stat_h) $(gdbcmd_h) $(language_h) \
-	$(regcache_h) $(exec_h)
+	$(regcache_h) $(exec_h) $(hppa_tdep_h)
 parse.o: parse.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
 	$(frame_h) $(expression_h) $(value_h) $(command_h) $(language_h) \
 	$(parser_defs_h) $(gdbcmd_h) $(symfile_h) $(inferior_h) \
@@ -2331,7 +2331,7 @@ somread.o: somread.c $(defs_h) $(bfd_h) 
 somsolib.o: somsolib.c $(defs_h) $(frame_h) $(bfd_h) $(som_h) $(libhppa_h) \
 	$(gdbcore_h) $(symtab_h) $(breakpoint_h) $(symfile_h) $(objfiles_h) \
 	$(inferior_h) $(gdb_stabs_h) $(gdb_stat_h) $(gdbcmd_h) $(language_h) \
-	$(regcache_h) $(gdb_assert_h) $(exec_h)
+	$(regcache_h) $(gdb_assert_h) $(exec_h) $(hppa_tdep_h)
 source.o: source.c $(defs_h) $(symtab_h) $(expression_h) $(language_h) \
 	$(command_h) $(source_h) $(gdbcmd_h) $(frame_h) $(value_h) \
 	$(gdb_string_h) $(gdb_stat_h) $(gdbcore_h) $(gdb_regex_h) \
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.143
diff -u -p -r1.143 hppa-tdep.c
--- hppa-tdep.c	11 Apr 2004 04:20:51 -0000	1.143
+++ hppa-tdep.c	14 Apr 2004 05:01:21 -0000
@@ -64,6 +64,8 @@ static const int hppa64_num_regs = 96;
 #define MASK_14 0x3fff
 #define MASK_21 0x1fffff
 
+#define INSTRUCTION_SIZE 4
+
 /* Define offsets into the call dummy for the _sr4export address.
    See comments related to CALL_DUMMY for more info.  */
 #define SR4EXPORT_LDIL_OFFSET (INSTRUCTION_SIZE * 12)
@@ -743,26 +739,6 @@ hppa64_register_name (int i)
     return names[i];
 }
 
-
-
-/* Return the adjustment necessary to make for addresses on the stack
-   as presented by hpread.c.
-
-   This is necessary because of the stack direction on the PA and the
-   bizarre way in which someone (?) decided they wanted to handle
-   frame pointerless code in GDB.  */
-int
-hpread_adjust_stack_address (CORE_ADDR func_addr)
-{
-  struct unwind_table_entry *u;
-
-  u = find_unwind_entry (func_addr);
-  if (!u)
-    return 0;
-  else
-    return u->Total_frame_size << 3;
-}
-
 /* This function pushes a stack frame with arguments as part of the
    inferior function calling mechanism.
 
Index: hppa-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.h,v
retrieving revision 1.1
diff -u -p -r1.1 hppa-tdep.h
--- hppa-tdep.h	15 Aug 2003 23:02:03 -0000	1.1
+++ hppa-tdep.h	14 Apr 2004 05:19:31 -0000
@@ -29,4 +29,102 @@ struct gdbarch_tdep
   int bytes_per_address;
 };
 
+/*
+ * Unwind table and descriptor.
+ */
+
+struct unwind_table_entry
+  {
+    CORE_ADDR region_start;
+    CORE_ADDR region_end;
+
+    unsigned int Cannot_unwind:1;	/* 0 */
+    unsigned int Millicode:1;	/* 1 */
+    unsigned int Millicode_save_sr0:1;	/* 2 */
+    unsigned int Region_description:2;	/* 3..4 */
+    unsigned int reserved1:1;	/* 5 */
+    unsigned int Entry_SR:1;	/* 6 */
+    unsigned int Entry_FR:4;	/* number saved *//* 7..10 */
+    unsigned int Entry_GR:5;	/* number saved *//* 11..15 */
+    unsigned int Args_stored:1;	/* 16 */
+    unsigned int Variable_Frame:1;	/* 17 */
+    unsigned int Separate_Package_Body:1;	/* 18 */
+    unsigned int Frame_Extension_Millicode:1;	/* 19 */
+    unsigned int Stack_Overflow_Check:1;	/* 20 */
+    unsigned int Two_Instruction_SP_Increment:1;	/* 21 */
+    unsigned int Ada_Region:1;	/* 22 */
+    unsigned int cxx_info:1;	/* 23 */
+    unsigned int cxx_try_catch:1;	/* 24 */
+    unsigned int sched_entry_seq:1;	/* 25 */
+    unsigned int reserved2:1;	/* 26 */
+    unsigned int Save_SP:1;	/* 27 */
+    unsigned int Save_RP:1;	/* 28 */
+    unsigned int Save_MRP_in_frame:1;	/* 29 */
+    unsigned int extn_ptr_defined:1;	/* 30 */
+    unsigned int Cleanup_defined:1;	/* 31 */
+
+    unsigned int MPE_XL_interrupt_marker:1;	/* 0 */
+    unsigned int HP_UX_interrupt_marker:1;	/* 1 */
+    unsigned int Large_frame:1;	/* 2 */
+    unsigned int Pseudo_SP_Set:1;	/* 3 */
+    unsigned int reserved4:1;	/* 4 */
+    unsigned int Total_frame_size:27;	/* 5..31 */
+
+    /* This is *NOT* part of an actual unwind_descriptor in an object
+       file.  It is *ONLY* part of the "internalized" descriptors that
+       we create from those in a file.
+     */
+    struct
+      {
+	unsigned int stub_type:4;	/* 0..3 */
+	unsigned int padding:28;	/* 4..31 */
+      }
+    stub_unwind;
+  };
+
+/* HP linkers also generate unwinds for various linker-generated stubs.
+   GDB reads in the stubs from the $UNWIND_END$ subspace, then 
+   "converts" them into normal unwind entries using some of the reserved
+   fields to store the stub type.  */
+
+/* The gaps represent linker stubs used in MPE and space for future
+   expansion.  */
+enum unwind_stub_types
+  {
+    LONG_BRANCH = 1,
+    PARAMETER_RELOCATION = 2,
+    EXPORT = 10,
+    IMPORT = 11,
+    IMPORT_SHLIB = 12,
+  };
+
+/* We use the objfile->obj_private pointer for two things:
+ * 1.  An unwind table;
+ *
+ * 2.  A pointer to any associated shared library object.
+ *
+ * #defines are used to help refer to these objects.
+ */
+
+/* Info about the unwind table associated with an object file.
+ * This is hung off of the "objfile->obj_private" pointer, and
+ * is allocated in the objfile's psymbol obstack.  This allows
+ * us to have unique unwind info for each executable and shared
+ * library that we are debugging.
+ */
+struct obj_unwind_info
+  {
+    struct unwind_table_entry *table;	/* Pointer to unwind info */
+    struct unwind_table_entry *cache;	/* Pointer to last entry we found */
+    int last;			/* Index of last entry */
+  };
+
+typedef struct obj_private_struct
+  {
+    struct obj_unwind_info *unwind_info;	/* a pointer */
+    struct so_list *so_info;	/* a pointer  */
+    CORE_ADDR dp;
+  }
+obj_private_data_t;
+
 #endif  /* HPPA_TDEP_H */
Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.46
diff -u -p -r1.46 hpread.c
--- hpread.c	8 Apr 2004 21:18:12 -0000	1.46
+++ hpread.c	14 Apr 2004 05:01:22 -0000
@@ -37,6 +37,7 @@
 #include "demangle.h"
 #include "somsolib.h"
 #include "gdb_assert.h"
+#include "hppa-tdep.h"
 
 /* Private information attached to an objfile which we use to find
    and internalize the HP C debug symbols within that objfile.  */
@@ -234,6 +235,8 @@ static void fixup_class_method_type
 
 static void hpread_adjust_bitoffsets (struct type *, int);
 
+static int hpread_adjust_stack_address (CORE_ADDR func_addr);
+
 static dnttpointer hpread_get_next_skip_over_anon_unions
   (int, dnttpointer, union dnttentry **, struct objfile *);
 
@@ -3247,10 +3250,9 @@ hpread_read_function_type (dnttpointer h
       if (paramp->dfparam.copyparam)
 	{
 	  SYMBOL_VALUE (sym) = paramp->dfparam.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
 	  SYMBOL_VALUE (sym)
-	    += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+	    += hpread_adjust_stack_address (CURRENT_FUNCTION_VALUE (objfile));
+
 	  /* This is likely a pass-by-invisible reference parameter,
 	     Hack on the symbol class to make GDB happy.  */
 	  /* ??rehrauer: This appears to be broken w/r/t to passing
@@ -3426,10 +3428,9 @@ hpread_read_doc_function_type (dnttpoint
       if (paramp->dfparam.copyparam)
 	{
 	  SYMBOL_VALUE (sym) = paramp->dfparam.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
 	  SYMBOL_VALUE (sym)
-	    += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+	    += hpread_adjust_stack_address(CURRENT_FUNCTION_VALUE (objfile));
+
 	  /* This is likely a pass-by-invisible reference parameter,
 	     Hack on the symbol class to make GDB happy.  */
 	  /* ??rehrauer: This appears to be broken w/r/t to passing
@@ -5697,10 +5698,8 @@ hpread_process_one_debug_symbol (union d
       if (dn_bufp->dfparam.copyparam)
 	{
 	  SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
 	  SYMBOL_VALUE (sym)
-	    += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+	    += hpread_adjust_stack_address (CURRENT_FUNCTION_VALUE (objfile));
 	}
       else
 	SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
@@ -5781,10 +5780,8 @@ hpread_process_one_debug_symbol (union d
 	SYMBOL_CLASS (sym) = LOC_LOCAL;
 
       SYMBOL_VALUE (sym) = dn_bufp->ddvar.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
       SYMBOL_VALUE (sym)
-	+= HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+	+= hpread_adjust_stack_address (CURRENT_FUNCTION_VALUE (objfile));
       SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
       if (dn_bufp->ddvar.global)
 	add_symbol_to_list (sym, &global_symbols);
@@ -6262,6 +6259,24 @@ hpread_adjust_bitoffsets (struct type *t
 
   for (i = 0; i < TYPE_NFIELDS (type); i++)
     TYPE_FIELD_BITPOS (type, i) -= bits;
+}
+
+/* Return the adjustment necessary to make for addresses on the stack
+   as presented by hpread.c.
+
+   This is necessary because of the stack direction on the PA and the
+   bizarre way in which someone (?) decided they wanted to handle
+   frame pointerless code in GDB.  */
+int
+hpread_adjust_stack_address (CORE_ADDR func_addr)
+{
+  struct unwind_table_entry *u;
+
+  u = find_unwind_entry (func_addr);
+  if (!u)
+    return 0;
+  else
+    return u->Total_frame_size << 3;
 }
 
 /* Because of quirks in HP compilers' treatment of anonymous unions inside
Index: pa64solib.c
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.c,v
retrieving revision 1.21
diff -u -p -r1.21 pa64solib.c
--- pa64solib.c	7 Feb 2004 23:13:47 -0000	1.21
+++ pa64solib.c	14 Apr 2004 05:01:26 -0000
@@ -52,6 +52,7 @@
 #include "language.h"
 #include "regcache.h"
 #include "exec.h"
+#include "hppa-tdep.h"
 
 #include <fcntl.h>
 
 void
Index: somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.30
diff -u -p -r1.30 somsolib.c
--- somsolib.c	7 Feb 2004 23:13:47 -0000	1.30
+++ somsolib.c	14 Apr 2004 05:01:26 -0000
@@ -43,6 +43,7 @@
 #include "regcache.h"
 #include "gdb_assert.h"
 #include "exec.h"
+#include "hppa-tdep.h"
 
 #include <fcntl.h>
 
Index: config/pa/tm-hppa.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/tm-hppa.h,v
retrieving revision 1.69
diff -u -p -r1.69 tm-hppa.h
--- config/pa/tm-hppa.h	6 Apr 2004 16:11:06 -0000	1.69
+++ config/pa/tm-hppa.h	14 Apr 2004 05:22:49 -0000
@@ -28,17 +28,6 @@
 
 #define GDB_MULTI_ARCH 1
 
-/* Hack, get around problem with including "arch-utils.h".  */
-struct frame_info;
-
-/* Forward declarations of some types we use in prototypes */
-
-struct frame_info;
-struct frame_saved_regs;
-struct value;
-struct type;
-struct inferior_status;
-
 extern int hppa_pc_requires_run_before_use (CORE_ADDR pc);
 #define PC_REQUIRES_RUN_BEFORE_USE(pc) hppa_pc_requires_run_before_use (pc)
 
@@ -92,113 +81,6 @@ extern int hppa_pc_requires_run_before_u
 extern int hppa_instruction_nullified (void);
 #define INSTRUCTION_NULLIFIED hppa_instruction_nullified ()
 #endif
-
-#define INSTRUCTION_SIZE 4
-
-/*
- * Unwind table and descriptor.
- */
-
-struct unwind_table_entry
-  {
-    CORE_ADDR region_start;
-    CORE_ADDR region_end;
-
-    unsigned int Cannot_unwind:1;	/* 0 */
-    unsigned int Millicode:1;	/* 1 */
-    unsigned int Millicode_save_sr0:1;	/* 2 */
-    unsigned int Region_description:2;	/* 3..4 */
-    unsigned int reserved1:1;	/* 5 */
-    unsigned int Entry_SR:1;	/* 6 */
-    unsigned int Entry_FR:4;	/* number saved *//* 7..10 */
-    unsigned int Entry_GR:5;	/* number saved *//* 11..15 */
-    unsigned int Args_stored:1;	/* 16 */
-    unsigned int Variable_Frame:1;	/* 17 */
-    unsigned int Separate_Package_Body:1;	/* 18 */
-    unsigned int Frame_Extension_Millicode:1;	/* 19 */
-    unsigned int Stack_Overflow_Check:1;	/* 20 */
-    unsigned int Two_Instruction_SP_Increment:1;	/* 21 */
-    unsigned int Ada_Region:1;	/* 22 */
-    unsigned int cxx_info:1;	/* 23 */
-    unsigned int cxx_try_catch:1;	/* 24 */
-    unsigned int sched_entry_seq:1;	/* 25 */
-    unsigned int reserved2:1;	/* 26 */
-    unsigned int Save_SP:1;	/* 27 */
-    unsigned int Save_RP:1;	/* 28 */
-    unsigned int Save_MRP_in_frame:1;	/* 29 */
-    unsigned int extn_ptr_defined:1;	/* 30 */
-    unsigned int Cleanup_defined:1;	/* 31 */
-
-    unsigned int MPE_XL_interrupt_marker:1;	/* 0 */
-    unsigned int HP_UX_interrupt_marker:1;	/* 1 */
-    unsigned int Large_frame:1;	/* 2 */
-    unsigned int Pseudo_SP_Set:1;	/* 3 */
-    unsigned int reserved4:1;	/* 4 */
-    unsigned int Total_frame_size:27;	/* 5..31 */
-
-    /* This is *NOT* part of an actual unwind_descriptor in an object
-       file.  It is *ONLY* part of the "internalized" descriptors that
-       we create from those in a file.
-     */
-    struct
-      {
-	unsigned int stub_type:4;	/* 0..3 */
-	unsigned int padding:28;	/* 4..31 */
-      }
-    stub_unwind;
-  };
-
-/* HP linkers also generate unwinds for various linker-generated stubs.
-   GDB reads in the stubs from the $UNWIND_END$ subspace, then 
-   "converts" them into normal unwind entries using some of the reserved
-   fields to store the stub type.  */
-
-/* The gaps represent linker stubs used in MPE and space for future
-   expansion.  */
-enum unwind_stub_types
-  {
-    LONG_BRANCH = 1,
-    PARAMETER_RELOCATION = 2,
-    EXPORT = 10,
-    IMPORT = 11,
-    IMPORT_SHLIB = 12,
-  };
-
-/* We use the objfile->obj_private pointer for two things:
-
- * 1.  An unwind table;
- *
- * 2.  A pointer to any associated shared library object.
- *
- * #defines are used to help refer to these objects.
- */
-
-/* Info about the unwind table associated with an object file.
-
- * This is hung off of the "objfile->obj_private" pointer, and
- * is allocated in the objfile's psymbol obstack.  This allows
- * us to have unique unwind info for each executable and shared
- * library that we are debugging.
- */
-struct obj_unwind_info
-  {
-    struct unwind_table_entry *table;	/* Pointer to unwind info */
-    struct unwind_table_entry *cache;	/* Pointer to last entry we found */
-    int last;			/* Index of last entry */
-  };
-
-typedef struct obj_private_struct
-  {
-    struct obj_unwind_info *unwind_info;	/* a pointer */
-    struct so_list *so_info;	/* a pointer  */
-    CORE_ADDR dp;
-  }
-obj_private_data_t;
-
-/* For a number of horrible reasons we may have to adjust the location
-   of variables on the stack.  Ugh.  */
-#define HPREAD_ADJUST_STACK_ADDRESS(ADDR) hpread_adjust_stack_address(ADDR)
-extern int hpread_adjust_stack_address (CORE_ADDR);
 
 /* Here's how to step off a permanent breakpoint.  */
 #define SKIP_PERMANENT_BREAKPOINT (hppa_skip_permanent_breakpoint)
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]