From 0520bb6990070633be3689e1c1e91f088d807073 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 4 Apr 2002 22:33:49 +0000 Subject: [PATCH] 2002-04-04 Daniel Jacobowitz Merge from trunk: 2002-03-17 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 | 10 ++++++++++ gdb/dbxread.c | 23 ++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a5bbd2d7cfd..dabad3f2cbf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-04-04 Daniel Jacobowitz + + Merge from trunk: + + 2002-03-17 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-04-04 Michal Ludvig * x86-64-linux-nat.c (child_xfer_memory): x86-64 ptrace() ABI diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 26be70c18bb..16d00434e28 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.47.3