symtab.c (find_function_start_sal): Move definition to better spot.

gdb/ChangeLog:

	* symtab.c (find_function_start_sal): Move definition to better spot.
This commit is contained in:
Doug Evans 2014-08-28 16:09:50 -07:00
parent fb0576e983
commit aab2f20890
2 changed files with 36 additions and 32 deletions

View File

@ -1,3 +1,7 @@
2014-08-28 Doug Evans <dje@google.com>
* symtab.c (find_function_start_sal): Move definition to better spot.
2014-08-28 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_in_function_epilogue_p): Don't set

View File

@ -2787,6 +2787,38 @@ find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
return sal.symtab != 0;
}
/* Given a function symbol SYM, find the symtab and line for the start
of the function.
If the argument FUNFIRSTLINE is nonzero, we want the first line
of real code inside the function. */
struct symtab_and_line
find_function_start_sal (struct symbol *sym, int funfirstline)
{
struct symtab_and_line sal;
fixup_symbol_section (sym, NULL);
sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym), 0);
/* We always should have a line for the function start address.
If we don't, something is odd. Create a plain SAL refering
just the PC and hope that skip_prologue_sal (if requested)
can find a line number for after the prologue. */
if (sal.pc < BLOCK_START (SYMBOL_BLOCK_VALUE (sym)))
{
init_sal (&sal);
sal.pspace = current_program_space;
sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
sal.section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
}
if (funfirstline)
skip_prologue_sal (&sal);
return sal;
}
/* Given a function start address FUNC_ADDR and SYMTAB, find the first
address for that function that has an entry in SYMTAB's line info
table. If such an entry cannot be found, return FUNC_ADDR
@ -2827,38 +2859,6 @@ skip_prologue_using_lineinfo (CORE_ADDR func_addr, struct symtab *symtab)
return func_addr;
}
/* Given a function symbol SYM, find the symtab and line for the start
of the function.
If the argument FUNFIRSTLINE is nonzero, we want the first line
of real code inside the function. */
struct symtab_and_line
find_function_start_sal (struct symbol *sym, int funfirstline)
{
struct symtab_and_line sal;
fixup_symbol_section (sym, NULL);
sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym), 0);
/* We always should have a line for the function start address.
If we don't, something is odd. Create a plain SAL refering
just the PC and hope that skip_prologue_sal (if requested)
can find a line number for after the prologue. */
if (sal.pc < BLOCK_START (SYMBOL_BLOCK_VALUE (sym)))
{
init_sal (&sal);
sal.pspace = current_program_space;
sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
sal.section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
}
if (funfirstline)
skip_prologue_sal (&sal);
return sal;
}
/* Adjust SAL to the first instruction past the function prologue.
If the PC was explicitly specified, the SAL is not changed.
If the line number was explicitly specified, at most the SAL's PC