#include <string>
#include <vector>
-extern initialize_file_ftype _initialize_rust_language;
-
/* Returns the last segment of a Rust path like foo::bar::baz. Will
not handle cases where the last segment contains generics. This
will return NULL if the last segment cannot be found. */
fputs_filtered ("[", stream);
rust_print_type (TYPE_TARGET_TYPE (type), NULL,
stream, show - 1, level, flags);
- fputs_filtered ("; ", stream);
if (TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCEXPR
|| TYPE_HIGH_BOUND_KIND (TYPE_INDEX_TYPE (type)) == PROP_LOCLIST)
- fprintf_filtered (stream, "variable length");
+ fprintf_filtered (stream, "; variable length");
else if (get_array_bounds (type, &low_bound, &high_bound))
- fprintf_filtered (stream, "%s",
+ fprintf_filtered (stream, "; %s",
plongest (high_bound - low_bound + 1));
fputs_filtered ("]", stream);
}
if (noside == EVAL_AVOID_SIDE_EFFECTS)
result = value_zero (TYPE_TARGET_TYPE (fn_type), not_lval);
else
- result = call_function_by_hand (function, num_args + 1, args.data ());
+ result = call_function_by_hand (function, NULL, num_args + 1, args.data ());
return result;
}
\f
+/* la_watch_location_expression for Rust. */
+
+static gdb::unique_xmalloc_ptr<char>
+rust_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 as *mut %s)", core_addr_to_string (addr),
+ name.c_str ()));
+}
+
+\f
+
static const struct exp_descriptor exp_descriptor_rust =
{
rust_print_subexp,
".rs", NULL
};
-static const struct language_defn rust_language_defn =
+extern const struct language_defn rust_language_defn =
{
"rust",
"Rust",
1, /* c-style arrays */
0, /* String lower bound */
default_word_break_characters,
- default_make_symbol_completion_list,
+ default_collect_symbol_completion_matches,
rust_language_arch_info,
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ rust_watch_location_expression,
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
&default_varobj_ops,
NULL,
LANG_MAGIC
};
-
-void
-_initialize_rust_language (void)
-{
- add_language (&rust_language_defn);
-}