Question 2: Generally C++ compiled as a code is being compiled as static library, and I doubt that you can attach to it with
Visual studio - we need probably .dll + .pdb to be loaded dynamically (shared object / dynamic library).
And this leads to Question 3: Can .pdb’s be produced by clang ?
.pdb as file format probably exists in Visual studio, but I’m not sure if clang is capable of producing Visual studio compatible .pdb file format. I saw some options to switch to CL.exe (Visual studio compiler), I guess it could be one alternative as well.
Question 1: there’s no magic “passing args t clang”; cling needs to know what argument that is, because things work differently for cling and clang - e.g. because cling is using llvm’s JIT while clang is not.
I don’t know the answer to your questions 2 and 3 - these are really questions for llvm’s (Orc)JIT. Maybe you could ask at the llvm mailing list? The question is whether MSVC has an interface for JITed code, to tell the debugger about these new symbols. This was added to gdb (and AFAIK re-used by lldb) - but I don’t know about MSVC.
Said that - I never got around to enabling the debugger interface for cling either, not even for gdb :frowning. A contribution here would be super welcome!
I guess there could be plenty of different ways to attach to debugger - debugger itself could attach to c++ script on fly - but that would require some interoperability between script host and debugger. I would propose to start from something that should work already - c++ code is compiled to .dll + .pdb, and .dll gets executed. Is it possible with current cling, which options I can use to compile to dll ?