+2003-10-22 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (convert_from_func_ptr_addr): Convert to a pure
+ multi-arch method, add "targ" parameter.
+ (struct target_ops): Declare.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * Makefile.in (c-valprint.o): Update dependencies.
+ * arch-utils.h: Update copyright.
+ (convert_from_func_ptr_addr_identity): Declare.
+ * arch-utils.c (convert_from_func_ptr_addr_identity): New function.
+ * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update.
+ * rs6000-tdep.c (rs6000_convert_from_func_ptr_addr): Upate.
+ * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): Update.
+ * infcall.c (find_function_addr, call_function_by_hand): Update.
+ * c-valprint.c: Include "target.h".
+ (print_function_pointer_address): Update.
+
2003-10-22 Andrew Cagney <cagney@redhat.com>
* target.c (target_close): New function.
$(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \
$(gdb_string_h)
c-valprint.o: c-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \
- $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \
- $(c_lang_h) $(cp_abi_h)
+ $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) \
+ $(language_h) $(c_lang_h) $(cp_abi_h) $(target_h)
d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \
$(frame_base_h) $(symtab_h) $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) \
$(gdb_string_h) $(value_h) $(inferior_h) $(dis_asm_h) $(symfile_h) \
return addr;
}
+CORE_ADDR
+convert_from_func_ptr_addr_identity (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct target_ops *targ)
+{
+ return addr;
+}
+
int
no_op_reg_to_regnum (int reg)
{
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation,
+ Inc.
This file is part of GDB.
extern const struct floatformat *default_float_format (struct gdbarch *gdbarch);
extern const struct floatformat *default_double_format (struct gdbarch *gdbarch);
-/* Identity function on a CORE_ADDR. Just returns its parameter. */
+/* Identity functions on a CORE_ADDR. Just return the "addr". */
extern CORE_ADDR core_addr_identity (CORE_ADDR addr);
+extern gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr_identity;
/* No-op conversion of reg to regnum. */
#include "language.h"
#include "c-lang.h"
#include "cp-abi.h"
+#include "target.h"
\f
/* Print function pointer with inferior address ADDRESS onto stdio
static void
print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
{
- CORE_ADDR func_addr = CONVERT_FROM_FUNC_PTR_ADDR (address);
+ CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ address,
+ ¤t_target);
/* If the function pointer is represented by a description, print the
address of the description. */
0, /* float_format */
0, /* double_format */
0, /* long_double_format */
- 0, /* convert_from_func_ptr_addr */
+ convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */
0, /* addr_bits_remove */
0, /* smash_text_address */
0, /* software_single_step */
current_gdbarch->deprecated_frame_args_address = get_frame_base;
current_gdbarch->deprecated_frame_locals_address = get_frame_base;
current_gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
- current_gdbarch->convert_from_func_ptr_addr = core_addr_identity;
+ current_gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
current_gdbarch->addr_bits_remove = core_addr_identity;
current_gdbarch->smash_text_address = core_addr_identity;
current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
fprintf_unfiltered (file,
"gdbarch_dump: GDB_MULTI_ARCH = %d\n",
GDB_MULTI_ARCH);
+ fprintf_unfiltered (file,
+ "gdbarch_dump: convert_from_func_ptr_addr = 0x%08lx\n",
+ (long) current_gdbarch->convert_from_func_ptr_addr);
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_frame_align_p() = %d\n",
gdbarch_frame_align_p (current_gdbarch));
fprintf_unfiltered (file,
"gdbarch_dump: construct_inferior_arguments = 0x%08lx\n",
(long) current_gdbarch->construct_inferior_arguments);
-#ifdef CONVERT_FROM_FUNC_PTR_ADDR
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "CONVERT_FROM_FUNC_PTR_ADDR(addr)",
- XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr)));
- fprintf_unfiltered (file,
- "gdbarch_dump: CONVERT_FROM_FUNC_PTR_ADDR = <0x%08lx>\n",
- (long) current_gdbarch->convert_from_func_ptr_addr
- /*CONVERT_FROM_FUNC_PTR_ADDR ()*/);
-#endif
#ifdef CONVERT_REGISTER_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
}
CORE_ADDR
-gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
+gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
- return gdbarch->convert_from_func_ptr_addr (addr);
+ return gdbarch->convert_from_func_ptr_addr (gdbarch, addr, targ);
}
void
struct reggroup;
struct regset;
struct disassemble_info;
+struct target_ops;
extern struct gdbarch *current_gdbarch;
#define TARGET_LONG_DOUBLE_FORMAT (gdbarch_long_double_format (current_gdbarch))
#endif
-typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (CORE_ADDR addr);
-extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr);
+typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
+extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (CONVERT_FROM_FUNC_PTR_ADDR)
-#error "Non multi-arch definition of CONVERT_FROM_FUNC_PTR_ADDR"
-#endif
-#if !defined (CONVERT_FROM_FUNC_PTR_ADDR)
-#define CONVERT_FROM_FUNC_PTR_ADDR(addr) (gdbarch_convert_from_func_ptr_addr (current_gdbarch, addr))
-#endif
/* On some machines there are bits in addresses which are not really
part of the address, but are used by the kernel, the hardware, etc.
v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name
v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch)::%s:(TARGET_DOUBLE_FORMAT)->name
v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::default_double_format (gdbarch)::%s:(TARGET_LONG_DOUBLE_FORMAT)->name
-f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::core_addr_identity::0
+m:::CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ:::convert_from_func_ptr_addr_identity::0
# On some machines there are bits in addresses which are not really
# part of the address, but are used by the kernel, the hardware, etc.
# for special purposes. ADDR_BITS_REMOVE takes out any such bits so
struct reggroup;
struct regset;
struct disassemble_info;
+struct target_ops;
extern struct gdbarch *current_gdbarch;
so the user can see the function address rather than just the
function descriptor. */
static CORE_ADDR
-ia64_convert_from_func_ptr_addr (CORE_ADDR addr)
+ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct target_ops *targ)
{
struct obj_section *s;
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
{
- funaddr = CONVERT_FROM_FUNC_PTR_ADDR (funaddr);
+ funaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ funaddr,
+ ¤t_target);
value_type = TYPE_TARGET_TYPE (ftype);
}
else
dummy_addr = DEPRECATED_CALL_DUMMY_ADDRESS ();
/* Make certain that the address points at real code, and not a
function descriptor. */
- dummy_addr = CONVERT_FROM_FUNC_PTR_ADDR (dummy_addr);
+ dummy_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ dummy_addr,
+ ¤t_target);
/* A call dummy always consists of just a single breakpoint, so
it's address is the same as the address of the dummy. */
bp_addr = dummy_addr;
dummy_addr = entry_point_address ();
/* Make certain that the address points at real code, and not
a function descriptor. */
- dummy_addr = CONVERT_FROM_FUNC_PTR_ADDR (dummy_addr);
+ dummy_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ dummy_addr,
+ ¤t_target);
/* A call dummy always consists of just a single breakpoint,
so it's address is the same as the address of the dummy. */
bp_addr = dummy_addr;
}
-/* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR) on PPC64 GNU/Linux.
+/* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG) on PPC64
+ GNU/Linux.
Usually a function pointer's representation is simply the address
of the function. On GNU/Linux on the 64-bit PowerPC however, a
random addresses such as occures when there is no symbol table. */
static CORE_ADDR
-ppc64_linux_convert_from_func_ptr_addr (CORE_ADDR addr)
+ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ)
{
struct obj_section *s;
rs6000_set_host_arch_hook (pid);
}
\f
-/* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR).
+/* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG).
Usually a function pointer's representation is simply the address
of the function. On the RS/6000 however, a function pointer is
space and is therefore a special function pointer. */
static CORE_ADDR
-rs6000_convert_from_func_ptr_addr (CORE_ADDR addr)
+rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ)
{
struct obj_section *s;