2003-11-14 Andrew Cagney <cagney@redhat.com>

* Makefile.in (ppc-sysv-tdep.o): Update dependencies.
	* ppc-sysv-tdep.c: Include "objfiles.h".
	(ppc64_sysv_abi_push_dummy_call): Provide the
	the FN's objfile when looking for the descriptor.
This commit is contained in:
Andrew Cagney 2003-11-14 14:34:30 +00:00
parent 9ea97f2aa0
commit 0a90bcdd1e
2 changed files with 32 additions and 15 deletions

View file

@ -1,4 +1,9 @@
2003-11-13 Andrew Cagney <cagney@redhat.com> 2003-11-14 Andrew Cagney <cagney@redhat.com>
* Makefile.in (ppc-sysv-tdep.o): Update dependencies.
* ppc-sysv-tdep.c: Include "objfiles.h".
(ppc64_sysv_abi_push_dummy_call): Provide the
the FN's objfile when looking for the descriptor.
* ppc-linux-tdep.c (ppc_linux_init_abi): Set PPC64's * ppc-linux-tdep.c (ppc_linux_init_abi): Set PPC64's
"name_of_malloc" to ".malloc". "name_of_malloc" to ".malloc".

View file

@ -29,6 +29,7 @@
#include "gdb_assert.h" #include "gdb_assert.h"
#include "ppc-tdep.h" #include "ppc-tdep.h"
#include "target.h" #include "target.h"
#include "objfiles.h"
/* Pass the arguments in either registers, or in the stack. Using the /* Pass the arguments in either registers, or in the stack. Using the
ppc sysv ABI, the first eight words of the argument list (that might ppc sysv ABI, the first eight words of the argument list (that might
@ -790,27 +791,38 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
".FN" and "FN" in the minimal symbol table. "FN" points at the ".FN" and "FN" in the minimal symbol table. "FN" points at the
FN's descriptor, while ".FN" points at the entry point (which FN's descriptor, while ".FN" points at the entry point (which
matches FUNC_ADDR). Need to reverse from FUNC_ADDR back to the matches FUNC_ADDR). Need to reverse from FUNC_ADDR back to the
FN's descriptor address. */ FN's descriptor address (while at the same time being careful to
find "FN" in the same object file as ".FN"). */
{ {
/* Find the minimal symbol that corresponds to FUNC_ADDR (should /* Find the minimal symbol that corresponds to FUNC_ADDR (should
have the name ".FN"). */ have the name ".FN"). */
struct minimal_symbol *dot_fn = lookup_minimal_symbol_by_pc (func_addr); struct minimal_symbol *dot_fn = lookup_minimal_symbol_by_pc (func_addr);
if (dot_fn != NULL && SYMBOL_LINKAGE_NAME (dot_fn)[0] == '.') if (dot_fn != NULL && SYMBOL_LINKAGE_NAME (dot_fn)[0] == '.')
{ {
/* Now find the corresponding "FN" (dropping ".") minimal /* Get the section that contains FUNC_ADR. Need this for the
symbol's address. */ "objfile" that it contains. */
struct minimal_symbol *fn = struct obj_section *dot_fn_section = find_pc_section (func_addr);
lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (dot_fn) + 1, NULL, if (dot_fn_section != NULL && dot_fn_section->objfile != NULL)
NULL);
if (fn != NULL)
{ {
/* Got the address of that descriptor. The TOC is the /* Now find the corresponding "FN" (dropping ".") minimal
second double word. */ symbol's address. Only look for the minimal symbol in
CORE_ADDR toc = ".FN"'s object file - avoids problems when two object
read_memory_unsigned_integer (SYMBOL_VALUE_ADDRESS (fn) + files (i.e., shared libraries) contain a minimal symbol
tdep->wordsize, tdep->wordsize); with the same name. */
regcache_cooked_write_unsigned (regcache, struct minimal_symbol *fn =
tdep->ppc_gp0_regnum + 2, toc); lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (dot_fn) + 1, NULL,
dot_fn_section->objfile);
if (fn != NULL)
{
/* Got the address of that descriptor. The TOC is the
second double word. */
CORE_ADDR toc =
read_memory_unsigned_integer (SYMBOL_VALUE_ADDRESS (fn)
+ tdep->wordsize,
tdep->wordsize);
regcache_cooked_write_unsigned (regcache,
tdep->ppc_gp0_regnum + 2, toc);
}
} }
} }
} }