Debugging DLL CMake project


  • We are migrating an sln project to CMake and we are running into debugging problems. The project output is a .dll but the solution does not contain the executable project which uses the .dll. This executable is a pre-installed test tool. This is also the tool which should be started when debugging the .dll. We have the debugger working in the .vcxproj but we cannot get the .vs/launch.vs.json file to properly start the executable and attach to it when starting the debugger. Our current .vcxproj debugger setup is:

    Configuration Properties -> Debugging:
    Command:                         K:\$(USERNAME)\RemoteDebug\SomeProgram\SomeProgram.exe
    Working Directory:             K:\$(USERNAME)\RemoteDebug\SomeProgram
    Attach:                               no
    Debugger type:                  Auto
    Environment:                     <unset>
    Merge environment:          Yes
    SQL Debugging:                 No
    Amp Default Accelerator:    WARP software accelerator

    The build creates a SomeProgram.dll which is used by SomeProgram.exe.
    I have tried a lot of configs in launch.vs.json. I used automatically generated configs, manually written configs. I even tried configs from Visual Studio code. But nothing works well enough to properly start SomeProgram.exe.

    I also cannot really find proper documentation on the launch file. How can I properly set this up?

    Thursday, August 2, 2018 7:54 AM

All replies

  • CMake project in Visual studio actually creates a hidden VS project.

    Find it, open in VS in a normal way (without any json) and enjoy debugging.

    Or, start the main program in any way, then attach the VS debugger to it.

    -- pa

    Thursday, August 2, 2018 1:57 PM
  • yeah.. I already figured this out :-). But that's more of a workaround. There should be a way to do this in a portable way without having to explain this to EVERY SW developer in my team. I woud assume this is supported as it is a normal feature of VS since like VS2010 or so.
    Wednesday, August 8, 2018 7:45 PM
  • Is there no-one AT ALL who has ever done this.
    Thursday, August 16, 2018 7:07 PM