We are using custom language say FileName.xyz which on precompilation preprocessing temporarily generates C++ files, which in turn is built to an executable (and PDB for temporary C++ files symbols).
We want to Debug this Filename.xyz using generated exe and PDBs.
The difference between FileName.xyz and generated FileName.cpp is that
CPP file has additional code #include etc. in the beginning so 1st stmt in xyz may appear at 11th line in cpp
to map line differences and filename at line 10th in FileName.cpp it puts
#line 1 FileName.xyzis used to set __LINE and __FILE before 1st statement.also each "custom language statement;" is inline replaced in CPP with their function definition with "n-comma separated statements;" (same way as #define functions get replaced during pre-processing).
In Visual Studio 2019:
- How Can I debug FileName.xyz (place brakepoint, check variable values/callstack, F9, F10, F11, Shift+F11) using standard C++ debugger with exe and generated pdbs for C++ file?
- I need some explicit mapping for .xyz file to debugger, and .xyz to .cpp pdbs, but what exactly not sure and how?
- do I need Custom debugger for this? if yes, what minimum steps I can perform, MSDN says I need to implement ATL component and implement lots of interfaces.
I've even asked it at MSDN ( https://learn.microsoft.com/en-us/answers/questions/1190586/how-to-debugger-for-custom-language-generating-c-d ) Any help would be appreciated.
Unless you want to debug the generated C++ directly, you have to build your own debugger/translator that sits between a c++ debugger and an api (your custom debugger's api).
I think there is an API for using MSVC from C++ if not you could use the LLDB debugger as a library or just parse the stdio. you don't have to use MinGw's clang, clang-cl will work fine on windows. its not that hard to implement assuming you are adding the #line correctly and by correctly I mean the mapping of your custom language source and the c++ source say main.awesome::50 -> tmp.cpp::500 #line 50 "main.awesome".
last option would be to make your custom language output LLVM IR, with that you have access to LLDB directly and pretty much instant compile times (depending on how complex your language is).