This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[ref] Remove macro DEPRECATED_REG_STRUCT_HAS_ADDR
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Wed, 13 Jun 2007 20:30:40 +0200
- Subject: [ref] Remove macro DEPRECATED_REG_STRUCT_HAS_ADDR
Hello,
this patch completely removes DEPRECATED_REG_STRUCT_HAS_ADDR. This was only used in infcall.c
and was replaced by gdbarch_stabs_argument_has_addr. Build and tested on x86. Testsuite showed no regressions.
ChangeLog:
* infcall.c (call_function_by_hand): Remove
DEPRECATED_REG_STRUCT_HAS_ADDR_P.
Replace DEPRECATED_REG_STRUCT_HAS_ADDR by stabs_argument_has_addr.
* gdbarch.sh (DEPRECATED_REG_STRUCT_HAS_ADDR): Remove.
* gdbarch.c, gdbarch.h: Regenerate.
Is this ok to commit?
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c 2007-06-13 20:02:38.000000000 +0200
+++ dev/gdb/gdbarch.c 2007-06-13 20:19:51.000000000 +0200
@@ -205,7 +205,6 @@
gdbarch_unwind_sp_ftype *unwind_sp;
gdbarch_frame_num_args_ftype *frame_num_args;
gdbarch_frame_align_ftype *frame_align;
- gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr;
gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr;
int frame_red_zone_size;
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
@@ -329,7 +328,6 @@
0, /* unwind_sp */
0, /* frame_num_args */
0, /* frame_align */
- 0, /* deprecated_reg_struct_has_addr */
default_stabs_argument_has_addr, /* stabs_argument_has_addr */
0, /* frame_red_zone_size */
convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */
@@ -579,7 +577,6 @@
/* Skip verify of unwind_sp, has predicate */
/* Skip verify of frame_num_args, has predicate */
/* Skip verify of frame_align, has predicate */
- /* Skip verify of deprecated_reg_struct_has_addr, has predicate */
/* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
/* Skip verify of addr_bits_remove, invalid_p == 0 */
@@ -767,24 +764,6 @@
fprintf_unfiltered (file,
"gdbarch_dump: deprecated_function_start_offset = 0x%s\n",
paddr_nz (current_gdbarch->deprecated_function_start_offset));
-#ifdef DEPRECATED_REG_STRUCT_HAS_ADDR_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "DEPRECATED_REG_STRUCT_HAS_ADDR_P()",
- XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR_P ()));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: gdbarch_deprecated_reg_struct_has_addr_p() = %d\n",
- gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch));
-#ifdef DEPRECATED_REG_STRUCT_HAS_ADDR
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type)",
- XSTRING (DEPRECATED_REG_STRUCT_HAS_ADDR (gcc_p, type)));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: deprecated_reg_struct_has_addr = <0x%lx>\n",
- (long) current_gdbarch->deprecated_reg_struct_has_addr);
#ifdef DEPRECATED_REGISTER_SIZE
fprintf_unfiltered (file,
"gdbarch_dump: DEPRECATED_REGISTER_SIZE # %s\n",
@@ -2596,30 +2575,6 @@
}
int
-gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- return gdbarch->deprecated_reg_struct_has_addr != NULL;
-}
-
-int
-gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type)
-{
- gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->deprecated_reg_struct_has_addr != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_reg_struct_has_addr called\n");
- return gdbarch->deprecated_reg_struct_has_addr (gcc_p, type);
-}
-
-void
-set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch,
- gdbarch_deprecated_reg_struct_has_addr_ftype deprecated_reg_struct_has_addr)
-{
- gdbarch->deprecated_reg_struct_has_addr = deprecated_reg_struct_has_addr;
-}
-
-int
gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
{
gdb_assert (gdbarch != NULL);
diff -urN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h 2007-06-13 20:02:38.000000000 +0200
+++ dev/gdb/gdbarch.h 2007-06-13 20:19:40.000000000 +0200
@@ -613,34 +613,6 @@
extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address);
extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align);
-/* DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by
- stabs_argument_has_addr. */
-
-#if defined (DEPRECATED_REG_STRUCT_HAS_ADDR)
-/* Legacy for systems yet to multi-arch DEPRECATED_REG_STRUCT_HAS_ADDR */
-#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P)
-#define DEPRECATED_REG_STRUCT_HAS_ADDR_P() (1)
-#endif
-#endif
-
-extern int gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch);
-#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P)
-#error "Non multi-arch definition of DEPRECATED_REG_STRUCT_HAS_ADDR"
-#endif
-#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR_P)
-#define DEPRECATED_REG_STRUCT_HAS_ADDR_P() (gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch))
-#endif
-
-typedef int (gdbarch_deprecated_reg_struct_has_addr_ftype) (int gcc_p, struct type *type);
-extern int gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type);
-extern void set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr);
-#if !defined (GDB_TM_FILE) && defined (DEPRECATED_REG_STRUCT_HAS_ADDR)
-#error "Non multi-arch definition of DEPRECATED_REG_STRUCT_HAS_ADDR"
-#endif
-#if !defined (DEPRECATED_REG_STRUCT_HAS_ADDR)
-#define DEPRECATED_REG_STRUCT_HAS_ADDR(gcc_p, type) (gdbarch_deprecated_reg_struct_has_addr (current_gdbarch, gcc_p, type))
-#endif
-
typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch, struct type *type);
extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type);
extern void set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr);
diff -urN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh 2007-06-13 20:02:38.000000000 +0200
+++ dev/gdb/gdbarch.sh 2007-06-13 20:19:32.000000000 +0200
@@ -574,9 +574,6 @@
F::int:frame_num_args:struct frame_info *frame:frame
#
M::CORE_ADDR:frame_align:CORE_ADDR address:address
-# DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by
-# stabs_argument_has_addr.
-F:=:int:deprecated_reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type
m::int:stabs_argument_has_addr:struct type *type:type::default_stabs_argument_has_addr::0
v::int:frame_red_zone_size
#
diff -urN src/gdb/infcall.c dev/gdb/infcall.c
--- src/gdb/infcall.c 2007-06-08 05:38:50.000000000 +0200
+++ dev/gdb/infcall.c 2007-06-13 20:18:58.000000000 +0200
@@ -336,6 +336,7 @@
struct regcache *caller_regcache;
struct cleanup *caller_regcache_cleanup;
struct frame_id dummy_id;
+ int i;
if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
@@ -520,7 +521,6 @@
error (_("too few arguments in function call"));
{
- int i;
for (i = nargs - 1; i >= 0; i--)
{
int prototyped;
@@ -582,60 +582,51 @@
}
}
- if (DEPRECATED_REG_STRUCT_HAS_ADDR_P ())
+ /* This is a machine like the sparc, where we may need to pass a
+ pointer to the structure, not the structure itself. */
+ for (i = nargs - 1; i >= 0; i--)
{
- int i;
- /* This is a machine like the sparc, where we may need to pass a
- pointer to the structure, not the structure itself. */
- for (i = nargs - 1; i >= 0; i--)
- {
- struct type *arg_type = check_typedef (value_type (args[i]));
- if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (arg_type) == TYPE_CODE_UNION
- || TYPE_CODE (arg_type) == TYPE_CODE_ARRAY
- || TYPE_CODE (arg_type) == TYPE_CODE_STRING
- || TYPE_CODE (arg_type) == TYPE_CODE_BITSTRING
- || TYPE_CODE (arg_type) == TYPE_CODE_SET
- || (TYPE_CODE (arg_type) == TYPE_CODE_FLT
- && TYPE_LENGTH (arg_type) > 8)
- )
- && DEPRECATED_REG_STRUCT_HAS_ADDR (using_gcc, arg_type))
- {
- CORE_ADDR addr;
- int len; /* = TYPE_LENGTH (arg_type); */
- int aligned_len;
- arg_type = check_typedef (value_enclosing_type (args[i]));
- len = TYPE_LENGTH (arg_type);
-
- aligned_len = len;
- if (gdbarch_inner_than (current_gdbarch, 1, 2))
- {
- /* stack grows downward */
- sp -= aligned_len;
- /* ... so the address of the thing we push is the
- stack pointer after we push it. */
- addr = sp;
- }
- else
- {
- /* The stack grows up, so the address of the thing
- we push is the stack pointer before we push it. */
- addr = sp;
- sp += aligned_len;
- }
- /* Push the structure. */
- write_memory (addr, value_contents_all (args[i]), len);
- /* The value we're going to pass is the address of the
- thing we just pushed. */
- /*args[i] = value_from_longest (lookup_pointer_type (values_type),
- (LONGEST) addr); */
- args[i] = value_from_pointer (lookup_pointer_type (arg_type),
- addr);
- }
- }
+ struct type *arg_type = check_typedef (value_type (args[i]));
+ if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT
+ || TYPE_CODE (arg_type) == TYPE_CODE_UNION
+ || TYPE_CODE (arg_type) == TYPE_CODE_ARRAY
+ || TYPE_CODE (arg_type) == TYPE_CODE_STRING
+ || TYPE_CODE (arg_type) == TYPE_CODE_BITSTRING
+ || TYPE_CODE (arg_type) == TYPE_CODE_SET
+ || (TYPE_CODE (arg_type) == TYPE_CODE_FLT
+ && TYPE_LENGTH (arg_type) > 8))
+ && gdbarch_stabs_argument_has_addr (current_gdbarch, arg_type))
+ {
+ CORE_ADDR addr;
+ int len; /* = TYPE_LENGTH (arg_type); */
+ int aligned_len;
+ arg_type = check_typedef (value_enclosing_type (args[i]));
+ len = TYPE_LENGTH (arg_type);
+
+ aligned_len = len;
+ if (gdbarch_inner_than (current_gdbarch, 1, 2))
+ {
+ /* stack grows downward */
+ sp -= aligned_len;
+ /* ... so the address of the thing we push is the
+ stack pointer after we push it. */
+ addr = sp;
+ }
+ else
+ {
+ /* The stack grows up, so the address of the thing
+ we push is the stack pointer before we push it. */
+ addr = sp;
+ sp += aligned_len;
+ }
+ /* Push the structure. */
+ write_memory (addr, value_contents_all (args[i]), len);
+ /* The value we're going to pass is the address of the
+ thing we just pushed. */
+ args[i] = value_from_pointer (lookup_pointer_type (arg_type), addr);
+ }
}
-
/* Reserve space for the return structure to be written on the
stack, if necessary. Make certain that the value is correctly
aligned. */