* gdbarch.sh (DEPRECATED_REG_STRUCT_HAS_ADDR): Add comment.

* gdbarch.h, gdbarch.c: Regenerate.
(stabs_argument_has_addr): New architecture method.
* arch-utils.h (default_stabs_argument_has_addr): New prototype.
* arch-utils.c: Include "buildsym.h".
(default_stabs_argument_has_addr): New function.
* stabsread.c (define_symbol): Use stabs_argument_has_addr
instead of DEPRECATED_REG_STRUCT_HAS_ADDR.
This commit is contained in:
Mark Kettenis 2003-09-17 19:48:42 +00:00
parent efe59759d8
commit 192cb3d4e2
7 changed files with 95 additions and 39 deletions

View File

@ -1,3 +1,14 @@
2003-09-17 Mark Kettenis <kettenis@gnu.org>
* gdbarch.sh (DEPRECATED_REG_STRUCT_HAS_ADDR): Add comment.
* gdbarch.h, gdbarch.c: Regenerate.
(stabs_argument_has_addr): New architecture method.
* arch-utils.h (default_stabs_argument_has_addr): New prototype.
* arch-utils.c: Include "buildsym.h".
(default_stabs_argument_has_addr): New function.
* stabsread.c (define_symbol): Use stabs_argument_has_addr
instead of DEPRECATED_REG_STRUCT_HAS_ADDR.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_NPC_REGNUM): Deprecate NPC_REGNUM.

View File

@ -23,6 +23,7 @@
#include "defs.h"
#include "arch-utils.h"
#include "buildsym.h"
#include "gdbcmd.h"
#include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
#include "gdb_string.h"
@ -359,6 +360,23 @@ legacy_value_to_register (struct frame_info *frame, int regnum,
put_frame_register (frame, regnum, to);
}
int
default_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
{
if (DEPRECATED_REG_STRUCT_HAS_ADDR_P ()
&& DEPRECATED_REG_STRUCT_HAS_ADDR (processing_gcc_compilation, type))
{
CHECK_TYPEDEF (type);
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION
|| TYPE_CODE (type) == TYPE_CODE_SET
|| TYPE_CODE (type) == TYPE_CODE_BITSTRING);
}
return 0;
}
/* Functions to manipulate the endianness of the target. */

View File

@ -138,6 +138,9 @@ extern void legacy_register_to_value (struct frame_info *frame, int regnum,
extern void legacy_value_to_register (struct frame_info *frame, int regnum,
struct type *type, const void *from);
extern int default_stabs_argument_has_addr (struct gdbarch *gdbarch,
struct type *type);
/* For compatibility with older architectures, returns
(LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid
name. */

View File

@ -238,6 +238,7 @@ struct gdbarch
gdbarch_deprecated_stack_align_ftype *deprecated_stack_align;
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;
int parm_boundary;
const struct floatformat * float_format;
@ -406,6 +407,7 @@ struct gdbarch startup_gdbarch =
0, /* deprecated_stack_align */
0, /* frame_align */
0, /* deprecated_reg_struct_has_addr */
default_stabs_argument_has_addr, /* stabs_argument_has_addr */
0, /* frame_red_zone_size */
0, /* parm_boundary */
0, /* float_format */
@ -540,6 +542,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
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->addr_bits_remove = core_addr_identity;
current_gdbarch->smash_text_address = core_addr_identity;
@ -730,6 +733,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of deprecated_stack_align, 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 */
if (gdbarch->float_format == 0)
gdbarch->float_format = default_float_format (gdbarch);
if (gdbarch->double_format == 0)
@ -797,6 +801,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: register_reggroup_p = 0x%08lx\n",
(long) current_gdbarch->register_reggroup_p);
fprintf_unfiltered (file,
"gdbarch_dump: stabs_argument_has_addr = 0x%08lx\n",
(long) current_gdbarch->stabs_argument_has_addr);
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
gdbarch_pseudo_register_read_p (current_gdbarch));
@ -4930,6 +4937,23 @@ set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch,
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);
gdb_assert (gdbarch->stabs_argument_has_addr != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_stabs_argument_has_addr called\n");
return gdbarch->stabs_argument_has_addr (gdbarch, type);
}
void
set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch,
gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
{
gdbarch->stabs_argument_has_addr = stabs_argument_has_addr;
}
int
gdbarch_frame_red_zone_size (struct gdbarch *gdbarch)
{

View File

@ -1939,6 +1939,9 @@ typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADD
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)
@ -1964,6 +1967,10 @@ extern void set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch,
#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);
extern int gdbarch_frame_red_zone_size (struct gdbarch *gdbarch);
extern void set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch, int frame_red_zone_size);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_RED_ZONE_SIZE)
@ -2039,7 +2046,7 @@ extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_
#define ADDR_BITS_REMOVE(addr) (gdbarch_addr_bits_remove (current_gdbarch, addr))
#endif
/* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
/* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
ADDR_BITS_REMOVE. */
typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (CORE_ADDR addr);
@ -2333,7 +2340,7 @@ typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int re
extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup);
extern void set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *register_reggroup_p);
/* Fetch the pointer to the ith function argument. */
/* Fetch the pointer to the ith function argument. */
#if defined (FETCH_POINTER_ARGUMENT)
/* Legacy for systems yet to multi-arch FETCH_POINTER_ARGUMENT */

