public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>
Cc: Yao Qi <qiyaoltc@gmail.com>, Pedro Alves <palves@redhat.com>,
	       <gdb-patches@sourceware.org>
Subject: [PATCH] Fix coredump-filter.exp by correctly unsetting array (was: Re: [rfc] Fix PR 18208: update /proc/pid/coredump_filter by c code)
Date: Thu, 07 May 2015 17:05:00 -0000	[thread overview]
Message-ID: <87mw1g1fp2.fsf_-_@redhat.com> (raw)
In-Reply-To: <554B702F.5090006@codesourcery.com> (Luis Machado's message of	"Thu, 7 May 2015 11:01:19 -0300")

On Thursday, May 07 2015, Luis Machado wrote:

> Besides that, without the conditional block i also see a problem with
> the existing testcase using coredump_var_addr as an array but
> declaring it as a regular variable. It causes a number of errors. Did
> you notice that? Maybe it is specific to a certain version of expect.
>
> # Obtain the address of each variable that will be checked on each
> # case.
> set coredump_var_addr ""
> foreach item $all_anon_corefiles {
>     foreach name [list [lindex $item 3] [lindex $item 4]] {
>         set test "print/x $name"
>         gdb_test_multiple $test $test {
>             -re " = \($hex\)\r\n$gdb_prompt $" {
>                 set coredump_var_addr($name) $expect_out(1,string)
>             }
>         }
>     }
> }

Thanks for catching this.

This is because of the discussion on:

  <https://sourceware.org/ml/gdb-patches/2015-04/msg00452.html>

And the patch:

  <https://sourceware.org/ml/gdb-patches/2015-04/msg00979.html>

It seems it is not possible to "clear" the variable using "" and then
use as an array.  I think the best way would be to call 'unset
-nocomplain' in this case.  The following patch does this.  With it
applied, the test fully passes on Fedora 20 x86_64 native.

WDYT?

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

gdb/testsuite/ChangeLog:
2015-05-07  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.base/coredump-filter.exp: Correctly unset
	"coredump_var_addr" array.

diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp
index 72f756a..c601939 100644
--- a/gdb/testsuite/gdb.base/coredump-filter.exp
+++ b/gdb/testsuite/gdb.base/coredump-filter.exp
@@ -170,7 +170,7 @@ gdb_test_multiple "print/x &main" "getting main's address" {
 
 # Obtain the address of each variable that will be checked on each
 # case.
-set coredump_var_addr ""
+unset -nocomplain coredump_var_addr
 foreach item $all_anon_corefiles {
     foreach name [list [lindex $item 3] [lindex $item 4]] {
 	set test "print/x $name"

  reply	other threads:[~2015-05-07 17:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 15:29 [rfc] Fix PR 18208: update /proc/pid/coredump_filter by c code Yao Qi
2015-05-06 16:12 ` Pedro Alves
2015-05-06 16:43   ` Luis Machado
2015-05-07  9:05     ` Yao Qi
2015-05-07 10:45       ` Luis Machado
2015-05-07 14:01         ` Luis Machado
2015-05-07 17:05           ` Sergio Durigan Junior [this message]
2015-05-08 11:57             ` [PATCH] Fix coredump-filter.exp by correctly unsetting array Yao Qi
2015-05-08 17:23               ` Sergio Durigan Junior
2015-05-08 11:41           ` [rfc] Fix PR 18208: update /proc/pid/coredump_filter by c code Yao Qi
2015-05-08 14:40           ` Pedro Alves
2015-05-08 14:47             ` Luis Machado
2015-05-08  5:09   ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mw1g1fp2.fsf_-_@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=palves@redhat.com \
    --cc=qiyaoltc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).