From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org, jan.kratochvil@redhat.com
Subject: Re: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
Date: Fri, 17 Feb 2012 21:00:00 -0000 [thread overview]
Message-ID: <4F3EBEAC.1070805@redhat.com> (raw)
In-Reply-To: <87pqdd9pjs.fsf@fleche.redhat.com>
On 02/17/2012 08:24 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> - build different executable files for the non-threaded and threaded
> Pedro> cases. This was my motivation. I wanted to test the non-threaded
> Pedro> case manually, but the threaded variant always clobbered the
> Pedro> non-threaded executable.
>
> I think this ought to be a general rule. We need exceptions to it for
> some executable-changed cases, but I think in general different tests
> should build different executables, because this makes it easier to do
> additional checking by hand.
>
> Pedro> + set save_pf_prefix $pf_prefix
> Pedro> + lappend pf_prefix "$threadtype:"
>
> I think this should be append rather than lappend, as pf_prefix is just
> a string, not a list.
Hmm, the only thing dejagnu does with it is 'concat'.
/usr/share/dejagnu/framework.exp:681: global pf_prefix
/usr/share/dejagnu/framework.exp:688: if {[info exists pf_prefix]} {
/usr/share/dejagnu/framework.exp:689: set message [concat $pf_prefix " " $message]
Interesting data-point:
$ grep -rn pf_prefix *| grep append | grep lappend | wc -l
40
$ grep -rn pf_prefix *| grep append | grep append | grep -v lappend | wc -l
2
'concat' actually takes lists as arguments, so it could be said that lappend
is the correct thing to do. 'concat' also accepts strings all the same too,
and everything is a string in tcl anyway, so it could go both ways.
Hmm, having said that, with lists we can pop back one level without
saving the previous state of pf_prefix. That is, all the
"set save_pf_prefix $pf_prefix" are really unnecessary. So we could instead
write:
lappend pf_prefix "$threadtype:"
...
set pf_prefix [lreplace $pf_prefix end end]
or even better, hide that a bit in a couple of methods in lib/gdb.exp:
proc push_prefix { $new_prefix} {
lappend pf_prefix "$threadtype:"
}
proc pop_prefix {} {
set pf_prefix [lreplace $pf_prefix end end]
}
All without any extra variables.
>
> Pedro> if [get_compiler_info ${binfile}] {
> Pedro> + set pf_prefix $save_pf_prefix
> Pedro> return -1
> Pedro> }
>
> I've occasionally wanted a wrapper like 'with_pf_prefix $whatever { body }'.
> But not enough to write it :)
Oh, that's a good idea!
--
Pedro Alves
next prev parent reply other threads:[~2012-02-17 20:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-17 19:37 [PATCH 0/2] gdb.threads/attach-into-signal.exp: prepare for gdbserver Pedro Alves
2012-02-17 19:38 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-02-17 20:55 ` Tom Tromey
2012-02-17 21:00 ` Pedro Alves [this message]
2012-02-17 22:04 ` Tom Tromey
2012-02-20 13:27 ` Pedro Alves
2012-02-21 16:05 ` testsuite: prefix handling Pedro Alves
2012-02-21 18:18 ` Jan Kratochvil
2012-02-21 19:28 ` Pedro Alves
2012-02-21 19:54 ` Tom Tromey
2012-02-21 19:17 ` Tom Tromey
2012-02-21 20:08 ` Pedro Alves
2012-02-21 20:59 ` Pedro Alves
2012-02-21 21:02 ` Tom Tromey
2012-02-21 22:08 ` Pedro Alves
2012-02-21 21:00 ` Tom Tromey
2012-02-21 22:03 ` Pedro Alves
2012-02-17 21:31 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-03-01 11:47 ` Pedro Alves
2012-02-17 23:55 ` Joel Brobecker
2012-02-20 8:57 ` Jan Kratochvil
2012-02-17 19:52 ` [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output Pedro Alves
2012-02-20 9:41 ` Jan Kratochvil
2012-02-20 12:32 ` Pedro Alves
2012-02-20 12:34 ` Jan Kratochvil
2012-02-20 12:37 ` Pedro Alves
2012-02-21 18:17 ` Edjunior Barbosa Machado
2012-02-21 19:11 ` Pedro Alves
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=4F3EBEAC.1070805@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=tromey@redhat.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