This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] PR varobj/18564 regression in showing __thread so extern variable
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 02 Sep 2015 14:03:37 +0100
- Subject: Re: [PATCH] PR varobj/18564 regression in showing __thread so extern variable
- Authentication-results: sourceware.org; auth=none
- References: <1440934487 dot 22248 dot 9 dot camel at skynet dot be>
Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
Hi Philippe,
I am not an expert on symbol stuff, but I can only review test case.
Some one else may review the rest of the patch later.
> diff --git a/gdb/testsuite/gdb.threads/tls-so_extern.c b/gdb/testsuite/gdb.threads/tls-so_extern.c
> new file mode 100644
> index 0000000..1559de2
> --- /dev/null
> +++ b/gdb/testsuite/gdb.threads/tls-so_extern.c
> @@ -0,0 +1 @@
> +__thread void *so_extern;
We need a copy right header.
> diff --git a/gdb/testsuite/gdb.threads/tls-so_extern.exp b/gdb/testsuite/gdb.threads/tls-so_extern.exp
> new file mode 100644
> index 0000000..c4acb21
> --- /dev/null
> +++ b/gdb/testsuite/gdb.threads/tls-so_extern.exp
> @@ -0,0 +1,70 @@
> +# Copyright 2015-2015 Free Software Foundation, Inc.
Either 2014-2015 or 2015.
> +
> +# 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/>. */
> +
> +# tls-so_extern.exp -- Expect script to test thread local storage in gdb, with
> +# a variable defined in a shared library.
> +
> +standard_testfile tls-so_extern_main.c
> +set libfile tls-so_extern
> +set srcfile_lib ${libfile}.c
> +set binfile_lib [standard_output_file ${libfile}.so]
> +
> +remote_exec build "rm -f ${binfile}"
> +
Don't need to remove binfile.
> diff --git a/gdb/testsuite/gdb.threads/tls-so_extern_main.c b/gdb/testsuite/gdb.threads/tls-so_extern_main.c
> new file mode 100644
> index 0000000..5531fda
> --- /dev/null
> +++ b/gdb/testsuite/gdb.threads/tls-so_extern_main.c
> @@ -0,0 +1,21 @@
Copy right header is needed.
> +#include <stdio.h>
> +#include <pthread.h>
> +
> +extern __thread void *so_extern;
> +
> +static void *tls_ptr(void *p)
The code should comply to GNU coding standard.
> +{
> + so_extern = &so_extern;
> + printf("address is %p\n", &so_extern); /* break here to check result */
Don't have to call printf and include stdio.h.
--
Yao (éå)