diff options
author | Doug Evans <dje@google.com> | 2014-08-28 16:09:50 -0700 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2014-08-28 16:09:50 -0700 |
commit | aab2f20890b9252f88a157611df14e79902e02b6 (patch) | |
tree | acc013270e1b85fd4b8f790152b4d51e86a94d92 | |
parent | fb0576e98388c6f4585b94684cea8d18c97a91aa (diff) | |
download | gdb-aab2f20890b9252f88a157611df14e79902e02b6.zip gdb-aab2f20890b9252f88a157611df14e79902e02b6.tar.gz gdb-aab2f20890b9252f88a157611df14e79902e02b6.tar.bz2 |
symtab.c (find_function_start_sal): Move definition to better spot.
gdb/ChangeLog:
* symtab.c (find_function_start_sal): Move definition to better spot.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/symtab.c | 64 |
2 files changed, 36 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b6d8469..bc3d401 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/symtab.c b/gdb/symtab.c index ab56892..c505f97 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 |