This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Re: Accessing tls variables across files causes a bug


Thanks for working on this. Just a few cosmetic comments.

On Sat, 2008-08-02 at 19:18 +0200, Jan Kratochvil wrote:
>      block = BLOCKVECTOR_BLOCK (bv, block_index);
>      sym = lookup_block_symbol (block, name, linkage_name, domain);
> -    if (sym)
> +    if (sym != NULL)

Shouldn't we just leave it as "if (sym)"?

>        {
> -	block_found = block;
> -	return fixup_symbol_section (sym, objfile);
> +	sym_best = sym;
> +	if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED
> +	    && SYMBOL_CLASS (sym) != LOC_OPTIMIZED_OUT)
> +	  break;
>        }
>    }

> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ ./gdb/testsuite/gdb.threads/tls2.c	2 Aug 2008 17:05:40 -0000
> @@ -0,0 +1,28 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> +   Copyright 2008 Free Software Foundation, Inc.
> +
> +   This program is free software; you can redistribute it and/or
> modify
> +   it under the terms of the GNU General Public License as published
> by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see
> <http://www.gnu.org/licenses/>.
> +
> +   Please email any bugs, comments, and/or additions to this file to:
> +   bug-gdb@prep.ai.mit.edu  */

This header is probably very old. Newer testcases have a more up-to-date
header. For example, gdb.opt/clobbered-registers-O2.c.

The patch works for me, getting rid of the memory access error when
trying to inspect the extern tls variable.

Regards,
Luis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]