Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » how to config debuger for an specific program(program with variables)
how to config debuger for an specific program [message #1749007] Thu, 01 December 2016 04:18 Go to next message
samira af is currently offline samira afFriend
Messages: 8
Registered: January 2016
Junior Member
HI all,
I have a folder for a program it contains video folder, audio folder, result folder, Pgm folder, sendercofig.txt and receivercofig.txt.

In video folder is a video and in audio folder is an audio. in pgm isa build folder and src folder.

in src there are many cpp files .

for building the program i opened build folder in terminal and cmake .. then make.
I have an executable with name pgm.

to run the program i have to use two terminal one for sender and one for receiver. then in one terminal i will write command:
./pgm /path/receivercofig 127.0.0.1 7777 ( 7777 is the port number)
in another terminal:
./pgm /path/sendercofig 127.0.0.1 7777 ( 7777 is the port number)
i did the following, which is not working correctly. Could you please guide me?
https://s14.postimg.org/ias5aox0h/Screenshot_from_2016_12_01_02_22_34.png

[Updated on: Thu, 01 December 2016 04:27]

Report message to a moderator

Re: how to config debuger for an specific program [message #1749010 is a reply to message #1749007] Thu, 01 December 2016 06:24 Go to previous messageGo to next message
David VavraFriend
Messages: 1412
Registered: October 2012
Senior Member
The resulting command line you are getting is:
<whatever program> receivercofig 127.0.0.1 7777 sendercofig 127.0.0.1 7777

Is this what your programs are expecting in the command arguments?
From your description, the receiver arguments should be: 127.0.0.1 7777
Likewise for the sender arguments.

.

[Updated on: Thu, 01 December 2016 06:49]

Report message to a moderator

Re: how to config debuger for an specific program [message #1749081 is a reply to message #1749010] Thu, 01 December 2016 16:13 Go to previous messageGo to next message
samira af is currently offline samira afFriend
Messages: 8
Registered: January 2016
Junior Member
Thanks for your reply.

As you explained my goal is not "<whatever program> receivercofig 127.0.0.1 7777 sendercofig 127.0.0.1 7777"
my goal is "<whatever program> receivercofig 127.0.0.1 7777" and "<whatever program> sendercofig 127.0.0.1 7777" the order is also important first receiver has to run and then sender.

As i am newer please guide me in more details about where and how i have to add this config in eclipse.
If i add only 127.0.0.1 7777, where and how should i addd config files?
https://s11.postimg.org/c84o09ngj/Screenshot_from_2016_12_01_12_45_25.png
Re: how to config debuger for an specific program [message #1749085 is a reply to message #1749081] Thu, 01 December 2016 16:59 Go to previous messageGo to next message
David VavraFriend
Messages: 1412
Registered: October 2012
Senior Member
A launch configuration contains the settings used by Eclipse to run or debug your program.
Whatever is placed in the Arguments tab will be on the command line used.

Run --> Debug Configurations ... or
Run --> Run Configurations ...
There is also a dropdown arrow next to the debug and run icons in the toolbar.

There is really only one type of configuration used for both running and debugging
The only difference with the menu selection is the dialog used for settings and the configuration name.

Make a configuration for each program using different names.
Launch them in proper order using the dropdown next to the icons or run menu
Select the configuration for editing and press Run/Debug
You can have more than one debug session running at the same time.

More details here: http://help.eclipse.org/neon/topic/org.eclipse.cdt.doc.user/tasks/cdt_o_run.htm?cp=8_3_5
and here: http://help.eclipse.org/neon/topic/org.eclipse.cdt.doc.user/tasks/cdt_t_new_run_config.htm

Step two in the latter is incorrect.
Run --> Debug will start debugging with the last configuration used.

Instead use:
Run --> Debug Configurations ... or
Run --> Run Configurations ...
Re: how to config debuger for an specific program [message #1749119 is a reply to message #1749085] Fri, 02 December 2016 05:27 Go to previous messageGo to next message
samira af is currently offline samira afFriend
Messages: 8
Registered: January 2016
Junior Member
Thanks for your reply. The main function is in pgm.cpp. I mean that two debug sessions have to run on one program at the same time.

"Make a configuration for each program using different names."
I made NEWTEStPGMDebugReceiver for receiver and NEWTEStPGMDebugSender for sender each one with its argument.
https://s16.postimg.org/4gscmzvgl/Screenshot_from_2016_12_02_03_16_59.png

"Launch them in proper order using the dropdown next to the icons or run menu"
in the picture that i added the order is correct (first receiver and then sender) is it enough?

"Select the configuration for editing and press Run/Debug"
I chose Run-> debug configuration -> when i select NEWTEStPGMDebugReceiver just this one is debugging and when i am selecting "NEWTEStPGMDebugSender" just this one is running. And when c/c++ application is selected, debug button is inactive.

I couldn't debug both together at the same time Sad



Thanks in advance.
Re: how to config debuger for an specific program [message #1749129 is a reply to message #1749119] Fri, 02 December 2016 08:17 Go to previous messageGo to next message
David VavraFriend
Messages: 1412
Registered: October 2012
Senior Member
I don't understand. Didn't you say you have two programs?
Quote:

one terminal i will write command:
./pgm /path/receivercofig 127.0.0.1 7777 ( 7777 is the port number)
in another terminal:
./pgm /path/sendercofig 127.0.0.1 7777 ( 7777 is the port number)

Even if they are the same program, you should be able to start a debug session on the first then, while it's running, start a second.
They will both be in the Debug View.
Here's an example of debugging two copies of the same program. It could easily have been two different programs.

Don't know why the button would be grayed. Mine doesn't. You may need to use the Run menu instead.

index.php/fa/27754/0/

EDIT:
I see you still don't understand how to set up the launcher.
You put the name of the program in the Main tab and the arguments in the Arguments tab.
If the program requires no arguments, the Arguments tab will be empty.

[Updated on: Fri, 02 December 2016 08:50]

Report message to a moderator

Re: how to config debuger for an specific program [message #1749179 is a reply to message #1749129] Fri, 02 December 2016 17:40 Go to previous messageGo to next message
samira af is currently offline samira afFriend
Messages: 8
Registered: January 2016
Junior Member
Thanks a lot.
Now i have both on Debug information and they can run parallel and i can check line by line each of receiver and sender.

The result of each one (receiver and sender) is shown in separate console. First, I need your confirm that it is correct?

Then, is there any possibility that i can see sender console and receiver console based on the order. I mean for example,
currently, when i am checking sender console (i can use F6 or F5) it shows at 1s, first packet sent, then at 2 s, the seconed packet was sent. Then, i can pause sender debug and resume receiver debug in debugger information and i can check commands (with F6 or F5) in receiver console I can see the first packet arrived in 1.5s and the seconed packet arrived at 2.5s.

what i prefer to see is:
The first packet is sent at 1s from sender ( sender console becomes active) then it goes through receiver console to see at 1.5 s the packet arrived ( receiver console becomes active). Then at 2s next packet sends in sender console ( sender console becomes active) and in 2.5 the second packet is arrived in receiver console ( receiver console becomes active).

I hope that i could explain my question Smile .
Thanks again.

[Updated on: Fri, 02 December 2016 17:41]

Report message to a moderator

Re: how to config debuger for an specific program [message #1749190 is a reply to message #1749179] Fri, 02 December 2016 20:49 Go to previous message
David VavraFriend
Messages: 1412
Registered: October 2012
Senior Member
Glad you got it working.

I don't think there's any way to tie the two consoles together -- at lest not easily or without redesign of your code.
You can have two consoles displayed at the same time though.
Just add another console view.

In my experience, trying to debug and get good timing are mutually exclusive goals.
I would use the debugger to verify that the actions are correct then work on the tiiming some other way.
Maybe with trace messages. YMMV

Good luck!

[Updated on: Fri, 02 December 2016 21:02]

Report message to a moderator

Previous Topic:How to use a C library project from another C project
Next Topic:Multi-process debugging not hitting breakpoints
Goto Forum:
  


Current Time: Sat Jan 22 07:51:42 GMT 2022

Powered by FUDForum. Page generated in 0.05213 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top