Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of inferior PTY / IO needed #161

Open
a1994846931931 opened this issue Dec 10, 2019 · 3 comments
Open

Implementation of inferior PTY / IO needed #161

a1994846931931 opened this issue Dec 10, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@a1994846931931
Copy link

Cannot distinguish program output from gdb mi output

cdt-gdb-adapter would try to interpret every line as gdb mi output, which causes a problem because it cannot distinguish program output from that. For example:
image
In the image above, cdt-gdb-adapter tried to parse the line that's started with = or *, and failed.

Only parse the output after a line is finished

According to:
https://github.com/eclipse-cdt/cdt-gdb-adapter/blob/3b9442075d06759035dbae616dbbd9923b921bc6/src/MIParser.ts#L26
the MIParser only handle the output when a line is finished. In the case of program output, this can be really buggy.

@a1994846931931 a1994846931931 changed the title GDB output parser is buggy GDB MI-parser is buggy Dec 10, 2019
@simark
Copy link
Contributor

simark commented Dec 10, 2019

Hmm the MI should really not be on the same channel as the program output.

@jonahgraham
Copy link
Contributor

I believe no one has implemented this functionality yet - probably because most of the usecases for the adapter so far are embedded. On Linux probably want to use -inferior-tty-set and on Windows -gdb-set new-console on.

There is already PTY support needed by the new-ui when openGdbConsole is set.

Patches welcome.

@jonahgraham jonahgraham changed the title GDB MI-parser is buggy Implementation of inferior PTY / IO needed Dec 10, 2019
@jonahgraham jonahgraham added the enhancement New feature or request label Jan 31, 2023
jonahgraham added a commit to jonahgraham/cdt-gdb-adapter that referenced this issue Feb 7, 2023
Using DAP's runInTerminal this PR adds the ability to use that new
terminal for the inferior's I/O.

The basic idea of the inferior terminal on Linux is:

- adapter requests client (aka vscode) to create a
  terminal (using runInTerminal)
- in that terminal we run a small script that "returns"
  the tty name to the adapter (using an atomically created
  file with the output of tty command)
- then the script waits until the adapter is complete by
  monitoring the PID of the adapter's node process

The script run in the terminal won't auto-stop when
running the adapter in server mode (typically should only
be used for development of the adapter)

Part of eclipse-cdt-cloud#161
jonahgraham added a commit to jonahgraham/cdt-gdb-adapter that referenced this issue Feb 7, 2023
Using DAP's runInTerminal this PR adds the ability to use that new
terminal for the inferior's I/O.

The basic idea of the inferior terminal on Linux is:

- adapter requests client (aka vscode) to create a
  terminal (using runInTerminal)
- in that terminal we run a small script that "returns"
  the tty name to the adapter (using an atomically created
  file with the output of tty command)
- then the script waits until the adapter is complete by
  monitoring the PID of the adapter's node process

The script run in the terminal won't auto-stop when
running the adapter in server mode (typically should only
be used for development of the adapter)

Part of eclipse-cdt-cloud#161
@jonahgraham
Copy link
Contributor

I did a first pass of Linux support for this in #252. If anyone wants to review that to see what they think that would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants