I was asked an interesting question on a github issue about rust backtraces: is there an API in Cygwin to get a list of loaded modules? I know the info is there in the dlls list, but I don't see an API to get at it.
The question was in regards to whether rust should be using toolhelp32 on Cygwin as it does on Windows to get a list of modules, load addresses, and sizes to then use to identify from which module addresses in a backtrace are from. It appears the general non-Windows case uses dl_iterate_phdr to do this, but it also appears that this function is pretty ELF-specific. It feels like most of the data could be filled out from Windows APIs, but I'm not sure it makes sense to. I recommended to them to use cygwin_conv_path(CCP_WIN_W_TO_POSIX, ...) on the szExePath rather than WideCharToMultiByte(CP_UTF8), or to pass the hModule to dlinfo to get the name, or to inspect /proc/self/maps (which the non-Windows path also uses in concert with dl_iterate_phdr). -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple