class Variant

Defined at line 21 of file ../../src/developer/debug/zxdb/symbols/variant.h

A variant is one possible value of a "variant part".

Each Variant contains a discriminant value which is a selector for this in the containing

VariantPart, and the set of data inside it.

See VariantPart for a full description.

Public Methods

const std::optional<uint64_t> & discr_value ()

The discriminant value associated with this variant. See VariantPart.

The discriminant value may be unset which indicates that this variant is the default one.

DWARF discriminant values can be either signed or unsigned, according to the type associated

with the discriminant data member in the VariantPart. This makes it complicated do handle

because the full type of the VariantPart needs to be understood just to properly parse the

Variant out of the file.

Since our only current use of these is Rust which always uses unsigned discriminants, we also

assume unsigned here.

If in the future we need to support signed discriminants, we could sign-extend the values

during decode so that internally we always deal with unsigned types.

Defined at line 39 of file ../../src/developer/debug/zxdb/symbols/variant.h

const std::vector<LazySymbol> & data_members ()

Data members. These should be DataMember objects. The offsets of the data members will be from

the structure containing the VariantPart.

As of this writing, Rust (our only use-case for this) generates variants with exactly one data

member. If Rust has:

enum MyEnum {

Foo,

Bar(i32),

}

DWARF will define two structure types "MyEnum::Foo" (with no members) and "MyEnum::Bar" (with

one member) and each variant's data members will contain a DataMember of that type. The "name"

of these data members will match the type ("Foo" and "Bar" in this example).

Defined at line 55 of file ../../src/developer/debug/zxdb/symbols/variant.h

Protected Methods

const Variant * AsVariant ()

Symbol overrides.

Defined at line 59 of file ../../src/developer/debug/zxdb/symbols/variant.h

Friends

class MakeRefCountedHelper
class RefCountedThreadSafe