Convert REG_STRUCT_HAS_ADDR to multi-arch. Use REG_STRUCT_HAS_ADDR_P
in conversion.
This commit is contained in:
parent
19be430370
commit
d03e67c95f
6 changed files with 132 additions and 71 deletions
|
@ -1,3 +1,18 @@
|
||||||
|
Fri Apr 21 15:23:13 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||||
|
|
||||||
|
* stabsread.c (REG_STRUCT_HAS_ADDR): Delete default.
|
||||||
|
(define_symbol): Check REG_STRUCT_HAS_ADDR_P before using
|
||||||
|
REG_STRUCT_HAS_ADDR.
|
||||||
|
(define_symbol): Ditto.
|
||||||
|
|
||||||
|
* valops.c (hand_function_call): Replace #ifdef
|
||||||
|
REG_STRUCT_HAS_ADDR with if REG_STRUCT_HAS_ADDR_P. Re-indent
|
||||||
|
affected code.
|
||||||
|
|
||||||
|
* gdbarch.sh (REG_STRUCT_HAS_ADDR): Add along with the predicate
|
||||||
|
function REG_STRUCT_HAS_ADDR_P.
|
||||||
|
* gdbarch.h, gdbarch.c: Re-generate.
|
||||||
|
|
||||||
2000-04-21 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
|
2000-04-21 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
|
||||||
|
|
||||||
* gdb-stabs.h (SECT_OFF_MAX): Increase to 40.
|
* gdb-stabs.h (SECT_OFF_MAX): Increase to 40.
|
||||||
|
|
|
@ -214,6 +214,7 @@ struct gdbarch
|
||||||
gdbarch_saved_pc_after_call_ftype *saved_pc_after_call;
|
gdbarch_saved_pc_after_call_ftype *saved_pc_after_call;
|
||||||
gdbarch_frame_num_args_ftype *frame_num_args;
|
gdbarch_frame_num_args_ftype *frame_num_args;
|
||||||
gdbarch_stack_align_ftype *stack_align;
|
gdbarch_stack_align_ftype *stack_align;
|
||||||
|
gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,6 +320,7 @@ struct gdbarch startup_gdbarch = {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
0,
|
||||||
/* startup_gdbarch() */
|
/* startup_gdbarch() */
|
||||||
};
|
};
|
||||||
struct gdbarch *current_gdbarch = &startup_gdbarch;
|
struct gdbarch *current_gdbarch = &startup_gdbarch;
|
||||||
|
@ -623,6 +625,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
||||||
&& (gdbarch->frame_num_args == 0))
|
&& (gdbarch->frame_num_args == 0))
|
||||||
internal_error ("gdbarch: verify_gdbarch: frame_num_args invalid");
|
internal_error ("gdbarch: verify_gdbarch: frame_num_args invalid");
|
||||||
/* Skip verify of stack_align, has predicate */
|
/* Skip verify of stack_align, has predicate */
|
||||||
|
/* Skip verify of reg_struct_has_addr, has predicate */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -962,6 +965,10 @@ gdbarch_dump (void)
|
||||||
"gdbarch_update: STACK_ALIGN = 0x%08lx\n",
|
"gdbarch_update: STACK_ALIGN = 0x%08lx\n",
|
||||||
(long) current_gdbarch->stack_align
|
(long) current_gdbarch->stack_align
|
||||||
/*STACK_ALIGN ()*/);
|
/*STACK_ALIGN ()*/);
|
||||||
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
|
"gdbarch_update: REG_STRUCT_HAS_ADDR = 0x%08lx\n",
|
||||||
|
(long) current_gdbarch->reg_struct_has_addr
|
||||||
|
/*REG_STRUCT_HAS_ADDR ()*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gdbarch_tdep *
|
struct gdbarch_tdep *
|
||||||
|
@ -2517,6 +2524,29 @@ set_gdbarch_stack_align (struct gdbarch *gdbarch,
|
||||||
gdbarch->stack_align = stack_align;
|
gdbarch->stack_align = stack_align;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gdbarch_reg_struct_has_addr_p (struct gdbarch *gdbarch)
|
||||||
|
{
|
||||||
|
return gdbarch->reg_struct_has_addr != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type)
|
||||||
|
{
|
||||||
|
if (gdbarch->reg_struct_has_addr == 0)
|
||||||
|
internal_error ("gdbarch: gdbarch_reg_struct_has_addr invalid");
|
||||||
|
if (gdbarch_debug >= 2)
|
||||||
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_reg_struct_has_addr called\n");
|
||||||
|
return gdbarch->reg_struct_has_addr (gcc_p, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch,
|
||||||
|
gdbarch_reg_struct_has_addr_ftype reg_struct_has_addr)
|
||||||
|
{
|
||||||
|
gdbarch->reg_struct_has_addr = reg_struct_has_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Keep a registrary of per-architecture data-pointers required by GDB
|
/* Keep a registrary of per-architecture data-pointers required by GDB
|
||||||
modules. */
|
modules. */
|
||||||
|
|
|
@ -815,6 +815,23 @@ extern void set_gdbarch_stack_align (struct gdbarch *gdbarch, gdbarch_stack_alig
|
||||||
#define STACK_ALIGN(sp) (gdbarch_stack_align (current_gdbarch, sp))
|
#define STACK_ALIGN(sp) (gdbarch_stack_align (current_gdbarch, sp))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (REG_STRUCT_HAS_ADDR)
|
||||||
|
/* Legacy for systems yet to multi-arch REG_STRUCT_HAS_ADDR */
|
||||||
|
#define REG_STRUCT_HAS_ADDR_P() (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int gdbarch_reg_struct_has_addr_p (struct gdbarch *gdbarch);
|
||||||
|
#if (GDB_MULTI_ARCH > 1) || !defined (REG_STRUCT_HAS_ADDR_P)
|
||||||
|
#define REG_STRUCT_HAS_ADDR_P() (gdbarch_reg_struct_has_addr_p (current_gdbarch))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int (gdbarch_reg_struct_has_addr_ftype) (int gcc_p, struct type *type);
|
||||||
|
extern int gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type);
|
||||||
|
extern void set_gdbarch_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_reg_struct_has_addr_ftype *reg_struct_has_addr);
|
||||||
|
#if (GDB_MULTI_ARCH > 1) || !defined (REG_STRUCT_HAS_ADDR)
|
||||||
|
#define REG_STRUCT_HAS_ADDR(gcc_p, type) (gdbarch_reg_struct_has_addr (current_gdbarch, gcc_p, type))
|
||||||
|
#endif
|
||||||
|
|
||||||
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
|
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,7 @@ f:2:SAVED_PC_AFTER_CALL:CORE_ADDR:saved_pc_after_call:struct frame_info *frame:f
|
||||||
f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0
|
f:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame::0:0
|
||||||
#
|
#
|
||||||
F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0
|
F:2:STACK_ALIGN:CORE_ADDR:stack_align:CORE_ADDR sp:sp::0:0
|
||||||
|
F:2:REG_STRUCT_HAS_ADDR:int:reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type::0:0
|
||||||
EOF
|
EOF
|
||||||
grep -v '^#'
|
grep -v '^#'
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,10 +559,6 @@ read_type_number (pp, typenums)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !defined (REG_STRUCT_HAS_ADDR)
|
|
||||||
#define REG_STRUCT_HAS_ADDR(gcc_p,type) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define VISIBILITY_PRIVATE '0' /* Stabs character for private field */
|
#define VISIBILITY_PRIVATE '0' /* Stabs character for private field */
|
||||||
#define VISIBILITY_PROTECTED '1' /* Stabs character for protected fld */
|
#define VISIBILITY_PROTECTED '1' /* Stabs character for protected fld */
|
||||||
#define VISIBILITY_PUBLIC '2' /* Stabs character for public field */
|
#define VISIBILITY_PUBLIC '2' /* Stabs character for public field */
|
||||||
|
@ -1899,6 +1895,7 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
if (local_symbols
|
if (local_symbols
|
||||||
&& local_symbols->nsyms > 0
|
&& local_symbols->nsyms > 0
|
||||||
#ifndef USE_REGISTER_NOT_ARG
|
#ifndef USE_REGISTER_NOT_ARG
|
||||||
|
&& REG_STRUCT_HAS_ADDR_P ()
|
||||||
&& REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
|
&& REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
|
||||||
SYMBOL_TYPE (sym))
|
SYMBOL_TYPE (sym))
|
||||||
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
|
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
|
||||||
|
@ -2156,8 +2153,9 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
/* When passing structures to a function, some systems sometimes pass
|
/* When passing structures to a function, some systems sometimes pass
|
||||||
the address in a register, not the structure itself. */
|
the address in a register, not the structure itself. */
|
||||||
|
|
||||||
if (REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
|
if (REG_STRUCT_HAS_ADDR_P ()
|
||||||
&& (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
|
&& REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
|
||||||
|
&& (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
|
||||||
{
|
{
|
||||||
struct type *symbol_type = check_typedef (SYMBOL_TYPE (sym));
|
struct type *symbol_type = check_typedef (SYMBOL_TYPE (sym));
|
||||||
|
|
||||||
|
|
130
gdb/valops.c
130
gdb/valops.c
|
@ -1510,72 +1510,72 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (REG_STRUCT_HAS_ADDR)
|
if (REG_STRUCT_HAS_ADDR_P ())
|
||||||
{
|
{
|
||||||
/* This is a machine like the sparc, where we may need to pass a pointer
|
/* This is a machine like the sparc, where we may need to pass a
|
||||||
to the structure, not the structure itself. */
|
pointer to the structure, not the structure itself. */
|
||||||
for (i = nargs - 1; i >= 0; i--)
|
for (i = nargs - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
struct type *arg_type = check_typedef (VALUE_TYPE (args[i]));
|
struct type *arg_type = check_typedef (VALUE_TYPE (args[i]));
|
||||||
if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT
|
if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT
|
||||||
|| TYPE_CODE (arg_type) == TYPE_CODE_UNION
|
|| TYPE_CODE (arg_type) == TYPE_CODE_UNION
|
||||||
|| TYPE_CODE (arg_type) == TYPE_CODE_ARRAY
|
|| TYPE_CODE (arg_type) == TYPE_CODE_ARRAY
|
||||||
|| TYPE_CODE (arg_type) == TYPE_CODE_STRING
|
|| TYPE_CODE (arg_type) == TYPE_CODE_STRING
|
||||||
|| TYPE_CODE (arg_type) == TYPE_CODE_BITSTRING
|
|| TYPE_CODE (arg_type) == TYPE_CODE_BITSTRING
|
||||||
|| TYPE_CODE (arg_type) == TYPE_CODE_SET
|
|| TYPE_CODE (arg_type) == TYPE_CODE_SET
|
||||||
|| (TYPE_CODE (arg_type) == TYPE_CODE_FLT
|
|| (TYPE_CODE (arg_type) == TYPE_CODE_FLT
|
||||||
&& TYPE_LENGTH (arg_type) > 8)
|
&& TYPE_LENGTH (arg_type) > 8)
|
||||||
)
|
)
|
||||||
&& REG_STRUCT_HAS_ADDR (using_gcc, arg_type))
|
&& REG_STRUCT_HAS_ADDR (using_gcc, arg_type))
|
||||||
{
|
{
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
int len; /* = TYPE_LENGTH (arg_type); */
|
int len; /* = TYPE_LENGTH (arg_type); */
|
||||||
int aligned_len;
|
int aligned_len;
|
||||||
arg_type = check_typedef (VALUE_ENCLOSING_TYPE (args[i]));
|
arg_type = check_typedef (VALUE_ENCLOSING_TYPE (args[i]));
|
||||||
len = TYPE_LENGTH (arg_type);
|
len = TYPE_LENGTH (arg_type);
|
||||||
|
|
||||||
|
if (STACK_ALIGN_P ())
|
||||||
|
/* MVS 11/22/96: I think at least some of this
|
||||||
|
stack_align code is really broken. Better to let
|
||||||
|
PUSH_ARGUMENTS adjust the stack in a target-defined
|
||||||
|
manner. */
|
||||||
|
aligned_len = STACK_ALIGN (len);
|
||||||
|
else
|
||||||
|
aligned_len = len;
|
||||||
|
if (INNER_THAN (1, 2))
|
||||||
|
{
|
||||||
|
/* stack grows downward */
|
||||||
|
sp -= aligned_len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The stack grows up, so the address of the thing
|
||||||
|
we push is the stack pointer before we push it. */
|
||||||
|
addr = sp;
|
||||||
|
}
|
||||||
|
/* Push the structure. */
|
||||||
|
write_memory (sp, VALUE_CONTENTS_ALL (args[i]), len);
|
||||||
|
if (INNER_THAN (1, 2))
|
||||||
|
{
|
||||||
|
/* The stack grows down, so the address of the thing
|
||||||
|
we push is the stack pointer after we push it. */
|
||||||
|
addr = sp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* stack grows upward */
|
||||||
|
sp += aligned_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 (value_type),
|
||||||
|
(LONGEST) addr); */
|
||||||
|
args[i] = value_from_pointer (lookup_pointer_type (arg_type),
|
||||||
|
addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (STACK_ALIGN_P ())
|
|
||||||
/* MVS 11/22/96: I think at least some of this
|
|
||||||
stack_align code is really broken. Better to let
|
|
||||||
PUSH_ARGUMENTS adjust the stack in a target-defined
|
|
||||||
manner. */
|
|
||||||
aligned_len = STACK_ALIGN (len);
|
|
||||||
else
|
|
||||||
aligned_len = len;
|
|
||||||
if (INNER_THAN (1, 2))
|
|
||||||
{
|
|
||||||
/* stack grows downward */
|
|
||||||
sp -= aligned_len;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* The stack grows up, so the address of the thing we push
|
|
||||||
is the stack pointer before we push it. */
|
|
||||||
addr = sp;
|
|
||||||
}
|
|
||||||
/* Push the structure. */
|
|
||||||
write_memory (sp, VALUE_CONTENTS_ALL (args[i]), len);
|
|
||||||
if (INNER_THAN (1, 2))
|
|
||||||
{
|
|
||||||
/* The stack grows down, so the address of the thing we push
|
|
||||||
is the stack pointer after we push it. */
|
|
||||||
addr = sp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* stack grows upward */
|
|
||||||
sp += aligned_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 (value_type),
|
|
||||||
(LONGEST) addr); */
|
|
||||||
args[i] = value_from_pointer (lookup_pointer_type (arg_type),
|
|
||||||
addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* REG_STRUCT_HAS_ADDR. */
|
|
||||||
|
|
||||||
/* Reserve space for the return structure to be written on the
|
/* Reserve space for the return structure to be written on the
|
||||||
stack, if necessary */
|
stack, if necessary */
|
||||||
|
|
Loading…
Add table
Reference in a new issue