/* Return the demangled name for a symbol based on the language for
that symbol. If no demangled name exists, return NULL. */
char *
-symbol_demangled_name (struct general_symbol_info *gsymbol)
+symbol_demangled_name (const struct general_symbol_info *gsymbol)
{
switch (gsymbol->language)
{
int idx = s->the_bfd_section->index;
CORE_ADDR offset = ANOFFSET (objfile->section_offsets, idx);
- if (s->addr - offset <= addr && addr < s->endaddr - offset)
+ if (obj_section_addr (s) - offset <= addr
+ && addr < obj_section_endaddr (s) - offset)
{
ginfo->bfd_section = s->the_bfd_section;
ginfo->section = idx;
{
case LOC_STATIC:
case LOC_LABEL:
- case LOC_INDIRECT:
addr = SYMBOL_VALUE_ADDRESS (sym);
break;
case LOC_BLOCK:
{
case LOC_STATIC:
case LOC_LABEL:
- case LOC_INDIRECT:
case LOC_BLOCK:
addr = SYMBOL_VALUE_ADDRESS (psym);
break;
/* Find the definition for a specified symbol name NAME
in domain DOMAIN, visible from lexical block BLOCK.
Returns the struct symbol pointer, or zero if no symbol is found.
- If SYMTAB is non-NULL, store the symbol table in which the
- symbol was found there, or NULL if not found.
C++: if IS_A_FIELD_OF_THIS is nonzero on entry, check to see if
NAME is a field of the current implied argument `this'. If so set
*IS_A_FIELD_OF_THIS to 1, otherwise set it to zero.
return NULL;
}
-/* Look up a symbol in a block; if found, locate its symtab, fixup the
- symbol, and set block_found appropriately. */
+/* Look up a symbol in a block; if found, fixup the symbol, and set
+ block_found appropriately. */
struct symbol *
lookup_symbol_aux_block (const char *name, const char *linkage_name,
? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1))
{
sym_found = sym;
- if (SYMBOL_CLASS (sym) != LOC_ARG &&
- SYMBOL_CLASS (sym) != LOC_LOCAL_ARG &&
- SYMBOL_CLASS (sym) != LOC_REF_ARG &&
- SYMBOL_CLASS (sym) != LOC_REGPARM &&
- SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR &&
- SYMBOL_CLASS (sym) != LOC_BASEREG_ARG &&
- SYMBOL_CLASS (sym) != LOC_COMPUTED_ARG)
+ if (!SYMBOL_IS_ARGUMENT (sym))
{
break;
}
/* Recalculate the line number (might not be N+1). */
sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
}
+
+ /* On targets with executable formats that don't have a concept of
+ constructors (ELF with .init has, PE doesn't), gcc emits a call
+ to `__main' in `main' between the prologue and before user
+ code. */
+ if (funfirstline
+ && gdbarch_skip_main_prologue_p (current_gdbarch)
+ && SYMBOL_LINKAGE_NAME (sym)
+ && strcmp (SYMBOL_LINKAGE_NAME (sym), "main") == 0)
+ {
+ pc = gdbarch_skip_main_prologue (current_gdbarch, pc);
+ /* Recalculate the line number (might not be N+1). */
+ sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
+ }
+
sal.pc = pc;
return sal;
/* Handle ``executable_changed'' events for the symtab module. */
static void
-symtab_observer_executable_changed (void *unused)
+symtab_observer_executable_changed (void)
{
/* NAME_OF_MAIN may no longer be the same, so reset it for now. */
set_main_name (NULL);
blocks -- for each PC found above we see if there are other PCs
that are in the same block. If yes, the other PCs are filtered out. */
- filter = xmalloc (ret.nelts * sizeof (int));
- blocks = xmalloc (ret.nelts * sizeof (struct block *));
+ filter = alloca (ret.nelts * sizeof (int));
+ blocks = alloca (ret.nelts * sizeof (struct block *));
for (i = 0; i < ret.nelts; ++i)
{
filter[i] = 1;