On Sun Feb 25 19:44:17 2024 +0000, Jacek Caban wrote:
While `_r_debug` itself seems good to allow the debugger to hook Unix libs, I'm not sure if it's the best choice for PE files. The whole `wine_r_debug` thing and ntdll looking into the preloader does not seem appealing to me. Do we need this for PE files anyway? There is also an interface for JIT code [1] that looks similar, but simpler, maybe we could use that in the second commit instead. [1] https://sourceware.org/gdb/current/onlinedocs/gdb.html/Declarations.html#Dec...
The interface for JIT code is meant for block of code without any corresponding file on disk. It requires to load the debug info in memory, and attach it to the debugger notifications. It doesn't even support passing the module file name.
This doesn't seem like a good fit to me, as we would need to find and load the debug info ourselves. On the other hand, using `_r_debug` would let us benefit from all the standard mechanisms. For instance, using `_r_debug` Gdb can find the debug link and load split debug info directly. Or even read the build-id, and lookup the PE file debug info in the systems debug info database.