eclipse-cdt / cdt

Eclipse CDT™ C/C++ Development Tools
http://eclipse.org/cdt
Eclipse Public License 2.0
307 stars 201 forks source link

CDT need to provide console/terminal emulator for gdb inferior. #187

Open xu-chiheng opened 1 year ago

xu-chiheng commented 1 year ago

CDT can use PTY to connect the running program, by it provide no way to connect the gdb inferior.

A solution is to use a patched native terminal emulator like mintty(Cygwin and MSYS2/MinGW) or konsole(KDE), to call openpty() instead of forkpty() to allocate a pty, and output the device name of the pty slave, then CDT pass that slave device name(/dev/xxx) to gdb through --tty option.

--tty=TTY Use TTY for input/output by the program being debugged.

This has been realized in UltraGDB(https://github.com/ultragdb/ultragdb).

jonahgraham commented 1 year ago

Running processes in a terminal instead of the Eclipse Console is a good idea and I fully support work to get there. There have been quite some changes in CDT since ultragdb's fork point (new-ui, removal of old debug interface, terminal and remote code depending on process launching, etc) that need to be taken into consideration (as discussed in #180)

Presumably you are proposing this as a new option in launch configurations? Does it require configuration, or just a checkbox?

Ideally I would like this change upstream (in Eclipse Platform Debug), but there are challenges to making that happen, especially that the integrated terminal would probably need to move upstream too. The ideal place would be:

image

Looking at ultragdb's code, it has a fork on mintty, I don't think the Eclipse CDT project is interested in maintaining such a fork. Is the same true for konsole? Added into that mintty is GPL I think this is a non-starter.

Are you planning on upstreaming your changes to mintty/konsole?

xu-chiheng commented 1 year ago

Yes, as a new option launch configurations, just need a checkbox.

Yes, I'm upstreaming mintty/konsole.

mintty patch is ready to upstream. https://github.com/mintty/mintty/issues/1187 https://github.com/xu-chiheng/mintty/commit/f0e80e1876502a83c8e5d1b5c24a4c714a0b0e18

jonahgraham commented 1 year ago

Cool. Did you see that mintty has a contribution policy that says no unsolicited PRs. I wonder if we had such a policy in CDT we could have wasted less of your time yesterday?

xu-chiheng commented 1 year ago

no unsolicited pull request, not no unsolicited issue.

On Thu, Dec 1, 2022 at 4:48 AM Jonah Graham @.***> wrote:

Cool. Did you see that mintty has a contribution https://github.com/mintty/mintty#contribution policy that says no unsolicited PRs. I wonder if we had such a policy in CDT we could have wasted less of your time yesterday?

Message ID: @.***>

jonahgraham commented 1 year ago

My question was " if we had such a policy in CDT we could have wasted less of your time yesterday?"

xu-chiheng commented 1 year ago

understood