#if !defined (VALUE_H)
#define VALUE_H 1
-#include "doublest.h"
#include "frame.h" /* For struct frame_id. */
struct block;
/* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
which is (or will be copied to) VAL's contents buffer offset by
- EMBEDDED_OFFSET (that is, to &VAL->contents[EMBEDDED_OFFSET]).
- Marks value contents ranges as unavailable if the corresponding
- memory is likewise unavailable. STACK indicates whether the memory
- is known to be stack memory. */
+ BIT_OFFSET bits. Marks value contents ranges as unavailable if
+ the corresponding memory is likewise unavailable. STACK indicates
+ whether the memory is known to be stack memory. */
-extern void read_value_memory (struct value *val, LONGEST embedded_offset,
+extern void read_value_memory (struct value *val, LONGEST bit_offset,
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length);
struct gdbarch *, CORE_ADDR,
struct ui_file *, int);
+/* Returns true if VAL is of floating-point type. In addition,
+ throws an error if the value is an invalid floating-point value. */
+extern bool is_floating_value (struct value *val);
+
extern LONGEST value_as_long (struct value *val);
-extern DOUBLEST value_as_double (struct value *val);
extern CORE_ADDR value_as_address (struct value *val);
extern LONGEST unpack_long (struct type *type, const gdb_byte *valaddr);
-extern DOUBLEST unpack_double (struct type *type, const gdb_byte *valaddr,
- int *invp);
extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
extern LONGEST unpack_field_as_long (struct type *type,
extern struct value *value_from_longest (struct type *type, LONGEST num);
extern struct value *value_from_ulongest (struct type *type, ULONGEST num);
extern struct value *value_from_pointer (struct type *type, CORE_ADDR addr);
-extern struct value *value_from_double (struct type *type, DOUBLEST num);
-extern struct value *value_from_decfloat (struct type *type,
- const gdb_byte *decbytes);
extern struct value *value_from_history_ref (const char *, const char **);
extern struct value *value_from_component (struct value *, struct type *,
LONGEST);
extern void value_free_to_mark (const struct value *mark);
+/* A helper class that uses value_mark at construction time and calls
+ value_free_to_mark in the destructor. This is used to clear out
+ temporary values created during the lifetime of this object. */
+class scoped_value_mark
+{
+ public:
+
+ scoped_value_mark ()
+ : m_value (value_mark ())
+ {
+ }
+
+ ~scoped_value_mark ()
+ {
+ free_to_mark ();
+ }
+
+ scoped_value_mark (scoped_value_mark &&other) = default;
+
+ DISABLE_COPY_AND_ASSIGN (scoped_value_mark);
+
+ /* Free the values currently on the value stack. */
+ void free_to_mark ()
+ {
+ if (m_value != NULL)
+ {
+ value_free_to_mark (m_value);
+ m_value = NULL;
+ }
+ }
+
+ private:
+
+ const struct value *m_value;
+};
+
extern struct value *value_cstring (const char *ptr, ssize_t len,
struct type *char_type);
extern struct value *value_string (const char *ptr, ssize_t len,
extern struct value *value_addr (struct value *arg1);
-extern struct value *value_ref (struct value *arg1);
+extern struct value *value_ref (struct value *arg1, enum type_code refcode);
extern struct value *value_assign (struct value *toval,
struct value *fromval);
extern struct value *evaluate_subexpression_type (struct expression *exp,
int subexp);
+extern value *evaluate_var_value (enum noside noside, const block *blk,
+ symbol *var);
+
+extern value *evaluate_var_msym_value (enum noside noside,
+ struct objfile *objfile,
+ minimal_symbol *msymbol);
+
+extern value *eval_skip_value (expression *exp);
+
extern void fetch_subexp_value (struct expression *exp, int *pc,
struct value **valp, struct value **resultp,
struct value **val_chain,
extern struct internalvar *create_internalvar (const char *name);
-extern VEC (char_ptr) *complete_internalvar (const char *name);
+extern void complete_internalvar (completion_tracker &tracker,
+ const char *name);
/* An internalvar can be dynamically computed by supplying a vector of
function pointers to perform various operations. */
extern void value_free (struct value *val);
+/* A free policy class to interface std::unique_ptr with
+ value_free. */
+
+struct value_deleter
+{
+ void operator() (struct value *value) const
+ {
+ value_free (value);
+ }
+};
+
+/* A unique pointer to a struct value. */
+
+typedef std::unique_ptr<struct value, value_deleter> gdb_value_up;
+
extern void free_all_values (void);
extern void free_value_chain (struct value *v);
extern void print_floating (const gdb_byte *valaddr, struct type *type,
struct ui_file *stream);
-extern void print_decimal_floating (const gdb_byte *valaddr, struct type *type,
- struct ui_file *stream);
-
extern void value_print (struct value *val, struct ui_file *stream,
const struct value_print_options *options);