GDB (xrefs)
Classes | Macros | Enumerations | Functions | Variables
/tmp/gdb-8.1/gdb/rust-lang.c File Reference
#include "defs.h"
#include <ctype.h>
#include "block.h"
#include "c-lang.h"
#include "charset.h"
#include "cp-support.h"
#include "demangle.h"
#include "gdbarch.h"
#include "infcall.h"
#include "objfiles.h"
#include "psymtab.h"
#include "rust-lang.h"
#include "valprint.h"
#include "varobj.h"
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  disr_info
 

Macros

#define RUST_ENUM_PREFIX   "RUST$ENCODED$ENUM$"
 
#define RUST_ENCODED_ENUM_REAL   0
 
#define RUST_ENCODED_ENUM_HIDDEN   1
 

Enumerations

enum  rust_primitive_types {
  rust_primitive_bool, rust_primitive_char, rust_primitive_i8, rust_primitive_u8,
  rust_primitive_i16, rust_primitive_u16, rust_primitive_i32, rust_primitive_u32,
  rust_primitive_i64, rust_primitive_u64, rust_primitive_isize, rust_primitive_usize,
  rust_primitive_f32, rust_primitive_f64, rust_primitive_unit, rust_primitive_str,
  nr_rust_primitive_types
}
 

Functions

static const char * rust_last_path_segment (const char *path)
 
std::string rust_crate_for_block (const struct block *block)
 
static bool rust_union_is_untagged (struct type *type)
 
static struct disr_info rust_get_disr_info (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct value *val)
 
bool rust_tuple_type_p (struct type *type)
 
static bool rust_underscore_fields (struct type *type, int offset)
 
bool rust_tuple_struct_type_p (struct type *type)
 
static bool rust_tuple_variant_type_p (struct type *type)
 
static bool rust_slice_type_p (struct type *type)
 
static bool rust_range_type_p (struct type *type)
 
static bool rust_u8_type_p (struct type *type)
 
static bool rust_chartype_p (struct type *type)
 
static struct valuerust_get_trait_object_pointer (struct value *value)
 
static void rust_emitchar (int c, struct type *type, struct ui_file *stream, int quoter)
 
static void rust_printchar (int c, struct type *type, struct ui_file *stream)
 
static void rust_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, unsigned int length, const char *user_encoding, int force_ellipses, const struct value_print_options *options)
 
static void rust_val_print_str (struct ui_file *stream, struct value *val, const struct value_print_options *options)
 
static void val_print_struct (struct type *type, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options)
 
static void rust_val_print (struct type *type, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options)
 
static void rust_print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags)
 
static void rust_print_struct_def (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags)
 
static void rust_print_typedef (struct type *type, struct symbol *new_symbol, struct ui_file *stream)
 
static int rust_type_alignment (struct type *t)
 
static struct typerust_composite_type (struct type *original, const char *name, const char *field1, struct type *type1, const char *field2, struct type *type2)
 
struct typerust_slice_type (const char *name, struct type *elt_type, struct type *usize_type)
 
static void rust_language_arch_info (struct gdbarch *gdbarch, struct language_arch_info *lai)
 
static struct valuerust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
 
static struct valuerust_range (struct expression *exp, int *pos, enum noside noside)
 
static void rust_compute_range (struct type *type, struct value *range, LONGEST *low, LONGEST *high, enum range_type *kind)
 
static struct valuerust_subscript (struct expression *exp, int *pos, enum noside noside, int for_addr)
 
