+#include "leb128.h"
+#include "gdbtypes.h"
+
+/* The location of a value. */
+enum dwarf_value_location
+{
+ /* The piece is in memory.
+ The value on the dwarf stack is its address. */
+ DWARF_VALUE_MEMORY,
+
+ /* The piece is in a register.
+ The value on the dwarf stack is the register number. */
+ DWARF_VALUE_REGISTER,
+
+ /* The piece is on the dwarf stack. */
+ DWARF_VALUE_STACK,
+
+ /* The piece is a literal. */
+ DWARF_VALUE_LITERAL,
+
+ /* The piece was optimized out. */
+ DWARF_VALUE_OPTIMIZED_OUT,
+
+ /* The piece is an implicit pointer. */
+ DWARF_VALUE_IMPLICIT_POINTER
+};
+
+/* A piece of an object, as recorded by DW_OP_piece or DW_OP_bit_piece. */
+struct dwarf_expr_piece
+{
+ enum dwarf_value_location location;
+
+ union
+ {
+ struct
+ {
+ /* This piece's address, for DWARF_VALUE_MEMORY pieces. */
+ CORE_ADDR addr;
+ /* Non-zero if the piece is known to be in memory and on
+ the program's stack. */
+ bool in_stack_memory;
+ } mem;
+
+ /* The piece's register number, for DWARF_VALUE_REGISTER pieces. */
+ int regno;
+
+ /* The piece's literal value, for DWARF_VALUE_STACK pieces. */
+ struct value *value;
+
+ struct
+ {
+ /* A pointer to the data making up this piece,
+ for DWARF_VALUE_LITERAL pieces. */
+ const gdb_byte *data;
+ /* The length of the available data. */
+ ULONGEST length;
+ } literal;
+
+ /* Used for DWARF_VALUE_IMPLICIT_POINTER. */
+ struct
+ {
+ /* The referent DIE from DW_OP_implicit_pointer. */
+ sect_offset die_sect_off;
+ /* The byte offset into the resulting data. */
+ LONGEST offset;
+ } ptr;
+ } v;
+
+ /* The length of the piece, in bits. */
+ ULONGEST size;
+ /* The piece offset, in bits. */
+ ULONGEST offset;
+};
+
+/* The dwarf expression stack. */
+
+struct dwarf_stack_value
+{
+ dwarf_stack_value (struct value *value_, int in_stack_memory_)
+ : value (value_), in_stack_memory (in_stack_memory_)
+ {}
+
+ struct value *value;
+
+ /* True if the piece is in memory and is known to be on the program's stack.
+ It is always ok to set this to zero. This is used, for example, to
+ optimize memory access from the target. It can vastly speed up backtraces
+ on long latency connections when "set stack-cache on". */
+ bool in_stack_memory;
+};
+