* stabsread.c (define-symbol): Use invisible references
for TYPE_CODE_SET and TYPE_CODE_BITSTRING too. * eval.c (evaluate_subexp_standard): When known, use the formal parameter type as the expected type when evaluating arg expressions. * ch-lang.c (evaluate_subexp_chill): Likewise (for MULTI_SUBSCRIPT). This (with a fix to gcc/config/sparc/sparc.h) fixes PR chill/8742.
This commit is contained in:
parent
71897943c4
commit
1c486a2ba5
4 changed files with 63 additions and 28 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Thu Jan 11 17:21:25 1996 Per Bothner <bothner@kalessin.cygnus.com>
|
||||||
|
|
||||||
|
* stabsread.c (define-symbol): Use invisible references
|
||||||
|
for TYPE_CODE_SET and TYPE_CODE_BITSTRING too.
|
||||||
|
* eval.c (evaluate_subexp_standard): When known, use the formal
|
||||||
|
parameter type as the expected type when evaluating arg expressions.
|
||||||
|
* ch-lang.c (evaluate_subexp_chill): Likewise (for MULTI_SUBSCRIPT).
|
||||||
|
|
||||||
Wed Jan 10 11:25:37 1996 Fred Fish <fnf@cygnus.com>
|
Wed Jan 10 11:25:37 1996 Fred Fish <fnf@cygnus.com>
|
||||||
|
|
||||||
* coredep.c: Renamed to core-aout.c
|
* coredep.c: Renamed to core-aout.c
|
||||||
|
|
|
@ -424,6 +424,17 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
|
||||||
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 2));
|
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 2));
|
||||||
argvec[0] = arg1;
|
argvec[0] = arg1;
|
||||||
tem = 1;
|
tem = 1;
|
||||||
|
if (type && TYPE_CODE (type) == TYPE_CODE_PTR)
|
||||||
|
type = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
|
if (type && TYPE_CODE (type) == TYPE_CODE_FUNC)
|
||||||
|
{
|
||||||
|
for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
|
||||||
|
{
|
||||||
|
argvec[tem]
|
||||||
|
= evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem-1),
|
||||||
|
exp, pos, noside);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (; tem <= nargs; tem++)
|
for (; tem <= nargs; tem++)
|
||||||
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||||
argvec[tem] = 0; /* signal end of arglist */
|
argvec[tem] = 0; /* signal end of arglist */
|
||||||
|
|
36
gdb/eval.c
36
gdb/eval.c
|
@ -283,7 +283,7 @@ evaluate_struct_tuple (struct_val, exp, pos, noside, nargs)
|
||||||
|
|
||||||
field_type = TYPE_FIELD_TYPE (substruct_type, subfieldno);
|
field_type = TYPE_FIELD_TYPE (substruct_type, subfieldno);
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
val = evaluate_subexp (substruct_type, exp, pos, noside);
|
val = evaluate_subexp (field_type, exp, pos, noside);
|
||||||
|
|
||||||
/* Now actually set the field in struct_val. */
|
/* Now actually set the field in struct_val. */
|
||||||
|
|
||||||
|
@ -647,11 +647,15 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
||||||
case OP_FUNCALL:
|
case OP_FUNCALL:
|
||||||
(*pos) += 2;
|
(*pos) += 2;
|
||||||
op = exp->elts[*pos].opcode;
|
op = exp->elts[*pos].opcode;
|
||||||
|
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
||||||
|
/* Allocate arg vector, including space for the function to be
|
||||||
|
called in argvec[0] and a terminating NULL */
|
||||||
|
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 3));
|
||||||
if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
|
if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
|
||||||
{
|
{
|
||||||
LONGEST fnptr;
|
LONGEST fnptr;
|
||||||
|
|
||||||
nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
|
nargs++;
|
||||||
/* First, evaluate the structure into arg2 */
|
/* First, evaluate the structure into arg2 */
|
||||||
pc2 = (*pos)++;
|
pc2 = (*pos)++;
|
||||||
|
|
||||||
|
@ -719,7 +723,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
||||||
/* Hair for method invocations */
|
/* Hair for method invocations */
|
||||||
int tem2;
|
int tem2;
|
||||||
|
|
||||||
nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
|
nargs++;
|
||||||
/* First, evaluate the structure into arg2 */
|
/* First, evaluate the structure into arg2 */
|
||||||
pc2 = (*pos)++;
|
pc2 = (*pos)++;
|
||||||
tem2 = longest_to_int (exp->elts[pc2 + 1].longconst);
|
tem2 = longest_to_int (exp->elts[pc2 + 1].longconst);
|
||||||
|
@ -754,15 +758,27 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||||
tem = 0;
|
tem = 1;
|
||||||
|
type = VALUE_TYPE (argvec[0]);
|
||||||
|
if (type && TYPE_CODE (type) == TYPE_CODE_PTR)
|
||||||
|
type = TYPE_TARGET_TYPE (type);
|
||||||
|
if (type && TYPE_CODE (type) == TYPE_CODE_FUNC)
|
||||||
|
{
|
||||||
|
for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
|
||||||
|
{
|
||||||
|
argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type, tem-1),
|
||||||
|
exp, pos, noside);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Allocate arg vector, including space for the function to be
|
|
||||||
called in argvec[0] and a terminating NULL */
|
|
||||||
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 2));
|
|
||||||
for (; tem <= nargs; tem++)
|
for (; tem <= nargs; tem++)
|
||||||
/* Ensure that array expressions are coerced into pointer objects. */
|
{
|
||||||
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
/* Ensure that array expressions are coerced into pointer objects. */
|
||||||
|
|
||||||
|
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||||
|
}
|
||||||
|
|
||||||
/* signal end of arglist */
|
/* signal end of arglist */
|
||||||
argvec[tem] = 0;
|
argvec[tem] = 0;
|
||||||
|
|
|
@ -1000,7 +1000,9 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
&& 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
|
||||||
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
|
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION
|
||||||
|
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_SET
|
||||||
|
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_BITSTRING)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -1223,26 +1225,24 @@ 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 yields non-zero we have to convert LOC_REGPARM
|
if (REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
|
||||||
to LOC_REGPARM_ADDR for structures and unions. */
|
|
||||||
|
|
||||||
if (SYMBOL_CLASS (sym) == LOC_REGPARM
|
|
||||||
&& 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)
|
||||||
|| (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)))
|
|| (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
|
||||||
SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
|
|| (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_BITSTRING)
|
||||||
|
|| (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_SET)))
|
||||||
/* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th and
|
{
|
||||||
subsequent arguments on the sparc, for example). */
|
/* If REG_STRUCT_HAS_ADDR yields non-zero we have to
|
||||||
if (SYMBOL_CLASS (sym) == LOC_ARG
|
convert LOC_REGPARM to LOC_REGPARM_ADDR for structures and unions. */
|
||||||
&& REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
|
if (SYMBOL_CLASS (sym) == LOC_REGPARM)
|
||||||
SYMBOL_TYPE (sym))
|
SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
|
||||||
&& ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT)
|
/* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th and
|
||||||
|| (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)))
|
subsequent arguments on the sparc, for example). */
|
||||||
SYMBOL_CLASS (sym) = LOC_REF_ARG;
|
else if (SYMBOL_CLASS (sym) == LOC_ARG)
|
||||||
|
SYMBOL_CLASS (sym) = LOC_REF_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue