forked from Imagelibrary/binutils-gdb
2008-10-16 Thiago Jung Bauermann <bauerman@br.ibm.com>
Tom Tromey <tromey@redhat.com> gdb/ * Makefile.in (SUBDIR_PYTHON_OBS): Add python-value.o. (SUBDIR_PYTHON_SRCS): Add python-value.c. (python-value.o): New target. * configure.ac (CONFIG_OBS): Add python-value.o. (CONFIG_SRCS): Add python/python-value.c * configure: Regenerate. * python-internal.h (value_object_type): Add external declaration. (gdbpy_get_value_from_history, value_to_value_object, convert_value_from_python, gdbpy_initialize_values): Add function prototype. * python/python-value.c: New file. * python/python.c (GdbMethods): Add gdbpy_get_value_from_history. (_initialize_python): Call gdbpy_initialize_values. * python/python.h (values_in_python): Add external declaration. * value.c (value_prepend_to_list, value_remove_from_list): New functions. (preserve_values): Iterate over values_in_python list as well. * value.h (value_prepend_to_list, value_remove_from_list): Add function prototypes. gdb/doc/ * gdb.texinfo. (Values From Inferior): New subsubsection. gdb/testsuite/ * gdb.python/python-value.c: New file. * gdb.python/python-value.exp: New file.
This commit is contained in:
35
gdb/value.c
35
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user