This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Re: Accessing tls variables across files causes a bug
- From: Luis Machado <luisgpm at linux dot vnet dot ibm dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Vinay Sridhar <vinay at linux dot vnet dot ibm dot com>, gdb-patches at sources dot redhat dot com
- Date: Mon, 04 Aug 2008 16:17:14 -0300
- Subject: Re: [patch] Re: Accessing tls variables across files causes a bug
- References: <1217480020.4755.1.camel@vinaysridhar.in.ibm.com> <20080802171807.GA2755@host0.dyn.jankratochvil.net>
- Reply-to: luisgpm at linux dot vnet dot ibm dot com
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