static struct valuerust_evaluate_subexp (struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
 
static void rust_operator_length (const struct expression *exp, int pc, int *oplenp, int *argsp)
 
static const char * rust_op_name (enum exp_opcode opcode)
 
static int rust_dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
 
static void rust_print_subexp (struct expression *exp, int *pos, struct ui_file *stream, enum precedence prec)
 
static int rust_operator_check (struct expression *exp, int pos, int(*objfile_func)(struct objfile *objfile, void *data), void *data)
 
static struct block_symbol rust_lookup_symbol_nonlocal (const struct language_defn *langdef, const char *name, const struct block *block, const domain_enum domain)
 
static int rust_sniff_from_mangled_name (const char *mangled, char **demangled)
 
static gdb::unique_xmalloc_ptr< char > rust_watch_location_expression (struct type *type, CORE_ADDR addr)
 

Variables

static const struct generic_val_print_decorations rust_decorations
 
static const struct exp_descriptor exp_descriptor_rust
 
static const char * rust_extensions []
 
const struct language_defn rust_language_defn
 

Macro Definition Documentation

◆ RUST_ENCODED_ENUM_HIDDEN

#define RUST_ENCODED_ENUM_HIDDEN   1

Definition at line 91 of file rust-lang.c.

Referenced by rust_evaluate_subexp(), rust_get_disr_info(), and rust_val_print().

◆ RUST_ENCODED_ENUM_REAL

#define RUST_ENCODED_ENUM_REAL   0

Definition at line 87 of file rust-lang.c.

Referenced by rust_get_disr_info().

◆ RUST_ENUM_PREFIX

#define RUST_ENUM_PREFIX   "RUST$ENCODED$ENUM$"

Definition at line 83 of file rust-lang.c.

Referenced by rust_get_disr_info(), rust_print_type(), and rust_union_is_untagged().

Enumeration Type Documentation

◆ rust_primitive_types

Enumerator
rust_primitive_bool 
rust_primitive_char 
rust_primitive_i8 
rust_primitive_u8 
rust_primitive_i16 
rust_primitive_u16 
rust_primitive_i32 
rust_primitive_u32 
rust_primitive_i64 
rust_primitive_u64 
rust_primitive_isize 
rust_primitive_usize 
rust_primitive_f32 
rust_primitive_f64 
rust_primitive_unit 
rust_primitive_str 
nr_rust_primitive_types 

Definition at line 1208 of file rust-lang.c.

Function Documentation

◆ rust_chartype_p()

static bool rust_chartype_p ( struct type type)
static

Definition at line 393 of file rust-lang.c.

References TYPE_CODE, TYPE_CODE_CHAR, TYPE_LENGTH, and TYPE_UNSIGNED.

Referenced by rust_emitchar().

◆ rust_composite_type()

static struct type* rust_composite_type ( struct type original,
const char *  name,
const char *  field1,
struct type type1,
const char *  field2,
struct type type2 
)
static

◆ rust_compute_range()

static void rust_compute_range ( struct type type,
struct value range,
LONGEST low,
LONGEST high,
enum range_type kind 
)
static

◆ rust_crate_for_block()

std::string rust_crate_for_block ( const struct block block)

Definition at line 56 of file rust-lang.c.

References block_scope(), cp_find_first_component(), and string.

Referenced by crate_name().

◆ rust_dump_subexp_body()

static int rust_dump_subexp_body ( struct expression exp,
struct ui_file stream,
int  elt 
)
static

◆ rust_emitchar()

static void rust_emitchar ( int  c,
struct type type,
struct ui_file stream,
int  quoter 
)
static

◆ rust_evaluate_funcall()

static struct value* rust_evaluate_funcall ( struct expression exp,
int *  pos,
enum noside  noside 
)
static

◆ rust_evaluate_subexp()

static struct value* rust_evaluate_subexp ( struct type expect_type,
struct expression exp,
int *  pos,
enum noside  noside 
)
static

◆ rust_get_disr_info()

static struct disr_info rust_get_disr_info ( struct type type,
const gdb_byte valaddr,
int  embedded_offset,
CORE_ADDR  address,
struct value val 
)
static

◆ rust_get_trait_object_pointer()

static struct value* rust_get_trait_object_pointer ( struct value value)
static

◆ rust_language_arch_info()

static void rust_language_arch_info ( struct gdbarch gdbarch,
struct language_arch_info lai 
)
static

◆ rust_last_path_segment()

static const char* rust_last_path_segment ( const char *  path)
static

Definition at line 44 of file rust-lang.c.

Referenced by rust_get_disr_info(), and rust_print_type().

◆ rust_lookup_symbol_nonlocal()

static struct block_symbol rust_lookup_symbol_nonlocal ( const struct language_defn langdef,
const char *  name,
const struct block block,
const domain_enum  domain 
)
static

◆ rust_op_name()

static const char* rust_op_name ( enum exp_opcode  opcode)
static

Definition at line 2003 of file rust-lang.c.

References op_name_standard().

◆ rust_operator_check()

static int rust_operator_check ( struct expression exp,
int  pos,
int(*)(struct objfile *objfile, void *data)  objfile_func,
void *  data 
)
static

◆ rust_operator_length()

static void rust_operator_length ( const struct expression exp,
int  pc,
int *  oplenp,
int *  argsp 
)
static

◆ rust_print_struct_def()

static void rust_print_struct_def ( struct type type,
const char *  varstring,
struct ui_file stream,
int  show,
int  level,
const struct type_print_options flags 
)
static

◆ rust_print_subexp()

static void rust_print_subexp ( struct expression exp,
int *  pos,
struct ui_file stream,
enum precedence  prec 
)
static

◆ rust_print_type()

static void rust_print_type ( struct type type,
const char *  varstring,
struct ui_file stream,
int  show,
int  level,
const struct type_print_options flags 
)
static

◆ rust_print_typedef()

static void rust_print_typedef ( struct type type,
struct symbol new_symbol,
struct ui_file stream 
)
static

◆ rust_printchar()

static void rust_printchar ( int  c,
struct type type,
struct ui_file stream 
)
static

Definition at line 464 of file rust-lang.c.

References fputs_filtered(), and LA_EMIT_CHAR.

◆ rust_printstr()

static void rust_printstr ( struct ui_file stream,
struct type type,
const gdb_byte string,
unsigned int  length,
const char *  user_encoding,
int  force_ellipses,
const struct value_print_options options 
)
static

Definition at line 474 of file rust-lang.c.

References c_printstr(), generic_printstr(), type::length, and rust_u8_type_p().

Referenced by rust_val_print().

◆ rust_range()

static struct value* rust_range ( struct expression exp,
int *  pos,
enum noside  noside 
)
static

◆ rust_range_type_p()

static bool rust_range_type_p ( struct type type)
static

Definition at line 351 of file rust-lang.c.

References TYPE_CODE, TYPE_CODE_STRUCT, TYPE_FIELD_NAME, TYPE_NFIELDS, and TYPE_TAG_NAME.

Referenced by rust_subscript().

◆ rust_slice_type()

struct type* rust_slice_type ( const char *  name,
struct type elt_type,
struct type usize_type 
)

◆ rust_slice_type_p()

static bool rust_slice_type_p ( struct type type)
static

Definition at line 340 of file rust-lang.c.

References TYPE_CODE, TYPE_CODE_STRUCT, and TYPE_TAG_NAME.

Referenced by rust_subscript(), and val_print_struct().

◆ rust_sniff_from_mangled_name()

static int rust_sniff_from_mangled_name ( const char *  mangled,
char **  demangled 
)
static

Definition at line 2226 of file rust-lang.c.

References gdb_demangle().

◆ rust_subscript()

static struct value* rust_subscript ( struct expression exp,
int *  pos,
enum noside  noside,
int  for_addr 
)
static

◆ rust_tuple_struct_type_p()

bool rust_tuple_struct_type_p ( struct type type)

◆ rust_tuple_type_p()

bool rust_tuple_type_p ( struct type type)

◆ rust_tuple_variant_type_p()

static bool rust_tuple_variant_type_p ( struct type type)
static

Definition at line 331 of file rust-lang.c.

References rust_underscore_fields().

Referenced by rust_evaluate_subexp(), rust_print_type(), and rust_val_print().

◆ rust_type_alignment()

static int rust_type_alignment ( struct type t)
static

◆ rust_u8_type_p()

static bool rust_u8_type_p ( struct type type)
static

Definition at line 383 of file rust-lang.c.

References TYPE_CODE, TYPE_CODE_INT, TYPE_LENGTH, and TYPE_UNSIGNED.

Referenced by rust_printstr(), and rust_val_print().

◆ rust_underscore_fields()

static bool rust_underscore_fields ( struct type type,
int  offset 
)
static

◆ rust_union_is_untagged()

static bool rust_union_is_untagged ( struct type type)
static

Definition at line 96 of file rust-lang.c.

References RUST_ENUM_PREFIX, TYPE_FIELD_NAME, and TYPE_NFIELDS.

Referenced by rust_evaluate_subexp(), rust_print_type(), and rust_val_print().

◆ rust_val_print()

static void rust_val_print ( struct type type,
int  embedded_offset,
CORE_ADDR  address,
struct ui_file stream,
int  recurse,
struct value val,
const struct value_print_options options 
)
static

◆ rust_val_print_str()

static void rust_val_print_str ( struct ui_file stream,
struct value val,
const struct value_print_options options 
)
static

◆ rust_watch_location_expression()

static gdb::unique_xmalloc_ptr<char> rust_watch_location_expression ( struct type type,
CORE_ADDR  addr 
)
static

◆ val_print_struct()

static void val_print_struct ( struct type type,
int  embedded_offset,
CORE_ADDR  address,
struct ui_file stream,
int  recurse,
struct value val,
const struct value_print_options options 
)
static

Variable Documentation

◆ exp_descriptor_rust

const struct exp_descriptor exp_descriptor_rust
static
Initial value:
=
{
}
static const char * rust_op_name(enum exp_opcode opcode)
Definition: rust-lang.c:2003
static struct value * rust_evaluate_subexp(struct type *expect_type, struct expression *exp, int *pos, enum noside noside)
Definition: rust-lang.c:1645
static int rust_dump_subexp_body(struct expression *exp, struct ui_file *stream, int elt)
Definition: rust-lang.c:2019
static void rust_operator_length(const struct expression *exp, int pc, int *oplenp, int *argsp)
Definition: rust-lang.c:1960
static void rust_print_subexp(struct expression *exp, int *pos, struct ui_file *stream, enum precedence prec)
Definition: rust-lang.c:2084
static int rust_operator_check(struct expression *exp, int pos, int(*objfile_func)(struct objfile *objfile, void *data), void *data)
Definition: rust-lang.c:2153

Definition at line 2248 of file rust-lang.c.

◆ rust_decorations

const struct generic_val_print_decorations rust_decorations
static
Initial value:
=
{
"",
" + ",
" * I",
"true",
"false",
"()",
"[",
"]"
}

Definition at line 604 of file rust-lang.c.

Referenced by rust_val_print().

◆ rust_extensions

const char* rust_extensions[]
static
Initial value:
=
{
".rs", NULL
}

Definition at line 2258 of file rust-lang.c.

◆ rust_language_defn

const struct language_defn rust_language_defn