src/developer/debug/zxdb/symbols/dwarf_expr_eval.cc
// Pops the stack and pushes an given-sized value from memory at that location.
Pops the stack and pushes an given-sized value from memory at that location.
Pops the stack and pushes an given - sized value from memory at that location .
DwarfExprEval::Completion DwarfExprEval::OpDeref(uint32_t byte_size) {
  if (stack_.empty()) {
    ReportStackUnderflow();
    return Completion::kSync;
  }
  if (byte_size == 0 || byte_size > sizeof(StackEntry)) {
    ReportError(fxl::StringPrintf("Invalid DWARF expression read size: %u", byte_size));
    return Completion::kSync;
  }
  StackEntry addr = stack_.back();
  stack_.pop_back();
  ReadMemory(addr, byte_size, [](DwarfExprEval* eval, std::vector<uint8_t> data) {
    FX_DCHECK(data.size() <= sizeof(StackEntry));
    StackEntry to_push = 0;
    memcpy(&to_push, &data[0], data.size());
    eval->Push(to_push);
  });
  return Completion::kAsync;
}
DwarfExprEval :: Completion DwarfExprEval :: OpDeref ( uint32_t byte_size ) { if ( stack_ . empty ( ) ) { ReportStackUnderflow ( ) ; return Completion :: kSync ; } if ( byte_size == 0 || byte_size > sizeof ( StackEntry ) ) { ReportError ( fxl :: StringPrintf ( " " , byte_size ) ) ; return Completion :: kSync ; } StackEntry addr = stack_ . back ( ) ; stack_ . pop_back ( ) ; ReadMemory ( addr , byte_size , [ ] ( DwarfExprEval * eval , std :: vector < uint8_t > data ) { FX_DCHECK ( data . size ( ) <= sizeof ( StackEntry ) ) ; StackEntry to_push = 0 ; memcpy ( & to_push , & data [ 0 ] , data . size ( ) ) ; eval -> Push ( to_push ) ; } ) ; return Completion :: kAsync ; }
Pops the stack and pushes an given-sized value from memory at that location.
Pops the stack and pushes an given - sized value from memory at that location .
// Success. This assumes little-endian and copies starting from the low bytes. The data will // have already been validated to be the correct size so we know it will fit in a StackEntry.