Bug 516027 - [regression] Debug mode: Arguments are passed enclosed in single quotes on Neon
Summary: [regression] Debug mode: Arguments are passed enclosed in single quotes on Neon
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 9.2.0   Edit
Hardware: PC Mac OS X
: P3 major with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on: 494246
Blocks: 216510
  Show dependency tree
 
Reported: 2017-05-02 04:14 EDT by Jonah Graham CLA
Modified: 2020-09-04 15:16 EDT (History)
18 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonah Graham CLA 2017-05-02 04:14:58 EDT
+++ This bug was initially created as a clone of Bug #494246 +++

(In reply to Richard Ramos from Bug #494246 comment #13)
> I know the status for this Bug is resolved but I just installed eclipse
> Neon. I'm running CDT 9.2.1.201703062208 on a MAC and I'm seeing the problem
> with the single quotes. I'm running the same version on linux which isn't
> experiencing the issue.

Richard, can you expand on the failure in this new bug. The regression, AFAIK, was caused when command line handling was updated for Linux in Bug 474648. Bug 474648 had an incorrect assumption that Bash was always the shell used by GDB to launch inferior. That is certainly not the case on Windows, and Bug 494246 was to fix the regression caused on Windows. 

This bug is to fix the regression caused on Mac.

Specifically Richard I need to know the GDB version and how you are installing/using it. Is this cross-compilation or host debug?
Comment 1 Richard Ramos CLA 2017-05-02 07:26:29 EDT
Jonah, Because of the gdb issues on the MAC, some time ago I switched to using lldbmi2.  I was using version 1.0.114 but found that a commit on May 4, 2016 removed the quotes from the command line so I switched to a 1.0.26 build and I can now debug.  So it looks like the quotes are being passed into the debugger and being removed there.  I'm not sure what the current state of affairs are regarding gdb on the MAC so I took the path of least resistance (for me) to debugging. Hope this helps.
Comment 2 Jonah Graham CLA 2017-05-02 07:29:14 EDT
(In reply to Richard Ramos from comment #1)
> Hope this helps.

Yes, thank you.
Comment 3 Zach Metzinger CLA 2017-05-10 16:54:09 EDT
This bug (or something closely related) is causing us grief with Neon 4.6.3 / CDT 9.2.1.201703062208 under Windows 10:

295,828 (gdb) 
395,334 56-break-insert --thread-group i1 -f C:\\Users\\donkey\\workspace_me04\\EVK_Demo\\main.c:142\

395,343 &"No source file named C:\\\\Users\\\\donkey\\\\workspace_me04\\\\EVK_Demo\\\\main.c.\n"
395,344 56^done,bkpt={number="7",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending=\
"C:\\\\Users\\\\donkey\\\\workspace_me04\\\\EVK_Demo\\\\main.c:142",times="0",original-location="C:\\
\\\Users\\\\donkey\\\\workspace_me04\\\\EVK_Demo\\\\main.c:142"}
395,344 (gdb) 

It appears that something escaped the first backslash, and then another something escaped each of the two backslashes again.
Comment 4 Zach Metzinger CLA 2017-05-10 16:57:35 EDT
Disregard the comment on this bug. I was in the wrong tab. :-(

I will comment on bug #507569, instead.
Comment 5 Prapatsorn Wisuttirungseurai CLA 2017-06-01 05:21:51 EDT
I also found this bug while I'm debugging with some arguments option. I'm using gdb 7.12.1, Eclipse Neon 4.6.3, macOS Sierra 10.12.5

It passed the single quotes with my arguments. For example, in Arguments tab, I put:
arg1 arg2
but when debugging, it looks like:
'arg1' 'arg2'

My workaround is trying to set the arguments in .gdbinit file instead, just put the line like:
-------------------
set args arg1 arg2
-------------------
And then, it works fine!
Comment 6 Don Wills CLA 2017-10-15 02:04:21 EDT
It's still broken in Oxygen.1A Build id 20171005-1200
macOS 10.12.6 (Sierra)
the CDT Features are version 9.3.2.201709131603
gdb version 8.0.1

The symptom is very simple.

When a C project/program with command line arguments is run from the Run button with a Run Configuration, all of the command line arguments are as specified in the Arguments tab of the Run Configuration, everything is normal.

However, when the same C project/program is run from the Bug button with the same command line arguments in the Debug Configuration, then each argument that is passed in the argv array to main() is enclosed in single quote characters.

I grok why nobody else is reporting this bug - going through the certificate assignment process for gdb to make it work in macOS Sierra is a major pain.

My workaround is to add ugly code to the argv processing to check for the single quotes and remove them if they exist (which precludes using single quoted arguments, but that's not an issue for me).
Comment 7 Wilfried Kaneider CLA 2017-12-26 15:42:28 EST
I can confirm that it is still broken...

Version: Oxygen.2 Release (4.7.2)
Build id: 20171218-0600
Eclipse CDT Version: 9.4.0.201712051550

macOS 10.12.6 (Sierra)
gdb version 8.0.1
Comment 8 Richard Ramos CLA 2019-08-19 13:17:02 EDT
I can confirm that this is still a problem.  After fighting through the mac issues after apple stopped supporting gdb (certificate creation, code signing, etc.) I was able to kick off a gdb session and found that I'm still seeing the arguments enclosed in single quotes.  

I'm running macOS Mojave (version 10.14.5).  I'm running gdb 8.3 installed (as ggdb) via macports.  I'm running eclipse Version: 2019-03 (4.11.0)
Build id: 20190314-1200 and CDT Version: 9.7.2.201904300035.  I'm building natively (not cross-compiling) and debugging on the mac.
Comment 9 Olivier Hartmann CLA 2019-10-23 17:07:44 EDT
I confirm that this still is a problem with CDT 9.9.0. I am seeing the arguments enclosed in single quotes with the following setup:

- macOS Mojave (10.14.6)
- gdb 8.3 installed via Homebrew
- Eclipse 2019-09 R (4.13.0) - Build id 20190917-1200
- CDT 9.9.0.201909091956
Comment 10 michel sanches CLA 2020-05-29 06:59:08 EDT
still present on CDT 2020.3 MacOS  Catalina 
gdb 9.3 
Eclipse CDT	Eclipse C/C++ Development Tools	9.11.0.202003091030	org.eclipse.cdt