aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/value.h')
-rw-r--r--gdb/value.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/value.h b/gdb/value.h
index 4aba8c0..0c5ab28 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -714,6 +714,28 @@ extern struct value *value_mark (void);
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 ()
+ {
+ value_free_to_mark (m_value);
+ }
+
+ 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,