This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Don't apply line-number tweaks for non-GCC compilers
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: jimb at redhat dot com
- Cc: ezannoni at redhat dot com, gdb-patches at sources dot redhat dot com
- Date: Thu, 18 Nov 2004 23:37:58 +0100 (CET)
- Subject: Re: [RFA] Don't apply line-number tweaks for non-GCC compilers
- References: <vt2lleenrto.fsf@zenia.home> <16752 dot 3082 dot 255249 dot 837515at localhost dot redhat dot com> <vt21xfxm82l dot fsf at zenia dothome> <200410192215.i9JMF2NS014623@elgar.sibelius.xs4all.nl><200411091315.iA9DFrdB090647@elgar.sibelius.xs4all.nl> <vt2d5ym7qao.fsf@zenia.home>
From: Jim Blandy <jimb@redhat.com>
Date: 09 Nov 2004 14:53:03 -0500
For what it's worth, this change implements the suggestion I made.
I went ahead and checked this in.
Mark
> Index: ChangeLog
> from Mark Kettenis <kettenis@gnu.org>
>
> * dbxread.c (process_one_symbol): Do not adjust address of first
> N_SLINE stab for a function for code generated by non-GCC
> compilers.
>
>
> Index: dbxread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dbxread.c,v
> retrieving revision 1.74
> diff -u -p -r1.74 dbxread.c
> --- dbxread.c 11 Sep 2004 10:24:46 -0000 1.74
> +++ dbxread.c 19 Oct 2004 20:45:53 -0000
> @@ -2927,11 +2927,26 @@ process_one_symbol (int type, int desc,
> /* Relocate for dynamic loading and for ELF acc fn-relative syms. */
> valu += function_start_offset;
>
> - /* If this is the first SLINE note in the function, record it at
> - the start of the function instead of at the listed location. */
> + /* GCC 2.95.3 emits the first N_SLINE stab somwehere in the
> + middle of the prologue instead of right at the start of the
> + function. To deal with this we record the address for the
> + first N_SLINE stab to be the start of the function instead of
> + the listed location. We really shouldn't to this. When
> + compiling with optimization, this first N_SLINE stab might be
> + optimized away. Other (non-GCC) compilers don't emit this
> + stab at all. There is no real harm in having an extra
> + numbered line, although it can be a bit annoying for the
> + user. However, it totally screws up our testsuite.
> +
> + So for now, keep adjusting the address of the first N_SLINE
> + stab, but only for code compiled with GCC. */
> +
> if (within_function && sline_found_in_function == 0)
> {
> - record_line (current_subfile, desc, last_function_start);
> + if (processing_gcc_compilation == 2)
> + record_line (current_subfile, desc, last_function_start);
> + else
> + record_line (current_subfile, desc, valu);
> sline_found_in_function = 1;
> }
> else