code-debug icon indicating copy to clipboard operation
code-debug copied to clipboard

Can not wait for user input

Open jgueytat opened this issue 3 years ago • 17 comments

$ gdb --version GNU gdb (Debian 8.2.1-2+b3) 8.2.1

I get the program running properly with the terminal. In VSCode the prorgam does not wait for the user input.

Started Cancelled Terminal

jgueytat avatar Mar 24 '21 08:03 jgueytat

https://github.com/gitpod-io/gitpod/issues/3566 May be the report should go on VSCode side.

jgueytat avatar Mar 24 '21 08:03 jgueytat

I was only able to get the user input properly with ms-vscode.cpptools locally with VSCode for now.

jgueytat avatar Mar 24 '21 08:03 jgueytat

Same behavior there : https://github.com/eclipse-cdt/cdt-gdb-vscode/issues/43

jgueytat avatar Mar 24 '21 11:03 jgueytat

You you please re-run with showDevDebugOutput: true set for this extension and then post complete debug-log output?

GitMensch avatar Sep 17 '21 09:09 GitMensch

I think this is related to the use of this.process.stdin.write within the sendRaw command; or actual, the use of sendRaw in the sendCommand function. @WebFreak001 is there a reason to not use sendCliCommand (so interpreter-exec internally) for nearly everything we currently use sendCommand for?

GitMensch avatar Sep 17 '21 09:09 GitMensch

hm the commands not starting with a - should be run through interpreter-exec because that makes it feel more like a GDB console, good for people who are used to it.

However I don't think that is related to this problem at all, that input afaik isn't being piped to the program directly usually. You can try launching the program in separate terminal mode, which makes it pop up a console window that does the std io handling.

WebFreak001 avatar Sep 20 '21 08:09 WebFreak001

However I don't think that is related to this problem at all, that input afaik isn't being piped to the program directly usually.

But the code suggest it does: We have internal use of sendCommand 20 times (7/8 times during startup [ssh/normal, both using a 5 commands init function, leaving 10 more invokes open afterwards]).

So the startup here takes 8 stdin.write during startup and potentially 10 others later (likely one before, too). If the application gets to the user input before those 8 commands are finished on the GDB side then we still have an "input" open in this case.

For me the main question is really: why use stdin.write at all?

GitMensch avatar Sep 20 '21 09:09 GitMensch

Friendly ping @WebFreak001 because this really bugs me - as long as the program running is accepting input it should get through via stdin - and to allow that the extension should never send data there to communicate with GDB, shouldn't it?

GitMensch avatar Nov 25 '21 07:11 GitMensch

feel free to replace calls to sendRaw with sendCommand if they come from the extension and using -interpreter-exec

User input to the debug console should still support GDB commands if given as is and MI commands when starting with -

WebFreak001 avatar Nov 25 '21 09:11 WebFreak001

Hi guys,

I can get the getChar with the 25.1. The only thing is that I get a "Cancelled" in the Debug console at the end of the execution.

jgueytat avatar Nov 29 '21 10:11 jgueytat

GitPod has still trouble with that.

image

jgueytat avatar Nov 29 '21 11:11 jgueytat

Version : v25.1

With VSCode I can still miss the getChar() but it seems far much better.

image

jgueytat avatar Nov 29 '21 11:11 jgueytat

With a recent GitPod Workspace : https://coral-puffin-q8gr472u.ws-eu17.gitpod.io

I miss the getChar and the breakpoint.

image

jgueytat avatar Nov 29 '21 11:11 jgueytat

Here I got the getChar with the Hello lines at once.

image image

jgueytat avatar Nov 29 '21 12:11 jgueytat

I don't think the fix for this has been released yet, but it should be there on master.

WebFreak001 avatar Nov 29 '21 12:11 WebFreak001

Thanks for the reply @WebFreak001! May be we could add on the main README.md the latest published versions on the markets.

jgueytat avatar Nov 29 '21 12:11 jgueytat

That should be fixed now, no? An external console would obviously make that easier in any case, but that's a different issue.

GitMensch avatar Feb 07 '24 09:02 GitMensch