intellij icon indicating copy to clipboard operation
intellij copied to clipboard

Corrupted arguments passed to target executable when debugging with GDB

Open czartur opened this issue 1 year ago • 1 comments

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 avatar Sep 28 '24 17:09 czartur

me too.

kekxv avatar Dec 11 '24 02:12 kekxv

@ujohnny Is there a plan to fix it?

clion debug run args no work.

Image Image

kekxv avatar Jul 12 '25 14:07 kekxv

@kekxv let us check

ujohnny avatar Jul 14 '25 09:07 ujohnny

@ujohnny @LeFrosch hi, Is there any progress? Is there a way to reproduce this issue?

kekxv avatar Aug 01 '25 07:08 kekxv

Hi, @kekxv I was not able to reproduce your issue. As far as I could tell args defined in the BUILD file do work. If you still experience this issue, a small project to reproduce this would be really help full.

LeFrosch avatar Aug 01 '25 15:08 LeFrosch

@LeFrosch

https://github.com/clangTools/kpipeline

Image Image

Could you show a screenshot of your operation?

kekxv avatar Aug 02 '25 05:08 kekxv

@kekxv I think I found the cause for you issue as well and I hope to address it with #7816 too.

LeFrosch avatar Aug 14 '25 06:08 LeFrosch