Summary: | Konsole need to implement openpty mode to support gdb's --tty option | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | chiheng.xu |
Component: | general | Assignee: | Konsole Developer <konsole-devel> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | ninjalj, towo |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | All | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
chiheng.xu
2022-12-01 13:10:34 UTC
use --openpty to activate openpty mode konsole --openpty /dev/pty1 IIUC, something similar can be achieved via: konsole --noclose -e /usr/bin/tty (In reply to ninjalj from comment #2) > IIUC, something similar can be achieved via: > > konsole --noclose -e /usr/bin/tty A human can copy and past such slave name of the pty. How a program, like IDE(Eclipse CDT) get that slave name? The only way is through stdout. https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/7951 https://github.com/mintty/mintty/issues/1187 On Linux something like the following would output the tty device name. The sleep may need to be tweaked. die() { echo "$@" >&2 exit 1 } konsole --noclose -e /usr/bin/tty & konsolepid=$! sleep 1 for fd in /proc/$konsolepid/fd/* do [ "x$(readlink $fd)" = x"/dev/ptmx" ] && ptmx=$fd && break done [ -z $ptmx ] && die "konsole process doesn't appear to have opened a pty master" ptmx=${ptmx/fd/fdinfo} awk -F: '/tty-index/{ print "/dev/pts/"$2+0 }' $ptmx Figured out a way to work partially: mintty.exe --hold always sh.exe -c "tty > 1.txt; read;" & konsole --no-close sh -e "tty > 1.txt; read;" & gnome-terminal --hold sh -e "tty > 1.txt; read;" & gdb --tty=$(cat 1.txt) emacs run But there is a problem that emacs can't get input from the terminal, because of the read command. The 'read' is unnecessary. Try: konsole --hold -e 'sh -c /usr/bin/tty > konstty' (in konsole, --hold and --noclose are synonyms) and then: gdb --tty $(cat konstty) --args emacs -nw At the gdb prompt type "run" and you should be set to go. Sorry, that should have been: konsole --hold -e 'sh -c "/usr/bin/tty > konstty"' (In reply to ninjalj from comment #7) > Sorry, that should have been: > > konsole --hold -e 'sh -c "/usr/bin/tty > konstty"' Have you tried that ? On windows using mintty, this method does not work perfectly. sometimes the program(emacs) does not respond. I'm trying this with 'mintty -Rt -h alw sleep 99999 &' and running gdb with another screen program (text editor mined) and see no problems. (In reply to chiheng.xu from comment #8) > (In reply to ninjalj from comment #7) > > Sorry, that should have been: > > > > konsole --hold -e 'sh -c "/usr/bin/tty > konstty"' > > Have you tried that ? On windows using mintty, this method does not work > perfectly. > sometimes the program(emacs) does not respond. I don't use windows. With this method, you will need to wait for konsole/mintty to open the pty pair and execute 'sh -c "/usr/bin/tty > konstty"'. E.g: you could remove the "konstty" file, and wait for it to have a valid terminal name. On my testing, I have not seen any problem debugging emacs. Note that there may be unavoidable problems with SIGINT, see https://lwn.net/Articles/909496/ |