aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.h
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2003-02-21 15:24:18 +0000
committerDaniel Jacobowitz <drow@false.org>2003-02-21 15:24:18 +0000
commit4c2df51b5ace4f5c0a1f8a76cdf536ac4432dd14 (patch)
tree598c2097c2499be7ad8123ff91575ab6085f08f6 /gdb/symtab.h
parent4cf623b60bb41ce141aa47d27e6d119324cb5ed1 (diff)
downloadgdb-4c2df51b5ace4f5c0a1f8a76cdf536ac4432dd14.zip
gdb-4c2df51b5ace4f5c0a1f8a76cdf536ac4432dd14.tar.gz
gdb-4c2df51b5ace4f5c0a1f8a76cdf536ac4432dd14.tar.bz2
Based on a patch from Daniel Berlin (dberlin@dberlin.org).
* symtab.h: Add opaque declarations of struct axs_value and struct agent_expr. (enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG. (struct location_funcs): New type. (struct symbol): Add "loc" to aux_value. (SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros. * dwarf2read.c: Include "dwarf2expr.h". (dwarf2_symbol_mark_computed): New function. (read_func_scope): Use it. (var_decode_location): New function. (new_symbol): Use it. * dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files. * Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c. (dwarf2expr_h, dwarf2loc_h): New variables. (COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o. (dwarf2expr.o, dwarf2loc.o): New rules. (dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h). * buildsym.c (finish_block): Handle LOC_COMPUTED and LOC_COMPUTED_ARG. * findvar.c (symbol_read_needs_frame, read_var_value): Likewise. * m2-exp.y (yylex): Likewise. * printcmd.c (address_info, print_frame_args): Likewise. * stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise. * symmisc.c (print_symbol, print_partial_symbols): Likewise. * ada-lang.c (ada_resolve_subexp, symtab_for_sym) (ada_add_block_symbols, fill_in_ada_prototype): Likewise. * symtab.c (lookup_block_symbol): Likewise.
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r--gdb/symtab.h72
1 files changed, 71 insertions, 1 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 3bde09f..0d1b41c 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -30,6 +30,8 @@ struct obstack;
struct objfile;
struct block;
struct blockvector;
+struct axs_value;
+struct agent_expr;
/* Don't do this; it means that if some .o's are compiled with GNU C
and some are not (easy to do accidentally the way we configure
@@ -474,7 +476,58 @@ enum address_class
* with a level of indirection.
*/
- LOC_INDIRECT
+ LOC_INDIRECT,
+
+ /* The variable's address is computed by a set of location
+ functions (see "struct location_funcs" below). */
+ LOC_COMPUTED,
+
+ /* Same as LOC_COMPUTED, but for function arguments. */
+ LOC_COMPUTED_ARG
+};
+
+/* A structure of function pointers describing the location of a
+ variable, structure member, or structure base class.
+
+ These functions' BATON arguments are generic data pointers, holding
+ whatever data the functions need --- the code which provides this
+ structure also provides the actual contents of the baton, and
+ decides its form. However, there may be other rules about where
+ the baton data must be allocated; whoever is pointing to this
+ `struct location_funcs' object will know the rules. For example,
+ when a symbol S's location is LOC_COMPUTED, then
+ SYMBOL_LOCATION_FUNCS(S) is pointing to a location_funcs structure,
+ and SYMBOL_LOCATION_BATON(S) is the baton, which must be allocated
+ on the same obstack as the symbol itself. */
+
+struct location_funcs
+{
+
+ /* Return the value of the variable SYMBOL, relative to the stack
+ frame FRAME. If the variable has been optimized out, return
+ zero.
+
+ Iff `read_needs_frame (SYMBOL)' is zero, then FRAME may be zero. */
+
+ struct value *(*read_variable) (struct symbol * symbol,
+ struct frame_info * frame);
+
+ /* Return non-zero if we need a frame to find the value of the SYMBOL. */
+ int (*read_needs_frame) (struct symbol * symbol);
+
+ /* Write to STREAM a natural-language description of the location of
+ SYMBOL. */
+ int (*describe_location) (struct symbol * symbol, struct ui_file * stream);
+
+ /* Tracepoint support. Append bytecodes to the tracepoint agent
+ expression AX that push the address of the object SYMBOL. Set
+ VALUE appropriately. Note --- for objects in registers, this
+ needn't emit any code; as long as it sets VALUE properly, then
+ the caller will generate the right code in the process of
+ treating this as an lvalue or rvalue. */
+
+ void (*tracepoint_var_ref) (struct symbol * symbol, struct agent_expr * ax,
+ struct axs_value * value);
};
/* Linked list of symbol's live ranges. */
@@ -536,6 +589,21 @@ struct symbol
variable declared with the `__thread' storage class), we may
need to know which object file it's in. */
struct objfile *objfile;
+
+ /* For a LOC_COMPUTED or LOC_COMPUTED_ARG symbol, this is the
+ baton and location_funcs structure to find its location. For a
+ LOC_BLOCK symbol for a function in a compilation unit compiled
+ with DWARF 2 information, this is information used internally
+ by the DWARF 2 code --- specifically, the location expression
+ for the frame base for this function. */
+ /* FIXME drow/2003-02-21: For the LOC_BLOCK case, it might be better
+ to add a magic symbol to the block containing this information,
+ or to have a generic debug info annotation slot for symbols. */
+ struct
+ {
+ void *baton;
+ struct location_funcs *funcs;
+ } loc;
}
aux_value;
@@ -560,6 +628,8 @@ struct symbol
#define SYMBOL_OBJFILE(symbol) (symbol)->aux_value.objfile
#define SYMBOL_ALIASES(symbol) (symbol)->aliases
#define SYMBOL_RANGES(symbol) (symbol)->ranges
+#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value.loc.baton
+#define SYMBOL_LOCATION_FUNCS(symbol) (symbol)->aux_value.loc.funcs
/* A partial_symbol records the name, namespace, and address class of
symbols whose types we have not parsed yet. For functions, it also