[PDB] [JIT] Write to PDB file when COFFObjectFile is emitted by JIT

Is it possible to write a .pdb file containing the debug info stored in a COFFObjectFile once the NotifyObjectEmitted is triggered by the JIT compiler ?

Hi Vivien,

I’m not familiar with Windows development, but I believe you could dump the object file to disk then run LINK.EXE to produce the PDB. Alternatively, I think LLD can also produce PDB files (Rui – is that right?), in which case you may be able to use that.

Is the aim to be able to debug JIT’d code? Which debugger do you plan to use?

– Lang.

Hi Vivien,

I’m not familiar with Windows development, but I believe you could dump the object file to disk then run LINK.EXE to produce the PDB. Alternatively, I think LLD can also produce PDB files (Rui – is that right?), in which case you may be able to use that.

Yes, lld can produce PDB files.

Hi, thanks for the answers, i tried to use LINK.EXE to produce a pdb, but unfortunately, it produces an empty pdb (i have debug symbols in the dumped .obj because I can see them with PEViewer).
It is probably because i have undefined symbols, which is logical because i’m dumping machine code which points to running native code. I still dont understand why LINK.EXE is not able to produce a valid pdb for my valid symbols even if all symbols referenced are not resolved.
Do you think LLD would do the same if the .obj is not ‘valid’ by itself alone ?

I’m sorry but I don’t think I understand the question. But if you can’t produce a pdb using MSVC, it is hard to imagine that only lld can do, unless MSVC linker has a bug.

My .obj has debug infos and is valid, but is not really linkable by itself (unresolved symbols). LINK.EXE produces a .pdb but this pdb seems to have only a header (i tried a tool which tells me that the pdb has no page). I was just wondering if LLD would do a better job than outputing an “empty” PDB, but if you don’t know, I will test and see. Thanks.