This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [RFC] Testsuite: permit simple transformation of gdb_expect code
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Joel Brobecker'" <brobecker at adacore dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Thu, 3 Jun 2010 08:39:49 +0200
- Subject: RE: [RFC] Testsuite: permit simple transformation of gdb_expect code
- References: <000001cb0250$e4034590$ac09d0b0$@muller@ics-cnrs.unistra.fr> <20100602212929.GX3019@adacore.com>
> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Joel Brobecker
> Envoyé?: Wednesday, June 02, 2010 11:29 PM
> À?: Pierre Muller
> Cc?: gdb-patches@sourceware.org
> Objet?: Re: [RFC] Testsuite: permit simple transformation of gdb_expect
> code
>
> > I would like to insert a no-op change to lib/gdb.exp that allows
> > easily to write a transformation function (that can be inside the
> > target board file). The idea is to simply add a global variable
> > named `transform_gdb_expect_code' that defaults to empty.
>
> No objection from my end in principle; I guess there is no way to
> make that decision automatic? In AdaCore's testsuite, we get
> the version information in GDB and determine from there the host
> and target, and that allows to whether or not certain features
> are available, etc.
>
> In terms of implementation, rather than having an empty global,
> perhaps it'd be just as simple to test its existence? Just thinking
> out loud...
Do you mean the variable or the procedure itself?
I thought about it, but I still didn't really
understand all the tcl command details:
info exists VAR_NAME
will return 1 if VAR_NAME exists
as either a global or a local variable,
but it seems that
info proc PROC_NAME
works as a regular expression,
and can thus return a list containing both PROC_NAME and PROC_NAME_VERSION_2
procedures ...
But I might be wrong.
I am still not very skilled in tcl in general:
does
global VAR;
already create that variable?
or does it just say that that name VAR should be looked up
in global namespace?
If it does not create the variable then
using
global gdb_transform_expect_code;
and
if [info exists gdb_transform_expect_code] {
would be cleaner probably.
I am still so new to tcl that I didn't even
try it out, out of fear that I would not really
correctly interpret the results I see!
Pierre