This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Add a `(not loaded) ` prefix to placeholder object filename to indicate they are not loaded.
AcceptedPublic

Authored by zequanwu on Oct 26 2022, 2:51 PM.

Details

Reviewers
labath
Summary

Minidump may contain modules that are created from placeholder object files if
they are not loaded. Add a (not loaded) prefix to placeholder object file name
to indicate they are not loaded.

Diff Detail

Event Timeline

zequanwu created this revision.Oct 26 2022, 2:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2022, 2:51 PM
zequanwu requested review of this revision.Oct 26 2022, 2:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 26 2022, 2:51 PM

It's a good idea, but this is a pretty bad layering violation. The "placeholder" object files aren't even first class plugins (though I think they should be -- as the concept is useful in other situations as well), but an internal detail of the minidump process plugin.

Ideally, we would do this from inside the minidump code, perhaps by modifying the name (file spec) of the fake object file?

A test would be nice as well.

zequanwu updated this revision to Diff 471337.Oct 27 2022, 5:21 PM
  • Modify file spec of placeholder object file.
  • Change it to "(not loaded)" which is more obvious than "(placeholder)".
  • Use prefix so the file extension is preseved.
zequanwu retitled this revision from [LLDB] Mark placeholder modules in `target module list` output. to [LLDB] Add a `(not loaded) ` prefix to placeholder object filename to indicate they are not loaded..Oct 27 2022, 5:23 PM
zequanwu edited the summary of this revision. (Show Details)
labath accepted this revision.Oct 28 2022, 1:14 AM

I'm not entirely sold on the string "(not loaded)". Maybe would be ok for the user, but to me it sounds extremely weird, because the main reason we are creating this module is so that we can pretend there is something "loaded" at the given address. If you don't like "placeholder", what would you say to "(artificial)" ?

lldb/test/Shell/Minidump/modules-not-loaded.yaml
7 ↗(On Diff #471337)
This revision is now accepted and ready to land.Oct 28 2022, 1:14 AM

Actually just changing the module's file spec make image dump symtab /tmp/test/linux-x86_64 to fail because the extra string. I still prefer the previous version though PlaceholderObjectFile isn't first class plugin as we just checking the plugin name.

labath added a comment.Nov 3 2022, 7:37 AM

That's exactly why i don't like this stringly typed GetPluginName API. If you had to write isa<ProcessMinidump::Placeholder>(objfile), or even just objfile->GetPluginName()==ProcessMinidump::Placeholder::GetPluginNameStatic() , you'll be a lot less likely to think that you can get away with it.

You weren't around then, but back when this "plugin" was introduced, I made the point that the functionality is not really minidump-specific -- and it was dismissed because it was "experimental". At some point, I think it stopped being that.

Since this is essentially adding support for the placeholder concept into the generic code, why not just admit that, and move the code somewhere else. That'll open up a lot of other cool features as well.

I expect that when the user starts seeing this "placeholder" annotation, his next request will be like "oh, but I know where to find that file -- why don't you let me load it?". Well, if we had first class support for this, we could add a command that does just that.