[PATCH] D102355: Add support for DWARF embedded source to llvm-symbolizer

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 15 13:59:25 PDT 2021


dblaikie added inline comments.


================
Comment at: llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp:305
+      std::string SourceCopy;
+      if (*Source.end() != '\0') {
+        SourceCopy = Source.str();
----------------
It's not valid to dereference an end iterator like this.

What is this code intended to address?


================
Comment at: llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp:312-321
+      for (line_iterator I = line_iterator(MemoryBufferRef(Source, ""), false);
+           !I.is_at_eof(); ++I) {
+        int64_t L = SourceCode.FirstLine + I.line_number() - 1;
+        Stream << format_decimal(L, MaxLineNumberWidth);
+        if (L == SourceCode.Line)
+          Stream << " >: ";
+        else
----------------
This looks rather similar to PlainPrinterBase::printContext - perhaps it could be refactored out into a common function?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102355/new/

https://reviews.llvm.org/D102355



More information about the llvm-commits mailing list