brianmc95 / OpenCV2X

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
37 stars 15 forks source link

Cannot Debug in CLion #22

Closed buraksenkus closed 3 years ago

buraksenkus commented 3 years ago

Hi,

I have completed all steps in the documentation. I can run simulations from terminal without an error.

Also I can run from CLion if I don't change Before launch section. In that way, I cannot use breakpoint functionality.

resim

If I change Before launch section as described in the documentation like this

resim

I'm getting following error and simulation does not start.

resim

What is the problem? Do I need to change anything in build_inet, build_veins etc.? Thank you in advance!

brianmc95 commented 3 years ago

Hi @buraksenkus,

Sorry for the delay in response with this, as for the issue I think it's mainly due to different versions of Clion changing how this function works which is frustrating. Though there is a workaround you can use to get it working.

If you remove the build_inet, build_veins and build_simulte steps and instead whenever a change is made you use the build command (hammer icon) to build the target first this will launch the build stages for all the projects and complete with a command line gdb run (which you can use but I don't personally). At this stage you can kill this build and simply hit the debug button, it won't build again but it will launch a debug run with all CLions functionality for doing so which should be what you need ultimately. You just need to remember that it will require you to use the build hammer everytime you make a change.

You can see the below for a rough idea of what you should see when this is done. build-debug

If you get stuck then please feel free to reply here and I'll try help out.

buraksenkus commented 3 years ago

Hi again @brianmc95, thank you very much for your detailed answer. It is very nice to see that you are really trying to help.

Unfortunately, although I did it the way you said, I still did not succeed.

I clicked build hammer, build has been completed successfully till gdb prompt (As you have shown in figure). Then I cancelled build operation.

Then, I clicked bug symbol and gdb prompted again. At that moment, when I type run, simulation starts but CLion breakpoints are not recognized. But as I understood from your explanation, gdb should not be started when I click bug symbol.

To summarize, gdb starts every time whether I click build hammer or bug symbol.

Further details about my environment:

Thanks!

brianmc95 commented 3 years ago

No worries happy to help where I can.

Though that is curious on my side I am also on Ubuntu 18.04 though my CLion is a little older 2019.3.3 still I think possibly it's not fully down to versions and we might just have something configured incorrectly possibly. The main thing is to check do you have anything in the before launch window? It should be empty to builds or anything of the sort. I'll share one of mine below it should be more or less the same bar different locations for the libraries and target but yours should look the same overall.

github_screenshot

buraksenkus commented 3 years ago

Oh, everything is clear right now. My before launch window was containing Build rule. I thought that it is necessary to run scenario. It was probably my misunderstanding.

In conclusion, I've resolved the problem by clearing everything in before launch window. Now, I can debug by using CLion.

Thank you very much for your help! Issue can be closed.

Note: I think the work done on this framework is very valuable and I try to use it in my own work. I have few questions in my mind about the capabilities of this framework. Although this is not an issue, I would like to open a new issue to get your opinion about them. I would be very grateful if you could help with that too!

brianmc95 commented 3 years ago

Hi @buraksenkus great glad you got up and running that is great I will close this issue.

Thanks that's very much appreciated, if you have questions I am more than happy to answer as best I can but would you mind just sending them to my email. It just makes a little more sense to work through that than on the github issue when it's not necessarily a bug or a problem with the model.