Search code examples
adagnat-gpsada2012

Ada 2012 and the GNAT GPS IDE Debugger Can't Find Source File


I'm working with a simple hello world single .adb file program in Ada 2012 using the GPS IDE under Windows 7/64. If I keep all the object and source files together everything works. I did have to go to the project properties Switches tab and select the Ada tab and enable the 'Debug Information' checkbox.

Now I want to organize my project a little better and put the object files in their own directory. I used the project properties Objects tab and changed the setting from . to ojb. I can build and run. Now when I go to debug and click on a line in hello.adb I get the "No source file named hello.adb. I'm guessing that it's looking in the obj directory. I tried issuing a set directory command and gave the absolute path to the parent folder. A subsequent show directories command shows that the folder containing my hello.adb file is now in the path but still no joy. I can no longer set a breakpoint. This doesn't seem like that unusual an operation, I suspect there is another higher level way to specify the source path for the debugger. Anyone know what it is, or any tips on getting this to work?


Solution

  • GPS itself does not do the debugging. It spawns a command line debugger named gdb for that purpose. You could try running GPS with --traceon=GVD.OUT (or alternatively, and often simpler on Windows, change the %USERPROFILE%.gps\traces.cfg file and add "GVD.OUT=yes"). This will log all communications between GPS and gdb in %USERPROFILE%.gps\log.*, which might be helpful in understanding why gdb is not outputting the correct full path for the files. Please also double-check that "-g" is indeed passed to the compiler (perhaps after removing all files from obj)