charles-zablit wrote:

> I don't think that this is a good idea. This enables long paths at the cost 
> of valid image enumeration. `EnumProcessModulesEx` is not thread safe and 
> that means that the process may have changed its module list _during_ 
> iteration.
> 
> While ToolHlp32 has its own set of issues, you are certain that the snapshot 
> itself is valid.
> 
> I think that you should instead address `FileSystem::Resolve` to use 
> `GetModuleHandleExW` with `GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 
> GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT` with the `me.modBaseAddr` and 
> then use `GetFinalPathNameByHandleW` with `VOLUME_NAME_NT | 
> FILE_NAME_NORMALIZED` to get the long path name.

We can't use `GetModuleHandleExW` because it only resolves modules loaded by 
lldb, not the debuggee:

> The module must have been loaded by the calling process.

https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulehandleexw

https://github.com/llvm/llvm-project/pull/206117
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to