aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdb-2.5.3 <gdb@fsf.org>1988-06-13 01:00:00 +0100
committerPedro Alves <palves@redhat.com>2012-06-03 15:36:30 +0100
commit7c75bab3d3ef344a6a0b13b9ab59ecd5855aceb5 (patch)
tree4e50a84965c0e24ba6734d9717e007e68879c8e0
parent6368691e88d78f0bb6a46b74d7ed86118ac84e8b (diff)
downloadgdb-7c75bab3d3ef344a6a0b13b9ab59ecd5855aceb5.zip
gdb-7c75bab3d3ef344a6a0b13b9ab59ecd5855aceb5.tar.gz
gdb-7c75bab3d3ef344a6a0b13b9ab59ecd5855aceb5.tar.bz2
gdb-2.5.3
-rw-r--r--gdb/dbxread.c5
-rw-r--r--gdb/eval.c196
-rw-r--r--gdb/valarith.c180
-rw-r--r--gdb/valops.c5
-rw-r--r--gdb/valprint.c18
-rw-r--r--gdb/value.h16
-rw-r--r--gdb/version.c2
7 files changed, 323 insertions, 99 deletions
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 05326cf..084135f 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2878,6 +2878,11 @@ read_args (pp, end)
{
rval = (struct type **) xmalloc (2 * sizeof (struct type *));
}
+ else if (TYPE_CODE (types[n-1]) != TYPE_CODE_VOID)
+ {
+ rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *));
+ bzero (rval + n, sizeof (struct type *));
+ }
else
{
rval = (struct type **) xmalloc (n * sizeof (struct type *));
diff --git a/gdb/eval.c b/gdb/eval.c
index dcca415..899d140 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -386,7 +386,10 @@ evaluate_subexp (exp, pos, noside)
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
- return value_assign (arg1, arg2);
+ if (binop_must_be_user_defined (arg1, arg2))
+ return value_x_binop (arg1, arg2, op, 0);
+ else
+ return value_assign (arg1, arg2);
case BINOP_ASSIGN_MODIFY:
(*pos) += 2;
@@ -395,7 +398,9 @@ evaluate_subexp (exp, pos, noside)
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
op = exp->elts[pc + 1].opcode;
- if (op == BINOP_ADD)
+ if (binop_must_be_user_defined (arg1, arg2))
+ return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op);
+ else if (op == BINOP_ADD)
arg2 = value_add (arg1, arg2);
else if (op == BINOP_SUB)
arg2 = value_sub (arg1, arg2);
@@ -408,14 +413,20 @@ evaluate_subexp (exp, pos, noside)
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- return value_add (arg1, arg2);
+ if (binop_must_be_user_defined (arg1, arg2))
+ return value_x_binop (arg1, arg2, op, 0);
+ else
+ return value_add (arg1, arg2);
case BINOP_SUB:
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- return value_sub (arg1, arg2);
+ if (binop_must_be_user_defined (arg1, arg2))
+ return value_x_binop (arg1, arg2, op, 0);
+ else
+ return value_sub (arg1, arg2);
case BINOP_MUL:
case BINOP_DIV:
@@ -429,78 +440,142 @@ evaluate_subexp (exp, pos, noside)
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- return value_binop (arg1, arg2, op);
+ if (binop_must_be_user_defined (arg1, arg2))
+ return value_x_binop (arg1, arg2, op, 0);
+ else
+ return value_binop (arg1, arg2, op);
case BINOP_SUBSCRIPT:
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- return value_subscript (arg1, arg2, op);
+ if (binop_must_be_user_defined (arg1, arg2))
+ return value_x_binop (arg1, arg2, op, 0);
+ else
+ return value_subscript (arg1, arg2, op);
case BINOP_AND:
arg1 = evaluate_subexp (exp, pos, noside);
- tem = value_zerop (arg1);
- arg2 = evaluate_subexp (exp, pos,
- (tem ? EVAL_SKIP : noside));
- return value_from_long (builtin_type_int,
- !tem && !value_zerop (arg2));
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ arg2 = evaluate_subexp (exp, pos, noside);
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_zerop (arg1);
+ arg2 = evaluate_subexp (exp, pos,
+ (tem ? EVAL_SKIP : noside));
+ return value_from_long (builtin_type_int,
+ !tem && !value_zerop (arg2));
+ }
case BINOP_OR:
arg1 = evaluate_subexp (exp, pos, noside);
- tem = value_zerop (arg1);
- arg2 = evaluate_subexp (exp, pos,
- (!tem ? EVAL_SKIP : noside));
- return value_from_long (builtin_type_int,
- !tem || !value_zerop (arg2));
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ arg2 = evaluate_subexp (exp, pos, noside);
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_zerop (arg1);
+ arg2 = evaluate_subexp (exp, pos,
+ (!tem ? EVAL_SKIP : noside));
+ return value_from_long (builtin_type_int,
+ !tem || !value_zerop (arg2));
+ }
case BINOP_EQUAL:
arg1 = evaluate_subexp (exp, pos, noside);
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- tem = value_equal (arg1, arg2);
- return value_from_long (builtin_type_int, tem);
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_equal (arg1, arg2);
+ return value_from_long (builtin_type_int, tem);
+ }
case BINOP_NOTEQUAL:
arg1 = evaluate_subexp (exp, pos, noside);
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- tem = value_equal (arg1, arg2);
- return value_from_long (builtin_type_int, ! tem);
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_equal (arg1, arg2);
+ return value_from_long (builtin_type_int, ! tem);
+ }
case BINOP_LESS:
arg1 = evaluate_subexp (exp, pos, noside);
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- tem = value_less (arg1, arg2);
- return value_from_long (builtin_type_int, tem);
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_less (arg1, arg2);
+ return value_from_long (builtin_type_int, tem);
+ }
case BINOP_GTR:
arg1 = evaluate_subexp (exp, pos, noside);
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- tem = value_less (arg2, arg1);
- return value_from_long (builtin_type_int, tem);
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_less (arg2, arg1);
+ return value_from_long (builtin_type_int, tem);
+ }
case BINOP_GEQ:
arg1 = evaluate_subexp (exp, pos, noside);
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- tem = value_less (arg1, arg2);
- return value_from_long (builtin_type_int, ! tem);
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_less (arg1, arg2);
+ return value_from_long (builtin_type_int, ! tem);
+ }
case BINOP_LEQ:
arg1 = evaluate_subexp (exp, pos, noside);
arg2 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- tem = value_less (arg2, arg1);
- return value_from_long (builtin_type_int, ! tem);
+ if (binop_must_be_user_defined (arg1, arg2))
+ {
+ return value_x_binop (arg1, arg2, op, 0);
+ }
+ else
+ {
+ tem = value_less (arg2, arg1);
+ return value_from_long (builtin_type_int, ! tem);
+ }
case BINOP_REPEAT:
arg1 = evaluate_subexp (exp, pos, noside);
@@ -517,19 +592,28 @@ evaluate_subexp (exp, pos, noside)
arg1 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- return value_neg (arg1);
+ if (unop_must_be_user_defined (arg1))
+ return value_x_unop (arg1, op, 0);
+ else
+ return value_neg (arg1);
case UNOP_LOGNOT:
arg1 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- return value_lognot (arg1);
+ if (unop_must_be_user_defined (arg1))
+ return value_x_unop (arg1, op, 0);
+ else
+ return value_lognot (arg1);
case UNOP_ZEROP:
arg1 = evaluate_subexp (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- return value_from_long (builtin_type_int, value_zerop (arg1));
+ if (unop_must_be_user_defined (arg1))
+ return value_x_unop (arg1, op, 0);
+ else
+ return value_from_long (builtin_type_int, value_zerop (arg1));
case UNOP_IND:
arg1 = evaluate_subexp (exp, pos, noside);
@@ -584,34 +668,62 @@ evaluate_subexp (exp, pos, noside)
case UNOP_PREINCREMENT:
arg1 = evaluate_subexp (exp, pos, noside);
- arg2 = value_add (arg1, value_from_long (builtin_type_char, 1));
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
- return value_assign (arg1, arg2);
+ else if (unop_must_be_user_defined (arg1))
+ {
+ return value_x_unop (arg1, op, 0);
+ }
+ else
+ {
+ arg2 = value_add (arg1, value_from_long (builtin_type_char, 1));
+ return value_assign (arg1, arg2);
+ }
case UNOP_PREDECREMENT:
arg1 = evaluate_subexp (exp, pos, noside);
- arg2 = value_sub (arg1, value_from_long (builtin_type_char, 1));
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
- return value_assign (arg1, arg2);
+ else if (unop_must_be_user_defined (arg1))
+ {
+ return value_x_unop (arg1, op, 0);
+ }
+ else
+ {
+ arg2 = value_sub (arg1, value_from_long (builtin_type_char, 1));
+ return value_assign (arg1, arg2);
+ }
case UNOP_POSTINCREMENT:
arg1 = evaluate_subexp (exp, pos, noside);
- arg2 = value_add (arg1, value_from_long (builtin_type_char, 1));
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
- value_assign (arg1, arg2);
- return arg1;
+ else if (unop_must_be_user_defined (arg1))
+ {
+ return value_x_unop (arg1, op, 0);
+ }
+ else
+ {
+ arg2 = value_add (arg1, value_from_long (builtin_type_char, 1));
+ value_assign (arg1, arg2);
+ return arg1;
+ }
case UNOP_POSTDECREMENT:
arg1 = evaluate_subexp (exp, pos, noside);
- arg2 = value_sub (arg1, value_from_long (builtin_type_char, 1));
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
- value_assign (arg1, arg2);
- return arg1;
-
+ else if (unop_must_be_user_defined (arg1))
+ {
+ return value_x_unop (arg1, op, 0);
+ }
+ else
+ {
+ arg2 = value_sub (arg1, value_from_long (builtin_type_char, 1));
+ value_assign (arg1, arg2);
+ return arg1;
+ }
+
case OP_THIS:
(*pos) += 1;
return value_of_this (1);
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 6ce7c6a..d62815d 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -27,8 +27,6 @@ anyone else from sharing it farther. Help stamp out software hoarding!
START_FILE
-value value_x_binop ();
-
value
value_add (arg1, arg2)
value arg1, arg2;
@@ -65,7 +63,7 @@ value_add (arg1, arg2)
return val;
}
- return value_x_binop (arg1, arg2, BINOP_ADD);
+ return value_binop (arg1, arg2, BINOP_ADD);
}
value
@@ -98,7 +96,7 @@ value_sub (arg1, arg2)
return val;
}
- return value_x_binop (arg1, arg2, BINOP_SUB);
+ return value_binop (arg1, arg2, BINOP_SUB);
}
/* Return the value of ARRAY[IDX]. */
@@ -110,16 +108,43 @@ value_subscript (array, idx)
return value_ind (value_add (array, idx));
}
-/* Check to see if either argument is a structure. If so, then
- create an argument vector that calls arg1.operator @ (arg1,arg2)
- and return that value (where '@' is any binary operator which
- is legal for GNU C++). If both args are scalar types then just
- return value_binop(). */
+/* Check to see if either argument is a structure. This is called so
+ we know whether to go ahead with the normal binop or look for a
+ user defined function instead */
+
+int
+binop_must_be_user_defined (arg1, arg2)
+ value arg1, arg2;
+{
+ return (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT
+ || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_STRUCT
+ || (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
+ && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_STRUCT)
+ || (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_REF
+ && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg2))) == TYPE_CODE_STRUCT));
+}
+
+/* Check to see if argument is a structure. This is called so
+ we know whether to go ahead with the normal unop or look for a
+ user defined function instead */
+
+int unop_must_be_user_defined (arg1)
+ value arg1;
+{
+ return (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT
+ || (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
+ && TYPE_CODE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1))) == TYPE_CODE_STRUCT));
+}
+
+/* We know either arg1 or arg2 is a structure, so try to find the right
+ user defined function. Create an argument vector that calls
+ arg1.operator @ (arg1,arg2) and return that value (where '@' is any
+ binary operator which is legal for GNU C++). */
value
-value_x_binop (arg1, arg2, op)
+value_x_binop (arg1, arg2, op, otherop)
value arg1, arg2;
- int op;
+ int op, otherop;
{
value * argvec;
char *ptr;
@@ -128,49 +153,114 @@ value_x_binop (arg1, arg2, op)
COERCE_ENUM (arg1);
COERCE_ENUM (arg2);
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_STRUCT
- || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_STRUCT)
- {
- /* now we know that what we have to do is construct our
- arg vector and find the right function to call it with. */
+ /* now we know that what we have to do is construct our
+ arg vector and find the right function to call it with. */
- if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_STRUCT)
- error ("friend functions not implemented yet");
+ if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_STRUCT)
+ error ("friend functions not implemented yet");
- argvec = (value *) alloca (sizeof (value) * 4);
- argvec[1] = value_addr (arg1);
- argvec[2] = arg2;
- argvec[3] = 0;
+ argvec = (value *) alloca (sizeof (value) * 4);
+ argvec[1] = value_addr (arg1);
+ argvec[2] = arg2;
+ argvec[3] = 0;
- /* make the right function name up */
- strcpy(tstr,"operator __");
- ptr = tstr+9;
- switch (op)
+ /* make the right function name up */
+ strcpy(tstr, "operator __");
+ ptr = tstr+9;
+ switch (op)
+ {
+ case BINOP_ADD: strcpy(ptr,"+"); break;
+ case BINOP_SUB: strcpy(ptr,"-"); break;
+ case BINOP_MUL: strcpy(ptr,"*"); break;
+ case BINOP_DIV: strcpy(ptr,"/"); break;
+ case BINOP_REM: strcpy(ptr,"%"); break;
+ case BINOP_LSH: strcpy(ptr,"<<"); break;
+ case BINOP_RSH: strcpy(ptr,">>"); break;
+ case BINOP_LOGAND: strcpy(ptr,"&"); break;
+ case BINOP_LOGIOR: strcpy(ptr,"|"); break;
+ case BINOP_LOGXOR: strcpy(ptr,"^"); break;
+ case BINOP_AND: strcpy(ptr,"&&"); break;
+ case BINOP_OR: strcpy(ptr,"||"); break;
+ case BINOP_MIN: strcpy(ptr,"<?"); break;
+ case BINOP_MAX: strcpy(ptr,">?"); break;
+ case BINOP_ASSIGN: strcpy(ptr,"="); break;
+ case BINOP_ASSIGN_MODIFY:
+ switch (otherop)
{
- case BINOP_ADD: *ptr++ = '+'; *ptr = '\0'; break;
- case BINOP_SUB: *ptr++ = '-'; *ptr = '\0'; break;
- case BINOP_MUL: *ptr++ = '*'; *ptr = '\0'; break;
- case BINOP_DIV: *ptr++ = '/'; *ptr = '\0'; break;
- case BINOP_REM: *ptr++ = '%'; *ptr = '\0';break;
- case BINOP_LSH: *ptr++ = '<'; *ptr = '<'; break;
- case BINOP_RSH: *ptr++ = '>'; *ptr = '>'; break;
- case BINOP_LOGAND: *ptr++ = '&'; *ptr = '\0'; break;
- case BINOP_LOGIOR: *ptr++ = '|'; *ptr = '\0'; break;
- case BINOP_LOGXOR: *ptr++ = '^'; *ptr = '\0'; break;
- case BINOP_AND: *ptr++ = '&'; *ptr = '&'; break;
- case BINOP_OR: *ptr++ = '|'; *ptr = '|'; break;
- case BINOP_MIN: *ptr++ = '<'; *ptr = '?'; break;
- case BINOP_MAX: *ptr++ = '>'; *ptr = '?'; break;
+ case BINOP_ADD: strcpy(ptr,"+="); break;
+ case BINOP_SUB: strcpy(ptr,"-="); break;
+ case BINOP_MUL: strcpy(ptr,"*="); break;
+ case BINOP_DIV: strcpy(ptr,"/="); break;
+ case BINOP_REM: strcpy(ptr,"%="); break;
+ case BINOP_LOGAND: strcpy(ptr,"&="); break;
+ case BINOP_LOGIOR: strcpy(ptr,"|="); break;
+ case BINOP_LOGXOR: strcpy(ptr,"^="); break;
default:
error ("Invalid binary operation specified.");
}
- argvec[0] = value_struct_elt (arg1, argvec+1, tstr, "structure");
- if (argvec[0])
- return call_function (argvec[0], 2, argvec + 1);
- else error ("member function %s not found", tstr);
+ break;
+ case BINOP_SUBSCRIPT: strcpy(ptr,"[]"); break;
+ case BINOP_EQUAL: strcpy(ptr,"=="); break;
+ case BINOP_NOTEQUAL: strcpy(ptr,"!="); break;
+ case BINOP_LESS: strcpy(ptr,"<"); break;
+ case BINOP_GTR: strcpy(ptr,">"); break;
+ case BINOP_GEQ: strcpy(ptr,">="); break;
+ case BINOP_LEQ: strcpy(ptr,"<="); break;
+ default:
+ error ("Invalid binary operation specified.");
}
+ argvec[0] = value_struct_elt (arg1, argvec+1, tstr, "structure");
+ if (argvec[0])
+ return call_function (argvec[0], 2, argvec + 1);
+ else error ("member function %s not found", tstr);
+}
- return value_binop(arg1, arg2, op);
+/* We know that arg1 is a structure, so try to find a unary user
+ defined operator that matches the operator in question.
+ Create an argument vector that calls arg1.operator @ (arg1)
+ and return that value (where '@' is (almost) any unary operator which
+ is legal for GNU C++). */
+
+value
+value_x_unop (arg1, op)
+ value arg1;
+ int op;
+{
+ value * argvec;
+ char *ptr;
+ char tstr[13];
+
+ COERCE_ENUM (arg1);
+
+ /* now we know that what we have to do is construct our
+ arg vector and find the right function to call it with. */
+
+ if (TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_STRUCT)
+ error ("friend functions not implemented yet");
+
+ argvec = (value *) alloca (sizeof (value) * 3);
+ argvec[1] = value_addr (arg1);
+ argvec[2] = 0;
+
+ /* make the right function name up */
+ strcpy(tstr,"operator __");
+ ptr = tstr+9;
+ switch (op)
+ {
+ case UNOP_PREINCREMENT: strcpy(ptr,"++"); break;
+ case UNOP_PREDECREMENT: strcpy(ptr,"++"); break;
+ case UNOP_POSTINCREMENT: strcpy(ptr,"++"); break;
+ case UNOP_POSTDECREMENT: strcpy(ptr,"++"); break;
+ case UNOP_ZEROP: strcpy(ptr,"!"); break;
+ case UNOP_LOGNOT: strcpy(ptr,"~"); break;
+ case UNOP_NEG: strcpy(ptr,"-"); break;
+ default:
+ error ("Invalid binary operation specified.");
+ }
+ argvec[0] = value_struct_elt (arg1, argvec+1, tstr, "structure");
+ if (argvec[0])
+ return call_function (argvec[0], 1, argvec + 1);
+ else error ("member function %s not found", tstr);
}
/* Perform a binary operation on two integers or two floats.
diff --git a/gdb/valops.c b/gdb/valops.c
index 8992c0f..76466b6 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -957,8 +957,8 @@ int typecmp(t1, t2)
int i;
if (t1[0]->code == TYPE_CODE_VOID) return 0;
- if (!t1[1])return 0;
- for (i = 1; t1[i]->code != TYPE_CODE_VOID; i++)
+ if (!t1[1]) return 0;
+ for (i = 1; t1[i] && t1[i]->code != TYPE_CODE_VOID; i++)
{
if (! t2[i]
|| t1[i]->code != t2[i]->type->code
@@ -967,6 +967,7 @@ int typecmp(t1, t2)
return i+1;
}
}
+ if (!t1[i]) return 0;
return t2[i] ? i+1 : 0;
}
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 32601a6..29df920 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -220,7 +220,7 @@ val_print (type, valaddr, address, stream)
common:
if (i < len)
{
- fprintf (stream, "& ");
+ fputc ('&', stream);
type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (f, j), stream, 0, 0);
fprintf (stream, kind);
if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
@@ -265,7 +265,7 @@ val_print (type, valaddr, address, stream)
}
if (i < len)
{
- fprintf (stream, "& ");
+ fputc ('&', stream);
type_print_base (domain, stream, 0, 0);
fprintf (stream, "::");
fprintf (stream, "%s", TYPE_FIELD_NAME (domain, i));
@@ -517,7 +517,12 @@ type_print_method_args (args, prefix, varstring, stream)
while (1)
{
type_print (args[i++], "", stream, 0);
- if (args[i]->code != TYPE_CODE_VOID)
+ if (!args[i])
+ {
+ fprintf (stream, " ...");
+ break;
+ }
+ else if (args[i]->code != TYPE_CODE_VOID)
{
fprintf (stream, ", ");
}
@@ -555,7 +560,9 @@ type_print_varspec_prefix (type, stream, show, passed_a_ptr)
break;
case TYPE_CODE_MEMBER:
- type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
+ type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0,
+ passed_a_ptr);
+ fputc (' ', stream);
type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0,
passed_a_ptr);
fprintf (stream, "::");
@@ -748,8 +755,7 @@ type_print_base (type, stream, show, level)
print_spaces (level + 4, stream);
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
fprintf (stream, "virtual ");
- type_print_base (TYPE_FN_FIELD_TYPE (f, j), stream, 0, level);
- type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (f, j), stream, 0, 0);
+ type_print (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j))), "", stream, 0);
if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
&& TYPE_FN_FIELD_PHYSNAME (f, j)[1] == '$')
type_print_method_args
diff --git a/gdb/value.h b/gdb/value.h
index 0b21e38..985e01e 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -56,10 +56,14 @@ typedef struct value *value;
#define VALUE_REGNO(val) (val)->regno
/* If ARG is an array, convert it to a pointer.
- If ARG is an enum, convert it to an integer. */
+ If ARG is an enum, convert it to an integer.
+
+ References are dereferenced. */
#define COERCE_ARRAY(arg) \
-{ if (VALUE_REPEATED (arg) \
+{ if (TYPE_CODE (arg) == TYPE_CODE_REF) \
+ arg = value_ind (arg); \
+ if (VALUE_REPEATED (arg) \
|| TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY) \
arg = value_coerce_array (arg); \
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
@@ -69,7 +73,9 @@ typedef struct value *value;
/* If ARG is an enum, convert it to an integer. */
#define COERCE_ENUM(arg) \
-{ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
+{ if (TYPE_CODE (arg) == TYPE_CODE_REF) \
+ arg = value_ind (arg); \
+ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
arg = value_cast (builtin_type_unsigned_int, arg); \
}
@@ -133,3 +139,7 @@ int value_zerop ();
/* C++ */
value value_of_this ();
value value_static_field ();
+value value_x_binop ();
+value value_x_unop ();
+int binop_must_be_user_defined ();
+int unop_must_be_user_defined ();
diff --git a/gdb/version.c b/gdb/version.c
index 5e1f907..033b5d8 100644
--- a/gdb/version.c
+++ b/gdb/version.c
@@ -1,3 +1,3 @@
/* Define the current version number of GDB. */
-char *version = "2.5.2 (GNU C++ 1.22.0 compatible)";
+char *version = "2.5.3 (GNU C++ 1.22.0 compatible)";