[Lldb-commits] [PATCH] D126657: [lldb] Fix loading DLL from some ramdisk on Windows

Alvin Wong via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 30 08:27:09 PDT 2022


alvinhochun created this revision.
Herald added a subscriber: mstorsjo.
Herald added a project: All.
alvinhochun requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The WinAPI `GetFinalPathNameByHandle` is used to retrieve the DLL file
name from the HANDLE provided to `LOAD_DLL_DEBUG_EVENT` in the debug
loop. When this API fails, lldb will simply ignore that module.

Certain ramdisk (e.g. ImDisk) does not work with this API, which means
it is impossible to use lldb to debug a process which loads DLLs located
on this type of ramdisk. In order to make this work, we need to use a
fallback routine which involves creating a file mapping, using
`GetMappedFileName` to get a device path, then substitutes the device
path with its drive letter.

References:

- https://developercommunity.visualstudio.com/t/cannot-debug-program-when-compiled-to-ram-drive/43004#T-N109926
- https://github.com/jrfonseca/drmingw/issues/65
- https://docs.microsoft.com/en-us/windows/win32/memory/obtaining-a-file-name-from-a-file-handle


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126657

Files:
  lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126657.432931.patch
Type: text/x-patch
Size: 4461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220530/993acd25/attachment.bin>


More information about the lldb-commits mailing list