2004-12-17 Randolph Chung <tausq@debian.org>

* hppa-hpux-tdep.c (IS_32BIT_TARGET): New.
	(in_opd_section): New.
	(hppa32_hpux_find_global_pointer): Rename from
	hppa_hpux_som_find_global_pointer.
	(hppa64_hpux_find_global_pointer): New.
	(ldsid_pattern): New.
	(hppa_hpux_search_pattern): New.
	(hppa32_hpux_search_dummy_call_sequence): New.
	(hppa64_hpux_search_dummy_call_sequence): New.
	(hppa_hpux_find_import_stub_for_addr): New.
	(hppa_hpux_sr_for_addr): New.
	(hppa_hpux_find_dummy_bpaddr): New.
	(hppa_hpux_init_abi): Use IS_32BIT_TARGET predicate.
	(hppa_hpux_som_init_abi): Set find_global_pointer method to
	hppa32_hpux_find_global_pointer instead of
	hppa_hpux_som_find_global_pointer.
	(hppa_hpux_elf_init_abi): Set find_global_pointer method.
	* hppa-tdep.c (hppa_init_objfile_priv_data): New.
	(read_unwind_info): Use function to initialize objfile-private data.
	(hppa32_push_dummy_call): Don't automatically set the RP if there is
	a push_dummy_code method.
	(hppa64_push_dummy_call): Retrieve and set the global pointer.
	Don't automatically set the RP if there is a push_dummy_code method.
	* hppa-tdep.h (hppa_objfile_private): Add dummy_call_sequence_reg and
	dummy_call_sequence_addr members.
	(hppa_init_objfile_priv_data): New prototype.
This commit is contained in:
Randolph Chung
2004-12-17 19:09:53 +00:00
parent e3070fef41
commit 77d18ded6e
4 changed files with 531 additions and 143 deletions

View File

@@ -273,6 +273,20 @@ hppa_symbol_address(const char *sym)
else
return (CORE_ADDR)-1;
}
struct hppa_objfile_private *
hppa_init_objfile_priv_data (struct objfile *objfile)
{
struct hppa_objfile_private *priv;
priv = (struct hppa_objfile_private *)
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct hppa_objfile_private));
set_objfile_data (objfile, hppa_objfile_priv_data, priv);
memset (priv, 0, sizeof (*priv));
return priv;
}
/* Compare the start address for two unwind entries returning 1 if
@@ -529,15 +543,8 @@ read_unwind_info (struct objfile *objfile)
obj_private = (struct hppa_objfile_private *)
objfile_data (objfile, hppa_objfile_priv_data);
if (obj_private == NULL)
{
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;
}
obj_private = hppa_init_objfile_priv_data (objfile);
obj_private->unwind_info = ui;
}
@@ -912,7 +919,8 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
write_register (19, gp);
/* Set the return address. */
regcache_cooked_write_unsigned (regcache, HPPA_RP_REGNUM, bp_addr);
if (!gdbarch_push_dummy_code_p (gdbarch))
regcache_cooked_write_unsigned (regcache, HPPA_RP_REGNUM, bp_addr);
/* Update the Stack Pointer. */
regcache_cooked_write_unsigned (regcache, HPPA_SP_REGNUM, param_end);
@@ -952,6 +960,10 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
been pushed. */
CORE_ADDR new_sp = 0;
/* Global pointer (r27) of the function we are trying to call. */
CORE_ADDR gp;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Two passes. First pass computes the location of everything,
second pass writes the bytes out. */
int write_pass;
@@ -1033,8 +1045,14 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (struct_return)
write_register (28, struct_addr);
gp = tdep->find_global_pointer (function);
if (gp != 0)
write_register (27, gp);
/* Set the return address. */
regcache_cooked_write_unsigned (regcache, HPPA_RP_REGNUM, bp_addr);
if (!gdbarch_push_dummy_code_p (gdbarch))
regcache_cooked_write_unsigned (regcache, HPPA_RP_REGNUM, bp_addr);
/* Update the Stack Pointer. */
regcache_cooked_write_unsigned (regcache, HPPA_SP_REGNUM, param_end + 64);