<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Ahh. So then hopefully it extracts the triple from the mini dump file and sets it correctly which gets us right platform set?</span><br></blockquote><div><br></div><div>Yes, this part seems to be working fine.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Just to make sure I understand:  we need a file with the debug info (e.g., a PDB), but we shouldn't need the actual executable/shared library/DLL file except on platforms where the debug info is embedded in the binary.  Right?</span><br></blockquote><div><br></div><div>As far as I can tell, LLDB today does need the binary image (executable/shared library). </div><div><br></div><div>The minidump has a list of modules and memory ranges, but it's a bit tricky to map that to LLDB modules and sections: I did a quick experiment with placeholder modules, but the easy patch doesn't seem it gets us very far (ex. without an image file to parse we don't get the sections)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 10, 2018 at 3:31 PM, Adrian McCarthy <span dir="ltr"><<a href="mailto:amccarth@google.com" target="_blank">amccarth@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Apr 10, 2018 at 3:12 PM, Greg Clayton via lldb-dev <span dir="ltr"><<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><br><div><span><br><blockquote type="cite"><div>On Apr 10, 2018, at 2:30 PM, Leonard Mosescu <<a href="mailto:mosescu@google.com" target="_blank">mosescu@google.com</a>> wrote:</div><br class="m_6774156893467152084m_-745941620240898344Apple-interchange-newline"><div><div dir="ltr">Thanks Greg! It makes sense and looking at the code it's already implemented along those lines: Target::GetSharedModule() defaults to Platform::GetSharedModule() if the initial attempt to get the module fails.<div><br></div><div>The part I'd like to understand is if there's a precedence for modules which don't have any accessible file image (local or remote). Is everything expected to work if we create placeholder Module & ModuleSpecs?</div></div></div></blockquote><div><br></div></span>No, it is up to the platform to be able to track down files that don't exist locally. Most platforms do nothing and will return an empty module shared pointer. We need a file to use or we will just not have any info.</div></div></blockquote><div><br></div></span><div>Just to make sure I understand:  we need a file with the debug info (e.g., a PDB), but we shouldn't need the actual executable/shared library/DLL file except on platforms where the debug info is embedded in the binary.  Right?</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><span><br><blockquote type="cite"><div><div dir="ltr"><div>(it seems that the current implementation assumes that we have a file somewhere. Ex. even creating a Module from a ModuleSpec will still try to map the source ModuleSpec to some files).</div></div></div></blockquote><div><br></div></span>Yes. Right now with only the path, we will load the file if it exists on disk since no UUID was specified in the ModuleSpec which is really bad and can lead to incorrect info being displayed.</div><div><span><br><blockquote type="cite"><div><div dir="ltr"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">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.</span></blockquote><div><br></div><div>Just curious, what happens if the download fails? Is the corresponding module skipped? (is this strictly about the dSYMs or the same mechanism works for the Mach-O binaries?)</div></div></div></blockquote><div><br></div></span>It will block until the module is downloaded, and it can and often does fail and returns an error that can be displayed. When we need to download large debug info files, it creates delays with no user interaction and often leads to people wondering what is going on. Not optimal, but it does work if you wait for it.</div><div><span><br><blockquote type="cite"><div><div dir="ltr"><div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">That way if you create a target that is a minidump on a different system (macOS, linux, etc), the platform would be remote-windows. </span><br></blockquote><div><br></div><div>Not sure if I understand this one, core & minidumps are currently not using any of the the remote debugging machinery, right? Are you suggesting changing that?</div></div></div></div></blockquote><div><br></div></span><div>No. Each binary knows how to tell LLDB what target triple it is. PECOFF files will always map to the host windows platform or remote-windows when not on a Windows host computer. If you say "file a.out" and give it a PECOFF file, just do "target list" and see the platform was selected for you. Since the Minidump is specific to Windows, it should select the right platform for you. If it doesn't we will need to fix that.</div><div><br></div><div>Does the mini dump format have the UUID or some sort of checksum of the file in it?</div><div><div class="m_6774156893467152084h5"><div><br></div><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 10, 2018 at 11:56 AM, Greg Clayton <span dir="ltr"><<a href="mailto:clayborg@gmail.com" target="_blank">clayborg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><br><div><span><br><blockquote type="cite"><div>On Apr 10, 2018, at 11:32 AM, Leonard Mosescu via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="m_6774156893467152084m_-745941620240898344m_5255565185019921136Apple-interchange-newline"><div><div dir="ltr">I'm looking at how the LLDB minidump reader creates the list of modules:<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><font face="monospace, monospace"><span style="white-space:pre-wrap;color:rgb(0,0,255)">void</span><span style="white-space:pre-wrap"> </span><span style="white-space:pre-wrap;color:rgb(121,94,38)">ProcessMinidump::ReadModuleLis<wbr>t</span><span style="white-space:pre-wrap">() {</span></font><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><font face="monospace, monospace">...</font></div></div></blockquote><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><font face="monospace, monospace"><span>    </span><span style="color:rgb(0,0,255)">const</span><span> </span><span style="color:rgb(0,0,255)">auto</span><span> file_spec </span><span>=</span><span> </span><span style="color:rgb(121,94,38)">FileSpec</span><span>(name.</span><span style="color:rgb(121,94,38)">getValue</span><span>(), </span><span style="color:rgb(0,0,255)">true</span><span>);</span></font></div></div></div><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><font face="monospace, monospace"><span>    ModuleSpec module_spec </span><span>=</span><span> file_spec;</span></font></div></div></div><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><span><font face="monospace, monospace">    Status error;</font></span></div></div></div><div><div style="font-weight:normal;line-height:18px;white-space:pre-wrap"><div><font face="monospace, monospace"><span><span style="background-color:rgb(255,255,255)">    </span><span style="background-color:rgb(255,242,204)">lldb::ModuleSP module_sp </span></span><span style="background-color:rgb(255,242,204)"><span>=</span><span> </span><span style="color:rgb(121,94,38)">GetTarget</span><span>().</span><span style="color:rgb(121,94,38)">GetSharedModule</span><span>(mo<wbr>dule_spec, </span><span>&</span><span>error);</span></span></font></div></div></div><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><font face="monospace, monospace"><span>    </span><span style="color:rgb(175,0,219)">if</span><span> (</span><span>!</span><span>module_sp </span><span>||</span><span> error.</span><span style="color:rgb(121,94,38)">Fail</span><span>()) {</span></font></div></div></div><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><font face="monospace, monospace"><span>      </span><span style="color:rgb(175,0,219)">continue</span><span>;</span></font></div></div></div><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><span><font face="monospace, monospace">    }</font></span></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><span><font face="monospace, monospace">...</font></span></div></div></div></blockquote><div><div style="background-color:rgb(255,255,255);font-weight:normal;line-height:18px;white-space:pre-wrap"><div><font face="monospace, monospace">}</font></div></div></div></blockquote><div><div style="background-color:rgb(255,255,255);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-weight:normal;font-size:13px;line-height:18px;white-space:pre-wrap"><div></div></div></div><div><br></div><div>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.</div><div><br></div><div>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?<br></div></div></div></blockquote><div><br></div></span>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. </div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Let me know if you have any more questions,</div><div><br></div><div>Greg</div><div><br><blockquote type="cite"><div><div dir="ltr"><div><br></div><div>Thanks!</div><div>Lemo.</div><div><br></div><div><br></div><div><br></div></div>
______________________________<wbr>_________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/lldb-dev</a><br></div></blockquote></div><br></div></blockquote></div><br></div>
</div></blockquote></div></div></div><br></div><br>______________________________<wbr>_________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>