From a1b9830cba82d49cc509dd60f3dc2c030b987ee4 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 21 Mar 2002 19:48:54 +0000 Subject: [PATCH] 2002-03-21 Daniel Jacobowitz * dbxread.c (process_one_symbol): Extend the first N_SLINE in a function to cover the entire beginning of the function as well if it does not already. --- gdb/ChangeLog | 6 ++++++ gdb/dbxread.c | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0499e90..42934b2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2002-03-21 Daniel Jacobowitz + + * dbxread.c (process_one_symbol): Extend the first N_SLINE + in a function to cover the entire beginning of the function + as well if it does not already. + 2002-03-21 Tom Rix * rs6000-nat.c (rs6000_ptrace32): Renamed from ptrace32. diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 26be70c..16d0043 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2707,6 +2707,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, used to relocate these symbol types rather than SECTION_OFFSETS. */ static CORE_ADDR function_start_offset; + /* This holds the address of the start of a function, without the system + peculiarities of function_start_offset. */ + static CORE_ADDR last_function_start; + + /* If this is nonzero, we've seen an N_SLINE since the start of the current + function. Initialized to nonzero to assure that last_function_start + is never used uninitialized. */ + static int sline_found_in_function = 1; + /* If this is nonzero, we've seen a non-gcc N_OPT symbol for this source file. Used to detect the SunPRO solaris compiler. */ static int n_opt_found; @@ -2758,9 +2767,13 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, break; } + sline_found_in_function = 0; + /* Relocate for dynamic loading */ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); valu = SMASH_TEXT_ADDRESS (valu); + last_function_start = valu; + goto define_a_symbol; case N_LBRAC: @@ -2953,7 +2966,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, #ifdef SUN_FIXED_LBRAC_BUG last_pc_address = valu; /* Save for SunOS bug circumcision */ #endif - record_line (current_subfile, desc, valu); + /* If this is the first SLINE note in the function, record it at + the start of the function instead of at the listed location. */ + if (within_function && sline_found_in_function == 0) + { + record_line (current_subfile, desc, last_function_start); + sline_found_in_function = 1; + } + else + record_line (current_subfile, desc, valu); break; case N_BCOMM: -- 2.7.4