Comments (5)
The debugger logs provided above are accidentally using an overridden gdb:
$ ll ~/.local/bin/gdb
lrwxrwxrwx 1 ts ts 39 Feb 25 18:58 /home/ts/.local/bin/gdb -> /opt/rh/gcc-toolset-13/root/usr/bin/gdb
But behaviour is the same with RHEL 9.4 stock /usr/bin/gdb (GNU gdb (GDB) Red Hat Enterprise Linux 10.2-13.el9)
from vscode-cpptools.
I can reproduce the behaviour with /usr/bin/gdb on the command line using --interpreter=mi
using this string of commands:
-gdb-set target-async on
-file-exec-and-symbols /bin/echo
-exec-arguments foo;bar
-exec-run
As can be seen the inferior outputs only foo
, not foo;bar
:
$ /usr/bin/gdb --interpreter=mi -nx -q
=thread-group-added,id="i1"
(gdb)
-gdb-set target-async on
^done
(gdb)
-file-exec-and-symbols /bin/echo
^done
(gdb)
-exec-arguments foo;bar
^done
(gdb)
-exec-run
=thread-group-started,id="i1",pid="23252"
=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",ranges=[{from="0x00007ffff7fc9090",to="0x00007ffff7feeb43"}]
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="/lib64/libc.so.6",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffff7dd4700",to="0x00007ffff7f4740d"}]
~"[Thread debugging using libthread_db enabled]\n"
~"Using host libthread_db library \"/lib64/libthread_db.so.1\".\n"
foo
~"[Inferior 1 (process 23252) exited normally]\n"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
*stopped,reason="exited-normally"
If I change -exec-arguments foo;bar
to -exec-arguments "foo;bar"
then /bin/echo outputs foo;bar
.
from vscode-cpptools.
Hm, I can see with execsnoop that gdb actually uses bash to launch the executable:
$ sudo -E /usr/share/bcc/tools/execsnoop |grep foo
bash 3880 3853 0 /bin/bash -c exec /usr/bin/echo foo;bar
echo 3880 3853 0 /usr/bin/echo foo
This also happens when I just run gdb --args /bin/echo "foo;bar"
, but here I can see in the execsnoop output that the semicolon gets escaped:
$ sudo -E /usr/share/bcc/tools/execsnoop |grep foo
gdb 5952 16623 0 /usr/bin/gdb --args /bin/echo foo;bar
bash 5974 5952 0 /bin/bash -c exec /usr/bin/echo foo\;bar
echo 5974 5952 0 /usr/bin/echo foo;bar
I also checked qt-creator version 12.0.1 and it has the same behaviour as Visual Studio Code, i.e. the same bug. Now I'm uncertain if this is an issue in Visual Studio Code or gdb.
from vscode-cpptools.
I can disable gdb's use of a shell with set startup-with-shell off
or equivalently in gdb MI lingo -gdb-set startup-with-shell off
. Doing this fixes the reported issue.
This means this is not a vscode or vscode-cpptools problem as adding "setupCommands": [ { "text": "-gdb-set startup-with-shell off" }]
allows this to be done. Here is the full working configuration:
{
"name": "example",
"type": "cppdbg",
"request": "launch",
"program": "/bin/echo",
"args": [
"foo;bar"
],
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [ { "text": "-gdb-set startup-with-shell off" }]
}
from vscode-cpptools.
Not a vscode-cpptools problem. Closing issue.
from vscode-cpptools.
Related Issues (20)
- The LineEnding setting in .clang-format has no effect within VS Code HOT 3
- Absolute compiler paths are resolved incorrectly on MacOS and Linux in the Configurations UI
- cpptools-srv quit unexpectedly HOT 4
- Incorrect tokens highlight with "requires" clause with brackets HOT 1
- Extension pack is not compatiable HOT 2
- C++ CTRL-F5 always hits the invisible `Breakpoint 1, main (argc=1, argv=0x7fffffffd648)` the first time it runs! HOT 1
- C++ stopped loading HOT 1
- VS Code to Auto-detect language HOT 1
- Update `braces` to version 3.0.3 HOT 2
- cpptools-srv quit unexpectedly when rescanning workspace HOT 1
- Tweak the hover popup information to make it more readable and concise HOT 3
- format do not support AlignEscapedNewlines : LeftWithLastLine HOT 1
- Validation for VS Code settings HOT 1
- Outline view is randomly incorrect after opening a file and pasting code
- "<unnamed>" is incorrectly offered as a completion
- Intellisense error sizeof(uint32_t) is 8 bytes HOT 1
- Workspace tag parsing performance regression with 1.21.0 on Linux/Mac HOT 2
- Database may randomly have incorrect symbols after Close All Editors (without saving) is done HOT 1
- the prelaunchtask c/c++: gcc build active file terminated with exit code -1
- Formatting does not work in the if statement in the λ expression to the right of the assignment statement … HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-cpptools.