-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
No stdout when running gdb/gdbserver. #827
Comments
I've been able to reproduce this running locally with a simple gdb on my host machine. The application output and gdb output are both in the Debug Console; Sample launch.json:
|
@d-bahr Setting Is there a reason why you are using two different remoting processes? Could you use the |
@pieandcakes The decision to avoid gdbserver basically boils down to wanting VSCode to be in charge of starting the debugging session. I could start gdbserver manually on the remote ARM, but that's an extra step that I would prefer to eliminate. Also, it seems that gdbserver is significantly slower than gdb to launch a new debugging session (this is related to our setup; not related to VSCode). So that explains why I'm not using I was using plink.exe before upgrading to the Windows 10 Creator's update because of the issues with forwarding stdin/stdout with bash.exe. I wasn't able to quite get it working with |
Maybe a separate issue, but I have noticed that stderr does not show up in the debug console (or anywhere) at all on Linux (CentOS 7.2). When the process being debugged prints to stdout, it does show up for me. However, if stdout gets flushed in between newlines (so a partial line is output by the process), it interferes with the MI output, causing the debugger to miss important events (like stopped on solib-event). |
Same here. When I run gdbserver in docker container and an executable on the host can't see |
@nikitablack So it looks like gdbserver is not sending back the stdout text to gdb. I see it in the docker container if its running in a separate window but gdb gets no notification of the output and as such we don't have anything to show you. |
@tmandry That might be a bug. Can you open a separate issue about stderr not appearing? |
@d-bahr I think my comment to @nikitablack is the same reason why you can't see it. It seems like gdbserver is not sending back stdout or stderr output to gdb, which in turn is communicating with VSCode which is why it isn't showing up in the console. There needs to be a way to tell gdbserver to send the debuggee's stdout/stderr back to gdb itself. |
@pieandcakes That makes sense. A possible workaround would be to force gdbserver/gdb to save stdout/stderr to a specific tty and then tell VSCode to open the tty, but I don't think VSCode supports that. |
I can start a gdb session with a specific tty for stdout like so: |
@d-bahr
But supporting this by vscode without explicit "--tty" command seems to be required feature |
Following up with some new information... I have been able to reproduce on a native linux host. My
I see with logging enabled that the stdout is getting sent from gdbserver to gdb:
So it seems that gdb is receiving stdout, but I suppose that either the MI engine or VSCode isn't parsing it out. My suspicion is that the MI engine isn't parsing it correctly because it isn't in the right output format, e.g.:
It seems reasonable to me to simple allow any output in the |
For @pudding8757 's answer, I specify my debuggerPath as follows and it works! "debuggerPath": "stdbuf -i0 -o0 -e0 /usr/bin/gdb" stdbuf here is used to disable buffer of all three channels. |
This works for me! You deserve a thousand likes! |
@alan23273850 It's not working for me :( |
I'm having this error too. In my case I'm manually running gdbserver through a pipe to docker like this:
I can't modify the container and it has no network connectivity. That's my reason for piping "target remote" through docker exec gdbserver. I too see that the actual output is reaching vscode with lines like this one:
|
This issue has been closed automatically because it's labeled as 'external'. |
To make gdb ignore this error use: "configurations": [
{
...
"setupCommands": [
{
"description": "disable pipe",
"text": "handle SIGPIPE nostop",
"ignoreFailures": true
}
]
...
}
] https://stackoverflow.com/questions/18935446/program-received-signal-sigpipe-broken-pipe/18963142 |
* Fix for maps with complex key types Fixes: * microsoft#3024 * microsoft/MIEngine#822
I have an ARM processor that is my target for debugging. I can successfully copy an executable to the target and debug it using gdbserver running on the target and gdb running on the host. The host is a Windows computer running WSL; the code is cross-compiled in WSL and all of the copying and debugging commands are also executed from within WSL. When I debug, I can see the gdb commands in the Debug Console window, but I do not see my application output (stderr and stdout).
This is a snippet from my launch.json file:
Changing
externalConsole
doesn't seem to have an effect; I never see an external console opening nor do I see the output in the Output or Debug Console windows. This option seems to be ignored.If I run the debugging commands from Windows command line (as in the following example), I can see the program output just fine.
I should also note that when I ssh into the target and run gdb natively, the application output is interleaved with the gdb output in the Debug Console, but it never shows up in a separate terminal, even with
"externalConsole": true
.My current workaround is to run gdb natively on the target and view the application output in the Debug Console, but it would be nice to view the application output in a separate terminal.
The text was updated successfully, but these errors were encountered: