This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add image dump pcm-info command
ClosedPublic

Authored by kastiglione on Jul 10 2022, 3:58 PM.

Details

Summary

Add pcm-info to the target module dump subcommands.

This dump command shows information about clang .pcm files. This command
effectively runs clang -module-file-info and produces identical output.

The .pcm file format is tightly coupled to the clang version. The clang
embedded in lldb is not guaranteed to match the version of the clang executable
available on the local system.

There have been times when I've needed to view the details about a .pcm file
produced by lldb's embedded clang, but because the clang executable was a
slightly different version, the -module-file-info invocation failed. With
this command, users can inspect .pcm files generated by lldb too.

Diff Detail

Event Timeline

kastiglione created this revision.Jul 10 2022, 3:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2022, 3:58 PM
kastiglione requested review of this revision.Jul 10 2022, 3:58 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 10 2022, 3:58 PM

add @skipUnlessDarwin

remove commented-out code in test

kastiglione retitled this revision from [lldb] Add image dump pcm command to [lldb] Add image dump pcm-info command.Jul 10 2022, 4:06 PM
mib accepted this revision.Jul 11 2022, 10:34 AM

LGTM with a comment

lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
38

Left over ?

This revision is now accepted and ready to land.Jul 11 2022, 10:34 AM
kastiglione added inline comments.
lldb/test/API/commands/target/dump-pcm-info/TestDumpPCMInfo.py
38

yep thanks!

[bikeshedding] pcm-info seems a little odd. Do we have other command that end with -info? target modules dump already sounds like you're about to dump some kind of "info". What about just pcm? [/bikeshedding]

@JDevlieghere I had it as dump pcm at first, but switched it to pcm-info for two reasons

  1. it doesn't dump the whole pcm, the actual ast itself is not dumped
  2. to match the clang flag -module-file-info

I agree that pcm is better, but I was worried it would be misunderstood as dumping more than it actually does.

I think -info here is more like -metadata but shorter.

One option is to name it back to pcm, and update the help description to be more descriptive.

added error handling

simplify error handling by checking for .pcm extension

This revision was landed with ongoing or failed builds.Jul 13 2022, 4:57 PM
This revision was automatically updated to reflect the committed changes.