How to debug a clang plugin with Visual Studio?

Hello,

has anybody experience with debugging a clang plugin with Visual Studio?

Thanks

Marcel

Dear community,

to be more specific:

clang.exe spanws another process of it self and then loads the plugin dll.

This is a real pain to debug. Is there a clang option to ease debugging of plugins?

Any idea appreciated...

Thanks

Marcel

Run whatever command you normally run, but with an extra "-v". Clang will print out what command line to use for the sub-processes.

When debugging, use the command for the subprocess rather than normal top level command.

I've not debugged plugins specifically, but in general, if you invoke clang
with -v or -###, it should give you a clang -cc1 command. You can debug that
command instead of your original one, and it should avoid any further process
spawning (or at least it does when plugins aren't involved).

    Dear community,
    
    to be more specific:
    
    clang.exe spanws another process of it self and then loads the plugin dll.
    
    This is a real pain to debug. Is there a clang option to ease debugging
    of plugins?
    
    Any idea appreciated...
    
    Thanks
    
    Marcel

Most debuggers have a setting as to whether to follow forks or not. GDB for example has 'set follow-fork-mode ...'

MVSC has this plugin available as a power tool to do this: Introducing the Child Process Debugging Power Tool - Azure DevOps Blog

Alternatively, you can do "clang <compile command> -### "to see the command handed to that child process. You can then debug THAT instead.

Your proposed solution with "-v" or "-###" works fine.

Thanks for your help

Marcel