2005-01-27 Andrew Cagney <cagney@gnu.org>

* gdbarch.sh (integer_to_address): Change buf parameter to a const
	bfd_byte, make pure-multi-arch.
	* gdbarch.h, gdbarch.c: Regenerate.
	* mips-tdep.c (mips_integer_to_address): Update.
	* value.c (value_as_address): Update.
This commit is contained in:
Andrew Cagney 2005-01-27 21:00:59 +00:00
parent c26b8e3b42
commit 79dd2d2463
6 changed files with 23 additions and 47 deletions

View File

@ -1,5 +1,11 @@
2005-01-27 Andrew Cagney <cagney@gnu.org>
* gdbarch.sh (integer_to_address): Change buf parameter to a const
bfd_byte, make pure-multi-arch.
* gdbarch.h, gdbarch.c: Regenerate.
* mips-tdep.c (mips_integer_to_address): Update.
* value.c (value_as_address): Update.
* cli/cli-dump.h (fopen_with_cleanup): Make "filename" const.
* cli/cli-dump.c (dump_binary_file, dump_bfd_file): Make string
parameters const, change buf to a const bfd_byte.

View File

@ -2,7 +2,7 @@
/* Dynamic architecture support for GDB, the GNU debugger.
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Software Foundation, Inc.
This file is part of GDB.
@ -1203,21 +1203,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: int_bit = %s\n",
paddr_d (current_gdbarch->int_bit));
#ifdef INTEGER_TO_ADDRESS_P
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"INTEGER_TO_ADDRESS_P()",
XSTRING (INTEGER_TO_ADDRESS_P ()));
#endif
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
gdbarch_integer_to_address_p (current_gdbarch));
#ifdef INTEGER_TO_ADDRESS
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"INTEGER_TO_ADDRESS(type, buf)",
XSTRING (INTEGER_TO_ADDRESS (type, buf)));
#endif
fprintf_unfiltered (file,
"gdbarch_dump: integer_to_address = <0x%lx>\n",
(long) current_gdbarch->integer_to_address);
@ -2714,13 +2702,13 @@ gdbarch_integer_to_address_p (struct gdbarch *gdbarch)
}
CORE_ADDR
gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf)
gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const bfd_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->integer_to_address != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_integer_to_address called\n");
return gdbarch->integer_to_address (type, buf);
return gdbarch->integer_to_address (gdbarch, type, buf);
}
void

View File

@ -2,7 +2,7 @@
/* Dynamic architecture support for GDB, the GNU debugger.
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Software Foundation, Inc.
This file is part of GDB.
@ -747,30 +747,11 @@ extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_add
#define ADDRESS_TO_POINTER(type, buf, addr) (gdbarch_address_to_pointer (current_gdbarch, type, buf, addr))
#endif
#if defined (INTEGER_TO_ADDRESS)
/* Legacy for systems yet to multi-arch INTEGER_TO_ADDRESS */
#if !defined (INTEGER_TO_ADDRESS_P)
#define INTEGER_TO_ADDRESS_P() (1)
#endif
#endif
extern int gdbarch_integer_to_address_p (struct gdbarch *gdbarch);
#if !defined (GDB_TM_FILE) && defined (INTEGER_TO_ADDRESS_P)
#error "Non multi-arch definition of INTEGER_TO_ADDRESS"
#endif
#if !defined (INTEGER_TO_ADDRESS_P)
#define INTEGER_TO_ADDRESS_P() (gdbarch_integer_to_address_p (current_gdbarch))
#endif
typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct type *type, void *buf);
extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf);
typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const bfd_byte *buf);
extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const bfd_byte *buf);
extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype *integer_to_address);
#if !defined (GDB_TM_FILE) && defined (INTEGER_TO_ADDRESS)
#error "Non multi-arch definition of INTEGER_TO_ADDRESS"
#endif
#if !defined (INTEGER_TO_ADDRESS)
#define INTEGER_TO_ADDRESS(type, buf) (gdbarch_integer_to_address (current_gdbarch, type, buf))
#endif
/* NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS. */

View File

@ -2,9 +2,8 @@
# Architecture commands for GDB, the GNU debugger.
#
# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
# Foundation, Inc.
#
# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
# Software Foundation, Inc.
#
# This file is part of GDB.
#
@ -500,7 +499,7 @@ f:=:void:value_to_register:struct frame_info *frame, int regnum, struct type *ty
#
f:=:CORE_ADDR:pointer_to_address:struct type *type, const void *buf:type, buf::unsigned_pointer_to_address::0
f:=:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0
F:=:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf
M::CORE_ADDR:integer_to_address:struct type *type, const bfd_byte *buf:type, buf
#
# NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS.
F:=:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp
@ -714,7 +713,7 @@ cat <<EOF
/* Dynamic architecture support for GDB, the GNU debugger.
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Software Foundation, Inc.
This file is part of GDB.

View File

@ -1,7 +1,7 @@
/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
@ -4596,7 +4596,8 @@ mips_register_sim_regno (int regnum)
guarenteed to be correctly sign extended. */
static CORE_ADDR
mips_integer_to_address (struct type *type, void *buf)
mips_integer_to_address (struct gdbarch *gdbarch,
struct type *type, const bfd_byte *buf)
{
char *tmp = alloca (TYPE_LENGTH (builtin_type_void_data_ptr));
LONGEST val = unpack_long (type, buf);

View File

@ -654,7 +654,7 @@ value_as_address (struct value *val)
take an address from a disassembly listing and give it to `x/i'.
This is certainly important.
Adding an architecture method like INTEGER_TO_ADDRESS certainly
Adding an architecture method like integer_to_address() certainly
makes it possible for GDB to "get it right" in all circumstances
--- the target has complete control over how things get done, so
people can Do The Right Thing for their target without breaking
@ -664,8 +664,9 @@ value_as_address (struct value *val)
if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR
&& TYPE_CODE (value_type (val)) != TYPE_CODE_REF
&& INTEGER_TO_ADDRESS_P ())
return INTEGER_TO_ADDRESS (value_type (val), VALUE_CONTENTS (val));
&& gdbarch_integer_to_address_p (current_gdbarch))
return gdbarch_integer_to_address (current_gdbarch, value_type (val),
VALUE_CONTENTS (val));
return unpack_long (value_type (val), VALUE_CONTENTS (val));
#endif