* [PATCH RFA] dbxread.c: Complain when local symbols are discarded
@ 2002-05-08 17:06 Kevin Buettner
2002-05-09 11:06 ` Jim Blandy
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2002-05-08 17:06 UTC (permalink / raw)
To: gdb-patches
I've found that some older versions of gcc incorrectly output N_LSYM
entries after the corresponding (enclosing) N_LBRAC entry. The real
fix for this problem is to patch gcc with the following patch from
Richard Henderson:
http://gcc.gnu.org/ml/gcc/2000-12/msg00870.html
However, it seems to me that GDB should not be silently discarding
local symbols, hence the reason for the new complaint.
Okay to commit?
* dbxread.c (discarding_local_symbols_complaint): New complaint.
(process_one_symbol): Complain about discarding local symbols
due to a misplaced N_LBRAC entry.
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.32
diff -u -p -r1.32 dbxread.c
--- dbxread.c 24 Apr 2002 08:00:54 -0000 1.32
+++ dbxread.c 8 May 2002 23:54:30 -0000
@@ -203,6 +203,9 @@ struct complaint repeated_header_complai
struct complaint unclaimed_bincl_complaint =
{"N_BINCL %s not in entries for any file, at symtab pos %d", 0, 0};
+
+struct complaint discarding_local_symbols_complaint =
+{"misplaced N_LBRAC entry; discarding local symbols which have no enclosing block", 0, 0};
\f
/* find_text_range --- find start and end of loadable code sections
@@ -2881,7 +2884,21 @@ process_one_symbol (int type, int desc,
/* Can only use new->locals as local symbols here if we're in
gcc or on a machine that puts them before the lbrack. */
if (!VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
- local_symbols = new->locals;
+ {
+ if (local_symbols != NULL)
+ {
+ /* GCC development snapshots from March to December of
+ 2000 would output N_LSYM entries after N_LBRAC
+ entries. As a consequence, these symbols are simply
+ discarded. Complain if this is the case. Note that
+ there are some compilers which legitimately put local
+ symbols within an LBRAC/RBRAC block; this complaint
+ might also help sort out problems in which
+ VARIABLES_INSIDE_BLOCK is incorrectly defined. */
+ complain (&discarding_local_symbols_complaint);
+ }
+ local_symbols = new->locals;
+ }
if (context_stack_depth
> !VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFA] dbxread.c: Complain when local symbols are discarded
2002-05-08 17:06 [PATCH RFA] dbxread.c: Complain when local symbols are discarded Kevin Buettner
@ 2002-05-09 11:06 ` Jim Blandy
[not found] ` <jimb@redhat.com>
0 siblings, 1 reply; 3+ messages in thread
From: Jim Blandy @ 2002-05-09 11:06 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
Looks good to me.
Kevin Buettner <kevinb@redhat.com> writes:
> I've found that some older versions of gcc incorrectly output N_LSYM
> entries after the corresponding (enclosing) N_LBRAC entry. The real
> fix for this problem is to patch gcc with the following patch from
> Richard Henderson:
>
> http://gcc.gnu.org/ml/gcc/2000-12/msg00870.html
>
> However, it seems to me that GDB should not be silently discarding
> local symbols, hence the reason for the new complaint.
>
> Okay to commit?
>
> * dbxread.c (discarding_local_symbols_complaint): New complaint.
> (process_one_symbol): Complain about discarding local symbols
> due to a misplaced N_LBRAC entry.
>
> Index: dbxread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dbxread.c,v
> retrieving revision 1.32
> diff -u -p -r1.32 dbxread.c
> --- dbxread.c 24 Apr 2002 08:00:54 -0000 1.32
> +++ dbxread.c 8 May 2002 23:54:30 -0000
> @@ -203,6 +203,9 @@ struct complaint repeated_header_complai
>
> struct complaint unclaimed_bincl_complaint =
> {"N_BINCL %s not in entries for any file, at symtab pos %d", 0, 0};
> +
> +struct complaint discarding_local_symbols_complaint =
> +{"misplaced N_LBRAC entry; discarding local symbols which have no enclosing block", 0, 0};
> \f
> /* find_text_range --- find start and end of loadable code sections
>
> @@ -2881,7 +2884,21 @@ process_one_symbol (int type, int desc,
> /* Can only use new->locals as local symbols here if we're in
> gcc or on a machine that puts them before the lbrack. */
> if (!VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
> - local_symbols = new->locals;
> + {
> + if (local_symbols != NULL)
> + {
> + /* GCC development snapshots from March to December of
> + 2000 would output N_LSYM entries after N_LBRAC
> + entries. As a consequence, these symbols are simply
> + discarded. Complain if this is the case. Note that
> + there are some compilers which legitimately put local
> + symbols within an LBRAC/RBRAC block; this complaint
> + might also help sort out problems in which
> + VARIABLES_INSIDE_BLOCK is incorrectly defined. */
> + complain (&discarding_local_symbols_complaint);
> + }
> + local_symbols = new->locals;
> + }
>
> if (context_stack_depth
> > !VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFA] dbxread.c: Complain when local symbols are discarded
[not found] ` <jimb@redhat.com>
@ 2002-05-10 0:35 ` Kevin Buettner
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Buettner @ 2002-05-10 0:35 UTC (permalink / raw)
To: gdb-patches
On May 9, 1:06pm, Jim Blandy wrote:
> Kevin Buettner <kevinb@redhat.com> writes:
>
> > * dbxread.c (discarding_local_symbols_complaint): New complaint.
> > (process_one_symbol): Complain about discarding local symbols
> > due to a misplaced N_LBRAC entry.
>
> Looks good to me.
Committed.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-05-10 7:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-08 17:06 [PATCH RFA] dbxread.c: Complain when local symbols are discarded Kevin Buettner
2002-05-09 11:06 ` Jim Blandy
[not found] ` <jimb@redhat.com>
2002-05-10 0:35 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox