diff options
author | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-03-21 03:03:56 +0000 |
---|---|---|
committer | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-03-21 03:03:56 +0000 |
commit | bc3b79fd1ac12e5432ef017d81064427d04a2d71 (patch) | |
tree | 2ebe34d96ed81c86dd3fef2a0944a4712dbc8357 /gdb/value.h | |
parent | c6dd29cec2aa072966e6ebccc56db0c5dbf636ee (diff) | |
download | fsf-binutils-gdb-bc3b79fd1ac12e5432ef017d81064427d04a2d71.zip fsf-binutils-gdb-bc3b79fd1ac12e5432ef017d81064427d04a2d71.tar.gz fsf-binutils-gdb-bc3b79fd1ac12e5432ef017d81064427d04a2d71.tar.bz2 |
gdb/
2009-03-05 Tom Tromey <tromey@redhat.com>
Add support for convenience functions in Python.
* Makefile.in (SUBDIR_PYTHON_OBS): Add python-function.o.
(SUBDIR_PYTHON_SRCS): Add python-function.c.
(python-function.o): New target.
* eval.c: Include "python/python.h" and <ctype.h>.
(evaluate_subexp_standard): Handle values of type
TYPE_CODE_INTERNAL_FUNCTION.
* gdbtypes.h (type_code): Add TYPE_CODE_INTERNAL_FUNCTION.
* parse.c (write_exp_string): Remove duplicate word in comment.
* python/python-function.c: New file.
* python/python-internal.h (gdbpy_initialize_functions): Add
prototype.
* python/python.c (_initialize_python): Call
gdbpy_initialize_functions.
* valprint.c (value_check_printable): Handle values of type
TYPE_CODE_INTERNAL_FUNCTION.
* value.c: Include "cli/cli-decode.h".
(internal_function): New struct.
(functionlist, internal_fn_type): New static variables.
(lookup_only_internalvar,
lookup_internalvar): Add const qualifier to name argument.
(create_internalvar): Likewise. Initialize new field.
(set_internal_var): Fix typo in comment. Don't allow assignment
to canonical variable.
(value_create_internal_function, value_internal_function_name,
call_internal_function, function_command, function_destroyer,
add_internal_function): New functions.
(_initialize_values): Create `function' placeholder command.
Initialize internal_fn_type.
* value.h (lookup_only_internalvar, create_internalvar,
lookup_internalvar): Add const qualifier to name argument.
(internal_function_fn, add_internal_function, call_internal_function,
value_internal_function_name): Add prototypes.
(struct internalvar) <canonical>: New field.
gdb/doc/
2008-03-05 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Convenience Vars): Document convenience functions.
(Functions In Python): New node.
(Python API): Update.
gdb/testsuite/
2009-03-05 Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.python/python-function.exp: New file.
Diffstat (limited to 'gdb/value.h')
-rw-r--r-- | gdb/value.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gdb/value.h b/gdb/value.h index 3dddeef..69a59a2 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -314,6 +314,9 @@ struct internalvar struct value *value; internalvar_make_value make_value; int endian; + /* True if this internalvar is the canonical name for a convenience + function. */ + int canonical; }; @@ -535,14 +538,14 @@ extern void set_internalvar_component (struct internalvar *var, int bitpos, int bitsize, struct value *newvalue); -extern struct internalvar *lookup_only_internalvar (char *name); +extern struct internalvar *lookup_only_internalvar (const char *name); -extern struct internalvar *create_internalvar (char *name); +extern struct internalvar *create_internalvar (const char *name); extern struct internalvar * create_internalvar_type_lazy (char *name, internalvar_make_value fun); -extern struct internalvar *lookup_internalvar (char *name); +extern struct internalvar *lookup_internalvar (const char *name); extern int value_equal (struct value *arg1, struct value *arg2); @@ -661,4 +664,20 @@ extern struct value *value_allocate_space_in_inferior (int); extern struct value *value_of_local (const char *name, int complain); extern struct value * value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound); + +/* User function handler. */ + +typedef struct value *(*internal_function_fn) (void *cookie, + int argc, + struct value **argv); + +void add_internal_function (const char *name, const char *doc, + internal_function_fn handler, + void *cookie); + +struct value *call_internal_function (struct value *function, + int argc, struct value **argv); + +char *value_internal_function_name (struct value *); + #endif /* !defined (VALUE_H) */ |