}
return evaluate_subexp_standard (expect_type, exp, pos, noside);
}
+ \f
+ /* la_watch_location_expression for C. */
+
+ gdb::unique_xmalloc_ptr<char>
+ c_watch_location_expression (struct type *type, CORE_ADDR addr)
+ {
+ type = check_typedef (TYPE_TARGET_TYPE (check_typedef (type)));
+ std::string name = type_to_string (type);
+ return gdb::unique_xmalloc_ptr<char>
+ (xstrprintf ("* (%s *) %s", name.c_str (), core_addr_to_string (addr)));
+ }
+/* Compute the C++ hash for STRING0.
+
+ For dictionaries, we group like-symbols together.
+ That means that all templates with the same unparameterized names
+ must yield the same hash. Likewise, overloaded functions must also
+ yield the same hash.
+
+ The following code deals largely with templates. The dreaded
+ strcmp_iw already enforces overloads to be grouped. */
+
+static unsigned int
+cplus_compute_string_hash (const char *string0)
+{
+ /* If '<' doesn't appear at all in STRING), there is no way we could
+ be dealing with a template name. */
+ if (find_toplevel_char (string0, '<') == NULL)
+ return default_compute_string_hash (string0);
+
+ /* Locate the last qualified component of STRING0. */
+ const char *p = find_toplevel_string (string0, "::");
+ const char *last_scope = NULL;
+
+ while (p != NULL)
+ {
+ last_scope = p;
+ p = find_toplevel_string (p + 2, "::");
+ }
+
+ /* last_scope points to the last "::". If NULL, then no scope operator
+ was seen in STRING0, and we use the entire string. */
+ if (last_scope == NULL)
+ last_scope = string0;
+
+ /* Find a possible template parameter list. Valid operators will be
+ dealt with later. */
+ p = find_toplevel_char (last_scope, '<');
+
+ /* P points to toplevel '<', but it could still be a valid operator
+ and not be a template at all. */
+ if ((p - last_scope) > 8 && strncmp (p - 8, "operator", 8) == 0)
+ {
+ /* Skip <,=. */
+ while (strchr ("<=", *p) != NULL)
+ ++p;
+
+ /* Check if this operator contains a template parameter list marker. */
+ p = find_toplevel_char (p, '<');
+ }
+
+ /* If NULL, the string represents an operator (<, <=, <<, <<=) and is not
+ a template function itself. */
+ if (p == NULL)
+ return default_compute_string_hash (string0);
+
+ char *copy = ASTRDUP (string0);
+
+ copy[p - string0] = '\0';
+
+ /* It is a template, compute the hash based only until P. */
+ return default_compute_string_hash (copy);
+}
+
\f
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ c_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
+ default_compute_string_hash,
&c_varobj_ops,
c_get_compile_context,
c_compute_program,
default_print_array_index,
cp_pass_by_reference,
c_get_string,
+ c_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
+ cplus_compute_string_hash,
&cplus_varobj_ops,
- NULL,
- NULL,
+ cplus_get_compile_context,
+ cplus_compute_program,
LANG_MAGIC
};
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ c_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
+ default_compute_string_hash,
&default_varobj_ops,
NULL,
NULL,
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ c_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
+ default_compute_string_hash,
&default_varobj_ops,
NULL,
NULL,
#include "symfile.h"
#include "cp-support.h"
#include "frame.h"
+ #include "c-lang.h"
+#include "dictionary.h" /* for dict_hash */
extern void _initialize_language (void);
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ c_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
+ default_compute_string_hash,
&default_varobj_ops,
NULL,
NULL,
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ c_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
+ default_compute_string_hash,
&default_varobj_ops,
NULL,
NULL,
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ c_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
+ default_compute_string_hash,
&default_varobj_ops,
NULL,
NULL,