Author Topic: Set program's arguments don't work with vs2015 build tools & CDB  (Read 3161 times)

Offline eqychan

  • Single posting newcomer
  • *
  • Posts: 3
I made a program (simple console app ywfxvs.exe) in C++. I set the arguments in Project -> set program's arguments and fill the program arguments edit box with "1018" (without quotes), but it don't work. when I debug the program, argc is still 1, and argv[1] is "".
Am I doing a mistake somewhere ? Thanks.

My environment: Windows 7 32bit; Codeblocks 20.03; Visual studio build tools 2015; debugger: CDB (windows kits 8.1)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Set program's arguments don't work with vs2015 build tools & CDB
« Reply #1 on: March 14, 2022, 11:55:13 am »
Make sure you have selected the right "target" in the programs argurments dialog and when you run your application (the drop down menu near the run button)

Offline eqychan

  • Single posting newcomer
  • *
  • Posts: 3
Re: Set program's arguments don't work with vs2015 build tools & CDB
« Reply #2 on: March 15, 2022, 06:44:00 am »
Thanks for your reply, I did select the right and same "target" when debug the application.
And now I found that when I use GDB as the debugger or run the program without debugging, it works fine. but when i change the debugger to CDB and press F8 to debug my program, again i cannot see the arguments in my program.  Any problems with my CDB parameter settings?(My debugger setting showing in the attatchment)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Set program's arguments don't work with vs2015 build tools & CDB
« Reply #3 on: March 15, 2022, 09:15:10 am »
A sry, my fault, i did not realize that you are talking about debugging.

Please enable full debug log in Settings->Debugger->Common->Full Debug log

Then start your debugger, and post the output of the "Debugger" tab in the log view at the bottom in code tags here (use the # in the new post editor of the forum)

thank you!

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Set program's arguments don't work with vs2015 build tools & CDB
« Reply #4 on: March 15, 2022, 09:34:28 am »
From cdb_driver.cpp:81 and cdb_driver.cpp:97
Code
// FIXME (obfuscated#): Implement user arguments
so looks like CDB ignores user arguments ATM.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Set program's arguments don't work with vs2015 build tools & CDB
« Reply #5 on: March 15, 2022, 10:07:54 am »
I have just commited a patch to fix this, I can not test it because I do not have CDB, but the change is straightforward:
Code
+    if (!userArguments.empty())
+        cmd << ' ' << userArguments;

Offline eqychan

  • Single posting newcomer
  • *
  • Posts: 3
Re: Set program's arguments don't work with vs2015 build tools & CDB
« Reply #6 on: March 16, 2022, 11:28:31 am »
Thanks for your replay, I applied your patch and rebuilt Codeblocks form source, now it works pretty fine. thanks ;D

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Set program's arguments don't work with vs2015 build tools & CDB
« Reply #7 on: March 16, 2022, 12:50:56 pm »
Thank you for testing and reporting.