/* Symbol table definitions for GDB.
Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008
+ 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GDB.
struct general_symbol_info ginfo;
- /* The info field is available for caching machine-specific
- information so it doesn't have to rederive the info constantly
- (over a serial line). It is initialized to zero and stays that
- way until target-dependent code sets it. Storage for any data
- pointed to by this field should be allocated on the
- objfile_obstack for the associated objfile. The type would be
- "void *" except for reasons of compatibility with older
- compilers. This field is optional.
-
- Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
- from the instructions in the function header, and the MIPS-16 code uses
- it to identify 16-bit procedures. */
-
- char *info;
-
/* Size of this symbol. end_psymtab in dbxread.c uses this
information to calculate the end of the partial symtab based on the
address of the last symbol plus the size of the last symbol. */
ENUM_BITFIELD(minimal_symbol_type) type : 8;
+ /* Two flag bits provided for the use of the target. */
+ unsigned int target_flag_1 : 1;
+ unsigned int target_flag_2 : 1;
+
/* Minimal symbols with the same hash key are kept on a linked
list. This is the link. */
struct minimal_symbol *demangled_hash_next;
};
-#define MSYMBOL_INFO(msymbol) (msymbol)->info
+#define MSYMBOL_TARGET_FLAG_1(msymbol) (msymbol)->target_flag_1
+#define MSYMBOL_TARGET_FLAG_2(msymbol) (msymbol)->target_flag_2
#define MSYMBOL_SIZE(msymbol) (msymbol)->size
#define MSYMBOL_TYPE(msymbol) (msymbol)->type
/* Searching domains. These overlap with VAR_DOMAIN, providing
some granularity with the search_symbols function. */
- /* Everything in VAR_DOMAIN minus FUNCTIONS_-, TYPES_-, and
- METHODS_DOMAIN */
+ /* Everything in VAR_DOMAIN minus FUNCTIONS_DOMAIN and
+ TYPES_DOMAIN. */
VARIABLES_DOMAIN,
/* All functions -- for some reason not methods, though. */
FUNCTIONS_DOMAIN,
/* All defined types */
- TYPES_DOMAIN,
-
- /* All class methods -- why is this separated out? */
- METHODS_DOMAIN
+ TYPES_DOMAIN
}
domain_enum;
LOC_STATIC,
- /* Value is in register. SYMBOL_VALUE is the register number.
+ /* Value is in register. SYMBOL_VALUE is the register number
+ in the original debug format. SYMBOL_REGISTER_OPS holds a
+ function that can be called to transform this into the
+ actual register number this represents in a specific target
+ architecture (gdbarch).
For some symbol formats (stabs, for some compilers at least),
the compiler generates two symbols, an argument and a register.
in another object file or runtime common storage.
The linker might even remove the minimal symbol if the global
symbol is never referenced, in which case the symbol remains
- unresolved. */
+ unresolved.
+
+ GDB would normally find the symbol in the minimal symbol table if it will
+ not find it in the full symbol table. But a reference to an external
+ symbol in a local block shadowing other definition requires full symbol
+ without possibly having its address available for LOC_STATIC. Testcase
+ is provided as `gdb.dwarf2/dw2-unresolved.exp'. */
LOC_UNRESOLVED,
LOC_OPTIMIZED_OUT,
/* The variable's address is computed by a set of location
- functions (see "struct symbol_ops" below). */
+ functions (see "struct symbol_computed_ops" below). */
LOC_COMPUTED,
};
-/* The methods needed to implement a symbol class. These methods can
+/* The methods needed to implement LOC_COMPUTED. These methods can
use the symbol's .aux_value for additional per-symbol information.
At present this is only used to implement location expressions. */
-struct symbol_ops
+struct symbol_computed_ops
{
/* Return the value of the variable SYMBOL, relative to the stack
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);
+ void (*tracepoint_var_ref) (struct symbol *symbol, struct gdbarch *gdbarch,
+ struct agent_expr *ax, struct axs_value *value);
+};
+
+/* Functions used with LOC_REGISTER and LOC_REGPARM_ADDR. */
+
+struct symbol_register_ops
+{
+ int (*register_number) (struct symbol *symbol, struct gdbarch *gdbarch);
};
/* This structure is space critical. See space comments at the top. */
unsigned is_argument : 1;
- /* Line number of definition. FIXME: Should we really make the assumption
- that nobody will try to debug files longer than 64K lines? What about
- machine generated programs? */
+ /* Whether this is an inlined function (class LOC_BLOCK only). */
+ unsigned is_inlined : 1;
+
+ /* Line number of this symbol's definition, except for inlined
+ functions. For an inlined function (class LOC_BLOCK and
+ SYMBOL_INLINED set) this is the line number of the function's call
+ site. Inlined function symbols are not definitions, and they are
+ never found by symbol table lookup.
+
+ FIXME: Should we really make the assumption that nobody will try
+ to debug files longer than 64K lines? What about machine
+ generated programs? */
unsigned short line;
/* Method's for symbol's of this class. */
/* NOTE: cagney/2003-11-02: See comment above attached to "aclass". */
- const struct symbol_ops *ops;
+ union
+ {
+ /* Used with LOC_COMPUTED. */
+ const struct symbol_computed_ops *ops_computed;
+
+ /* Used with LOC_REGISTER and LOC_REGPARM_ADDR. */
+ const struct symbol_register_ops *ops_register;
+ } ops;
/* An arbitrary data pointer, allowing symbol readers to record
additional information on a per-symbol basis. Note that this data
#define SYMBOL_DOMAIN(symbol) (symbol)->domain
#define SYMBOL_CLASS(symbol) (symbol)->aclass
#define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument
+#define SYMBOL_INLINED(symbol) (symbol)->is_inlined
#define SYMBOL_TYPE(symbol) (symbol)->type
#define SYMBOL_LINE(symbol) (symbol)->line
#define SYMBOL_SYMTAB(symbol) (symbol)->symtab
-#define SYMBOL_OPS(symbol) (symbol)->ops
+#define SYMBOL_COMPUTED_OPS(symbol) (symbol)->ops.ops_computed
+#define SYMBOL_REGISTER_OPS(symbol) (symbol)->ops.ops_register
#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
\f
/* A partial_symbol records the name, domain, and address class of
extern struct minimal_symbol *prim_record_minimal_symbol_and_info
(const char *, CORE_ADDR,
enum minimal_symbol_type,
- char *info, int section, asection * bfd_section, struct objfile *);
+ int section, asection * bfd_section, struct objfile *);
extern unsigned int msymbol_hash_iw (const char *);
extern char **default_make_symbol_completion_list (char *, char *);
extern char **make_symbol_completion_list (char *, char *);
+extern char **make_symbol_completion_list_fn (struct cmd_list_element *,
+ char *, char *);
extern char **make_file_symbol_completion_list (char *, char *, char *);
/* symtab.c */
-extern int in_prologue (CORE_ADDR pc, CORE_ADDR func_start);
+extern int in_prologue (struct gdbarch *gdbarch,
+ CORE_ADDR pc, CORE_ADDR func_start);
-extern CORE_ADDR skip_prologue_using_sal (CORE_ADDR func_addr);
+extern CORE_ADDR skip_prologue_using_sal (struct gdbarch *gdbarch,
+ CORE_ADDR func_addr);
extern struct symbol *fixup_symbol_section (struct symbol *,
struct objfile *);