all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Helmut Eller <eller.helmut@gmail.com>, Paul Eggert <eggert@cs.ucla.edu>
Cc: 70519@debbugs.gnu.org
Subject: bug#70519: 30.0.50; Device for Emacs terminal I/O
Date: Tue, 23 Apr 2024 08:32:25 +0300	[thread overview]
Message-ID: <86zftk4pau.fsf@gnu.org> (raw)
In-Reply-To: <871q6xkvm9.fsf@gmail.com> (message from Helmut Eller on Mon, 22 Apr 2024 22:09:18 +0200)

> From: Helmut Eller <eller.helmut@gmail.com>
> Date: Mon, 22 Apr 2024 22:09:18 +0200
> 
> I'd like to start Emacs under GDB, but so that Emacs doesn't use the
> same terminal as GDB.

You should be able to do that with GDB features.  These include:

  . the 'set inferior-tty' command
  . the 'set new-console' command

The first sets the terminal of the debuggee to the named terminal, the
latter causes GDB to create a new terminal each time you "run" a
debuggee, and force the debuggee to use that new terminal.  These
commands should work for you without any changes to the Emacs sources.

Alternatively, you could start GDB from a different terminal and
attach it to an already running Emacs, but this does not allow you to
debug the Emacs startup code.

> It seems that the --terminal command line switch is there for
> exactly this use case.
> 
> However, it doesn't work.  Emacs parses the command line option and
> replaces stdin and stdout with the correct device, but then in dispnew.c
> it always calls init_tty with 0 as argument for the device name.  That
> simply opens the controlling terminal, i.e. /dev/tty and that is usually
> the same device as the one that GDB uses.
> 
> What would you think of the change below?

I don't think it's the correct change.  For starters, ttyname is
non-portable: on some supported platforms there's no way of getting at
the name of a non-default terminal.

More importantly, we already know the name of the terminal: we used it
in emacs.c when we processed the --terminal switch.  We just "forgot"
it because we didn't save it anywhere.  So one way of fixing this is
to record that name and reuse it in init_tty.  E.g., make DEV_TTY
non-const, and save the actual name there when we process it in
emacs.c.

Adding Paul in case he has comments.





  reply	other threads:[~2024-04-23  5:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 20:09 bug#70519: 30.0.50; Device for Emacs terminal I/O Helmut Eller
2024-04-23  5:32 ` Eli Zaretskii [this message]
2024-04-23  6:09   ` Helmut Eller
2024-05-04 10:34   ` Eli Zaretskii
2024-05-04 15:47     ` Helmut Eller
2024-05-04 16:19       ` Eli Zaretskii
2024-05-04 16:25         ` Helmut Eller
2024-05-04 17:03           ` Eli Zaretskii
2024-05-04 16:36         ` Paul Eggert
2024-05-04 17:19           ` Eli Zaretskii
2024-05-04 17:39             ` Paul Eggert
2024-05-04 18:19       ` Andreas Schwab
2024-05-04 18:27         ` Helmut Eller
2024-05-04 18:40           ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zftk4pau.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70519@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eller.helmut@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.