stdout of target program is streamed to debug console instead of terminal
@pieandcakes ya está trabajando en esto.
Desde el 24/9/2019.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Type: Debugger
Describe the bug
- OS and Version: Ubuntu 16.04.1
- VS Code Version: 1.38.1
- C/C++ Extension Version: 0.25.1
- Other extensions you installed (and if the issue persists after disabling them): CMake-0.0.17
- A clear and concise description of what the bug is.
I'm doing remote debugging on Ubuntu 16.04 for a target board running qnx7, everything works well, except that the stdout of my program is shown in the debug console instead of the terminal as local debugging which looks more comfortable.
A code sample:
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hello, world!" << std::endl;
std::cout << "argc = " << argc << std::endl;
for (int i = 1; i < argc; i++)
{
std::cout << "argv[" << i << "] = " << argv[i] << std::endl;
}
return 0;
}
When debug locally, it's fine, debug console shows
=thread-group-added,id="i1"
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
Stopped due to shared library event (no libraries added or removed)
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
Breakpoint 1, main (argc=2, argv=0x7fffffffe258) at main.cpp:5
5 std::cout << "Hello, world!" << std::endl;
Loaded '/usr/lib/x86_64-linux-gnu/libstdc++.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libc.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libm.so.6'. Symbols loaded.
Loaded '/lib/x86_64-linux-gnu/libgcc_s.so.1'. Symbols loaded.
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
[Inferior 1 (process 34697) exited normally]
The program '/build/xpt' has exited with code 0 (0x00000000).
and terminal shows
Hello, world!
argc = 2
argv[1] = arg_string
[1] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-slyrtsqi.vdn" 1>"/tmp/Microsoft-MIEngine-Out-lvf3edxt.mfe"
But if I use qnx-gdb to debug remotely, everything goes to debug console
=thread-group-added,id="i1"
GNU gdb (GDB) 7.12 [qnx700 r1234]
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=aarch64-unknown-nto-qnx7.0.0".
Type "show configuration" for configuration details.Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
Remote: /tmp/xpt
Breakpoint 1, main (argc=2, argv=0x100c7a08) at main.cpp:5
5 std::cout << "Hello, world!" << std::endl;
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
@"Hello, world!\r\n"
@"argc = 2\r\nargv[1] = arg_string\r\n"
[Inferior 1 (pid 17801281) exited normally]
The program '/build/xpt' has exited with code 0 (0x00000000).
and the terminal only has
[1] + Done "/usr/bin/ntoaarch64-gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-aszz1ibu.xa6" 1>"/tmp/Microsoft-MIEngine-Out-ga8klbwt.3fi"
I searched for the manual of gdb and found
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Stream-Records.html#GDB_002fMI-Stream-Records, according to which I know that the prefix character '@' means the following string is a target output, while it is not parsed by this extension, I thought.
Debugging the program in command line shows the different output of the two gdbs
With local gdb
lin@ubuntu:~$ gdb -i mi
=thread-group-added,id="i1"
~"GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1\n"
~"Copyright (C) 2016 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"x86_64-linux-gnu\".\nType \"show configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n"
(gdb)
file build/xpt
&"file build/xpt\n"
~"Reading symbols from build/xpt..."
~"done.\n"
^done
(gdb)
b main
&"b main\n"
~"Breakpoint 1 at 0x4008a6: file main.cpp, line 5.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004008a6",func="main(int, char**)",file="main.cpp",fullname="main.cpp",line="5",thread-groups=["i1"],times="0",original-location="main"}
^done
(gdb)
run
&"run\n"
~"Starting program: build/xpt \n"
=thread-group-started,id="i1",pid="36208"
=thread-created,id="1",group-id="i1"
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",target-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",host-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/x86_64-linux-gnu/libm.so.6",target-name="/lib/x86_64-linux-gnu/libm.so.6",host-name="/lib/x86_64-linux-gnu/libm.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/x86_64-linux-gnu/libgcc_s.so.1",target-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",host-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004008a6",func="main(int, char**)",file="main.cpp",fullname="main.cpp",line="5",thread-groups=["i1"],times="1",original-location="main"}
~"\n"
~"Breakpoint 1, main (argc=1, argv=0x7fffffffe448) at main.cpp:5\n"
~"5\t std::cout << \"Hello, world!\" << std::endl;\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00000000004008a6",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffe448"}],file="main.cpp",fullname="main.cpp",line="5"},thread-id="1",stopped-threads="all",core="10"
(gdb)
n 1
&"n 1\n"
^running
*running,thread-id="all"
(gdb)
Hello, world!
~"6\t std::cout << \"argc = \" << argc << std::endl;\n"
*stopped,reason="end-stepping-range",frame={addr="0x00000000004008c2",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffe448"}],file="main.cpp",fullname="main.cpp",line="6"},thread-id="1",stopped-threads="all",core="11"
(gdb)
n 1
&"n 1\n"
^running
*running,thread-id="all"
(gdb)
argc = 1
~"7\t for (int i = 1; i < argc; i++)\n"
*stopped,reason="end-stepping-range",frame={addr="0x00000000004008ee",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffe448"}],file="main.cpp",fullname="main.cpp",line="7"},thread-id="1",stopped-threads="all",core="11"
(gdb)
n 1
&"n 1\n"
^running
*running,thread-id="all"
(gdb)
~"12\t return 0;\n"
*stopped,reason="end-stepping-range",frame={addr="0x000000000040095e",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffe448"}],file="main.cpp",fullname="main.cpp",line="12"},thread-id="1",stopped-threads="all",core="11"
(gdb)
c
&"c\n"
~"Continuing.\n"
^running
*running,thread-id="all"
(gdb)
~"[Inferior 1 (process 36208) exited normally]\n"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
*stopped,reason="exited-normally"
(gdb)
q
&"q\n"
lin@ubuntu:~$
with qnx gdb
lin@ubuntu:~$ /usr/bin/ntoaarch64-gdb -i mi
=thread-group-added,id="i1"
~"GNU gdb (GDB) 7.12 [qnx700 r1234]\n"
~"Copyright (C) 2016 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"--host=x86_64-pc-linux-gnu --target=aarch64-unknown-nto-qnx7.0.0\".\nType \"show configuration\" for configuration details."
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n"
(gdb)
target qnx ip:port
&"target qnx ip:port\n"
~"Remote debugging using ip:port\n"
~"MsgNak received - resending\n"
~"Remote target is little-endian\n"
^done
(gdb)
file build/xpt
&"file build/xpt\n"
~"Reading symbols from build/xpt..."
~"done.\n"
^done
(gdb)
upload build/xpt /tmp/xpt
&"upload build/xpt /tmp/xpt\n"
^done
(gdb)
b main
&"b main\n"
~"Breakpoint 1 at 0x1550: file main.cpp, line 5.\n"
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000001550",func="main(int, char**)",file="main.cpp",fullname="main.cpp",line="5",thread-groups=["i1"],times="0",original-location="main"}
^done
(gdb)
run
&"run\n"
~"Starting program: build/xpt \n"
~"Remote: /tmp/xpt\n"
=thread-group-started,id="i1",pid="18014273"
=thread-created,id="1",group-id="i1"
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000000100c9550",func="main(int, char**)",file="main.cpp",fullname="main.cpp",line="5",thread-groups=["i1"],times="0",original-location="main"}
&"warning: Unable to find dynamic linker breakpoint function.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code."
&"\n"
^running
*running,thread-id="all"
(gdb)
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000000100c9550",func="main(int, char**)",file="main.cpp",fullname="main.cpp",line="5",thread-groups=["i1"],times="1",original-location="main"}
~"\n"
~"Breakpoint 1, main (argc=1, argv=0x100c7a18) at main.cpp:5\n"
~"5\t std::cout << \"Hello, world!\" << std::endl;\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00000000100c9550",func="main",args=[{name="argc",value="1"},{name="argv",value="0x100c7a18"}],file="main.cpp",fullname="main.cpp",line="5"},thread-id="1",stopped-threads="all"
(gdb)
n 1
&"n 1\n"
^running
*running,thread-id="all"
(gdb)
@"Hello, world!\r\n"
~"6\t std::cout << \"argc = \" << argc << std::endl;\n"
*stopped,reason="end-stepping-range",frame={addr="0x00000000100c9580",func="main",args=[{name="argc",value="1"},{name="argv",value="0x100c7a18"}],file="main.cpp",fullname="main.cpp",line="6"},thread-id="1",stopped-threads="all"
(gdb)
c
&"c\n"
~"Continuing.\n"
^running
*running,thread-id="all"
(gdb)
@"argc = 1\r\n"
~"[Inferior 1 (pid 18014273) exited normally]\n"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
&"No inferior.\n"
*stopped,reason="exited-normally"
(gdb)
q
&"q\n"
lin@ubuntu:~$
The main difference and which I think is also the reason of the problem is that the target output in qnx gdb is quoted and has a prefix character '@' while local gdb just output the raw string. Maybe this extension does not parse this output format and leave the stdout in the debug console. Is this a bug?
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/vscode-cpptools
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Abiertobug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 asignado ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 comentario · 1 asignado ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 64/100
microsoft/vscode-cpptools#14769 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
microsoft/vscode-cpptools#14768 · 1 comentario ·
Todos los issues de microsoft/vscode-cpptools
Issues similares
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
-
code-quality refactoring
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
langchain-ai/deepagents#6450 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
vercel/react-tweet#225 ·