This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] lookup_block_symbol ignores namespace parameter in binary search (gnatsweb gdb/15)
- To: Michael Elizabeth Chastain <chastain at cygnus dot com>
- Subject: Re: [RFA] lookup_block_symbol ignores namespace parameter in binary search (gnatsweb gdb/15)
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Mon, 29 Jan 2001 21:07:48 -0500 (EST)
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <200101292348.PAA19138@bosch.cygnus.com>
I think JimB is pretty swamped at the moment, so I am approving this.
(Funny enough the comment on top of these lines explicitly says that
the nemaspaces need to match too).
Thanks, Michael.
Elena
Michael Elizabeth Chastain writes:
> This patch fixes gnats gdb bug gdb/15 and the ERROR (gdb core dumps)
> in gdb.base/structs3.exp, which I am submitting as a separate patch.
>
> This is one of those stupid "how did it ever work" bugs. The binary
> search in lookup_block_symbol simply fails to make a required check.
>
> I found this problem while I was analyzing some other problem in gdb.
> I did a "maint print symbols" with a sourceware gdb on an inferior gdb,
> and the *superior* gdb crashed with fifty thousand stack frames in
> the core dump. So then I fired up an older, good gdb and debugged the
> superior sourceware gdb operating on an inferior sourceware gdb.
>
> I tracked that crash to this bug.
>
> I tested this on Red Hat Linux 7 native using sourceware CVS gcc and
> sourceware CVS gdb. I ran the test suite before and after this patch
> and got no variations. I also ran a new test script before and after
> and observed the bug happening (before) and not happening (after).
>
> OK to commit?
>
> Michael Elizabeth Chastain
> <chastain@redhat.com>
> "love without fear"
>
> 2001-01-29 Michael Chastain <chastain@redhat.com>
>
> * symtab.c (block_lookup_symbol): Use 'namespace' parameter in
> symbol comparisons in binary search.
>
> Index: gdb/symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.27
> diff -c -3 -p -r1.27 symtab.c
> *** gdb/symtab.c 2001/01/19 08:01:46 1.27
> --- gdb/symtab.c 2001/01/29 23:35:28
> *************** lookup_block_symbol (register const stru
> *** 1259,1266 ****
> while (bot < top)
> {
> sym = BLOCK_SYM (block, bot);
> ! if (SYMBOL_MATCHES_NAME (sym, name))
> ! return sym;
> bot++;
> }
> }
> --- 1259,1269 ----
> while (bot < top)
> {
> sym = BLOCK_SYM (block, bot);
> ! if (SYMBOL_NAMESPACE (sym) == namespace &&
> ! SYMBOL_MATCHES_NAME (sym, name))
> ! {
> ! return sym;
> ! }
> bot++;
> }
> }
>