[RFC] gdb.mi tests

Aleksandar Ristovski aristovski@qnx.com
Wed Mar 12 20:49:00 GMT 2008


Daniel Jacobowitz wrote:
> On Wed, Mar 12, 2008 at 10:25:12PM +0300, Vladimir Prus wrote:
>> Aleksandar Ristovski wrote:
>>
>>>> Something like the diffs attached (I manually removed some things from my diff
>>>> so the diff may not be patchable, but it should be sufficient to illustrate what
>>>> am I talking about.
>>>>
>>> Attached working diff. Comments welcome.
>> I don't have any objections to this course of action, if this simplifies
>> your testing.
>>
>> But just for the record, can you tell how you override mi_gdb_start? Of course,
>> assuming it's not some proprietary information.
> 
> FWIW, I tried something similar long ago and Elena preferred it the
> way it is - you'll see that sid and gdbserver target support is also
> in mi-support.exp, not in config/ with the other pieces.
> 
>   http://sources.redhat.com/ml/gdb-patches/2002-07/msg00227.html
> 
> However, CodeSourcery's test harness goes to some trouble to work
> around this - you still can, you just need to be handy with TCL to do
> it.  We load mi-support.exp in our board files and use "rename".
> Which is a bit silly to have to do.
> 

The way I understand it, tcl is dynamically scoped language (I hope I used the 
right term) and will, effectively override a definition with the subsequent 
redefinition.

This means that the order in which files are loaded matters and the latter in 
the process a file gets loaded, it carries more 'overriding' capabilities. 
Therefore, first files loaded should be very generic, going towards 
customization files.

If tests are run with --verbose flag, the order of loaded files is clear:

/usr/share/dejagnu/runtest.exp as main test driver$
site.exp (generated by the makefile, specifies tool name and such)
site.exp (global site.exp as defined by DEJAGNU env. var - optional, I use it to 
add my baseboard directory)
then follow bunch of dejagnu framework files loaded by runtest.exp:
Loading /usr/share/dejagnu/utils.exp
Loading /usr/share/dejagnu/framework.exp
...
Loading /usr/share/dejagnu/libgloss.exp
Loading library file ../../../gdb/testsuite/lib/gdb.exp

After that,
boardfile is loaded and finally the test file.


For gdb.base tests, gdb_start, gdb_load and such are easily overriden by 
redefinition in baseboard file. However, due to the fact that mi-support.exp is 
explicitly loaded from gdb.mi/* tests, it will have the final say, thus 
preventing us from overriding mi_gdb_load and such in the baseboard file.


Thanks,

Aleksandar



More information about the Gdb-patches mailing list