[PATCH] D17457: [VFS] Add 'overlay-relative' field to YAML files

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 19 10:45:27 PST 2016


bruno created this revision.
bruno added reviewers: benlangmuir, bogner.
bruno added subscribers: cfe-commits, dexonsmith.

The VFS overlay mapping between virtual paths and real paths is done through
the 'external-contents' entries in YAML files, which contains hardcoded paths
to the real files.

When a module compilation crashes, headers are dumped into <name>.cache/vfs
directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script
generated for reproduction uses -ivfsoverlay pointing to file to gather the
mapping between virtual paths and files inside <name>.cache/vfs. Currently, we
are only capable of reproducing such crashes in the same machine as they
happen, because of the hardcoded paths in 'external-contents'.

To be able to reproduce a crash in another machine, this patch introduces a new
option in the VFS yaml file called 'overlay-relative'. When it's equal to
'true' it means that the provided path to the YAML file through the
-ivfsoverlay option should also be used to prefix the final path for every
'external-contents'.

Example, given the invocation snippet "... -ivfsoverlay
<name>.cache/vfs/vfs.yaml" and the following entry in the yaml file:

"overlay-relative": "true",
"roots": [
...
  "type": "directory",
  "name": "/usr/include",
  "contents": [
    {
      "type": "file",
      "name": "stdio.h",
      "external-contents": "/usr/include/stdio.h"
    },
...

Here, a file manager request for virtual "/usr/include/stdio.h", that will map
into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h.

This is a useful feature for debugging module crashes in machines other than
the one where the error happened.

This patch depends on http://reviews.llvm.org/D17104.

http://reviews.llvm.org/D17457

Files:
  include/clang/Basic/VirtualFileSystem.h
  lib/Basic/VirtualFileSystem.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/ModuleDependencyCollector.cpp
  test/Modules/crash-vfs-path-symlink-component.m
  test/Modules/crash-vfs-path-traversal.m
  test/Modules/crash-vfs-relative-overlay.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17457.48515.patch
Type: text/x-patch
Size: 17784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160219/f2682b00/attachment-0001.bin>


More information about the cfe-commits mailing list