return (start % HOST_CHAR_BIT + n_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
}
+/* Throw an exception about the invalid DWARF expression. */
+
+static void ATTRIBUTE_NORETURN
+ill_formed_expression ()
+{
+ error (_("Ill-formed DWARF expression"));
+}
+
/* See expr.h. */
CORE_ADDR
}
class dwarf_location;
+class dwarf_value;
/* Base class that describes entries found on a DWARF expression
evaluation stack. */
m_initialised = initialised;
};
+ /* Convert DWARF entry into a DWARF value. TYPE defines a desired type of
+ the returned DWARF value if it doesn't already have one.
+
+ If the conversion from that location description kind to a value is not
+ supported, throw an error. */
+ virtual std::unique_ptr<dwarf_value> to_value (struct type *type) const
+ {
+ ill_formed_expression ();
+ }
+
protected:
/* Architecture of the location. */
gdbarch *m_arch;
struct type *m_type;
};
+using dwarf_value_up = std::unique_ptr<dwarf_value>;
+
/* Undefined location description entry. This is a special location
description type that describes the location description that is
not known. */
m_stack = stack;
};
+ dwarf_value_up to_value (struct type *type) const override;
+
private:
/* True if the location belongs to a stack memory region. */
bool m_stack;
return make_unique<dwarf_memory> (arch, offset);
}
+dwarf_value_up
+dwarf_memory::to_value (struct type *type) const
+{
+ return make_unique<dwarf_value> (m_offset, type);
+}
+
/* Register location description entry. */
class dwarf_register final : public dwarf_location