aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.h
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2012-04-27 20:38:39 +0000
committerSergio Durigan Junior <sergiodj@redhat.com>2012-04-27 20:38:39 +0000
commit22d2b532b8f2de5bd20d70b89a06894a5b9f97b1 (patch)
treec6d2a778e345fb8f5565d7c95bc68aba19fe7bc8 /gdb/value.h
parentc49ead2f3873ca2ac8af4fd961ad64d88e66b5f6 (diff)
downloadgdb-22d2b532b8f2de5bd20d70b89a06894a5b9f97b1.zip
gdb-22d2b532b8f2de5bd20d70b89a06894a5b9f97b1.tar.gz
gdb-22d2b532b8f2de5bd20d70b89a06894a5b9f97b1.tar.bz2
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 03aa5fd..76c8e85 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);