This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: PING [RFC] Testsuite: permit simple transformation of gdb_expect code
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Jan Kratochvil'" <jan dot kratochvil at redhat dot com>
- Cc: <gdb-patches at sourceware dot org>, <drow at false dot org>
- Date: Wed, 16 Jun 2010 17:33:56 +0200
- Subject: RE: PING [RFC] Testsuite: permit simple transformation of gdb_expect code
- References: <000901cb0c52$b7d767b0$27863710$@muller@ics-cnrs.unistra.fr> <20100616141356.GA32701@host0.dyn.jankratochvil.net>
> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Jan Kratochvil
> Envoyé?: Wednesday, June 16, 2010 4:14 PM
> À?: Pierre Muller
> Cc?: gdb-patches@sourceware.org; drow@false.org
> Objet?: Re: PING [RFC] Testsuite: permit simple transformation of
> gdb_expect code
>
> On Tue, 15 Jun 2010 08:19:30 +0200, Pierre Muller wrote:
> > use only a procedure, but this would mean
> > that there is no way to insert its code inside
> > gdb.exp itself.
>
> I do not understand this part.
Once again, this is due to my lack of knowledge of
expect/tcl.
> > This allows to use either
> > unset transform_gdb_expect_code
> > or
> > set transform_gdb_expect_code ""
> > to disable the transformation at any point
> > in the testsuite.
>
> With the patch proposed below one defines it using:
> proc transform_gdb_expect_code { expcode } {
> verbose -log "code = <$expcode>"
> return $expcode
> }
> and undefines it using:
> rename transform_gdb_expect_code ""
I didn't know about rename builtin command,
this means that we could define
proc gdb_allow_dos_type_readline { expcode} {
which would translate the expcode to cope with the extra \n appearing in
that case,
and insert later
if { [istarget "*-*-mingw*"] || [istarget "*-*-*djgpp*"] } {
rename gdb_allow_dos_type_readline transform_gdb_expect_code
}
This is perfect for me!
> Thanks,
Thank you for this new simpler proposal!
> 2010-06-16 Pierre Muller <muller@ics.u-strasbg.fr>
> Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * lib/gdb.exp (gdb_expect): Call transform_gdb_expect_code
> procedure
> if it exists.
>
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -2178,6 +2178,13 @@ proc gdb_expect { args } {
> }
> }
>
> + # The global procedure transform_gdb_expect_code can transform the
> code
> + # parameter of gdb_expect call in order to cope for some target
> dependant
> + # problems.
> + if { "[info procs transform_gdb_expect_code]" != "" } {
> + set expcode [transform_gdb_expect_code $expcode]
> + }
> +
> global suppress_flag;
> global remote_suppress_flag;
> if [info exists remote_suppress_flag] {