[llvm] r336793 - Use debug-prefix-map for AT_NAME

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 11:14:18 PDT 2018


Hello Jonas,

This commit broke one of our builders:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/18383
. . .
Failing Tests (1):
    LLVM :: MC/ELF/debug-prefix-map.s

Please have a look?
The builder was already red and did not send notifications.

Also at least one more builder is affected:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10902

Thanks

Galina

On Wed, Jul 11, 2018 at 5:30 AM, Jonas Devlieghere via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: jdevlieghere
> Date: Wed Jul 11 05:30:35 2018
> New Revision: 336793
>
> URL: http://llvm.org/viewvc/llvm-project?rev=336793&view=rev
> Log:
> Use debug-prefix-map for AT_NAME
>
> AT_NAME was being emitted before the directory paths were remapped. This
> ensures that all paths are remapped before anything is emitted.
>
> An additional test case has been added.
>
> Note that this only works if the replacement string is an absolute path.
> If not, then AT_decl_file believes the new path is a relative path, and
> joins that path with the compilation directory. I do not know of a good
> way to resolve this.
>
> Patch by: Siddhartha Bagaria (starsid)
>
> Differential revision: https://reviews.llvm.org/D49169
>
> Modified:
>     llvm/trunk/include/llvm/MC/MCContext.h
>     llvm/trunk/include/llvm/MC/MCDwarf.h
>     llvm/trunk/lib/MC/MCContext.cpp
>     llvm/trunk/lib/MC/MCDwarf.cpp
>     llvm/trunk/lib/MC/MCObjectStreamer.cpp
>     llvm/trunk/test/MC/ELF/debug-prefix-map.s
>
> Modified: llvm/trunk/include/llvm/MC/MCContext.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/MC/MCContext.h?rev=336793&r1=336792&r2=336793&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/MC/MCContext.h (original)
> +++ llvm/trunk/include/llvm/MC/MCContext.h Wed Jul 11 05:30:35 2018
> @@ -502,11 +502,8 @@ namespace llvm {
>      /// Add an entry to the debug prefix map.
>      void addDebugPrefixMapEntry(const std::string &From, const
> std::string &To);
>
> -    // Remaps the given path in-place as per the debug prefix map.
> -    void RemapDebugPath(std::string *Path);
> -
> -    // Remaps the compilation dir as per the debug prefix map.
> -    void RemapCompilationDir();
> +    // Remaps all debug directory paths in-place as per the debug prefix
> map.
> +    void RemapDebugPaths();
>
>      /// Get the main file name for use in error messages and debug
>      /// info. This can be set to ensure we've got the correct file name
>
> Modified: llvm/trunk/include/llvm/MC/MCDwarf.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/
> llvm/MC/MCDwarf.h?rev=336793&r1=336792&r2=336793&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/MC/MCDwarf.h (original)
> +++ llvm/trunk/include/llvm/MC/MCDwarf.h Wed Jul 11 05:30:35 2018
> @@ -301,8 +301,6 @@ public:
>                                 FileNumber));
>    }
>
> -  void RemapDwarfDirs(MCContext &Context);
> -
>    void setRootFile(StringRef Directory, StringRef FileName,
>                     MD5::MD5Result *Checksum, Optional<StringRef> Source) {
>      Header.CompilationDir = Directory;
>
> Modified: llvm/trunk/lib/MC/MCContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
> MCContext.cpp?rev=336793&r1=336792&r2=336793&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/MC/MCContext.cpp (original)
> +++ llvm/trunk/lib/MC/MCContext.cpp Wed Jul 11 05:30:35 2018
> @@ -540,19 +540,26 @@ void MCContext::addDebugPrefixMapEntry(c
>    DebugPrefixMap.insert(std::make_pair(From, To));
>  }
>
> -void MCContext::RemapDebugPath(std::string *Path) {
> -  for (const auto &Entry : DebugPrefixMap)
> -    if (StringRef(*Path).startswith(Entry.first)) {
> -      std::string RemappedPath =
> -          (Twine(Entry.second) + Path->substr(Entry.first.size())).str();
> -      Path->swap(RemappedPath);
> -    }
> -}
> +void MCContext::RemapDebugPaths() {
> +  const auto &DebugPrefixMap = this->DebugPrefixMap;
> +  const auto RemapDebugPath = [&DebugPrefixMap](std::string &Path) {
> +    for (const auto &Entry : DebugPrefixMap)
> +      if (StringRef(Path).startswith(Entry.first)) {
> +        std::string RemappedPath =
> +            (Twine(Entry.second) + Path.substr(Entry.first.size()
> )).str();
> +        Path.swap(RemappedPath);
> +      }
> +  };
>
> -void MCContext::RemapCompilationDir() {
> +  // Remap compilation directory.
>    std::string CompDir = CompilationDir.str();
> -  RemapDebugPath(&CompDir);
> +  RemapDebugPath(CompDir);
>    CompilationDir = CompDir;
> +
> +  // Remap MCDwarfDirs in all compilation units.
> +  for (auto &CUIDTablePair : MCDwarfLineTablesCUMap)
> +    for (auto &Dir : CUIDTablePair.second.getMCDwarfDirs())
> +      RemapDebugPath(Dir);
>  }
>
>  //===-------------------------------------------------------
> ---------------===//
>
> Modified: llvm/trunk/lib/MC/MCDwarf.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
> MCDwarf.cpp?rev=336793&r1=336792&r2=336793&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)
> +++ llvm/trunk/lib/MC/MCDwarf.cpp Wed Jul 11 05:30:35 2018
> @@ -251,9 +251,7 @@ void MCDwarfLineTable::Emit(MCObjectStre
>
>    // Handle the rest of the Compile Units.
>    for (const auto &CUIDTablePair : LineTables) {
> -    auto &LineTable = context.getMCDwarfLineTable(CUIDTablePair.first);
> -    LineTable.RemapDwarfDirs(MCOS->getContext());
> -    LineTable.EmitCU(MCOS, Params, LineStr);
> +    CUIDTablePair.second.EmitCU(MCOS, Params, LineStr);
>    }
>
>    if (LineStr)
> @@ -634,11 +632,6 @@ MCDwarfLineTableHeader::tryGetFile(Strin
>    return FileNumber;
>  }
>
> -void MCDwarfLineTable::RemapDwarfDirs(MCContext &Context) {
> -  for (auto &Dir : Header.MCDwarfDirs)
> -    Context.RemapDebugPath(&Dir);
> -}
> -
>  /// Utility function to emit the encoding to a streamer.
>  void MCDwarfLineAddr::Emit(MCStreamer *MCOS, MCDwarfLineTableParams
> Params,
>                             int64_t LineDelta, uint64_t AddrDelta) {
>
> Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/
> MCObjectStreamer.cpp?rev=336793&r1=336792&r2=336793&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Wed Jul 11 05:30:35 2018
> @@ -661,8 +661,7 @@ void MCObjectStreamer::EmitFileDirective
>  }
>
>  void MCObjectStreamer::FinishImpl() {
> -  // Remap the compilation directory before emitting.
> -  getContext().RemapCompilationDir();
> +  getContext().RemapDebugPaths();
>
>    // If we are generating dwarf for assembly source files dump out the
> sections.
>    if (getContext().getGenDwarfForAssembly())
>
> Modified: llvm/trunk/test/MC/ELF/debug-prefix-map.s
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/
> ELF/debug-prefix-map.s?rev=336793&r1=336792&r2=336793&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/MC/ELF/debug-prefix-map.s (original)
> +++ llvm/trunk/test/MC/ELF/debug-prefix-map.s Wed Jul 11 05:30:35 2018
> @@ -4,9 +4,13 @@
>
>  // RUN: llvm-mc -triple=x86_64-linux-unknown -g src.s -filetype=obj -o
> out.o
>  // RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck
> --check-prefix=NO_MAP %s
> +
>  // RUN: llvm-mc -triple=x86_64-linux-unknown -g src.s -filetype=obj -o
> out.o -fdebug-prefix-map=%t.foo=src_root
>  // RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck
> --check-prefix=MAP --implicit-check-not ".foo" %s
>
> +// RUN: llvm-mc -triple=x86_64-linux-unknown -g %t.foo/src.s
> -filetype=obj -o out.o -fdebug-prefix-map=%t.foo=/src_root
> +// RUN: llvm-dwarfdump -v -debug-info out.o | FileCheck
> --check-prefix=MAP_ABS --implicit-check-not ".foo" %s
> +
>  f:
>    nop
>
> @@ -15,3 +19,7 @@ f:
>  // MAP: DW_AT_name [DW_FORM_string] ("src.s")
>  // MAP: DW_AT_comp_dir [DW_FORM_string] ("src_root")
>  // MAP: DW_AT_decl_file [DW_FORM_data4] ("src_root{{(/|\\)}}src.s")
> +
> +// MAP_ABS: DW_AT_name [DW_FORM_string] ("{{/|\\}}src_root{{(/|\\)}}
> src.s")
> +// MAP_ABS: DW_AT_comp_dir [DW_FORM_string] ("{{/|\\}}src_root")
> +// MAP_ABS: DW_AT_decl_file [DW_FORM_data4] ("{{/|\\}}src_root{{(/|\\)}}
> src.s")
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180711/7e425673/attachment.html>


More information about the llvm-commits mailing list