aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph Chung <tausq@debian.org>2004-04-17 17:19:29 +0000
committerRandolph Chung <tausq@debian.org>2004-04-17 17:19:29 +0000
commit7c46b9fb41fd107882032ecc34897a8e86e8264a (patch)
tree452418ea2949ab44c2dcf70fd16426319fae4c52
parent8d153463b57c4f70a61e0c421b715de8e591acd3 (diff)
downloadgdb-7c46b9fb41fd107882032ecc34897a8e86e8264a.zip
gdb-7c46b9fb41fd107882032ecc34897a8e86e8264a.tar.gz
gdb-7c46b9fb41fd107882032ecc34897a8e86e8264a.tar.bz2
2004-04-17 Randolph Chung <tausq@debian.org>
* Makefile.in (hpread.o, pa64solib.o, somsolib.o): Add $(hppa_tdep_h) * hppa-tdep.c (hppa_objfile_priv_data): New. (SR4EXPORT_LDIL_OFFSET, SR4EXPORT_LDO_OFFSET): Use HPPA_INSTRUCTION_SIZE. (read_unwind_info): Use objfile_data to reference unwind info. (find_unwind_entry): Likewise. (hpread_adjust_stack_address): Move to hpread.c. (_initialize_hppa_tdep): Register hppa objfile data. * hppa-tdep.h (HPPA_INSTRUCTION_SIZE): Define. (unwind_table_entry, unwind_stub_types): Move from tm-hppa.h. (obj_unwind_info, obj_private_struct): Move from tm-hppa.h, and rename with hppa_ prefix. * 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. Use objfile_data to access solib data. * pa64solib.c (hppa-tdep.h): Include. (pa64_solib_add_solib_objfile): Use objfile_data to access solib data. * somsolib.c (hppa-tdep.h): Include. (som_solib_add_solib_objfile): Use objfile_data to access solib data. * 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.
-rw-r--r--gdb/ChangeLog21
-rw-r--r--gdb/Makefile.in6
-rw-r--r--gdb/config/pa/tm-hppa.h118
-rw-r--r--gdb/hppa-tdep.c69
-rw-r--r--gdb/hppa-tdep.h101
-rw-r--r--gdb/hpread.c46
-rw-r--r--gdb/pa64solib.c14
-rw-r--r--gdb/somsolib.c14
8 files changed, 204 insertions, 185 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 198a0fd..b0d299e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,26 @@
2004-04-17 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.
+
+2004-04-17 Randolph Chung <tausq@debian.org>
+
* hppa-tdep.c (hppa_reg_struct_has_addr, hppa_skip_prologue)
(hppa_skip_trampoline_code, hppa_in_solib_call_trampoline)
(hppa_in_solib_return_trampoline, hppa_cannot_store_register)
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index bba9d89..41f1bdd 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1837,7 +1837,7 @@ hppa-tdep.o: hppa-tdep.c $(defs_h) $(frame_h) $(bfd_h) $(inferior_h) \
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) \
@@ -2128,7 +2128,7 @@ osabi.o: osabi.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(osabi_h) \
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) \
@@ -2338,7 +2338,7 @@ somread.o: somread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_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) \
diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h
index d5d2d03..cf9f31c 100644
--- a/gdb/config/pa/tm-hppa.h
+++ b/gdb/config/pa/tm-hppa.h
@@ -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)
@@ -93,113 +82,6 @@ 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)
extern void hppa_skip_permanent_breakpoint (void);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 8e2c142..b3e9f5f 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -58,6 +58,14 @@
static const int hppa32_num_regs = 128;
static const int hppa64_num_regs = 96;
+/* hppa-specific object data -- unwind and solib info.
+ TODO/maybe: think about splitting this into two parts; the unwind data is
+ common to all hppa targets, but is only used in this file; we can register
+ that separately and make this static. The solib data is probably hpux-
+ specific, so we can create a separate extern objfile_data that is registered
+ by hppa-hpux-tdep.c and shared with pa64solib.c and somsolib.c. */
+const struct objfile_data *hppa_objfile_priv_data = NULL;
+
/* Get at various relevent fields of an instruction word. */
#define MASK_5 0x1f
#define MASK_11 0x7ff
@@ -66,8 +74,8 @@ static const int hppa64_num_regs = 96;
/* 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)
-#define SR4EXPORT_LDO_OFFSET (INSTRUCTION_SIZE * 13)
+#define SR4EXPORT_LDIL_OFFSET (HPPA_INSTRUCTION_SIZE * 12)
+#define SR4EXPORT_LDO_OFFSET (HPPA_INSTRUCTION_SIZE * 13)
/* To support detection of the pseudo-initial frame
that threads have. */
@@ -456,12 +464,12 @@ read_unwind_info (struct objfile *objfile)
unsigned index, unwind_entries;
unsigned stub_entries, total_entries;
CORE_ADDR text_offset;
- struct obj_unwind_info *ui;
- obj_private_data_t *obj_private;
+ struct hppa_unwind_info *ui;
+ struct hppa_objfile_private *obj_private;
text_offset = ANOFFSET (objfile->section_offsets, 0);
- ui = (struct obj_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct obj_unwind_info));
+ ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
+ sizeof (struct hppa_unwind_info));
ui->table = NULL;
ui->cache = NULL;
@@ -570,18 +578,18 @@ read_unwind_info (struct objfile *objfile)
compare_unwind_entries);
/* Keep a pointer to the unwind information. */
- if (objfile->obj_private == NULL)
+ obj_private = (struct hppa_objfile_private *)
+ objfile_data (objfile, hppa_objfile_priv_data);
+ if (obj_private == NULL)
{
- obj_private = (obj_private_data_t *)
- obstack_alloc (&objfile->objfile_obstack,
- sizeof (obj_private_data_t));
+ obj_private = (struct hppa_objfile_private *)
+ obstack_alloc (&objfile->objfile_obstack,
+ sizeof (struct hppa_objfile_private));
+ set_objfile_data (objfile, hppa_objfile_priv_data, obj_private);
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;
obj_private->dp = 0;
-
- objfile->obj_private = obj_private;
}
- obj_private = (obj_private_data_t *) objfile->obj_private;
obj_private->unwind_info = ui;
}
@@ -595,6 +603,7 @@ find_unwind_entry (CORE_ADDR pc)
{
int first, middle, last;
struct objfile *objfile;
+ struct hppa_objfile_private *priv;
/* A function at address 0? Not in HP-UX! */
if (pc == (CORE_ADDR) 0)
@@ -602,17 +611,19 @@ find_unwind_entry (CORE_ADDR pc)
ALL_OBJFILES (objfile)
{
- struct obj_unwind_info *ui;
+ struct hppa_unwind_info *ui;
ui = NULL;
- if (objfile->obj_private)
- ui = ((obj_private_data_t *) (objfile->obj_private))->unwind_info;
+ priv = objfile_data (objfile, hppa_objfile_priv_data);
+ if (priv)
+ ui = ((struct hppa_objfile_private *) priv)->unwind_info;
if (!ui)
{
read_unwind_info (objfile);
- if (objfile->obj_private == NULL)
+ priv = objfile_data (objfile, hppa_objfile_priv_data);
+ if (priv == NULL)
error ("Internal error reading unwind information.");
- ui = ((obj_private_data_t *) (objfile->obj_private))->unwind_info;
+ ui = ((struct hppa_objfile_private *) priv)->unwind_info;
}
/* First, check the cache */
@@ -734,26 +745,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.
@@ -2730,6 +2721,8 @@ _initialize_hppa_tdep (void)
gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep);
+ hppa_objfile_priv_data = register_objfile_data ();
+
add_cmd ("unwind", class_maintenance, unwind_command,
"Print unwind table entry at given address.",
&maintenanceprintlist);
diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h
index 05a4e89..f41af2d 100644
--- a/gdb/hppa-tdep.h
+++ b/gdb/hppa-tdep.h
@@ -21,6 +21,8 @@
#ifndef HPPA_TDEP_H
#define HPPA_TDEP_H
+enum { HPPA_INSTRUCTION_SIZE = 4 };
+
/* Target-dependent structure in gdbarch. */
struct gdbarch_tdep
{
@@ -29,4 +31,103 @@ 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 hppa_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 */
+ };
+
+struct hppa_objfile_private
+ {
+ struct hppa_unwind_info *unwind_info; /* a pointer */
+ struct so_list *so_info; /* a pointer */
+ CORE_ADDR dp;
+ };
+
+extern const struct objfile_data *hppa_objfile_priv_data;
+
#endif /* HPPA_TDEP_H */
diff --git a/gdb/hpread.c b/gdb/hpread.c
index 6e92276..84bf646 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -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 hp_type, union dnttentry *dn_bufp,
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 (dnttpointer hp_type, union dnttentry *dn_bufp,
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 dnttentry *dn_bufp, char *name,
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;
@@ -5754,11 +5753,14 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
* to "somsolib.c". But C lets us point to one.
*/
struct so_list *so;
+ struct hppa_objfile_private *priv;
- if (objfile->obj_private == NULL)
+ priv = (struct hppa_objfile_private *)
+ objfile_data (objfile, hppa_objfile_priv_data);
+ if (priv == NULL)
error ("Internal error in reading shared library information.");
- so = ((obj_private_data_t *) (objfile->obj_private))->so_info;
+ so = ((struct hppa_objfile_private *) priv)->so_info;
if (so == NULL)
error ("Internal error in reading shared library information.");
@@ -5781,10 +5783,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
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);
@@ -6264,6 +6264,24 @@ hpread_adjust_bitoffsets (struct type *type, int bits)
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
classes, we have to chase through a chain of threaded FIELD entries.
If we encounter an anonymous union in the chain, we must recursively skip over
diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c
index 4e29455..d2a0602 100644
--- a/gdb/pa64solib.c
+++ b/gdb/pa64solib.c
@@ -52,6 +52,7 @@
#include "language.h"
#include "regcache.h"
#include "exec.h"
+#include "hppa-tdep.h"
#include <fcntl.h>
@@ -220,7 +221,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
{
bfd *tmp_bfd;
asection *sec;
- obj_private_data_t *obj_private;
+ struct hppa_objfile_private *obj_private;
struct section_addr_info *section_addrs;
struct cleanup *my_cleanups;
@@ -278,17 +279,18 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
/* Mark this as a shared library and save private data. */
so->objfile->flags |= OBJF_SHARED;
- if (so->objfile->obj_private == NULL)
+ obj_private = (struct hppa_objfile_private *)
+ objfile_data (so->objfile, hppa_objfile_priv_data);
+ if (obj_private == NULL)
{
- obj_private = (obj_private_data_t *)
+ obj_private = (struct hppa_objfile_private *)
obstack_alloc (&so->objfile->objfile_obstack,
- sizeof (obj_private_data_t));
+ sizeof (struct hppa_objfile_private));
+ set_objfile_data (so->objfile, hppa_objfile_priv_data, obj_private);
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;
- so->objfile->obj_private = obj_private;
}
- obj_private = (obj_private_data_t *) so->objfile->obj_private;
obj_private->so_info = so;
obj_private->dp = so->pa64_solib_desc.linkage_ptr;
do_cleanups (my_cleanups);
diff --git a/gdb/somsolib.c b/gdb/somsolib.c
index 7ecc97e..25f0376 100644
--- a/gdb/somsolib.c
+++ b/gdb/somsolib.c
@@ -43,6 +43,7 @@
#include "regcache.h"
#include "gdb_assert.h"
#include "exec.h"
+#include "hppa-tdep.h"
#include <fcntl.h>
@@ -278,7 +279,7 @@ static void
som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
CORE_ADDR text_addr)
{
- obj_private_data_t *obj_private;
+ struct hppa_objfile_private *obj_private;
struct obj_section *s;
so->objfile = symbol_file_add (name, from_tty, NULL, 0, OBJF_SHARED);
@@ -307,17 +308,18 @@ som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
*/
so->objfile->flags |= OBJF_SHARED;
- if (so->objfile->obj_private == NULL)
+ obj_private = (struct hppa_objfile_private *)
+ objfile_data (so->objfile, hppa_objfile_priv_data);
+ if (obj_private == NULL)
{
- obj_private = (obj_private_data_t *)
+ obj_private = (struct hppa_objfile_private *)
obstack_alloc (&so->objfile->objfile_obstack,
- sizeof (obj_private_data_t));
+ sizeof (struct hppa_objfile_private));
+ set_objfile_data (so->objfile, hppa_objfile_priv_data, obj_private);
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;
- so->objfile->obj_private = obj_private;
}
- obj_private = (obj_private_data_t *) so->objfile->obj_private;
obj_private->so_info = so;
if (!bfd_check_format (so->abfd, bfd_object))