aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 06b0d1e..0b530f0 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -37,6 +37,8 @@
#include "dfp.h"
#include "objfiles.h"
+#include "python/python.h"
+
/* Prototypes for exported functions. */
void _initialize_values (void);
@@ -130,8 +132,8 @@ struct value
/* Values are stored in a chain, so that they can be deleted easily
over calls to the inferior. Values assigned to internal
- variables or put into the value history are taken off this
- list. */
+ variables, put into the value history or exposed to Python are
+ taken off this list. */
struct value *next;
/* Register number if the value is from a register. */
@@ -257,6 +259,31 @@ allocate_repeat_value (struct type *type, int count)
type, range_type));
}
+/* Needed if another module needs to maintain its on list of values. */
+void
+value_prepend_to_list (struct value **head, struct value *val)
+{
+ val->next = *head;
+ *head = val;
+}
+
+/* Needed if another module needs to maintain its on list of values. */
+void
+value_remove_from_list (struct value **head, struct value *val)
+{
+ struct value *prev;
+
+ if (*head == val)
+ *head = (*head)->next;
+ else
+ for (prev = *head; prev->next; prev = prev->next)
+ if (prev->next == val)
+ {
+ prev->next = val->next;
+ break;
+ }
+}
+
/* Accessor methods. */
struct value *
@@ -916,6 +943,7 @@ preserve_values (struct objfile *objfile)
htab_t copied_types;
struct value_history_chunk *cur;
struct internalvar *var;
+ struct value *val;
int i;
/* Create the hash table. We allocate on the objfile's obstack, since
@@ -930,6 +958,9 @@ preserve_values (struct objfile *objfile)
for (var = internalvars; var; var = var->next)
preserve_one_value (var->value, objfile, copied_types);
+ for (val = values_in_python; val; val = val->next)
+ preserve_one_value (val, objfile, copied_types);
+
htab_delete (copied_types);
}