summaryrefslogtreecommitdiff
path: root/gdb/value.h
diff options
context:
space:
mode:
authorsergiodj <sergiodj>2012-04-27 20:38:36 +0000
committersergiodj <sergiodj>2012-04-27 20:38:36 +0000
commitf3a9452f6c0dab2c189a86c6daf57aabba0859f4 (patch)
tree7d1c8b18c0482157c5f63afe6f7acf2345579385 /gdb/value.h
parent7a431e7fb0e1a9d24f42a88ea45a13e6f5692063 (diff)
downloadgdb-f3a9452f6c0dab2c189a86c6daf57aabba0859f4.tar.gz
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com>
Tom Tromey <tromey@redhat.com> * ax-gdb.c (gen_expr): Clean up code to handle internal variables and to compile agent expressions. * infrun.c (siginfo_make_value): New argument `ignore'. (siginfo_funcs): New struct. (_initialize_infrun): New argument when calling `create_internalvar_type_lazy'. * thread.c (thread_id_make_value): New argument `ignore'. (thread_funcs): New struct. (_initialize_thread): New argument when calling `create_internalvar_type_lazy'. * tracepoint.c (sdata_make_value): New argument `ignore'. (sdata_funcs): New struct. (_initialize_tracepoint): New argument when calling `create_internalvar_type_lazy'. * value.c (make_value): New struct. (create_internalvar_type_lazy): New argument `data'. (compile_internalvar_to_ax): New function. (value_of_internalvar): Properly handling `make_value' case. (clear_internalvar): Likewise. (show_convenience): Adding `TRY_CATCH' block. * value.h (internalvar_make_value): Delete, replace by... (struct internalvar_funcs): ... this. (create_internalvar_type_lazy) <fun>: Delete argument. (create_internalvar_type_lazy) <funcs>, <data>: New arguments. (compile_internalvar_to_ax): New function. * windows-tdep.c (tlb_make_value): New argument `ignore'. (tlb_funcs): New struct. (_initialize_windows_tdep): New argument when calling `create_internalvar_type_lazy'.
Diffstat (limited to 'gdb/value.h')
-rw-r--r--gdb/value.h48
1 files changed, 45 insertions, 3 deletions
diff --git a/gdb/value.h b/gdb/value.h
index 03aa5fd3e47..76c8e85d43b 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -764,10 +764,52 @@ extern struct internalvar *lookup_only_internalvar (const char *name);
extern struct internalvar *create_internalvar (const char *name);
-typedef struct value * (*internalvar_make_value) (struct gdbarch *,
- struct internalvar *);
+/* An internalvar can be dynamically computed by supplying a vector of
+ function pointers to perform various operations. */
+
+struct internalvar_funcs
+{
+ /* Compute the value of the variable. The DATA argument passed to
+ the function is the same argument that was passed to
+ `create_internalvar_type_lazy'. */
+
+ struct value *(*make_value) (struct gdbarch *arch,
+ struct internalvar *var,
+ void *data);
+
+ /* Update the agent expression EXPR with bytecode to compute the
+ value. VALUE is the agent value we are updating. The DATA
+ argument passed to this function is the same argument that was
+ passed to `create_internalvar_type_lazy'. If this pointer is
+ NULL, then the internalvar cannot be compiled to an agent
+ expression. */
+
+ void (*compile_to_ax) (struct internalvar *var,
+ struct agent_expr *expr,
+ struct axs_value *value,
+ void *data);
+
+ /* If non-NULL, this is called to destroy DATA. The DATA argument
+ passed to this function is the same argument that was passed to
+ `create_internalvar_type_lazy'. */
+
+ void (*destroy) (void *data);
+};
+
extern struct internalvar *
- create_internalvar_type_lazy (char *name, internalvar_make_value fun);
+create_internalvar_type_lazy (const char *name,
+ const struct internalvar_funcs *funcs,
+ void *data);
+
+/* Compile an internal variable to an agent expression. VAR is the
+ variable to compile; EXPR and VALUE are the agent expression we are
+ updating. This will return 0 if there is no known way to compile
+ VAR, and 1 if VAR was successfully compiled. It may also throw an
+ exception on error. */
+
+extern int compile_internalvar_to_ax (struct internalvar *var,
+ struct agent_expr *expr,
+ struct axs_value *value);
extern struct internalvar *lookup_internalvar (const char *name);