1
votes

I am attempting to debug my project in GNAT's GPS IDE. Every time I chose Debug->Initialize->"program name" the gui of GPS switches to that of the debug GUI, and then an error pops up with "could not initialize the debugger".

The two possible solutions I have found are that gdb.exe may be out of date and it suggests running it outside of GPS, which it does run fine. The other possible solution is to make sure the -g tags are applied when building the project, as those are necessary for gnatlink and gcc for debugging. It also states that the -g tag is applied to a new project by default, unless you have specifically removed it. I doubt I have, but I am not sure where I would check that to make sure it is still included.

The other odd thing is that the tutorial that comes with GPS that runs through how to build and debug your code works perfectly fine when I initialize debugging on it. That tutorial I am referring to can be accessed through Help->GPS->GNAT Programming Studio Tutorial. It references the program 'sdc' which comes in the GNAT/2012/share/examples/gps/tutorial directory.

Any ideas on what I am doing incorrectly, since the error isnt very helpful?

Thanks!

1
Make sure you have set a Main in the project file: for Main use ("foo.adb"); - egilhh

1 Answers

0
votes

At first it sorta sounds like a path problem, but if you're able to run a debugger tutorial that's probably not the case.

The behavior you're seeing if the program isn't compiled with the debug (-g) flag doesn't quite match my experience, but let's go ahead and check/set the debug flag anyway.

Select Project/Edit Project_Properties

Click the Switches tab.

Click the Gnatmake tab.

Check "Debug information". Note that a -g now shows up in the text box at the bottom of the tab page. Click OK on the dialog.

Recompile your code so that it uses the changed option. Select Build/Clean/Clean All, and OK any dialog that pops up.

Then do your build (you can just press F4).