char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
char *newname = type_name_no_tag (type);
int is_constructor = STREQ (field_name, newname);
- int is_destructor = is_constructor && physname[0] == '_'
- && physname[1] == CPLUS_MARKER && physname[2] == '_';
+ int is_destructor = is_constructor && DESTRUCTOR_PREFIX_P (physname);
/* Need a new type prefix. */
char *const_prefix = method->is_const ? "C" : "";
char *volatile_prefix = method->is_volatile ? "V" : "";
register struct block *b;
struct blockvector *bv;
register struct symtab *s = NULL;
+ register struct symtab *best_s = NULL;
register struct partial_symtab *ps;
register struct objfile *objfile;
+ int distance = 0;;
+
/* Search all symtabs for one whose file contains our pc */
bv = BLOCKVECTOR (s);
b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
if (BLOCK_START (b) <= pc
- && BLOCK_END (b) > pc)
- return (s);
+ && BLOCK_END (b) > pc
+ && (distance == 0
+ || BLOCK_END (b) - BLOCK_START (b) < distance))
+ {
+ distance = BLOCK_END (b) - BLOCK_START (b);
+ best_s = s;
+ }
}
+ if (best_s != NULL)
+ return(best_s);
+
s = NULL;
ps = find_pc_psymtab (pc);
if (ps)
if (TYPE_FN_FIELD_STUB (f, field_counter))
check_stub_method (t, method_counter, field_counter);
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
+ /* Destructor is handled by caller, dont add it to the list */
+ if (DESTRUCTOR_PREFIX_P (phys_name))
+ continue;
sym_arr[i1] = lookup_symbol (phys_name,
SYMBOL_BLOCK_VALUE (sym_class),
VAR_NAMESPACE,
/* destructors are a special case. */
struct fn_field *f = TYPE_FN_FIELDLIST1 (t, 0);
int len = TYPE_FN_FIELDLIST_LENGTH (t, 0) - 1;
+ /* gcc 1.x puts destructor in last field,
+ gcc 2.x puts destructor in first field. */
char *phys_name = TYPE_FN_FIELD_PHYSNAME (f, len);
+ if (!DESTRUCTOR_PREFIX_P (phys_name))
+ {
+ phys_name = TYPE_FN_FIELD_PHYSNAME (f, 0);
+ if (!DESTRUCTOR_PREFIX_P (phys_name))
+ phys_name = "";
+ }
sym_arr[i1] =
lookup_symbol (phys_name, SYMBOL_BLOCK_VALUE (sym_class),
VAR_NAMESPACE, 0, (struct symtab **)NULL);
{
/* Set a breakpoint here, if it's a function */
if (class == 1)
- break_command (SYMBOL_NAME(sym), 0);
+ {
+ /* There may be more than one function with the
+ same name but in different files. In order to
+ set breakpoints on all of them, we must give
+ both the file name and the function name to
+ break_command. */
+ char *string =
+ (char *) alloca (strlen (s->filename)
+ + strlen (SYMBOL_NAME(sym))
+ + 2);
+ strcpy (string, s->filename);
+ strcat (string, ":");
+ strcat (string, SYMBOL_NAME(sym));
+ break_command (string, 0);
+ }
}
else if (!found_in_file)
{
/* end-sanitize-chill */
} lang_u;
} lang_specific;
+
+ /* Which section is this symbol in? This is an index into
+ section_offsets for this objfile. Negative means that the symbol
+ does not get relocated relative to a section. */
+ /* Disclaimer: currently this is just used for xcoff, so don't expect
+ all symbol-reading code to set it correctly. */
+ int section;
};
#define SYMBOL_NAME(symbol) (symbol)->ginfo.name
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->ginfo.value.block
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->ginfo.value.chain
#define SYMBOL_LANGUAGE(symbol) (symbol)->ginfo.lang_specific.language
+#define SYMBOL_SECTION(symbol) (symbol)->ginfo.section
#define SYMBOL_CPLUS_DEMANGLED_NAME(symbol) \
(symbol)->ginfo.lang_specific.lang_u.cplus_specific.demangled_name
LOC_BLOCK,
- /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_ADDRESS, in
+ /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in
target byte order. */
LOC_CONST_BYTES,
(FRAME_ARGS_ADDRESS). Added for i960, which passes args in regs then
copies to frame. */
- LOC_LOCAL_ARG
+ LOC_LOCAL_ARG,
+
+ /* The variable does not actually exist in the program.
+ The SYMBOL_VALUE is ignored. */
+ LOC_OPTIMIZED_OUT
};
struct symbol
struct linetable *linetable;
+ /* Section in objfile->section_offsets for the blockvector and
+ the linetable. */
+
+ int block_line_section;
+
+ /* If several symtabs share a blockvector, exactly one of them
+ should be designed the primary, so that the blockvector
+ is relocated exactly once by objfile_relocate. */
+
+ int primary;
+
/* Name of this source file. */
char *filename;
#define OPNAME_PREFIX_P(NAME) \
((NAME)[0] == 'o' && (NAME)[1] == 'p' && (NAME)[2] == CPLUS_MARKER)
+/* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
+ names. */
+
#define VTBL_PREFIX_P(NAME) \
((NAME)[3] == CPLUS_MARKER && !strncmp ((NAME), "_vt", 3))
+/* Macro that yields non-zero value iff NAME is the prefix for C++ destructor
+ names. */
+
+#define DESTRUCTOR_PREFIX_P(NAME) \
+ ((NAME)[0] == '_' && (NAME)[1] == CPLUS_MARKER && (NAME)[2] == '_')
+
\f
/* External variables and functions for the objects described above. */
extern void
prim_record_minimal_symbol_and_info PARAMS ((const char *, CORE_ADDR,
enum minimal_symbol_type,
- char *info));
+ char *info, int section));
extern struct minimal_symbol *
lookup_minimal_symbol PARAMS ((const char *, struct objfile *));