Author Topic: Passing command line arguments to target when debugging  (Read 44700 times)

Offline dushara

  • Multiple posting newcomer
  • *
  • Posts: 29
Passing command line arguments to target when debugging
« on: January 29, 2009, 06:15:18 am »
Hi all,

I'm using Code::Blocks 8.02 for Windoze with CDB as the debugger. I can't work out how to pass command line arguments to the target application when debugging.

Project -> Set Program Arguments... work only if I run the application. However, when debugging the app, the arguments aren't passed to the target.

Any ideas?

Thanks
Dushara

Offline jomeggs

  • Multiple posting newcomer
  • *
  • Posts: 92
Re: Passing command line arguments to target when debugging
« Reply #1 on: January 29, 2009, 10:18:59 pm »
I'm using Code::Blocks 8.02 for Windoze with CDB as the debugger...

Hi, it would be better to give the release number of CB, plase check out the about box. For me it's svn 5382 and it works fine with program arguments in debug mode.

There is another important checkbox to be found in Project -> Set Program Arguments named "This target provides the project's mains executable". Mark the Debug-target above and check the checkbox.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: Passing command line arguments to target when debugging
« Reply #2 on: January 29, 2009, 10:29:50 pm »
I'm using Code::Blocks 8.02 for Windoze with CDB as the debugger...
Hi, it would be better to give the release number of CB, plase check out the about box. For me it's svn 5382 and it works fine with program arguments in debug mode.

C::B 8.02 is enough.
If I remember right,  it's revision 4919. But it has no svn-revision number included, because it's an official release-version.

Offline dushara

  • Multiple posting newcomer
  • *
  • Posts: 29
Re: Passing command line arguments to target when debugging
« Reply #3 on: January 30, 2009, 01:47:57 am »
Hi thanks for your help...

There is another important checkbox to be found in Project -> Set Program Arguments named "This target provides the project's mains executable". Mark the Debug-target above and check the checkbox.

I've done this already but not luck. Here's part of the output in the Debugger tab:


--------------------------------------->8-----------------------------------------
Starting debugger:
done
Setting breakpoints
quit:
Microsoft (R) Windows Debugger Version 6.10.0003.233 X86
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: ../bin/Debug/test-compound.exe
Symbol search path is: C:/code/ccover/tests/test-compound/;C:/code/ccover/
Executable search path is:
---------------------------------------8<-----------------------------------------


Note the line containing the tag "CommandLine" it should contain an argument "--test wip"

Could this be a bug? (The linux version - with GDB - works ok).

Thanks again
dushara

blocker

  • Guest
Re: Passing command line arguments to target when debugging
« Reply #4 on: July 31, 2023, 11:14:14 am »
This post is several years old now, but, I guess I got the solution for CodeBlocks 20.03.

I'm not a professional developer but I reviewed the source code for versions 10.05 and 20.03; the issue is that "cdb_driver" does not pass arguments; see the attached screenshot.

Regards.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1629
Re: Passing command line arguments to target when debugging
« Reply #5 on: July 31, 2023, 12:12:11 pm »
This was fixed about a year ago, current nightly works as intended.

See r12753.
« Last Edit: July 31, 2023, 12:16:49 pm by Miguel Gimenez »

blocker

  • Guest
Re: Passing command line arguments to target when debugging
« Reply #6 on: July 31, 2023, 03:46:12 pm »
The last year nightly builds don't run on Windows XP, I had to review the source code of version 10.05 to get this issue fixed and running.

As far as the implementation of "UserArguments", in the 20.03 source code it depended of "GetActiveConfigEx().GetUserArguments()" (debuggergdb.cpp).

"GetActiveConfigEx()" returns a call to "GetActiveConfig()" which I could not find its implementation anywhere, so, I suspect that method was not implemented in the 20.03 source code.

I cannot find the source code of the revision you mentioned so I could not verify if this issue is really solved.

Just minutes ago I downloaded the yesterday revision of version 23.03 and I couldn't do a debugging test because it crashed when I tried to set a breakpoint; this attempt was on Windows 10.

Regards.
« Last Edit: July 31, 2023, 04:21:27 pm by blocker »