Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370376

Summary: [remote] Remote non-attach should not have a console for the inferior
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, pawel.1.piech
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix to not add an inferior to the launch for the remote case marc.khouzam: iplog-

Description Marc Khouzam CLA 2012-02-01 16:16:27 EST
I just noticed that the C/C++ Remote Application launch (manual or automatic) adds the inferior process in the launch, and therefore has a dedicated console for that inferior.

This is the case where we start gdbserver like this:

gdbserver :9999 /home/marc/myBinary

That console is useless since the I/O of the inferior is handled in the shell where gdbserver and the inferior are running.

So, having this always empty console is not user-friendly.  Furthermore, it causes a memory leak that I noticed when running over 140 Remote Junit tests.

I suggest to remove that console by simply not adding the inferior to the launch.

I believe we originally had the console as a side-effect of showing the inferior node in the Debug view, which required us to add it to the launch.  Now that we don't show the inferior in the Debug view, there is no need to add it to the launch.  This has always been the approach for a remote attach debug session.
Comment 1 Marc Khouzam CLA 2012-02-02 06:18:46 EST
Another problem with having the console, is that it is connect to GDB's I/O.  That means that if the user types to that console, it will send the command to GDB, which is surprising.  For example, pressing 'quit' in the inferior console will kill GDB.

The reason this happens, is that for a remote session there is no PTY available, so the code uses GDB's IO.  This makes sense for a local session, but not for a remote session, whose IO should not be handled by eclipse at all, thus, this bug.
Comment 2 Marc Khouzam CLA 2012-02-02 06:20:24 EST
Created attachment 210439 [details]
Fix to not add an inferior to the launch for the remote case

This patch checks if we are dealing with a remote session before creating an inferior process.

I will commit to master.
Comment 3 Marc Khouzam CLA 2012-02-02 06:39:21 EST
Fixed
Comment 4 CDT Genie CLA 2012-02-29 13:23:35 EST
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 370376: [remote] Remote non-attach should not have a console for the inferior

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=ce342ee755ee0eeae46cf8f3b50e24bb36213043
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 370376: [remote] Remote non-attach should not have a console for the inferior

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=ce342ee755ee0eeae46cf8f3b50e24bb36213043
Comment 5 CDT Genie CLA 2012-02-29 13:23:35 EST
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 370376: [remote] Remote non-attach should not have a console for the inferior

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=ce342ee755ee0eeae46cf8f3b50e24bb36213043
*** cdt git genie on behalf of Marc Khouzam ***

    Bug 370376: [remote] Remote non-attach should not have a console for the inferior

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=ce342ee755ee0eeae46cf8f3b50e24bb36213043