summaryrefslogtreecommitdiff
path: root/gdb/value.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-31 13:24:00 -0700
committerTom Tromey <tom@tromey.com>2023-02-13 15:21:07 -0700
commitcbe793af8831a7244de326d6b07c60c197f096a2 (patch)
treeebdab02eb11031a7b713952444ea5a7257a523d6 /gdb/value.h
parentf29de665046c1b1a2feabf8d3d584b3b89699e10 (diff)
downloadbinutils-gdb-cbe793af8831a7244de326d6b07c60c197f096a2.tar.gz
Turn allocate_value_lazy into a static "constructor"
This changes allocate_value_lazy to be a static "constructor" of struct value. I considered trying to change value to use ordinary new/delete, but it seems to me that due to reference counting, we may someday want to change these static constructors to return value_ref_ptr instead. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/value.h')
-rw-r--r--gdb/value.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/gdb/value.h b/gdb/value.h
index 788a3d8514e..29ed2a8a3ce 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -144,6 +144,9 @@ typedef gdb::ref_ptr<struct value, value_ref_policy> value_ref_ptr;
struct value
{
+private:
+
+ /* Values can only be created via "static constructors". */
explicit value (struct type *type_)
: m_modifiable (1),
m_lazy (1),
@@ -156,6 +159,13 @@ struct value
{
}
+public:
+
+ /* Allocate a lazy value for type TYPE. Its actual content is
+ "lazily" allocated too: the content field of the return value is
+ NULL; it will be allocated when it is fetched from the target. */
+ static struct value *allocate_lazy (struct type *type);
+
~value ();
DISABLE_COPY_AND_ASSIGN (value);
@@ -1002,7 +1012,7 @@ extern struct value *read_var_value (struct symbol *var,
frame_info_ptr frame);
extern struct value *allocate_value (struct type *type);
-extern struct value *allocate_value_lazy (struct type *type);
+
extern void value_contents_copy (struct value *dst, LONGEST dst_offset,
struct value *src, LONGEST src_offset,
LONGEST length);