From: Doug Evans Date: Thu, 28 Aug 2014 23:09:50 +0000 (-0700) Subject: symtab.c (find_function_start_sal): Move definition to better spot. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aab2f20890b9252f88a157611df14e79902e02b6;p=binutils-gdb.git symtab.c (find_function_start_sal): Move definition to better spot. gdb/ChangeLog: * symtab.c (find_function_start_sal): Move definition to better spot. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b6d846965ad..bc3d4012204 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2014-08-28 Doug Evans + + * symtab.c (find_function_start_sal): Move definition to better spot. + 2014-08-28 Yao Qi * arm-tdep.c (thumb_in_function_epilogue_p): Don't set diff --git a/gdb/symtab.c b/gdb/symtab.c index ab568923413..c505f977a77 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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