[lldb-dev] postmortem debugging (core/minidump) & modules

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Tue Apr 10 11:56:58 PDT 2018

> On Apr 10, 2018, at 11:32 AM, Leonard Mosescu via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> I'm looking at how the LLDB minidump reader creates the list of modules:
> void ProcessMinidump::ReadModuleList() {
> ...
>     const auto file_spec = FileSpec(name.getValue(), true);
>     ModuleSpec module_spec = file_spec;
>     Status error;
>     lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec, &error);
>     if (!module_sp || error.Fail()) {
>       continue;
>     }
> ...
> }
> LLDB currently will insist on finding a local image for the module, which is usually not the case for postmortem debugging on machines different than the the the one where the minidump was created.
> I don't see an obvious way to model modules which have no local image (which is still different than the remote scenario where there is a remote module image), am I missing anything?

The lldb_private::Platform is responsible for digging up any binaries for a given target, so this code should be grabbing the platform from the target and using that to get the shared module. That way if you create a target that is a minidump on a different system (macOS, linux, etc), the platform would be remote-windows. 

That being said "ModuleSpec" should be filled in with more than just the path. It should specify the UUID info from the mini dump that specifies exactly which version the file that you want. That way if the file on the current system exists, it won't return it unless the path matches. I assume the mini dump has each module's UUID information? If so, set it. If not the file format assumes you will be running the dumping the same machine and it should be updated to include this information. The platform code can then use this UUID info to possible go and fetch the right version from a UUID database, or how ever the platform wants to provide access to certain binaries. At Apple, we call "dsymForUUID <UUID>" which, if global defaults were set to point at Apple's build servers, would go out and download the correct file for us and store it locally in a cache for future use.

So fill in the UUID in ModuleSpec and modify the Platform::GetSharedModule() for your platform to do the right thing is the correct way to go. ProcessMinidump should switch over to using the Platform::GetSharedModule() instead of the target one, or use it after the target one if the target returns an invalid module.

Let me know if you have any more questions,


> Thanks!
> Lemo.
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180410/88a06a10/attachment.html>

More information about the lldb-dev mailing list