evaluate_expression (struct expression *exp)
{
int pc = 0;
+
return evaluate_subexp (NULL_TYPE, exp, &pc, EVAL_NORMAL);
}
evaluate_type (struct expression *exp)
{
int pc = 0;
+
return evaluate_subexp (NULL_TYPE, exp, &pc, EVAL_AVOID_SIDE_EFFECTS);
}
{
int tem;
char *result;
+
if (exp->elts[*subexp].opcode != STRUCTOP_STRUCT
&& exp->elts[*subexp].opcode != STRUCTOP_PTR)
return NULL;
int pc = (*pos)++;
char *name = &exp->elts[pc + 2].string;
int tem = longest_to_int (exp->elts[pc + 1].longconst);
+
(*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
return name;
}
int fieldno = -1;
int variantno = -1;
int subfieldno = -1;
+
while (--nargs >= 0)
{
int pc = *pos;
do
{
char *label = get_label (exp, &pc);
+
if (label)
{
for (fieldno = 0; fieldno < TYPE_NFIELDS (struct_type);
fieldno++)
{
char *field_name = TYPE_FIELD_NAME (struct_type, fieldno);
+
if (field_name != NULL && strcmp (field_name, label) == 0)
{
variantno = -1;
fieldno++)
{
char *field_name = TYPE_FIELD_NAME (struct_type, fieldno);
+
field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
if ((field_name == 0 || *field_name == '\0')
&& TYPE_CODE (field_type) == TYPE_CODE_UNION)
{
LONGEST index;
int element_size = TYPE_LENGTH (value_type (element));
+
if (exp->elts[*pos].opcode == BINOP_COMMA)
{
(*pos)++;
else if (exp->elts[*pos].opcode == BINOP_RANGE)
{
LONGEST low, high;
+
(*pos)++;
low = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
high = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
it needs to modify this function. */
{
struct type *builtin_int = builtin_type (gdbarch)->builtin_int;
+
if (TYPE_LENGTH (type1) < TYPE_LENGTH (builtin_int))
*arg1 = value_cast (builtin_int, *arg1);
}
&& TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
struct value *rec = allocate_value (expect_type);
+
memset (value_contents_raw (rec), '\0', TYPE_LENGTH (type));
return evaluate_struct_tuple (rec, exp, pos, noside, nargs);
}
struct value *array = allocate_value (expect_type);
int element_size = TYPE_LENGTH (check_typedef (element_type));
LONGEST low_bound, high_bound, index;
+
if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
{
low_bound = 0;
{
struct value *element;
int index_pc = 0;
+
if (exp->elts[*pos].opcode == BINOP_RANGE)
{
index_pc = ++(*pos);
if (index_pc)
{
int continue_pc = *pos;
+
*pos = index_pc;
index = init_array_element (array, element, exp, pos, noside,
low_bound, high_bound);
LONGEST range_low, range_high;
struct type *range_low_type, *range_high_type;
struct value *elem_val;
+
if (exp->elts[*pos].opcode == BINOP_RANGE)
{
(*pos)++;
for (; range_low <= range_high; range_low++)
{
int bit_index = (unsigned) range_low % TARGET_CHAR_BIT;
+
if (gdbarch_bits_big_endian (exp->gdbarch))
bit_index = TARGET_CHAR_BIT - 1 - bit_index;
valaddr[(unsigned) range_low / TARGET_CHAR_BIT]
{
struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
int lowbound
- = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+ = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
int upper
- = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+ = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+
if (noside == EVAL_SKIP)
goto nosideret;
return value_slice (array, lowbound, upper - lowbound + 1);
{
struct value *array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
int lowbound
- = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+ = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
int length
- = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+ = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
+
return value_slice (array, lowbound, length);
}
if (gnu_runtime)
{
struct type *type = selector_type;
+
type = lookup_function_type (type);
type = lookup_pointer_type (type);
type = lookup_function_type (type);
it. */
struct type *type = value_type (called_method);
+
if (type && TYPE_CODE (type) == TYPE_CODE_PTR)
type = TYPE_TARGET_TYPE (type);
type = TYPE_TARGET_TYPE (type);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *method_type = check_typedef (value_type (arg1));
+
arg1 = value_zero (method_type, not_lval);
}
else
/* Save the function position and move pos so that the arguments
can be evaluated. */
int func_name_len;
+
save_pos1 = *pos;
tem = 1;
/* Non-C++ case -- or no overload resolution */
{
struct value *temp = arg2;
+
argvec[0] = value_struct_elt (&temp, argvec + 1, tstr,
&static_memfuncp,
op == STRUCTOP_STRUCT
else
{
struct value *temp = arg1;
+
return value_struct_elt (&temp, NULL, &exp->elts[pc + 2].string,
NULL, "structure");
}
else
{
struct value *temp = arg1;
+
return value_struct_elt (&temp, NULL, &exp->elts[pc + 2].string,
NULL, "structure pointer");
}
else
{
struct value *retvalp = evaluate_subexp_for_address (exp, pos, noside);
+
return retvalp;
}
else
{
CORE_ADDR tls_addr;
+
tls_addr = target_translate_tls_address (exp->elts[pc + 1].objfile,
value_as_address (arg1));
return value_at_lazy (exp->elts[pc + 2].type, tls_addr);
else
{
struct value *tmp = arg1;
+
arg2 = value_one (value_type (arg1), not_lval);
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD);
else
{
struct value *tmp = arg1;
+
arg2 = value_one (value_type (arg1), not_lval);
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB);
else
{
struct value *tmp = arg1;
+
arg2 = value_one (value_type (arg1), not_lval);
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_ADD);
else
{
struct value *tmp = arg1;
+
arg2 = value_one (value_type (arg1), not_lval);
binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2);
arg2 = value_binop (tmp, arg2, BINOP_SUB);
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type = exp->elts[pc + 1].type;
+
/* If this is a typedef, then find its immediate target. We
use check_typedef to resolve stubs, but we ignore its
result because we do not want to dig past all
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type =
- lookup_pointer_type (SYMBOL_TYPE (var));
+ lookup_pointer_type (SYMBOL_TYPE (var));
enum address_class sym_class = SYMBOL_CLASS (var);
if (sym_class == LOC_CONST
{
char *tmp = (char *) alloca (length + 4);
struct expression *expr;
+
tmp[0] = '(';
memcpy (tmp + 1, p, length);
tmp[length + 1] = ')';
catcher_pop (void)
{
struct catcher *old_catcher = current_catcher;
+
current_catcher = old_catcher->prev;
/* Restore the cleanup chain, the error/quit messages, and the uiout
case CATCH_ITER:
{
struct gdb_exception exception = *current_catcher->exception;
+
if (current_catcher->mask & RETURN_MASK (exception.reason))
{
/* Exit normally if this catcher can handle this
deprecated_throw_reason (enum return_reason reason)
{
struct gdb_exception exception;
+
memset (&exception, 0, sizeof exception);
exception.reason = reason;
as that way the MI's behavior is preserved. */
const char *start;
const char *end;
+
for (start = e.message; start != NULL; start = end)
{
end = strchr (start, '\n');
throw_error (enum errors error, const char *fmt, ...)
{
va_list args;
+
va_start (args, fmt);
throw_it (RETURN_ERROR, error, fmt, args);
va_end (args);
return_mask mask)
{
volatile struct gdb_exception exception;
+
TRY_CATCH (exception, mask)
{
(*func) (uiout, func_args);
{
volatile struct gdb_exception exception;
volatile int val = 0;
+
TRY_CATCH (exception, mask)
{
val = (*func) (uiout, func_args);
{
volatile int val = 0;
volatile struct gdb_exception exception;
+
TRY_CATCH (exception, mask)
{
val = func (func_args);
char *arg, int from_tty, return_mask mask)
{
volatile struct gdb_exception e;
+
TRY_CATCH (e, mask)
{
command (arg, from_tty);
print_expression (struct expression *exp, struct ui_file *stream)
{
int pc = 0;
+
print_subexp (exp, &pc, stream, PREC_NULL);
}
case OP_LONG:
{
struct value_print_options opts;
+
get_raw_print_options (&opts);
(*pos) += 3;
value_print (value_from_longest (exp->elts[pc + 1].type,
case OP_DOUBLE:
{
struct value_print_options opts;
+
get_raw_print_options (&opts);
(*pos) += 3;
value_print (value_from_double (exp->elts[pc + 1].type,
case OP_VAR_VALUE:
{
struct block *b;
+
(*pos) += 3;
b = exp->elts[pc + 1].block;
if (b != NULL
case OP_REGISTER:
{
const char *name = &exp->elts[pc + 2].string;
+
(*pos) += 3 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1);
fprintf_filtered (stream, "$%s", name);
return;
case OP_STRING:
{
struct value_print_options opts;
+
nargs = longest_to_int (exp->elts[pc + 1].longconst);
(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
/* LA_PRINT_STRING will print using the current repeat count threshold.
case OP_OBJC_NSSTRING: /* Objective-C Foundation Class NSString constant. */
{
struct value_print_options opts;
+
nargs = longest_to_int (exp->elts[pc + 1].longconst);
(*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
fputs_filtered ("@\"", stream);
case OP_OBJC_MSGCALL:
{ /* Objective C message (method) call. */
char *selector;
+
(*pos) += 3;
nargs = longest_to_int (exp->elts[pc + 2].longconst);
fprintf_unfiltered (stream, "[");
if (nargs)
{
char *s, *nextS;
+
s = alloca (strlen (selector) + 1);
strcpy (s, selector);
for (tem = 0; tem < nargs; tem++)
if (tem > 0)
{
struct value_print_options opts;
+
get_user_print_options (&opts);
LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
tempstr, nargs - 1, NULL, 0, &opts);