class DwarfExprEval

Defined at line 49 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

This class evaluates DWARF expressions. These expressions are used to encode the locations of

variables and a few other nontrivial lookups.

This class is complicated by supporting asynchronous interactions with the debugged program. This

means that accessing register and memory data (which may be required to evaluate the expression)

may be asynchronous.

eval_ = std::make_unique

<DwarfExprEval

>();

eval_.eval(..., [](DwarfExprEval* eval, const Err

&

err) {

if (err.has_error()) {

// Handle error.

} else {

... use eval->GetResult() ...

}

});

Public Methods

void Clear ()

Clears any existing values in the stack.

Defined at line 93 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

bool is_complete ()

A complete expression has finished executing but may or may not have had an error. A successful

expression indicates execution is complete and there is a valid result to read.

Defined at line 97 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

bool is_success ()

Defined at line 98 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

debug::RegisterID current_register_id ()

When the result is computed, this will indicate if the result is directly from a register,

and if it is, which one. If the current result was the result of some computation and has no

direct register source, it will be RegisterID::kUnknown.

Defined at line 114 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

bool result_is_constant ()

When the result is computed, this will indicate whether it's from a constant source (encoded in

the DWARF expression) or is the result of reading some memory or registers.

Defined at line 118 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

void DwarfExprEval (UnitSymbolFactory symbol_factory, fxl::RefPtr<SymbolDataProvider> data_provider, const SymbolContext & symbol_context)

Defined at line 255 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

void ~DwarfExprEval ()

Defined at line 265 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

void Push (DwarfStackEntry value)

Pushes a value on the stack. Call before Eval() for the cases where an expression requires

some initial state.

Defined at line 272 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

ResultType GetResultType ()

Valid when is_success(), this indicates how to interpret the value from GetResult().

Defined at line 274 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

DwarfStackEntry GetResult ()

Valid when is_success() and type() == kPointer/kValue. Returns the result of evaluating the

expression. The meaning will be dependent on the context of the expression being evaluated.

Most results will be smaller than this in which case they will use only the low bits.

Defined at line 283 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

TaggedData TakeResultData ()

Destructively returns the generated data buffer. Valid when is_success() and type() == kData.

Defined at line 289 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

Completion Eval (DwarfExpr expr, CompletionCallback cb)

Evaluates the expression using the current stack. If the stack needs initial setup, callers

should call Push() first, or Clear() if there might be unwanted data.

This will take a reference to the SymbolDataProvider until the computation is complete.

The symbol context is used to evaluate relative addresses. It should be the context associated

with the module that this expression is from. Normally this will be retrieved from the

symbol that generated the dwarf expression (see DwarfExpr::source()).

The return value will indicate if the request completed synchronously. In synchronous

completion the callback will have been called reentrantly from within the stack of this

function. This does not indicate success as it could succeed or fail both synchronously and

asynchronously.

This class must not be deleted from within the completion callback.

Defined at line 295 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

std::string ToString (DwarfExpr expr, bool pretty)

Converts the given DWARF expression to a string. The result values on this class won't be

set since the expression won't actually be evaluated.

The data_provider is required to get the current architecture for pretty-printing register

names. To disable this, pass the default SymbolDataProvider implementation.

When "pretty" mode is enabled, operations will be simplified and platform register names will

be substituted.

Defined at line 302 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc

Enumerations

enum Completion
Name Value
kSync 0
kAsync 1

Type of completion from a call. Async completion will happen in a callback

in the future.

Defined at line 53 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

enum ResultType
Name Value
kPointer 0
kValue 1
kData 2

A DWARF expression can compute either the address of the desired object in the debugged

programs address space, or it can compute the actual value of the object (because it may not

exist in memory).

Defined at line 58 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h

enum StringOutput
Name Value
kNone 0
kLiteral 1
kPretty 2

Defined at line 73 of file ../../src/developer/debug/zxdb/symbols/dwarf_expr_eval.h