/* Perform non-arithmetic operations on values, for GDB.
- Copyright (C) 1986-2014 Free Software Foundation, Inc.
+ Copyright (C) 1986-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "tracepoint.h"
#include "observer.h"
#include "objfiles.h"
-#include "exceptions.h"
#include "extension.h"
extern unsigned int overload_debug;
}
if (objf_p)
- *objf_p = SYMBOL_SYMTAB (sym)->objfile;
+ *objf_p = symbol_objfile (sym);
return value_of_variable (sym, NULL);
}
deprecated_set_value_type (v, type);
return v;
}
- }
+ }
/* No superclass found, just change the pointer type. */
arg2 = value_copy (arg2);
&& TYPE_CODE (resolved_type) != TYPE_CODE_REF)
error (_("Argument to dynamic_cast must be a pointer or reference type"));
if (TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_VOID
- && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_CLASS)
+ && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast must be pointer to class or `void *'"));
class_type = check_typedef (TYPE_TARGET_TYPE (resolved_type));
if (TYPE_CODE (arg_type) == TYPE_CODE_PTR)
{
arg_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
- if (TYPE_CODE (arg_type) != TYPE_CODE_CLASS)
+ if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast does "
"not have pointer to class type"));
}
}
else
{
- if (TYPE_CODE (arg_type) != TYPE_CODE_CLASS)
+ if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast does not have class type"));
}
}
}
+ observer_notify_register_changed (frame, value_reg);
if (deprecated_register_changed_hook)
deprecated_register_changed_hook (-1);
break;
tt2 = check_typedef (value_type (t2[i]));
if (TYPE_CODE (tt1) == TYPE_CODE_REF
- /* We should be doing hairy argument matching, as below. */
+ /* We should be doing hairy argument matching, as below. */
&& (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (tt1)))
== TYPE_CODE (tt2)))
{
}
if (t_field_name
- && (t_field_name[0] == '\0'
- || (TYPE_CODE (type) == TYPE_CODE_UNION
- && (strcmp_iw (t_field_name, "else") == 0))))
+ && t_field_name[0] == '\0')
{
struct type *field_type = TYPE_FIELD_TYPE (type, i);
const char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
/* FIXME! May need to check for ARM demangling here. */
- if (strncmp (t_field_name, "__", 2) == 0 ||
- strncmp (t_field_name, "op", 2) == 0 ||
- strncmp (t_field_name, "type", 4) == 0)
+ if (startswith (t_field_name, "__") ||
+ startswith (t_field_name, "op") ||
+ startswith (t_field_name, "type"))
{
if (cplus_demangle_opname (t_field_name, dem_opname, DMGL_ANSI))
t_field_name = dem_opname;
/* The virtual base class pointer might have been
clobbered by the user program. Make sure that it
- still points to a valid memory location. */
+ still points to a valid memory location. */
if (offset < 0 || offset >= TYPE_LENGTH (type))
{
return v;
}
- v = search_struct_method (name, argp, args, 0,
- static_memfuncp, t);
+ v = search_struct_method (name, argp, args, 0,
+ static_memfuncp, t);
if (v == (struct value *) - 1)
{
value_find_oload_method_list above. */
if (fns_ptr)
{
- gdb_assert (TYPE_DOMAIN_TYPE (fns_ptr[0].type) != NULL);
+ gdb_assert (TYPE_SELF_TYPE (fns_ptr[0].type) != NULL);
src_method_oload_champ = find_oload_champ (args, nargs,
num_fns, fns_ptr, NULL,
parm_types[jj] = (fns_ptr != NULL
? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj].type)
: TYPE_FIELD_TYPE (SYMBOL_TYPE (oload_syms[ix]),
- jj));
+ jj));
}
/* Compare parameter types to supplied argument types. Skip
type = check_typedef (value_type (ptr));
gdb_assert (type != NULL
&& TYPE_CODE (type) == TYPE_CODE_MEMBERPTR);
- tmp = lookup_pointer_type (TYPE_DOMAIN_TYPE (type));
+ tmp = lookup_pointer_type (TYPE_SELF_TYPE (type));
v = value_cast_pointers (tmp, v, 1);
mem_offset = value_as_long (ptr);
tmp = lookup_pointer_type (TYPE_TARGET_TYPE (type));
const char *t_field_name = TYPE_FN_FIELDLIST_NAME (t, i);
char dem_opname[64];
- if (strncmp (t_field_name, "__", 2) == 0
- || strncmp (t_field_name, "op", 2) == 0
- || strncmp (t_field_name, "type", 4) == 0)
+ if (startswith (t_field_name, "__")
+ || startswith (t_field_name, "op")
+ || startswith (t_field_name, "type"))
{
if (cplus_demangle_opname (t_field_name,
dem_opname, DMGL_ANSI))
sym = cp_lookup_symbol_namespace (namespace_name, name,
get_selected_block (0), VAR_DOMAIN);
- if (sym == NULL)
- {
- char *concatenated_name = alloca (strlen (namespace_name) + 2
- + strlen (name) + 1);
-
- sprintf (concatenated_name, "%s::%s", namespace_name, name);
- sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
- }
-
if (sym == NULL)
return NULL;
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
else
result = value_of_variable (sym, get_selected_block (0));
- if (result && want_address)
+ if (want_address)
result = value_addr (result);
return result;
value_rtti_indirect_type (struct value *v, int *full,
int *top, int *using_enc)
{
- struct value *target;
+ struct value *target = NULL;
struct type *type, *real_type, *target_type;
type = value_type (v);
if (TYPE_CODE (type) == TYPE_CODE_REF)
target = coerce_ref (v);
else if (TYPE_CODE (type) == TYPE_CODE_PTR)
- target = value_ind (v);
+ {
+
+ TRY
+ {
+ target = value_ind (v);
+ }
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ if (except.error == MEMORY_ERROR)
+ {
+ /* value_ind threw a memory error. The pointer is NULL or
+ contains an uninitialized value: we can't determine any
+ type. */
+ return NULL;
+ }
+ throw_exception (except);
+ }
+ END_CATCH
+ }
else
return NULL;
value_of_this_silent (const struct language_defn *lang)
{
struct value *ret = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
ret = value_of_this (lang);
}
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ }
+ END_CATCH
return ret;
}