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

Corrupted arguments passed to target executable when debugging with GDB #6812

Open
czartur opened this issue Sep 28, 2024 · 0 comments
Open
Assignees
Labels
awaiting-maintainer Awaiting review from Bazel team on issues lang: c++ C++ rules integration product: CLion CLion plugin topic: debugging Issues related to debugging type: bug

Comments

@czartur
Copy link

czartur commented Sep 28, 2024

Description of the bug:

When debugging with GDB on CLion 2024.2, the plugin corrupts arguments passed to the target executable. The root cause seems to be improper handling of shell-escaped arguments.

For example:
"--tag=a b" becomes "--tag=a\ b"
"--tag=a,b" becomes "--tag=a\,b"

Looking at the gdbserver script, we can observe that shell escaping is enforced on line 96:

new_args+=("$(printf "%q" "${old_arg}")")

I am not sure why this is necessary as the script works as expected with:

new_args+=("${old_arg:q}")

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Create a bazel hello world project (e.g. stage1-tutorial)
  2. Add run configuration and set executable flags to "a,b"
  3. Debug and check argv[1] == "a,b"

Which Intellij IDE are you using? Please provide the specific version.

CLion 2024.2

What programming languages and tools are you using? Please provide specific versions.

C++: gcc 11.4, gdb 12.1

What Bazel plugin version are you using?

2024.09.10.0.1

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@czartur czartur added awaiting-maintainer Awaiting review from Bazel team on issues type: bug labels Sep 28, 2024
@sgowroji sgowroji assigned tpasternak and unassigned iancha1992 and satyanandak Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-maintainer Awaiting review from Bazel team on issues lang: c++ C++ rules integration product: CLion CLion plugin topic: debugging Issues related to debugging type: bug
Projects
None yet
Development

No branches or pull requests

5 participants
@tpasternak @czartur @iancha1992 @satyanandak and others