This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [patch] MI telnet service


> -----Original Message-----
> From: gdb-patches-owner@sourceware.org 
> [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Marc Khouzam
> Sent: Tuesday, July 24, 2012 3:06 PM
> To: 'Abid, Hafiz'
> Cc: 'gdb-patches@sourceware.org'; 'Eli Zaretskii'
> Subject: RE: [patch] MI telnet service
> 
> > > Here are some issues I found:
> > > 
> > > - If I set a tty (-inferior-tty-set), GDB exits (or crashes?) when
> > > sending an
> > > empty command (just pressing enter) over telnet.  Eclipse 
> uses a tty
> > > for the
> > > inferiors.
> > Can you kindly list the steps to reproduce this crash. I 
> > tried but it worked ok for me.
> 
> It happens all the time with Eclipse.  I thought I had also
> reproduced it on the command line but today I just can get it to
> happen anymore directly in GDB.  But I also can't stop it from 
> happening in Eclipse :)
> I reproduced the _exact_ same MI session outside of eclipse
> as the one that crashes, and it still doesn't happen.
> I'll have to figure out what is different.

Ok, the problem is in the use of the readline history.
I couldn't reproduce it today because I wasn't starting
gdb where I had a ./.gdb_history file.  But eclipse was
starting gdb in my $HOME which happened to have the 
command 'q' as the last command in the history file.
So GDB was not crashing, it was just exiting when I
pressed <enter> in the telnet session.  Nothing to do
with using a tty.

The problem is that the telnet service uses
'previous_history()' instead of 'current_history()'.
previous_history() modifies the history which is
not what you want here.

If you can change your patch to use current_history()
in the method execute_telnet_command()() of mi/mi-telnet.c,
it should fix things.

Thanks


> You could try it with Eclipse and see if it happens to you also.
> Just launch a debug session and start the telnet service
> from the eclipse gdb console, then telnet in and press enter.
> 
> While trying to reproduce this, I ran into another problem
> that I could reproduce outside of Eclispe.
> In async-mode, gdb seems to go into a tight-loop when resuming
> execution from the telnet session (excerpts of the session below):
> 
> > ./gdb/gdb -i mi <any program>
> ~"GNU gdb (GDB) 7.5.50.20120724-cvs\n"
> (gdb) -gdb-set target-async on
> ^done
> (gdb) start
> &"start\n"
> ~"Temporary breakpoint 1 at 0x804850d: file loopfirst.cc, line 5.\n"
> [...]
> *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={
addr="0x0804850d",func="main",args=[],file="loopfirst.cc",fullna> me="/home/lmckhou/testing/loopfirst.cc",line="5"},thread-id="1
",stopped-threads="all",core="0"
> =breakpoint-deleted,id="1"
> (gdb) -start-telnet-service 9999
> ^done
> 
> => start a telnet session from another terminal and give the 
> 'next' command
> => from the telnet session.
> 
> Switching to interpreter "console".
> (gdb) ^running
> *running,thread-id="all"
> 
> => gdb grabs 100% of the CPU and must be killed with -9
> 
> 
> > > - For every command sent over telnet, there is a printout 
> > in the orinal
> > > GDB
> > > saying "Switching to interpreter "console"."  Not a big 
> > deal, but maybe
> > > something to remove.
> > > 
> > > - starting the telnet service, connecting to it, and then 
> > stopping the
> > > service (-stop-telnet-service), does no seem to clean up the port
> > > propertly
> > > and I see:
> > > ^error,msg="Error: port 9996 can't be bind"
> > > 
> > > - If I start GDB in CLI mode, and try to use the telnet 
> service, GDB
> > > segfaults
> > > after the first command is sent over telnet.  I know this 
> service is
> > > not
> > > currently meant to be used with the CLI mode, but it should 
> > not crash
> > > :)
> > > I personally think this would be cool to have even for CLI 
> > mode, but if
> > > it
> > > won't be for now, maybe the telnet service should be 
> > disabled in that
> > > case.
> > > 
> > > I realize this is a first and important step, but it will 
> > be even nicer
> > > when the telnet service supports tab-completion and 
> command-history.
> > > 
> > > This is very exciting!  Thanks!
> > > 
> > > Marc
> > Thanks for taking time to test.
> > 
> > Regards,
> > Abid
> > 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]