[patch/testsuite] MI inferior's output in remote target

Pedro Alves pedro@codesourcery.com
Wed Oct 26 13:49:00 GMT 2011


On Thursday 29 September 2011 05:47:16, Yao Qi wrote:
> On 08/29/2011 09:37 PM, Pedro Alves wrote:
> > On Friday 19 August 2011 14:16:36, Yao Qi wrote:
> > 
> 
> [ Sorry for the delayed reply.  The board is moving to a new place, and 
> it takes a lot of time to set it up. ]
> 
> >> I noticed one test fail when testing gdb with my remote stub,
> >>
> >>   FAIL: gdb.mi/mi-console.exp: Testing console output inferior output
> >> (time out)
> >>
> >> The remote stub is able to "transfer" remote IO to host via `remote
> >> fileio' packets, and output is printed to gdb_stdtarg or gdb_stdtargerr
> >> (as indicated in remote-fileio.c:remote_fileio_func_write).  Here are
> >> two problems,
> >>  1.  In mi-console.exp, it is expected to read inferior's output from
> >> another tty (a separate tty from gdb's), but the output is printed in
> >> the same tty as gdb's.
> >>  2.  In MI, gdb_stdtarg and gdb_stdtargerr is initialized by
> >> mi_console_file_new (raw_stdout, "@", '"').  So, the output printed to
> >> them is prefixed with "@".
> >>
> >> I tried to fix these two problems [1], but it doesn't work.  
> > 
> >> [1] I tried to fix these two problems by opening a new ui_file when
> >> inferior-tty is changed, and update gdb_stdtarg/gdb_stdtargerr to it.
> > 
> > Let's discuss what _should_ be happening, and if indeed this is
> > a gdb bug to fix.  I think it does make sense that if the frontend
> > wants inferior output in a separate channel, then we shouldn't
> > "@"-prefix the inferior output, as the prefix's whole purpose is
> > to be able to untangle the inferior's output from regular MI output.
> > Does anyone know of any frontend out where such a change would break
> > things?
> 
> Your description on "what should be happening" above is reasonable and 
> correct to me.  I think of this problem again, and it looks 
> mi-support.exp:proc mi_gdb_test doesn't handle remote testing when 
> checking inferior's output.
> 
> At the end of mi_gdb_test, it expects the output from 
> mi_inferior_spawn_id.  It is wrong in remote testing, because in 
> remote testing, IO is transfered back to gdb.  So in remote testing, 
> we should use gdb_expect instead of `expect -i mi_inferior_spawn_id' 
> to expect the inferior's output from gdb.  This doesn't fix this 
> problem, but make some progress, because test case can get inferior's 
> output, but still doesn't match.
> 
> > 
> > Why didn't your original attempt work?
> > 
> 
> I look at my work again, and think my original attempt works, but 
> expect is unable to get these output.  During test, inferior-tty is 
> set to `/dev/pts/55', for example, and update 
> gdb_stdtarg/gdb_stdtargerr to a new ui-file created for `/dev/pts/55'.
> At that moment, expect is getting gdb's output, and unable to get 
> output from another pty in the same process.  That is the limitation
> of expect, if I read "Exploring  Exect" book correctly> .  

How does work when native testing then?  Do you have a url
where I can read about that?

> If my
> understand is correct here, the problem #2 in my first post is unable
> to fix.  So I change test case mi-console.exp to match @-prefixed output 
> from gdb in remote testing.

Quite frankly, this sounds like papering over a bug due to a testing
limitation.  A separate tty was requested, and we'd just ignore
that, hiding the issue, and not testing what was intented.  Better
would be to kfail the test, IMO.

> >> I suggest that we check the inferior's
> >> output if gdb,noinferiorio is false and is not a remote target.
> > 
> > A quick grep tells me this is probably happening on the sims too.
> > 
> 
> I don't understand your bit here, could you elaborate a little please?

I just meant that this is probably happening with "target sim" too,
or everything non-native.

-- 
Pedro Alves



More information about the Gdb-patches mailing list