View File

@ -648,7 +648,10 @@ F:2:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame
# alignment.
F:2:DEPRECATED_STACK_ALIGN:CORE_ADDR:deprecated_stack_align:CORE_ADDR sp:sp
M:::CORE_ADDR:frame_align:CORE_ADDR address:address
# DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by
# stabs_argument_has_addr.
F:2:DEPRECATED_REG_STRUCT_HAS_ADDR: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::FRAME_RED_ZONE_SIZE:int:frame_red_zone_size
v:2:PARM_BOUNDARY:int:parm_boundary
#

View File

@ -1748,17 +1748,20 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
if (within_function)
{
/* Sun cc uses a pair of symbols, one 'p' and one 'r' with the same
name to represent an argument passed in a register.
GCC uses 'P' for the same case. So if we find such a symbol pair
we combine it into one 'P' symbol. For Sun cc we need to do this
regardless of DEPRECATED_REG_STRUCT_HAS_ADDR, because the compiler puts out
the 'p' symbol even if it never saves the argument onto the stack.
/* Sun cc uses a pair of symbols, one 'p' and one 'r', with
the same name to represent an argument passed in a
register. GCC uses 'P' for the same case. So if we find
such a symbol pair we combine it into one 'P' symbol.
For Sun cc we need to do this regardless of
stabs_argument_has_addr, because the compiler puts out
the 'p' symbol even if it never saves the argument onto
the stack.
On most machines, we want to preserve both symbols, so that
we can still get information about what is going on with the
stack (VAX for computing args_printed, using stack slots instead
of saved registers in backtraces, etc.).
On most machines, we want to preserve both symbols, so
that we can still get information about what is going on
with the stack (VAX for computing args_printed, using
stack slots instead of saved registers in backtraces,
etc.).
Note that this code illegally combines
main(argc) struct foo argc; { register struct foo argc; }
@ -1768,13 +1771,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
if (local_symbols
&& local_symbols->nsyms > 0
#ifndef USE_REGISTER_NOT_ARG
&& DEPRECATED_REG_STRUCT_HAS_ADDR_P ()
&& DEPRECATED_REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
SYMBOL_TYPE (sym))
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_SET
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_BITSTRING)
&& gdbarch_stabs_argument_has_addr (current_gdbarch,
SYMBOL_TYPE (sym))
#endif
)
{
@ -2047,29 +2045,21 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
break;
}
/* When passing structures to a function, some systems sometimes pass
the address in a register, not the structure itself. */
/* Some systems pass variables of certain types by reference instead
of by value, i.e. they will pass the address of a structure (in a
register or on the stack) instead of the structure itself. */
if (DEPRECATED_REG_STRUCT_HAS_ADDR_P ()
&& DEPRECATED_REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
if (gdbarch_stabs_argument_has_addr (current_gdbarch, SYMBOL_TYPE (sym))
&& (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
{
struct type *symbol_type = check_typedef (SYMBOL_TYPE (sym));
if ((TYPE_CODE (symbol_type) == TYPE_CODE_STRUCT)
|| (TYPE_CODE (symbol_type) == TYPE_CODE_UNION)
|| (TYPE_CODE (symbol_type) == TYPE_CODE_BITSTRING)
|| (TYPE_CODE (symbol_type) == TYPE_CODE_SET))
{
/* If DEPRECATED_REG_STRUCT_HAS_ADDR yields non-zero we have to convert
LOC_REGPARM to LOC_REGPARM_ADDR for structures and unions. */
if (SYMBOL_CLASS (sym) == LOC_REGPARM)
SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
/* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th
and subsequent arguments on the sparc, for example). */
else if (SYMBOL_CLASS (sym) == LOC_ARG)
SYMBOL_CLASS (sym) = LOC_REF_ARG;
}
/* We have to convert LOC_REGPARM to LOC_REGPARM_ADDR (for
variables passed in a register). */
if (SYMBOL_CLASS (sym) == LOC_REGPARM)
SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
/* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th
and subsequent arguments on SPARC, for example). */
else if (SYMBOL_CLASS (sym) == LOC_ARG)
SYMBOL_CLASS (sym) = LOC_REF_ARG;
}
/* Is there more to parse? For example LRS/alias information? */