/* OpenCL language support for GDB, the GNU debugger.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Ken Werner <ken.werner@de.ibm.com>.
return 0;
}
+/* Return nonzero if bits in V from OFFSET and LENGTH represent a
+ synthetic pointer. */
+
+static int
+lval_func_check_synthetic_pointer (const struct value *v,
+ int offset, int length)
+{
+ struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
+ /* Size of the target type in bits. */
+ int elsize =
+ TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8;
+ int startrest = offset % elsize;
+ int start = offset / elsize;
+ int endrest = (offset + length) % elsize;
+ int end = (offset + length) / elsize;
+ int i;
+
+ if (endrest)
+ end++;
+
+ if (end > c->n)
+ return 0;
+
+ for (i = start; i < end; i++)
+ {
+ int startoffset = (i == start) ? startrest : 0;
+ int length = (i == end) ? endrest : elsize;
+
+ if (!value_bits_synthetic_pointer (c->val,
+ c->indices[i] * elsize + startoffset,
+ length))
+ return 0;
+ }
+
+ return 1;
+}
+
static void *
lval_func_copy_closure (const struct value *v)
{
lval_func_write,
lval_func_check_validity,
lval_func_check_any_valid,
+ NULL,
+ lval_func_check_synthetic_pointer,
lval_func_copy_closure,
lval_func_free_closure
};
Therefore we evaluate it once using EVAL_AVOID_SIDE_EFFECTS. */
int oldpos = *pos;
- arg2 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
+ EVAL_AVOID_SIDE_EFFECTS);
*pos = oldpos;
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
basic_lookup_transparent_type,/* lookup_transparent_type */
NULL, /* Language specific symbol demangler */
- NULL, /* Language specific class_name_from_physname */
+ NULL, /* Language specific
+ class_name_from_physname */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */